From e561e59a5be825eb99902becf95341ccec01d5a3 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Mon, 26 Oct 2020 08:43:37 +0000 Subject: [PATCH] Generated from 1f91f50eff5790375e54f20ff15fbb3d3640be73 --- .../compute/_compute_management_client.py | 14 + ...irtual_machine_scale_set_vms_operations.py | 4 +- .../_virtual_machines_operations.py | 11 +- ...irtual_machine_scale_set_vms_operations.py | 4 +- .../_virtual_machines_operations.py | 11 +- .../v2020_06_01/_compute_management_client.py | 5 + .../compute/v2020_06_01/models/__init__.py | 16 + .../_compute_management_client_enums.py | 11 + .../compute/v2020_06_01/models/_models.py | 249 +++++++++ .../compute/v2020_06_01/models/_models_py3.py | 249 +++++++++ .../v2020_06_01/models/_paged_models.py | 13 + .../v2020_06_01/operations/__init__.py | 2 + ...virtual_machine_run_commands_operations.py | 451 ++++++++++++++++ ...ne_scale_set_vm_run_commands_operations.py | 505 ++++++++++++++++++ .../compute/v2020_09_30/models/__init__.py | 7 +- .../_compute_management_client_enums.py | 2 +- .../compute/v2020_09_30/models/_models.py | 58 +- .../compute/v2020_09_30/models/_models_py3.py | 62 ++- .../operations/_galleries_operations.py | 2 +- 19 files changed, 1642 insertions(+), 34 deletions(-) create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py index d9d63e2e56e8..a2b92b90a4aa 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py @@ -72,6 +72,7 @@ class ComputeManagementClient(MultiApiClientMixin, SDKClient): 'virtual_machine_scale_set_extensions': '2020-06-01', 'virtual_machine_scale_set_rolling_upgrades': '2020-06-01', 'virtual_machine_scale_set_vm_extensions': '2020-06-01', + 'virtual_machine_scale_set_vm_run_commands': '2020-06-01', 'virtual_machine_scale_set_vms': '2020-06-01', 'virtual_machine_scale_sets': '2020-06-01', 'virtual_machine_sizes': '2020-06-01', @@ -1043,6 +1044,19 @@ def virtual_machine_scale_set_vm_extensions(self): raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def virtual_machine_scale_set_vm_run_commands(self): + """Instance depends on the API version: + + * 2020-06-01: :class:`VirtualMachineScaleSetVMRunCommandsOperations` + """ + api_version = self._get_api_version('virtual_machine_scale_set_vm_run_commands') + if api_version == '2020-06-01': + from .v2020_06_01.operations import VirtualMachineScaleSetVMRunCommandsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def virtual_machine_scale_set_vms(self): """Instance depends on the API version: diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vms_operations.py index 967b86a4faf7..ee808695532c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -1116,7 +1116,9 @@ def _perform_maintenance_initial( def perform_maintenance( self, resource_group_name, vm_scale_set_name, instance_id, custom_headers=None, raw=False, polling=True, **operation_config): - """Performs maintenance on a virtual machine in a VM scale set. + """Shuts down the virtual machine in a VMScaleSet, moves it to an already + updated node, and powers it back on during the self-service phase of + planned maintenance. :param resource_group_name: The name of the resource group. :type resource_group_name: str diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machines_operations.py index fdd3f5f441fa..c09f8772c390 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machines_operations.py @@ -676,7 +676,12 @@ def convert_to_managed_disks( self, resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config): """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this - operation. + operation.
For Windows, please refer to [Convert a virtual machine + from unmanaged disks to managed + disks.](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/convert-unmanaged-to-managed-disks).
For + Linux, please refer to [Convert a virtual machine from unmanaged disks + to managed + disks.](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/convert-unmanaged-to-managed-disks). :param resource_group_name: The name of the resource group. :type resource_group_name: str @@ -1614,7 +1619,9 @@ def _perform_maintenance_initial( def perform_maintenance( self, resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config): - """The operation to perform maintenance on a virtual machine. + """Shuts down the virtual machine, moves it to an already updated node, + and powers it back on during the self-service phase of planned + maintenance. :param resource_group_name: The name of the resource group. :type resource_group_name: str diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vms_operations.py index e64c9287bb78..19f13fb2b958 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -1116,7 +1116,9 @@ def _perform_maintenance_initial( def perform_maintenance( self, resource_group_name, vm_scale_set_name, instance_id, custom_headers=None, raw=False, polling=True, **operation_config): - """Performs maintenance on a virtual machine in a VM scale set. + """Shuts down the virtual machine in a VMScaleSet, moves it to an already + updated node, and powers it back on during the self-service phase of + planned maintenance. :param resource_group_name: The name of the resource group. :type resource_group_name: str diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machines_operations.py index 7793786ae0ac..2daf67b2f2d7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machines_operations.py @@ -676,7 +676,12 @@ def convert_to_managed_disks( self, resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config): """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this - operation. + operation.
For Windows, please refer to [Convert a virtual machine + from unmanaged disks to managed + disks.](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/convert-unmanaged-to-managed-disks).
For + Linux, please refer to [Convert a virtual machine from unmanaged disks + to managed + disks.](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/convert-unmanaged-to-managed-disks). :param resource_group_name: The name of the resource group. :type resource_group_name: str @@ -1614,7 +1619,9 @@ def _perform_maintenance_initial( def perform_maintenance( self, resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config): - """The operation to perform maintenance on a virtual machine. + """Shuts down the virtual machine, moves it to an already updated node, + and powers it back on during the self-service phase of planned + maintenance. :param resource_group_name: The name of the resource group. :type resource_group_name: str diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py index f6422e42a984..553e1facfe28 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py @@ -33,6 +33,7 @@ from .operations import VirtualMachineScaleSetVMsOperations from .operations import LogAnalyticsOperations from .operations import VirtualMachineRunCommandsOperations +from .operations import VirtualMachineScaleSetVMRunCommandsOperations from . import models @@ -82,6 +83,8 @@ class ComputeManagementClient(SDKClient): :vartype log_analytics: azure.mgmt.compute.v2020_06_01.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommands operations :vartype virtual_machine_run_commands: azure.mgmt.compute.v2020_06_01.operations.VirtualMachineRunCommandsOperations + :ivar virtual_machine_scale_set_vm_run_commands: VirtualMachineScaleSetVMRunCommands operations + :vartype virtual_machine_scale_set_vm_run_commands: azure.mgmt.compute.v2020_06_01.operations.VirtualMachineScaleSetVMRunCommandsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -144,3 +147,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( self._client, self.config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_vm_run_commands = VirtualMachineScaleSetVMRunCommandsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/__init__.py index 4cf5e17b2d24..bf1c47406573 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/__init__.py @@ -132,6 +132,10 @@ from ._models_py3 import VirtualMachineInstanceView from ._models_py3 import VirtualMachinePatchStatus from ._models_py3 import VirtualMachineReimageParameters + from ._models_py3 import VirtualMachineRunCommand + from ._models_py3 import VirtualMachineRunCommandInstanceView + from ._models_py3 import VirtualMachineRunCommandScriptSource + from ._models_py3 import VirtualMachineRunCommandUpdate from ._models_py3 import VirtualMachineScaleSet from ._models_py3 import VirtualMachineScaleSetDataDisk from ._models_py3 import VirtualMachineScaleSetExtension @@ -304,6 +308,10 @@ from ._models import VirtualMachineInstanceView from ._models import VirtualMachinePatchStatus from ._models import VirtualMachineReimageParameters + from ._models import VirtualMachineRunCommand + from ._models import VirtualMachineRunCommandInstanceView + from ._models import VirtualMachineRunCommandScriptSource + from ._models import VirtualMachineRunCommandUpdate from ._models import VirtualMachineScaleSet from ._models import VirtualMachineScaleSetDataDisk from ._models import VirtualMachineScaleSetExtension @@ -364,6 +372,7 @@ from ._paged_models import UpgradeOperationHistoricalStatusInfoPaged from ._paged_models import UsagePaged from ._paged_models import VirtualMachinePaged +from ._paged_models import VirtualMachineRunCommandPaged from ._paged_models import VirtualMachineScaleSetExtensionPaged from ._paged_models import VirtualMachineScaleSetPaged from ._paged_models import VirtualMachineScaleSetSkuPaged @@ -410,6 +419,7 @@ RollingUpgradeActionType, IntervalInMins, OrchestrationServiceStateAction, + ExecutionState, InstanceViewTypes, ) @@ -536,6 +546,10 @@ 'VirtualMachineInstanceView', 'VirtualMachinePatchStatus', 'VirtualMachineReimageParameters', + 'VirtualMachineRunCommand', + 'VirtualMachineRunCommandInstanceView', + 'VirtualMachineRunCommandScriptSource', + 'VirtualMachineRunCommandUpdate', 'VirtualMachineScaleSet', 'VirtualMachineScaleSetDataDisk', 'VirtualMachineScaleSetExtension', @@ -601,6 +615,7 @@ 'VirtualMachineScaleSetExtensionPaged', 'VirtualMachineScaleSetVMPaged', 'RunCommandDocumentBasePaged', + 'VirtualMachineRunCommandPaged', 'VmDiskTypes', 'HyperVGenerationTypes', 'StatusLevelTypes', @@ -641,5 +656,6 @@ 'RollingUpgradeActionType', 'IntervalInMins', 'OrchestrationServiceStateAction', + 'ExecutionState', 'InstanceViewTypes', ] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_compute_management_client_enums.py index d29fbdf55093..028462385f4e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_compute_management_client_enums.py @@ -444,6 +444,17 @@ class OrchestrationServiceStateAction(str, Enum): suspend = "Suspend" +class ExecutionState(str, Enum): + + unknown = "Unknown" + pending = "Pending" + running = "Running" + failed = "Failed" + succeeded = "Succeeded" + timed_out = "TimedOut" + canceled = "Canceled" + + class InstanceViewTypes(str, Enum): instance_view = "instanceView" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models.py index 99dafe0b6c18..1a4257eafe8d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models.py @@ -5033,6 +5033,255 @@ def __init__(self, **kwargs): self.temp_disk = kwargs.get('temp_disk', None) +class VirtualMachineRunCommand(Resource): + """Describes a Virtual Machine run command. + + 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: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param source: The source of the run command script. + :type source: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandScriptSource + :param parameters: The parameters used by the script. + :type parameters: + list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] + :param protected_parameters: The parameters used by the script. + :type protected_parameters: + list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] + :param async_execution: Optional. If set to true, provisioning will + complete as soon as the script starts and will not wait for script to + complete. Default value: False . + :type async_execution: bool + :param run_as_user: Specifies the user account on the VM when executing + the run command. + :type run_as_user: str + :param run_as_password: Specifies the user account password on the VM when + executing the run command. + :type run_as_password: str + :param timeout_in_seconds: The timeout in seconds to execute the run + command. + :type timeout_in_seconds: int + :param output_blob_uri: Specifies the Azure storage blob where script + output stream will be uploaded. + :type output_blob_uri: str + :param error_blob_uri: Specifies the Azure storage blob where script error + stream will be uploaded. + :type error_blob_uri: str + :ivar provisioning_state: The provisioning state, which only appears in + the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine run command instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandInstanceView + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'instance_view': {'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}'}, + 'source': {'key': 'properties.source', 'type': 'VirtualMachineRunCommandScriptSource'}, + 'parameters': {'key': 'properties.parameters', 'type': '[RunCommandInputParameter]'}, + 'protected_parameters': {'key': 'properties.protectedParameters', 'type': '[RunCommandInputParameter]'}, + 'async_execution': {'key': 'properties.asyncExecution', 'type': 'bool'}, + 'run_as_user': {'key': 'properties.runAsUser', 'type': 'str'}, + 'run_as_password': {'key': 'properties.runAsPassword', 'type': 'str'}, + 'timeout_in_seconds': {'key': 'properties.timeoutInSeconds', 'type': 'int'}, + 'output_blob_uri': {'key': 'properties.outputBlobUri', 'type': 'str'}, + 'error_blob_uri': {'key': 'properties.errorBlobUri', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineRunCommandInstanceView'}, + } + + def __init__(self, **kwargs): + super(VirtualMachineRunCommand, self).__init__(**kwargs) + self.source = kwargs.get('source', None) + self.parameters = kwargs.get('parameters', None) + self.protected_parameters = kwargs.get('protected_parameters', None) + self.async_execution = kwargs.get('async_execution', False) + self.run_as_user = kwargs.get('run_as_user', None) + self.run_as_password = kwargs.get('run_as_password', None) + self.timeout_in_seconds = kwargs.get('timeout_in_seconds', None) + self.output_blob_uri = kwargs.get('output_blob_uri', None) + self.error_blob_uri = kwargs.get('error_blob_uri', None) + self.provisioning_state = None + self.instance_view = None + + +class VirtualMachineRunCommandInstanceView(Model): + """The instance view of a virtual machine run command. + + :param execution_state: Script execution status. Possible values include: + 'Unknown', 'Pending', 'Running', 'Failed', 'Succeeded', 'TimedOut', + 'Canceled' + :type execution_state: str or + ~azure.mgmt.compute.v2020_06_01.models.ExecutionState + :param execution_message: Communicate script configuration errors or + execution messages. + :type execution_message: str + :param exit_code: Exit code returned from script execution. + :type exit_code: int + :param output: Script output stream. + :type output: str + :param error: Script error stream. + :type error: str + :param start_time: Script start time. + :type start_time: datetime + :param end_time: Script end time. + :type end_time: datetime + :param statuses: The resource status information. + :type statuses: + list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'execution_state': {'key': 'executionState', 'type': 'str'}, + 'execution_message': {'key': 'executionMessage', 'type': 'str'}, + 'exit_code': {'key': 'exitCode', 'type': 'int'}, + 'output': {'key': 'output', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__(self, **kwargs): + super(VirtualMachineRunCommandInstanceView, self).__init__(**kwargs) + self.execution_state = kwargs.get('execution_state', None) + self.execution_message = kwargs.get('execution_message', None) + self.exit_code = kwargs.get('exit_code', None) + self.output = kwargs.get('output', None) + self.error = kwargs.get('error', None) + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + self.statuses = kwargs.get('statuses', None) + + +class VirtualMachineRunCommandScriptSource(Model): + """Describes the script sources for run command. + + :param script: Specifies the script content to be executed on the VM. + :type script: str + :param script_uri: Specifies the script download location. + :type script_uri: str + :param command_id: Specifies a commandId of predefined built-in script. + :type command_id: str + """ + + _attribute_map = { + 'script': {'key': 'script', 'type': 'str'}, + 'script_uri': {'key': 'scriptUri', 'type': 'str'}, + 'command_id': {'key': 'commandId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(VirtualMachineRunCommandScriptSource, self).__init__(**kwargs) + self.script = kwargs.get('script', None) + self.script_uri = kwargs.get('script_uri', None) + self.command_id = kwargs.get('command_id', None) + + +class VirtualMachineRunCommandUpdate(UpdateResource): + """Describes a Virtual Machine run command. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param tags: Resource tags + :type tags: dict[str, str] + :param source: The source of the run command script. + :type source: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandScriptSource + :param parameters: The parameters used by the script. + :type parameters: + list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] + :param protected_parameters: The parameters used by the script. + :type protected_parameters: + list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] + :param async_execution: Optional. If set to true, provisioning will + complete as soon as the script starts and will not wait for script to + complete. Default value: False . + :type async_execution: bool + :param run_as_user: Specifies the user account on the VM when executing + the run command. + :type run_as_user: str + :param run_as_password: Specifies the user account password on the VM when + executing the run command. + :type run_as_password: str + :param timeout_in_seconds: The timeout in seconds to execute the run + command. + :type timeout_in_seconds: int + :param output_blob_uri: Specifies the Azure storage blob where script + output stream will be uploaded. + :type output_blob_uri: str + :param error_blob_uri: Specifies the Azure storage blob where script error + stream will be uploaded. + :type error_blob_uri: str + :ivar provisioning_state: The provisioning state, which only appears in + the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine run command instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandInstanceView + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source': {'key': 'properties.source', 'type': 'VirtualMachineRunCommandScriptSource'}, + 'parameters': {'key': 'properties.parameters', 'type': '[RunCommandInputParameter]'}, + 'protected_parameters': {'key': 'properties.protectedParameters', 'type': '[RunCommandInputParameter]'}, + 'async_execution': {'key': 'properties.asyncExecution', 'type': 'bool'}, + 'run_as_user': {'key': 'properties.runAsUser', 'type': 'str'}, + 'run_as_password': {'key': 'properties.runAsPassword', 'type': 'str'}, + 'timeout_in_seconds': {'key': 'properties.timeoutInSeconds', 'type': 'int'}, + 'output_blob_uri': {'key': 'properties.outputBlobUri', 'type': 'str'}, + 'error_blob_uri': {'key': 'properties.errorBlobUri', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineRunCommandInstanceView'}, + } + + def __init__(self, **kwargs): + super(VirtualMachineRunCommandUpdate, self).__init__(**kwargs) + self.source = kwargs.get('source', None) + self.parameters = kwargs.get('parameters', None) + self.protected_parameters = kwargs.get('protected_parameters', None) + self.async_execution = kwargs.get('async_execution', False) + self.run_as_user = kwargs.get('run_as_user', None) + self.run_as_password = kwargs.get('run_as_password', None) + self.timeout_in_seconds = kwargs.get('timeout_in_seconds', None) + self.output_blob_uri = kwargs.get('output_blob_uri', None) + self.error_blob_uri = kwargs.get('error_blob_uri', None) + self.provisioning_state = None + self.instance_view = None + + class VirtualMachineScaleSet(Resource): """Describes a Virtual Machine Scale Set. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py index b7b792891fc6..a1a446dd9ec7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py @@ -5033,6 +5033,255 @@ def __init__(self, *, temp_disk: bool=None, **kwargs) -> None: self.temp_disk = temp_disk +class VirtualMachineRunCommand(Resource): + """Describes a Virtual Machine run command. + + 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: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param source: The source of the run command script. + :type source: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandScriptSource + :param parameters: The parameters used by the script. + :type parameters: + list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] + :param protected_parameters: The parameters used by the script. + :type protected_parameters: + list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] + :param async_execution: Optional. If set to true, provisioning will + complete as soon as the script starts and will not wait for script to + complete. Default value: False . + :type async_execution: bool + :param run_as_user: Specifies the user account on the VM when executing + the run command. + :type run_as_user: str + :param run_as_password: Specifies the user account password on the VM when + executing the run command. + :type run_as_password: str + :param timeout_in_seconds: The timeout in seconds to execute the run + command. + :type timeout_in_seconds: int + :param output_blob_uri: Specifies the Azure storage blob where script + output stream will be uploaded. + :type output_blob_uri: str + :param error_blob_uri: Specifies the Azure storage blob where script error + stream will be uploaded. + :type error_blob_uri: str + :ivar provisioning_state: The provisioning state, which only appears in + the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine run command instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandInstanceView + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'instance_view': {'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}'}, + 'source': {'key': 'properties.source', 'type': 'VirtualMachineRunCommandScriptSource'}, + 'parameters': {'key': 'properties.parameters', 'type': '[RunCommandInputParameter]'}, + 'protected_parameters': {'key': 'properties.protectedParameters', 'type': '[RunCommandInputParameter]'}, + 'async_execution': {'key': 'properties.asyncExecution', 'type': 'bool'}, + 'run_as_user': {'key': 'properties.runAsUser', 'type': 'str'}, + 'run_as_password': {'key': 'properties.runAsPassword', 'type': 'str'}, + 'timeout_in_seconds': {'key': 'properties.timeoutInSeconds', 'type': 'int'}, + 'output_blob_uri': {'key': 'properties.outputBlobUri', 'type': 'str'}, + 'error_blob_uri': {'key': 'properties.errorBlobUri', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineRunCommandInstanceView'}, + } + + def __init__(self, *, location: str, tags=None, source=None, parameters=None, protected_parameters=None, async_execution: bool=False, run_as_user: str=None, run_as_password: str=None, timeout_in_seconds: int=None, output_blob_uri: str=None, error_blob_uri: str=None, **kwargs) -> None: + super(VirtualMachineRunCommand, self).__init__(location=location, tags=tags, **kwargs) + self.source = source + self.parameters = parameters + self.protected_parameters = protected_parameters + self.async_execution = async_execution + self.run_as_user = run_as_user + self.run_as_password = run_as_password + self.timeout_in_seconds = timeout_in_seconds + self.output_blob_uri = output_blob_uri + self.error_blob_uri = error_blob_uri + self.provisioning_state = None + self.instance_view = None + + +class VirtualMachineRunCommandInstanceView(Model): + """The instance view of a virtual machine run command. + + :param execution_state: Script execution status. Possible values include: + 'Unknown', 'Pending', 'Running', 'Failed', 'Succeeded', 'TimedOut', + 'Canceled' + :type execution_state: str or + ~azure.mgmt.compute.v2020_06_01.models.ExecutionState + :param execution_message: Communicate script configuration errors or + execution messages. + :type execution_message: str + :param exit_code: Exit code returned from script execution. + :type exit_code: int + :param output: Script output stream. + :type output: str + :param error: Script error stream. + :type error: str + :param start_time: Script start time. + :type start_time: datetime + :param end_time: Script end time. + :type end_time: datetime + :param statuses: The resource status information. + :type statuses: + list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'execution_state': {'key': 'executionState', 'type': 'str'}, + 'execution_message': {'key': 'executionMessage', 'type': 'str'}, + 'exit_code': {'key': 'exitCode', 'type': 'int'}, + 'output': {'key': 'output', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__(self, *, execution_state=None, execution_message: str=None, exit_code: int=None, output: str=None, error: str=None, start_time=None, end_time=None, statuses=None, **kwargs) -> None: + super(VirtualMachineRunCommandInstanceView, self).__init__(**kwargs) + self.execution_state = execution_state + self.execution_message = execution_message + self.exit_code = exit_code + self.output = output + self.error = error + self.start_time = start_time + self.end_time = end_time + self.statuses = statuses + + +class VirtualMachineRunCommandScriptSource(Model): + """Describes the script sources for run command. + + :param script: Specifies the script content to be executed on the VM. + :type script: str + :param script_uri: Specifies the script download location. + :type script_uri: str + :param command_id: Specifies a commandId of predefined built-in script. + :type command_id: str + """ + + _attribute_map = { + 'script': {'key': 'script', 'type': 'str'}, + 'script_uri': {'key': 'scriptUri', 'type': 'str'}, + 'command_id': {'key': 'commandId', 'type': 'str'}, + } + + def __init__(self, *, script: str=None, script_uri: str=None, command_id: str=None, **kwargs) -> None: + super(VirtualMachineRunCommandScriptSource, self).__init__(**kwargs) + self.script = script + self.script_uri = script_uri + self.command_id = command_id + + +class VirtualMachineRunCommandUpdate(UpdateResource): + """Describes a Virtual Machine run command. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param tags: Resource tags + :type tags: dict[str, str] + :param source: The source of the run command script. + :type source: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandScriptSource + :param parameters: The parameters used by the script. + :type parameters: + list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] + :param protected_parameters: The parameters used by the script. + :type protected_parameters: + list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] + :param async_execution: Optional. If set to true, provisioning will + complete as soon as the script starts and will not wait for script to + complete. Default value: False . + :type async_execution: bool + :param run_as_user: Specifies the user account on the VM when executing + the run command. + :type run_as_user: str + :param run_as_password: Specifies the user account password on the VM when + executing the run command. + :type run_as_password: str + :param timeout_in_seconds: The timeout in seconds to execute the run + command. + :type timeout_in_seconds: int + :param output_blob_uri: Specifies the Azure storage blob where script + output stream will be uploaded. + :type output_blob_uri: str + :param error_blob_uri: Specifies the Azure storage blob where script error + stream will be uploaded. + :type error_blob_uri: str + :ivar provisioning_state: The provisioning state, which only appears in + the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine run command instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandInstanceView + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source': {'key': 'properties.source', 'type': 'VirtualMachineRunCommandScriptSource'}, + 'parameters': {'key': 'properties.parameters', 'type': '[RunCommandInputParameter]'}, + 'protected_parameters': {'key': 'properties.protectedParameters', 'type': '[RunCommandInputParameter]'}, + 'async_execution': {'key': 'properties.asyncExecution', 'type': 'bool'}, + 'run_as_user': {'key': 'properties.runAsUser', 'type': 'str'}, + 'run_as_password': {'key': 'properties.runAsPassword', 'type': 'str'}, + 'timeout_in_seconds': {'key': 'properties.timeoutInSeconds', 'type': 'int'}, + 'output_blob_uri': {'key': 'properties.outputBlobUri', 'type': 'str'}, + 'error_blob_uri': {'key': 'properties.errorBlobUri', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineRunCommandInstanceView'}, + } + + def __init__(self, *, tags=None, source=None, parameters=None, protected_parameters=None, async_execution: bool=False, run_as_user: str=None, run_as_password: str=None, timeout_in_seconds: int=None, output_blob_uri: str=None, error_blob_uri: str=None, **kwargs) -> None: + super(VirtualMachineRunCommandUpdate, self).__init__(tags=tags, **kwargs) + self.source = source + self.parameters = parameters + self.protected_parameters = protected_parameters + self.async_execution = async_execution + self.run_as_user = run_as_user + self.run_as_password = run_as_password + self.timeout_in_seconds = timeout_in_seconds + self.output_blob_uri = output_blob_uri + self.error_blob_uri = error_blob_uri + self.provisioning_state = None + self.instance_view = None + + class VirtualMachineScaleSet(Resource): """Describes a Virtual Machine Scale Set. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_paged_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_paged_models.py index c3788b9e2406..0249609b7b25 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_paged_models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_paged_models.py @@ -220,3 +220,16 @@ class RunCommandDocumentBasePaged(Paged): def __init__(self, *args, **kwargs): super(RunCommandDocumentBasePaged, self).__init__(*args, **kwargs) +class VirtualMachineRunCommandPaged(Paged): + """ + A paging container for iterating over a list of :class:`VirtualMachineRunCommand ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[VirtualMachineRunCommand]'} + } + + def __init__(self, *args, **kwargs): + + super(VirtualMachineRunCommandPaged, self).__init__(*args, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/__init__.py index 4aed70a72e37..3a55f9ff9cf2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/__init__.py @@ -29,6 +29,7 @@ from ._virtual_machine_scale_set_vms_operations import VirtualMachineScaleSetVMsOperations from ._log_analytics_operations import LogAnalyticsOperations from ._virtual_machine_run_commands_operations import VirtualMachineRunCommandsOperations +from ._virtual_machine_scale_set_vm_run_commands_operations import VirtualMachineScaleSetVMRunCommandsOperations __all__ = [ 'Operations', @@ -51,4 +52,5 @@ 'VirtualMachineScaleSetVMsOperations', 'LogAnalyticsOperations', 'VirtualMachineRunCommandsOperations', + 'VirtualMachineScaleSetVMRunCommandsOperations', ] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_run_commands_operations.py index eb666484cd1c..8e1a1e0b880c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_run_commands_operations.py @@ -12,6 +12,8 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling from .. import models @@ -168,3 +170,452 @@ def get( return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} + + + def _create_or_update_initial( + self, resource_group_name, vm_name, run_command_name, run_command, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineRunCommand', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineRunCommand', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, vm_name, run_command_name, run_command, custom_headers=None, raw=False, polling=True, **operation_config): + """The operation to create or update the run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the run command + should be created or updated. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine + RunCommand operation. + :type run_command: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + VirtualMachineRunCommand or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('VirtualMachineRunCommand', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} + + + def _update_initial( + self, resource_group_name, vm_name, run_command_name, run_command, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineRunCommand', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, vm_name, run_command_name, run_command, custom_headers=None, raw=False, polling=True, **operation_config): + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the run command + should be updated. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine + RunCommand operation. + :type run_command: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandUpdate + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + VirtualMachineRunCommand or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('VirtualMachineRunCommand', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} + + + def _delete_initial( + self, resource_group_name, vm_name, run_command_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, vm_name, run_command_name, custom_headers=None, raw=False, polling=True, **operation_config): + """The operation to delete the run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the run command + should be deleted. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} + + def get_by_virtual_machine( + self, resource_group_name, vm_name, run_command_name, expand=None, custom_headers=None, raw=False, **operation_config): + """The operation to get the run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine containing the run + command. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: VirtualMachineRunCommand or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_by_virtual_machine.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineRunCommand', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_virtual_machine.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} + + def list_by_virtual_machine( + self, resource_group_name, vm_name, expand=None, custom_headers=None, raw=False, **operation_config): + """The operation to get all run commands of a Virtual Machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine containing the run + command. + :type vm_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of VirtualMachineRunCommand + :rtype: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_virtual_machine.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.VirtualMachineRunCommandPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_virtual_machine.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands'} diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py new file mode 100644 index 000000000000..f54068cd0d04 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -0,0 +1,505 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class VirtualMachineScaleSetVMRunCommandsOperations(object): + """VirtualMachineScaleSetVMRunCommandsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2020-06-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-06-01" + + self.config = config + + + def _create_or_update_initial( + self, resource_group_name, vm_scale_set_name, instance_id, run_command_name, run_command, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineRunCommand', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineRunCommand', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, vm_scale_set_name, instance_id, run_command_name, run_command, custom_headers=None, raw=False, polling=True, **operation_config): + """The operation to create or update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine + RunCommand operation. + :type run_command: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + VirtualMachineRunCommand or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + run_command=run_command, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('VirtualMachineRunCommand', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} + + + def _update_initial( + self, resource_group_name, vm_scale_set_name, instance_id, run_command_name, run_command, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineRunCommand', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, vm_scale_set_name, instance_id, run_command_name, run_command, custom_headers=None, raw=False, polling=True, **operation_config): + """The operation to update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine + RunCommand operation. + :type run_command: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandUpdate + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + VirtualMachineRunCommand or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + run_command=run_command, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('VirtualMachineRunCommand', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} + + + def _delete_initial( + self, resource_group_name, vm_scale_set_name, instance_id, run_command_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, vm_scale_set_name, instance_id, run_command_name, custom_headers=None, raw=False, polling=True, **operation_config): + """The operation to delete the VMSS VM run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} + + def get( + self, resource_group_name, vm_scale_set_name, instance_id, run_command_name, expand=None, custom_headers=None, raw=False, **operation_config): + """The operation to get the VMSS VM run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: VirtualMachineRunCommand or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineRunCommand', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} + + def list( + self, resource_group_name, vm_scale_set_name, instance_id, expand=None, custom_headers=None, raw=False, **operation_config): + """The operation to get all run commands of an instance in Virtual Machine + Scaleset. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of VirtualMachineRunCommand + :rtype: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.VirtualMachineRunCommandPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands'} diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/__init__.py index d6bc2888eb97..9e98b2edcfa0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/__init__.py @@ -57,6 +57,7 @@ from ._models_py3 import SharingUpdate from ._models_py3 import TargetRegion from ._models_py3 import UpdateResourceDefinition + from ._models_py3 import UserArtifactManage from ._models_py3 import UserArtifactSource except (SyntaxError, ImportError): from ._models import ApiError @@ -106,6 +107,7 @@ from ._models import SharingUpdate from ._models import TargetRegion from ._models import UpdateResourceDefinition + from ._models import UserArtifactManage from ._models import UserArtifactSource from ._paged_models import GalleryApplicationPaged from ._paged_models import GalleryApplicationVersionPaged @@ -126,7 +128,7 @@ StorageAccountType, HostCaching, SharingUpdateOperationTypes, - Permissions, + SelectPermissions, ReplicationStatusTypes, SharedToValues, ) @@ -179,6 +181,7 @@ 'SharingUpdate', 'TargetRegion', 'UpdateResourceDefinition', + 'UserArtifactManage', 'UserArtifactSource', 'GalleryPaged', 'GalleryImagePaged', @@ -198,7 +201,7 @@ 'StorageAccountType', 'HostCaching', 'SharingUpdateOperationTypes', - 'Permissions', + 'SelectPermissions', 'ReplicationStatusTypes', 'SharedToValues', ] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_compute_management_client_enums.py index df2002c9fbb6..633c361ecfd7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_compute_management_client_enums.py @@ -79,7 +79,7 @@ class SharingUpdateOperationTypes(str, Enum): reset = "Reset" -class Permissions(str, Enum): +class SelectPermissions(str, Enum): permissions = "Permissions" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models.py index 9ea0ac58e964..5c0a1dce1bf3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models.py @@ -615,9 +615,9 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType :param source: Required. :type source: ~azure.mgmt.compute.v2020_09_30.models.UserArtifactSource - :param content_type: Optional. May be used to help process this file. The - type of file contained in the source, e.g. zip, json, etc. - :type content_type: str + :param manage_actions: + :type manage_actions: + ~azure.mgmt.compute.v2020_09_30.models.UserArtifactManage :param enable_health_check: Optional. Whether or not this application reports health. :type enable_health_check: bool @@ -636,14 +636,14 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, 'source': {'key': 'source', 'type': 'UserArtifactSource'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, + 'manage_actions': {'key': 'manageActions', 'type': 'UserArtifactManage'}, 'enable_health_check': {'key': 'enableHealthCheck', 'type': 'bool'}, } def __init__(self, **kwargs): super(GalleryApplicationVersionPublishingProfile, self).__init__(**kwargs) self.source = kwargs.get('source', None) - self.content_type = kwargs.get('content_type', None) + self.manage_actions = kwargs.get('manage_actions', None) self.enable_health_check = kwargs.get('enable_health_check', None) @@ -1971,29 +1971,65 @@ def __init__(self, **kwargs): self.encryption = kwargs.get('encryption', None) +class UserArtifactManage(Model): + """UserArtifactManage. + + All required parameters must be populated in order to send to Azure. + + :param install: Required. Required. The path and arguments to install the + gallery application. This is limited to 4096 characters. + :type install: str + :param remove: Required. Required. The path and arguments to remove the + gallery application. This is limited to 4096 characters. + :type remove: str + :param update: Optional. The path and arguments to update the gallery + application. If not present, then update operation will invoke remove + command on the previous version and install command on the current version + of the gallery application. This is limited to 4096 characters. + :type update: str + """ + + _validation = { + 'install': {'required': True}, + 'remove': {'required': True}, + } + + _attribute_map = { + 'install': {'key': 'install', 'type': 'str'}, + 'remove': {'key': 'remove', 'type': 'str'}, + 'update': {'key': 'update', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(UserArtifactManage, self).__init__(**kwargs) + self.install = kwargs.get('install', None) + self.remove = kwargs.get('remove', None) + self.update = kwargs.get('update', None) + + class UserArtifactSource(Model): """The source image from which the Image Version is going to be created. All required parameters must be populated in order to send to Azure. - :param file_name: Required. Required. The fileName of the artifact. - :type file_name: str :param media_link: Required. Required. The mediaLink of the artifact, must - be a readable storage blob. + be a readable storage page blob. :type media_link: str + :param default_configuration_link: Optional. The defaultConfigurationLink + of the artifact, must be a readable storage page blob. + :type default_configuration_link: str """ _validation = { - 'file_name': {'required': True}, 'media_link': {'required': True}, } _attribute_map = { - 'file_name': {'key': 'fileName', 'type': 'str'}, 'media_link': {'key': 'mediaLink', 'type': 'str'}, + 'default_configuration_link': {'key': 'defaultConfigurationLink', 'type': 'str'}, } def __init__(self, **kwargs): super(UserArtifactSource, self).__init__(**kwargs) - self.file_name = kwargs.get('file_name', None) self.media_link = kwargs.get('media_link', None) + self.default_configuration_link = kwargs.get('default_configuration_link', None) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models_py3.py index ba4a72235bee..6800620f24fb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models_py3.py @@ -615,9 +615,9 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType :param source: Required. :type source: ~azure.mgmt.compute.v2020_09_30.models.UserArtifactSource - :param content_type: Optional. May be used to help process this file. The - type of file contained in the source, e.g. zip, json, etc. - :type content_type: str + :param manage_actions: + :type manage_actions: + ~azure.mgmt.compute.v2020_09_30.models.UserArtifactManage :param enable_health_check: Optional. Whether or not this application reports health. :type enable_health_check: bool @@ -636,14 +636,14 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, 'source': {'key': 'source', 'type': 'UserArtifactSource'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, + 'manage_actions': {'key': 'manageActions', 'type': 'UserArtifactManage'}, 'enable_health_check': {'key': 'enableHealthCheck', 'type': 'bool'}, } - def __init__(self, *, source, target_regions=None, replica_count: int=None, exclude_from_latest: bool=None, end_of_life_date=None, storage_account_type=None, content_type: str=None, enable_health_check: bool=None, **kwargs) -> None: + def __init__(self, *, source, target_regions=None, replica_count: int=None, exclude_from_latest: bool=None, end_of_life_date=None, storage_account_type=None, manage_actions=None, enable_health_check: bool=None, **kwargs) -> None: super(GalleryApplicationVersionPublishingProfile, self).__init__(target_regions=target_regions, replica_count=replica_count, exclude_from_latest=exclude_from_latest, end_of_life_date=end_of_life_date, storage_account_type=storage_account_type, **kwargs) self.source = source - self.content_type = content_type + self.manage_actions = manage_actions self.enable_health_check = enable_health_check @@ -1971,29 +1971,65 @@ def __init__(self, *, name: str, regional_replica_count: int=None, storage_accou self.encryption = encryption +class UserArtifactManage(Model): + """UserArtifactManage. + + All required parameters must be populated in order to send to Azure. + + :param install: Required. Required. The path and arguments to install the + gallery application. This is limited to 4096 characters. + :type install: str + :param remove: Required. Required. The path and arguments to remove the + gallery application. This is limited to 4096 characters. + :type remove: str + :param update: Optional. The path and arguments to update the gallery + application. If not present, then update operation will invoke remove + command on the previous version and install command on the current version + of the gallery application. This is limited to 4096 characters. + :type update: str + """ + + _validation = { + 'install': {'required': True}, + 'remove': {'required': True}, + } + + _attribute_map = { + 'install': {'key': 'install', 'type': 'str'}, + 'remove': {'key': 'remove', 'type': 'str'}, + 'update': {'key': 'update', 'type': 'str'}, + } + + def __init__(self, *, install: str, remove: str, update: str=None, **kwargs) -> None: + super(UserArtifactManage, self).__init__(**kwargs) + self.install = install + self.remove = remove + self.update = update + + class UserArtifactSource(Model): """The source image from which the Image Version is going to be created. All required parameters must be populated in order to send to Azure. - :param file_name: Required. Required. The fileName of the artifact. - :type file_name: str :param media_link: Required. Required. The mediaLink of the artifact, must - be a readable storage blob. + be a readable storage page blob. :type media_link: str + :param default_configuration_link: Optional. The defaultConfigurationLink + of the artifact, must be a readable storage page blob. + :type default_configuration_link: str """ _validation = { - 'file_name': {'required': True}, 'media_link': {'required': True}, } _attribute_map = { - 'file_name': {'key': 'fileName', 'type': 'str'}, 'media_link': {'key': 'mediaLink', 'type': 'str'}, + 'default_configuration_link': {'key': 'defaultConfigurationLink', 'type': 'str'}, } - def __init__(self, *, file_name: str, media_link: str, **kwargs) -> None: + def __init__(self, *, media_link: str, default_configuration_link: str=None, **kwargs) -> None: super(UserArtifactSource, self).__init__(**kwargs) - self.file_name = file_name self.media_link = media_link + self.default_configuration_link = default_configuration_link diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_galleries_operations.py index 67635d3718fe..2d5d2f086352 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_galleries_operations.py @@ -262,7 +262,7 @@ def get( :param select: The select expression to apply on the operation. Possible values include: 'Permissions' :type select: str or - ~azure.mgmt.compute.v2020_09_30.models.Permissions + ~azure.mgmt.compute.v2020_09_30.models.SelectPermissions :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response