diff --git a/azure-mgmt-compute/azure/mgmt/compute/compute_management_client.py b/azure-mgmt-compute/azure/mgmt/compute/compute_management_client.py index d81ad13372e9..b8853ddfdfbb 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/compute_management_client.py +++ b/azure-mgmt-compute/azure/mgmt/compute/compute_management_client.py @@ -467,6 +467,7 @@ def virtual_machine_run_commands(self): * 2017-03-30: :class:`VirtualMachineRunCommandsOperations` * 2017-12-01: :class:`VirtualMachineRunCommandsOperations` * 2018-04-01: :class:`VirtualMachineRunCommandsOperations` + * 2018-06-01: :class:`VirtualMachineRunCommandsOperations` """ api_version = self._get_api_version('virtual_machine_run_commands') if api_version == '2017-03-30': @@ -475,6 +476,8 @@ def virtual_machine_run_commands(self): from .v2017_12_01.operations import VirtualMachineRunCommandsOperations as OperationClass elif api_version == '2018-04-01': from .v2018_04_01.operations import VirtualMachineRunCommandsOperations as OperationClass + elif api_version == '2018-06-01': + from .v2018_06_01.operations import VirtualMachineRunCommandsOperations 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))) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/access_uri.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/access_uri.py index fec7ad1244ab..9ee6b01de1e1 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/access_uri.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/access_uri.py @@ -27,7 +27,7 @@ class AccessUri(Model): } _attribute_map = { - 'access_sas': {'key': 'accessSAS', 'type': 'str'}, + 'access_sas': {'key': 'properties.output.accessSAS', 'type': 'str'}, } def __init__(self, **kwargs): diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/access_uri_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/access_uri_py3.py index c13208a20d8d..bb9e56aa4221 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/access_uri_py3.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/access_uri_py3.py @@ -27,7 +27,7 @@ class AccessUri(Model): } _attribute_map = { - 'access_sas': {'key': 'accessSAS', 'type': 'str'}, + 'access_sas': {'key': 'properties.output.accessSAS', 'type': 'str'}, } def __init__(self, **kwargs) -> None: diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/compute_management_client.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/compute_management_client.py index ea3dc47fbf80..4d182b701b72 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/compute_management_client.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/compute_management_client.py @@ -27,6 +27,7 @@ from .operations.virtual_machine_scale_set_rolling_upgrades_operations import VirtualMachineScaleSetRollingUpgradesOperations from .operations.virtual_machine_scale_set_vms_operations import VirtualMachineScaleSetVMsOperations from .operations.log_analytics_operations import LogAnalyticsOperations +from .operations.virtual_machine_run_commands_operations import VirtualMachineRunCommandsOperations from .operations.galleries_operations import GalleriesOperations from .operations.gallery_images_operations import GalleryImagesOperations from .operations.gallery_image_versions_operations import GalleryImageVersionsOperations @@ -101,6 +102,8 @@ class ComputeManagementClient(SDKClient): :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2018_06_01.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalytics operations :vartype log_analytics: azure.mgmt.compute.v2018_06_01.operations.LogAnalyticsOperations + :ivar virtual_machine_run_commands: VirtualMachineRunCommands operations + :vartype virtual_machine_run_commands: azure.mgmt.compute.v2018_06_01.operations.VirtualMachineRunCommandsOperations :ivar galleries: Galleries operations :vartype galleries: azure.mgmt.compute.v2018_06_01.operations.GalleriesOperations :ivar gallery_images: GalleryImages operations @@ -157,6 +160,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.log_analytics = LogAnalyticsOperations( self._client, self.config, self._serialize, self._deserialize) + self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( + self._client, self.config, self._serialize, self._deserialize) self.galleries = GalleriesOperations( self._client, self.config, self._serialize, self._deserialize) self.gallery_images = GalleryImagesOperations( diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/__init__.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/__init__.py index 019a19c87ece..2d1d285f58b5 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/__init__.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/__init__.py @@ -132,6 +132,12 @@ from .log_analytics_input_base_py3 import LogAnalyticsInputBase from .log_analytics_output_py3 import LogAnalyticsOutput from .log_analytics_operation_result_py3 import LogAnalyticsOperationResult + from .run_command_input_parameter_py3 import RunCommandInputParameter + from .run_command_input_py3 import RunCommandInput + from .run_command_parameter_definition_py3 import RunCommandParameterDefinition + from .run_command_document_base_py3 import RunCommandDocumentBase + from .run_command_document_py3 import RunCommandDocument + from .run_command_result_py3 import RunCommandResult from .gallery_identifier_py3 import GalleryIdentifier from .gallery_py3 import Gallery from .gallery_image_identifier_py3 import GalleryImageIdentifier @@ -274,6 +280,12 @@ from .log_analytics_input_base import LogAnalyticsInputBase from .log_analytics_output import LogAnalyticsOutput from .log_analytics_operation_result import LogAnalyticsOperationResult + from .run_command_input_parameter import RunCommandInputParameter + from .run_command_input import RunCommandInput + from .run_command_parameter_definition import RunCommandParameterDefinition + from .run_command_document_base import RunCommandDocumentBase + from .run_command_document import RunCommandDocument + from .run_command_result import RunCommandResult from .gallery_identifier import GalleryIdentifier from .gallery import Gallery from .gallery_image_identifier import GalleryImageIdentifier @@ -304,6 +316,7 @@ from .upgrade_operation_historical_status_info_paged import UpgradeOperationHistoricalStatusInfoPaged from .virtual_machine_scale_set_extension_paged import VirtualMachineScaleSetExtensionPaged from .virtual_machine_scale_set_vm_paged import VirtualMachineScaleSetVMPaged +from .run_command_document_base_paged import RunCommandDocumentBasePaged from .gallery_paged import GalleryPaged from .gallery_image_paged import GalleryImagePaged from .gallery_image_version_paged import GalleryImageVersionPaged @@ -462,6 +475,12 @@ 'LogAnalyticsInputBase', 'LogAnalyticsOutput', 'LogAnalyticsOperationResult', + 'RunCommandInputParameter', + 'RunCommandInput', + 'RunCommandParameterDefinition', + 'RunCommandDocumentBase', + 'RunCommandDocument', + 'RunCommandResult', 'GalleryIdentifier', 'Gallery', 'GalleryImageIdentifier', @@ -492,6 +511,7 @@ 'UpgradeOperationHistoricalStatusInfoPaged', 'VirtualMachineScaleSetExtensionPaged', 'VirtualMachineScaleSetVMPaged', + 'RunCommandDocumentBasePaged', 'GalleryPaged', 'GalleryImagePaged', 'GalleryImageVersionPaged', diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_document.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_document.py new file mode 100644 index 000000000000..c4f94125b69b --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_document.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .run_command_document_base import RunCommandDocumentBase + + +class RunCommandDocument(RunCommandDocumentBase): + """Describes the properties of a Run Command. + + All required parameters must be populated in order to send to Azure. + + :param schema: Required. The VM run command schema. + :type schema: str + :param id: Required. The VM run command id. + :type id: str + :param os_type: Required. The Operating System type. Possible values + include: 'Windows', 'Linux' + :type os_type: str or + ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :param label: Required. The VM run command label. + :type label: str + :param description: Required. The VM run command description. + :type description: str + :param script: Required. The script to be executed. + :type script: list[str] + :param parameters: The parameters used by the script. + :type parameters: + list[~azure.mgmt.compute.v2018_06_01.models.RunCommandParameterDefinition] + """ + + _validation = { + 'schema': {'required': True}, + 'id': {'required': True}, + 'os_type': {'required': True}, + 'label': {'required': True}, + 'description': {'required': True}, + 'script': {'required': True}, + } + + _attribute_map = { + 'schema': {'key': '$schema', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'os_type': {'key': 'osType', 'type': 'OperatingSystemTypes'}, + 'label': {'key': 'label', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'script': {'key': 'script', 'type': '[str]'}, + 'parameters': {'key': 'parameters', 'type': '[RunCommandParameterDefinition]'}, + } + + def __init__(self, **kwargs): + super(RunCommandDocument, self).__init__(**kwargs) + self.script = kwargs.get('script', None) + self.parameters = kwargs.get('parameters', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_document_base.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_document_base.py new file mode 100644 index 000000000000..194bd6703d71 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_document_base.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RunCommandDocumentBase(Model): + """Describes the properties of a Run Command metadata. + + All required parameters must be populated in order to send to Azure. + + :param schema: Required. The VM run command schema. + :type schema: str + :param id: Required. The VM run command id. + :type id: str + :param os_type: Required. The Operating System type. Possible values + include: 'Windows', 'Linux' + :type os_type: str or + ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :param label: Required. The VM run command label. + :type label: str + :param description: Required. The VM run command description. + :type description: str + """ + + _validation = { + 'schema': {'required': True}, + 'id': {'required': True}, + 'os_type': {'required': True}, + 'label': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'schema': {'key': '$schema', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'os_type': {'key': 'osType', 'type': 'OperatingSystemTypes'}, + 'label': {'key': 'label', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RunCommandDocumentBase, self).__init__(**kwargs) + self.schema = kwargs.get('schema', None) + self.id = kwargs.get('id', None) + self.os_type = kwargs.get('os_type', None) + self.label = kwargs.get('label', None) + self.description = kwargs.get('description', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_document_base_paged.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_document_base_paged.py new file mode 100644 index 000000000000..59eee10b12bf --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_document_base_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class RunCommandDocumentBasePaged(Paged): + """ + A paging container for iterating over a list of :class:`RunCommandDocumentBase ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[RunCommandDocumentBase]'} + } + + def __init__(self, *args, **kwargs): + + super(RunCommandDocumentBasePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_document_base_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_document_base_py3.py new file mode 100644 index 000000000000..e82b42e4328d --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_document_base_py3.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RunCommandDocumentBase(Model): + """Describes the properties of a Run Command metadata. + + All required parameters must be populated in order to send to Azure. + + :param schema: Required. The VM run command schema. + :type schema: str + :param id: Required. The VM run command id. + :type id: str + :param os_type: Required. The Operating System type. Possible values + include: 'Windows', 'Linux' + :type os_type: str or + ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :param label: Required. The VM run command label. + :type label: str + :param description: Required. The VM run command description. + :type description: str + """ + + _validation = { + 'schema': {'required': True}, + 'id': {'required': True}, + 'os_type': {'required': True}, + 'label': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'schema': {'key': '$schema', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'os_type': {'key': 'osType', 'type': 'OperatingSystemTypes'}, + 'label': {'key': 'label', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, *, schema: str, id: str, os_type, label: str, description: str, **kwargs) -> None: + super(RunCommandDocumentBase, self).__init__(**kwargs) + self.schema = schema + self.id = id + self.os_type = os_type + self.label = label + self.description = description diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_document_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_document_py3.py new file mode 100644 index 000000000000..698a77668818 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_document_py3.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .run_command_document_base_py3 import RunCommandDocumentBase + + +class RunCommandDocument(RunCommandDocumentBase): + """Describes the properties of a Run Command. + + All required parameters must be populated in order to send to Azure. + + :param schema: Required. The VM run command schema. + :type schema: str + :param id: Required. The VM run command id. + :type id: str + :param os_type: Required. The Operating System type. Possible values + include: 'Windows', 'Linux' + :type os_type: str or + ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :param label: Required. The VM run command label. + :type label: str + :param description: Required. The VM run command description. + :type description: str + :param script: Required. The script to be executed. + :type script: list[str] + :param parameters: The parameters used by the script. + :type parameters: + list[~azure.mgmt.compute.v2018_06_01.models.RunCommandParameterDefinition] + """ + + _validation = { + 'schema': {'required': True}, + 'id': {'required': True}, + 'os_type': {'required': True}, + 'label': {'required': True}, + 'description': {'required': True}, + 'script': {'required': True}, + } + + _attribute_map = { + 'schema': {'key': '$schema', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'os_type': {'key': 'osType', 'type': 'OperatingSystemTypes'}, + 'label': {'key': 'label', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'script': {'key': 'script', 'type': '[str]'}, + 'parameters': {'key': 'parameters', 'type': '[RunCommandParameterDefinition]'}, + } + + def __init__(self, *, schema: str, id: str, os_type, label: str, description: str, script, parameters=None, **kwargs) -> None: + super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) + self.script = script + self.parameters = parameters diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_input.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_input.py new file mode 100644 index 000000000000..90dd6d6a5c1f --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_input.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RunCommandInput(Model): + """Capture Virtual Machine parameters. + + All required parameters must be populated in order to send to Azure. + + :param command_id: Required. The run command id. + :type command_id: str + :param script: Optional. The script to be executed. When this value is + given, the given script will override the default script of the command. + :type script: list[str] + :param parameters: The run command parameters. + :type parameters: + list[~azure.mgmt.compute.v2018_06_01.models.RunCommandInputParameter] + """ + + _validation = { + 'command_id': {'required': True}, + } + + _attribute_map = { + 'command_id': {'key': 'commandId', 'type': 'str'}, + 'script': {'key': 'script', 'type': '[str]'}, + 'parameters': {'key': 'parameters', 'type': '[RunCommandInputParameter]'}, + } + + def __init__(self, **kwargs): + super(RunCommandInput, self).__init__(**kwargs) + self.command_id = kwargs.get('command_id', None) + self.script = kwargs.get('script', None) + self.parameters = kwargs.get('parameters', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_input_parameter.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_input_parameter.py new file mode 100644 index 000000000000..cd76ad81bfa2 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_input_parameter.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RunCommandInputParameter(Model): + """Describes the properties of a run command parameter. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The run command parameter name. + :type name: str + :param value: Required. The run command parameter value. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RunCommandInputParameter, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_input_parameter_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_input_parameter_py3.py new file mode 100644 index 000000000000..6013f038a1c3 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_input_parameter_py3.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RunCommandInputParameter(Model): + """Describes the properties of a run command parameter. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The run command parameter name. + :type name: str + :param value: Required. The run command parameter value. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, name: str, value: str, **kwargs) -> None: + super(RunCommandInputParameter, self).__init__(**kwargs) + self.name = name + self.value = value diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_input_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_input_py3.py new file mode 100644 index 000000000000..cb2c7da12b4c --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_input_py3.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RunCommandInput(Model): + """Capture Virtual Machine parameters. + + All required parameters must be populated in order to send to Azure. + + :param command_id: Required. The run command id. + :type command_id: str + :param script: Optional. The script to be executed. When this value is + given, the given script will override the default script of the command. + :type script: list[str] + :param parameters: The run command parameters. + :type parameters: + list[~azure.mgmt.compute.v2018_06_01.models.RunCommandInputParameter] + """ + + _validation = { + 'command_id': {'required': True}, + } + + _attribute_map = { + 'command_id': {'key': 'commandId', 'type': 'str'}, + 'script': {'key': 'script', 'type': '[str]'}, + 'parameters': {'key': 'parameters', 'type': '[RunCommandInputParameter]'}, + } + + def __init__(self, *, command_id: str, script=None, parameters=None, **kwargs) -> None: + super(RunCommandInput, self).__init__(**kwargs) + self.command_id = command_id + self.script = script + self.parameters = parameters diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_parameter_definition.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_parameter_definition.py new file mode 100644 index 000000000000..e09f774d8241 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_parameter_definition.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RunCommandParameterDefinition(Model): + """Describes the properties of a run command parameter. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The run command parameter name. + :type name: str + :param type: Required. The run command parameter type. + :type type: str + :param default_value: The run command parameter default value. + :type default_value: str + :param required: The run command parameter required. Default value: False + . + :type required: bool + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'default_value': {'key': 'defaultValue', 'type': 'str'}, + 'required': {'key': 'required', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(RunCommandParameterDefinition, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.default_value = kwargs.get('default_value', None) + self.required = kwargs.get('required', False) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_parameter_definition_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_parameter_definition_py3.py new file mode 100644 index 000000000000..e5fbc708f965 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_parameter_definition_py3.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RunCommandParameterDefinition(Model): + """Describes the properties of a run command parameter. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The run command parameter name. + :type name: str + :param type: Required. The run command parameter type. + :type type: str + :param default_value: The run command parameter default value. + :type default_value: str + :param required: The run command parameter required. Default value: False + . + :type required: bool + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'default_value': {'key': 'defaultValue', 'type': 'str'}, + 'required': {'key': 'required', 'type': 'bool'}, + } + + def __init__(self, *, name: str, type: str, default_value: str=None, required: bool=False, **kwargs) -> None: + super(RunCommandParameterDefinition, self).__init__(**kwargs) + self.name = name + self.type = type + self.default_value = default_value + self.required = required diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_result.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_result.py new file mode 100644 index 000000000000..927839a4451b --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_result.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RunCommandResult(Model): + """RunCommandResult. + + :param value: Run command operation response. + :type value: + list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[InstanceViewStatus]'}, + } + + def __init__(self, **kwargs): + super(RunCommandResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_result_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_result_py3.py new file mode 100644 index 000000000000..bf0e76643ad6 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/run_command_result_py3.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RunCommandResult(Model): + """RunCommandResult. + + :param value: Run command operation response. + :type value: + list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[InstanceViewStatus]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(RunCommandResult, self).__init__(**kwargs) + self.value = value diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/__init__.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/__init__.py index 8700f11026cf..7f77ecf69132 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/__init__.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/__init__.py @@ -23,6 +23,7 @@ from .virtual_machine_scale_set_rolling_upgrades_operations import VirtualMachineScaleSetRollingUpgradesOperations from .virtual_machine_scale_set_vms_operations import VirtualMachineScaleSetVMsOperations from .log_analytics_operations import LogAnalyticsOperations +from .virtual_machine_run_commands_operations import VirtualMachineRunCommandsOperations from .galleries_operations import GalleriesOperations from .gallery_images_operations import GalleryImagesOperations from .gallery_image_versions_operations import GalleryImageVersionsOperations @@ -42,6 +43,7 @@ 'VirtualMachineScaleSetRollingUpgradesOperations', 'VirtualMachineScaleSetVMsOperations', 'LogAnalyticsOperations', + 'VirtualMachineRunCommandsOperations', 'GalleriesOperations', 'GalleryImagesOperations', 'GalleryImageVersionsOperations', diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/virtual_machine_run_commands_operations.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/virtual_machine_run_commands_operations.py new file mode 100644 index 000000000000..02c71c658dc6 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/virtual_machine_run_commands_operations.py @@ -0,0 +1,168 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class VirtualMachineRunCommandsOperations(object): + """VirtualMachineRunCommandsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2018-06-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01" + + self.config = config + + def list( + self, location, custom_headers=None, raw=False, **operation_config): + """Lists all available run commands for a subscription in a location. + + :param location: The location upon which run commands is queried. + :type location: 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 RunCommandDocumentBase + :rtype: + ~azure.mgmt.compute.v2018_06_01.models.RunCommandDocumentBasePaged[~azure.mgmt.compute.v2018_06_01.models.RunCommandDocumentBase] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, 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 + deserialized = models.RunCommandDocumentBasePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.RunCommandDocumentBasePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} + + def get( + self, location, command_id, custom_headers=None, raw=False, **operation_config): + """Gets specific run command for a subscription in a location. + + :param location: The location upon which run commands is queried. + :type location: str + :param command_id: The command id. + :type command_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RunCommandDocument or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.compute.v2018_06_01.models.RunCommandDocument or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'commandId': self._serialize.url("command_id", command_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, 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('RunCommandDocument', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/virtual_machine_scale_set_vms_operations.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/virtual_machine_scale_set_vms_operations.py index 41305faab6a4..482195142987 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/virtual_machine_scale_set_vms_operations.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/virtual_machine_scale_set_vms_operations.py @@ -1129,3 +1129,108 @@ def get_long_running_output(response): else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) perform_maintenance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} + + + def _run_command_initial( + self, resource_group_name, vm_scale_set_name, instance_id, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.run_command.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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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(parameters, 'RunCommandInput') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + 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('RunCommandResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def run_command( + self, resource_group_name, vm_scale_set_name, instance_id, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Run command on a virtual machine in a VM scale set. + + :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 parameters: Parameters supplied to the Run command operation. + :type parameters: + ~azure.mgmt.compute.v2018_06_01.models.RunCommandInput + :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 RunCommandResult or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2018_06_01.models.RunCommandResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2018_06_01.models.RunCommandResult]] + :raises: :class:`CloudError` + """ + raw_result = self._run_command_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('RunCommandResult', 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) + run_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand'} diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/virtual_machines_operations.py b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/virtual_machines_operations.py index 53c36ce96535..e113d0aedbb2 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/virtual_machines_operations.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/virtual_machines_operations.py @@ -1391,3 +1391,104 @@ def get_long_running_output(response): else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) perform_maintenance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} + + + def _run_command_initial( + self, resource_group_name, vm_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.run_command.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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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(parameters, 'RunCommandInput') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + 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('RunCommandResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def run_command( + self, resource_group_name, vm_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Run command on the VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Run command operation. + :type parameters: + ~azure.mgmt.compute.v2018_06_01.models.RunCommandInput + :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 RunCommandResult or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2018_06_01.models.RunCommandResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2018_06_01.models.RunCommandResult]] + :raises: :class:`CloudError` + """ + raw_result = self._run_command_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('RunCommandResult', 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) + run_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'}