diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/__init__.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/__init__.py index b8d6e058d197..1a770fdff29e 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/__init__.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/__init__.py @@ -104,14 +104,16 @@ from .virtual_machine_scale_set_instance_view_py3 import VirtualMachineScaleSetInstanceView from .virtual_machine_scale_set_sku_capacity_py3 import VirtualMachineScaleSetSkuCapacity from .virtual_machine_scale_set_sku_py3 import VirtualMachineScaleSetSku - from .virtual_machine_scale_set_vm_py3 import VirtualMachineScaleSetVM - from .virtual_machine_health_status_py3 import VirtualMachineHealthStatus - from .virtual_machine_scale_set_vm_instance_view_py3 import VirtualMachineScaleSetVMInstanceView + from .platform_image_reference_py3 import PlatformImageReference from .rolling_upgrade_running_status_py3 import RollingUpgradeRunningStatus from .rolling_upgrade_progress_info_py3 import RollingUpgradeProgressInfo from .api_error_base_py3 import ApiErrorBase from .inner_error_py3 import InnerError from .api_error_py3 import ApiError + from .virtual_machine_scale_set_os_upgrade_history_py3 import VirtualMachineScaleSetOSUpgradeHistory + from .virtual_machine_scale_set_vm_py3 import VirtualMachineScaleSetVM + from .virtual_machine_health_status_py3 import VirtualMachineHealthStatus + from .virtual_machine_scale_set_vm_instance_view_py3 import VirtualMachineScaleSetVMInstanceView from .rolling_upgrade_status_info_py3 import RollingUpgradeStatusInfo from .compute_long_running_operation_properties_py3 import ComputeLongRunningOperationProperties from .resource_py3 import Resource @@ -225,14 +227,16 @@ from .virtual_machine_scale_set_instance_view import VirtualMachineScaleSetInstanceView from .virtual_machine_scale_set_sku_capacity import VirtualMachineScaleSetSkuCapacity from .virtual_machine_scale_set_sku import VirtualMachineScaleSetSku - from .virtual_machine_scale_set_vm import VirtualMachineScaleSetVM - from .virtual_machine_health_status import VirtualMachineHealthStatus - from .virtual_machine_scale_set_vm_instance_view import VirtualMachineScaleSetVMInstanceView + from .platform_image_reference import PlatformImageReference from .rolling_upgrade_running_status import RollingUpgradeRunningStatus from .rolling_upgrade_progress_info import RollingUpgradeProgressInfo from .api_error_base import ApiErrorBase from .inner_error import InnerError from .api_error import ApiError + from .virtual_machine_scale_set_os_upgrade_history import VirtualMachineScaleSetOSUpgradeHistory + from .virtual_machine_scale_set_vm import VirtualMachineScaleSetVM + from .virtual_machine_health_status import VirtualMachineHealthStatus + from .virtual_machine_scale_set_vm_instance_view import VirtualMachineScaleSetVMInstanceView from .rolling_upgrade_status_info import RollingUpgradeStatusInfo from .compute_long_running_operation_properties import ComputeLongRunningOperationProperties from .resource import Resource @@ -259,6 +263,7 @@ from .virtual_machine_paged import VirtualMachinePaged from .virtual_machine_scale_set_paged import VirtualMachineScaleSetPaged from .virtual_machine_scale_set_sku_paged import VirtualMachineScaleSetSkuPaged +from .virtual_machine_scale_set_os_upgrade_history_paged import VirtualMachineScaleSetOSUpgradeHistoryPaged 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 @@ -381,14 +386,16 @@ 'VirtualMachineScaleSetInstanceView', 'VirtualMachineScaleSetSkuCapacity', 'VirtualMachineScaleSetSku', - 'VirtualMachineScaleSetVM', - 'VirtualMachineHealthStatus', - 'VirtualMachineScaleSetVMInstanceView', + 'PlatformImageReference', 'RollingUpgradeRunningStatus', 'RollingUpgradeProgressInfo', 'ApiErrorBase', 'InnerError', 'ApiError', + 'VirtualMachineScaleSetOSUpgradeHistory', + 'VirtualMachineScaleSetVM', + 'VirtualMachineHealthStatus', + 'VirtualMachineScaleSetVMInstanceView', 'RollingUpgradeStatusInfo', 'ComputeLongRunningOperationProperties', 'Resource', @@ -415,6 +422,7 @@ 'VirtualMachinePaged', 'VirtualMachineScaleSetPaged', 'VirtualMachineScaleSetSkuPaged', + 'VirtualMachineScaleSetOSUpgradeHistoryPaged', 'VirtualMachineScaleSetExtensionPaged', 'VirtualMachineScaleSetVMPaged', 'RunCommandDocumentBasePaged', diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/platform_image_reference.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/platform_image_reference.py new file mode 100644 index 000000000000..c5e6ac166ac7 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/platform_image_reference.py @@ -0,0 +1,55 @@ +# 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 PlatformImageReference(Model): + """A reference that identifies a CRP-PIR image or a UserVMImage. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar publisher: Publisher + :vartype publisher: str + :ivar offer: Offer + :vartype offer: str + :ivar sku: Sku + :vartype sku: str + :ivar version: Version + :vartype version: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str + """ + + _validation = { + 'publisher': {'readonly': True}, + 'offer': {'readonly': True}, + 'sku': {'readonly': True}, + 'version': {'readonly': True}, + 'uri': {'readonly': True}, + } + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PlatformImageReference, self).__init__(**kwargs) + self.publisher = None + self.offer = None + self.sku = None + self.version = None + self.uri = None diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/platform_image_reference_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/platform_image_reference_py3.py new file mode 100644 index 000000000000..e0a76c6752ec --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/platform_image_reference_py3.py @@ -0,0 +1,55 @@ +# 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 PlatformImageReference(Model): + """A reference that identifies a CRP-PIR image or a UserVMImage. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar publisher: Publisher + :vartype publisher: str + :ivar offer: Offer + :vartype offer: str + :ivar sku: Sku + :vartype sku: str + :ivar version: Version + :vartype version: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str + """ + + _validation = { + 'publisher': {'readonly': True}, + 'offer': {'readonly': True}, + 'sku': {'readonly': True}, + 'version': {'readonly': True}, + 'uri': {'readonly': True}, + } + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(PlatformImageReference, self).__init__(**kwargs) + self.publisher = None + self.offer = None + self.sku = None + self.version = None + self.uri = None diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_scale_set_os_upgrade_history.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_scale_set_os_upgrade_history.py new file mode 100644 index 000000000000..d7f4e8cc07d1 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_scale_set_os_upgrade_history.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 msrest.serialization import Model + + +class VirtualMachineScaleSetOSUpgradeHistory(Model): + """Describes each OS upgrade on the Virtual Machine Scale Set. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar running_status: Information about the overall status of the upgrade + operation. + :vartype running_status: + ~azure.mgmt.compute.v2017_12_01.models.RollingUpgradeRunningStatus + :ivar progress_info: Counts of the VM's in each state. + :vartype progress_info: + ~azure.mgmt.compute.v2017_12_01.models.RollingUpgradeProgressInfo + :ivar error: Error Details for this upgrade if there are any. + :vartype error: ~azure.mgmt.compute.v2017_12_01.models.ApiError + :ivar started_by: Error Details for this upgrade if there are any. + Possible values include: 'Unknown', 'User', 'Platform' + :vartype started_by: str or ~azure.mgmt.compute.v2017_12_01.models.enum + :ivar target_image_reference: Error Details for this upgrade if there are + any. + :vartype target_image_reference: + ~azure.mgmt.compute.v2017_12_01.models.PlatformImageReference + """ + + _validation = { + 'running_status': {'readonly': True}, + 'progress_info': {'readonly': True}, + 'error': {'readonly': True}, + 'started_by': {'readonly': True}, + 'target_image_reference': {'readonly': True}, + } + + _attribute_map = { + 'running_status': {'key': 'runningStatus', 'type': 'RollingUpgradeRunningStatus'}, + 'progress_info': {'key': 'progressInfo', 'type': 'RollingUpgradeProgressInfo'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + 'started_by': {'key': 'startedBy', 'type': 'str'}, + 'target_image_reference': {'key': 'targetImageReference', 'type': 'PlatformImageReference'}, + } + + def __init__(self, **kwargs): + super(VirtualMachineScaleSetOSUpgradeHistory, self).__init__(**kwargs) + self.running_status = None + self.progress_info = None + self.error = None + self.started_by = None + self.target_image_reference = None diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_scale_set_os_upgrade_history_paged.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_scale_set_os_upgrade_history_paged.py new file mode 100644 index 000000000000..e0f806493e7b --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_scale_set_os_upgrade_history_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 VirtualMachineScaleSetOSUpgradeHistoryPaged(Paged): + """ + A paging container for iterating over a list of :class:`VirtualMachineScaleSetOSUpgradeHistory ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[VirtualMachineScaleSetOSUpgradeHistory]'} + } + + def __init__(self, *args, **kwargs): + + super(VirtualMachineScaleSetOSUpgradeHistoryPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_scale_set_os_upgrade_history_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_scale_set_os_upgrade_history_py3.py new file mode 100644 index 000000000000..46c807548dd4 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_scale_set_os_upgrade_history_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 msrest.serialization import Model + + +class VirtualMachineScaleSetOSUpgradeHistory(Model): + """Describes each OS upgrade on the Virtual Machine Scale Set. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar running_status: Information about the overall status of the upgrade + operation. + :vartype running_status: + ~azure.mgmt.compute.v2017_12_01.models.RollingUpgradeRunningStatus + :ivar progress_info: Counts of the VM's in each state. + :vartype progress_info: + ~azure.mgmt.compute.v2017_12_01.models.RollingUpgradeProgressInfo + :ivar error: Error Details for this upgrade if there are any. + :vartype error: ~azure.mgmt.compute.v2017_12_01.models.ApiError + :ivar started_by: Error Details for this upgrade if there are any. + Possible values include: 'Unknown', 'User', 'Platform' + :vartype started_by: str or ~azure.mgmt.compute.v2017_12_01.models.enum + :ivar target_image_reference: Error Details for this upgrade if there are + any. + :vartype target_image_reference: + ~azure.mgmt.compute.v2017_12_01.models.PlatformImageReference + """ + + _validation = { + 'running_status': {'readonly': True}, + 'progress_info': {'readonly': True}, + 'error': {'readonly': True}, + 'started_by': {'readonly': True}, + 'target_image_reference': {'readonly': True}, + } + + _attribute_map = { + 'running_status': {'key': 'runningStatus', 'type': 'RollingUpgradeRunningStatus'}, + 'progress_info': {'key': 'progressInfo', 'type': 'RollingUpgradeProgressInfo'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + 'started_by': {'key': 'startedBy', 'type': 'str'}, + 'target_image_reference': {'key': 'targetImageReference', 'type': 'PlatformImageReference'}, + } + + def __init__(self, **kwargs) -> None: + super(VirtualMachineScaleSetOSUpgradeHistory, self).__init__(**kwargs) + self.running_status = None + self.progress_info = None + self.error = None + self.started_by = None + self.target_image_reference = None diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/virtual_machine_scale_sets_operations.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/virtual_machine_scale_sets_operations.py index d90905df725b..5f357b1a331c 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/virtual_machine_scale_sets_operations.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/virtual_machine_scale_sets_operations.py @@ -887,6 +887,78 @@ def internal_paging(next_link=None, raw=False): return deserialized list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus'} + def get_os_upgrade_history( + self, resource_group_name, vm_scale_set_name, custom_headers=None, raw=False, **operation_config): + """Gets list of OS upgrades on a VM scale set instance. + + :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 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 + VirtualMachineScaleSetOSUpgradeHistory + :rtype: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetOSUpgradeHistoryPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetOSUpgradeHistory] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.get_os_upgrade_history.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'), + '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.VirtualMachineScaleSetOSUpgradeHistoryPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.VirtualMachineScaleSetOSUpgradeHistoryPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + get_os_upgrade_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory'} + def _power_off_initial( self, resource_group_name, vm_scale_set_name, instance_ids=None, custom_headers=None, raw=False, **operation_config):