diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/__init__.py b/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/__init__.py index e90c8dab3a08..96f7a34ac2e1 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/__init__.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/__init__.py @@ -18,6 +18,7 @@ from .virtual_machine_image_resource_py3 import VirtualMachineImageResource from .virtual_machine_extension_instance_view_py3 import VirtualMachineExtensionInstanceView from .virtual_machine_extension_py3 import VirtualMachineExtension + from .virtual_machine_extension_update_py3 import VirtualMachineExtensionUpdate from .purchase_plan_py3 import PurchasePlan from .os_disk_image_py3 import OSDiskImage from .data_disk_image_py3 import DataDiskImage @@ -84,6 +85,7 @@ from .api_error_py3 import ApiError from .compute_long_running_operation_properties_py3 import ComputeLongRunningOperationProperties from .resource_py3 import Resource + from .update_resource_py3 import UpdateResource from .operation_status_response_py3 import OperationStatusResponse except (SyntaxError, ImportError): from .instance_view_status import InstanceViewStatus @@ -94,6 +96,7 @@ from .virtual_machine_image_resource import VirtualMachineImageResource from .virtual_machine_extension_instance_view import VirtualMachineExtensionInstanceView from .virtual_machine_extension import VirtualMachineExtension + from .virtual_machine_extension_update import VirtualMachineExtensionUpdate from .purchase_plan import PurchasePlan from .os_disk_image import OSDiskImage from .data_disk_image import DataDiskImage @@ -160,6 +163,7 @@ from .api_error import ApiError from .compute_long_running_operation_properties import ComputeLongRunningOperationProperties from .resource import Resource + from .update_resource import UpdateResource from .operation_status_response import OperationStatusResponse from .availability_set_paged import AvailabilitySetPaged from .virtual_machine_size_paged import VirtualMachineSizePaged @@ -192,6 +196,7 @@ 'VirtualMachineImageResource', 'VirtualMachineExtensionInstanceView', 'VirtualMachineExtension', + 'VirtualMachineExtensionUpdate', 'PurchasePlan', 'OSDiskImage', 'DataDiskImage', @@ -258,6 +263,7 @@ 'ApiError', 'ComputeLongRunningOperationProperties', 'Resource', + 'UpdateResource', 'OperationStatusResponse', 'AvailabilitySetPaged', 'VirtualMachineSizePaged', diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/update_resource.py b/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/update_resource.py new file mode 100644 index 000000000000..b1d2898ff082 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/update_resource.py @@ -0,0 +1,28 @@ +# 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 UpdateResource(Model): + """The Update Resource model definition. + + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(UpdateResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/update_resource_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/update_resource_py3.py new file mode 100644 index 000000000000..c06c17c124d9 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/update_resource_py3.py @@ -0,0 +1,28 @@ +# 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 UpdateResource(Model): + """The Update Resource model definition. + + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(UpdateResource, self).__init__(**kwargs) + self.tags = tags diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/virtual_machine_extension_update.py b/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/virtual_machine_extension_update.py new file mode 100644 index 000000000000..b920ff57ff96 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/virtual_machine_extension_update.py @@ -0,0 +1,62 @@ +# 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 .update_resource import UpdateResource + + +class VirtualMachineExtensionUpdate(UpdateResource): + """Describes a Virtual Machine Extension. + + :param tags: Resource tags + :type tags: dict[str, str] + :param force_update_tag: How the extension handler should be forced to + update even if the extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param auto_upgrade_minor_version: Indicates whether the extension should + use a newer minor version if one is available at deployment time. Once + deployed, however, the extension will not upgrade minor versions unless + redeployed, even with this property set to true. + :type auto_upgrade_minor_version: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either + protectedSettings or protectedSettingsFromKeyVault or no protected + settings at all. + :type protected_settings: object + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'type': {'key': 'properties.type', 'type': 'str'}, + 'type_handler_version': {'key': 'properties.typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(VirtualMachineExtensionUpdate, self).__init__(**kwargs) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.publisher = kwargs.get('publisher', None) + self.type = kwargs.get('type', None) + self.type_handler_version = kwargs.get('type_handler_version', None) + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) + self.settings = kwargs.get('settings', None) + self.protected_settings = kwargs.get('protected_settings', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/virtual_machine_extension_update_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/virtual_machine_extension_update_py3.py new file mode 100644 index 000000000000..a5b8ea8c1104 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/virtual_machine_extension_update_py3.py @@ -0,0 +1,62 @@ +# 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 .update_resource import UpdateResource + + +class VirtualMachineExtensionUpdate(UpdateResource): + """Describes a Virtual Machine Extension. + + :param tags: Resource tags + :type tags: dict[str, str] + :param force_update_tag: How the extension handler should be forced to + update even if the extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param auto_upgrade_minor_version: Indicates whether the extension should + use a newer minor version if one is available at deployment time. Once + deployed, however, the extension will not upgrade minor versions unless + redeployed, even with this property set to true. + :type auto_upgrade_minor_version: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either + protectedSettings or protectedSettingsFromKeyVault or no protected + settings at all. + :type protected_settings: object + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'type': {'key': 'properties.type', 'type': 'str'}, + 'type_handler_version': {'key': 'properties.typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + } + + def __init__(self, *, tags=None, force_update_tag: str=None, publisher: str=None, type: str=None, type_handler_version: str=None, auto_upgrade_minor_version: bool=None, settings=None, protected_settings=None, **kwargs) -> None: + super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) + self.force_update_tag = force_update_tag + self.publisher = publisher + self.type = type + self.type_handler_version = type_handler_version + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.settings = settings + self.protected_settings = protected_settings diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/virtual_machine_extensions_operations.py b/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/virtual_machine_extensions_operations.py index 096988d1f6ec..6b56e4ee45e6 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/virtual_machine_extensions_operations.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/virtual_machine_extensions_operations.py @@ -99,7 +99,7 @@ def create_or_update( :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 extension - should be create or updated. + should be created or updated. :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. :type vm_extension_name: str @@ -149,6 +149,113 @@ def get_long_running_output(response): create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} + def _update_initial( + self, resource_group_name, vm_name, vm_extension_name, extension_parameters, 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'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_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(extension_parameters, 'VirtualMachineExtensionUpdate') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('VirtualMachineExtension', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, vm_name, vm_extension_name, extension_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """The operation to update the extension. + + :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 extension + should be updated. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual + Machine Extension operation. + :type extension_parameters: + ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtensionUpdate + :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 VirtualMachineExtension + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtension] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtension]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('VirtualMachineExtension', 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}/extensions/{vmExtensionName}'} + + def _delete_initial( self, resource_group_name, vm_name, vm_extension_name, custom_headers=None, raw=False, **operation_config): # Construct URL diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/compute_management_client.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/compute_management_client.py index 9bce9b667099..fd70594a902c 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/compute_management_client.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/compute_management_client.py @@ -16,10 +16,10 @@ from .operations.availability_sets_operations import AvailabilitySetsOperations from .operations.virtual_machine_extension_images_operations import VirtualMachineExtensionImagesOperations from .operations.virtual_machine_extensions_operations import VirtualMachineExtensionsOperations +from .operations.virtual_machines_operations import VirtualMachinesOperations from .operations.virtual_machine_images_operations import VirtualMachineImagesOperations from .operations.usage_operations import UsageOperations from .operations.virtual_machine_sizes_operations import VirtualMachineSizesOperations -from .operations.virtual_machines_operations import VirtualMachinesOperations from .operations.virtual_machine_scale_sets_operations import VirtualMachineScaleSetsOperations from .operations.virtual_machine_scale_set_vms_operations import VirtualMachineScaleSetVMsOperations from . import models @@ -71,14 +71,14 @@ class ComputeManagementClient(object): :vartype virtual_machine_extension_images: azure.mgmt.compute.v2016_03_30.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensions operations :vartype virtual_machine_extensions: azure.mgmt.compute.v2016_03_30.operations.VirtualMachineExtensionsOperations + :ivar virtual_machines: VirtualMachines operations + :vartype virtual_machines: azure.mgmt.compute.v2016_03_30.operations.VirtualMachinesOperations :ivar virtual_machine_images: VirtualMachineImages operations :vartype virtual_machine_images: azure.mgmt.compute.v2016_03_30.operations.VirtualMachineImagesOperations :ivar usage: Usage operations :vartype usage: azure.mgmt.compute.v2016_03_30.operations.UsageOperations :ivar virtual_machine_sizes: VirtualMachineSizes operations :vartype virtual_machine_sizes: azure.mgmt.compute.v2016_03_30.operations.VirtualMachineSizesOperations - :ivar virtual_machines: VirtualMachines operations - :vartype virtual_machines: azure.mgmt.compute.v2016_03_30.operations.VirtualMachinesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSets operations :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2016_03_30.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMs operations @@ -111,14 +111,14 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_extensions = VirtualMachineExtensionsOperations( self._client, self.config, self._serialize, self._deserialize) + self.virtual_machines = VirtualMachinesOperations( + self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_images = VirtualMachineImagesOperations( self._client, self.config, self._serialize, self._deserialize) self.usage = UsageOperations( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_sizes = VirtualMachineSizesOperations( self._client, self.config, self._serialize, self._deserialize) - self.virtual_machines = VirtualMachinesOperations( - self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/__init__.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/__init__.py index 6a083cc17f20..ec069ff87f74 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/__init__.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/__init__.py @@ -18,6 +18,8 @@ from .virtual_machine_image_resource_py3 import VirtualMachineImageResource from .virtual_machine_extension_instance_view_py3 import VirtualMachineExtensionInstanceView from .virtual_machine_extension_py3 import VirtualMachineExtension + from .virtual_machine_extension_update_py3 import VirtualMachineExtensionUpdate + from .virtual_machine_extensions_list_result_py3 import VirtualMachineExtensionsListResult from .purchase_plan_py3 import PurchasePlan from .os_disk_image_py3 import OSDiskImage from .data_disk_image_py3 import DataDiskImage @@ -86,6 +88,7 @@ from .api_error_py3 import ApiError from .compute_long_running_operation_properties_py3 import ComputeLongRunningOperationProperties from .resource_py3 import Resource + from .update_resource_py3 import UpdateResource from .operation_status_response_py3 import OperationStatusResponse except (SyntaxError, ImportError): from .instance_view_status import InstanceViewStatus @@ -96,6 +99,8 @@ from .virtual_machine_image_resource import VirtualMachineImageResource from .virtual_machine_extension_instance_view import VirtualMachineExtensionInstanceView from .virtual_machine_extension import VirtualMachineExtension + from .virtual_machine_extension_update import VirtualMachineExtensionUpdate + from .virtual_machine_extensions_list_result import VirtualMachineExtensionsListResult from .purchase_plan import PurchasePlan from .os_disk_image import OSDiskImage from .data_disk_image import DataDiskImage @@ -164,11 +169,12 @@ from .api_error import ApiError from .compute_long_running_operation_properties import ComputeLongRunningOperationProperties from .resource import Resource + from .update_resource import UpdateResource from .operation_status_response import OperationStatusResponse from .availability_set_paged import AvailabilitySetPaged from .virtual_machine_size_paged import VirtualMachineSizePaged -from .usage_paged import UsagePaged from .virtual_machine_paged import VirtualMachinePaged +from .usage_paged import UsagePaged from .virtual_machine_scale_set_paged import VirtualMachineScaleSetPaged from .virtual_machine_scale_set_sku_paged import VirtualMachineScaleSetSkuPaged from .virtual_machine_scale_set_vm_paged import VirtualMachineScaleSetVMPaged @@ -197,6 +203,8 @@ 'VirtualMachineImageResource', 'VirtualMachineExtensionInstanceView', 'VirtualMachineExtension', + 'VirtualMachineExtensionUpdate', + 'VirtualMachineExtensionsListResult', 'PurchasePlan', 'OSDiskImage', 'DataDiskImage', @@ -265,11 +273,12 @@ 'ApiError', 'ComputeLongRunningOperationProperties', 'Resource', + 'UpdateResource', 'OperationStatusResponse', 'AvailabilitySetPaged', 'VirtualMachineSizePaged', - 'UsagePaged', 'VirtualMachinePaged', + 'UsagePaged', 'VirtualMachineScaleSetPaged', 'VirtualMachineScaleSetSkuPaged', 'VirtualMachineScaleSetVMPaged', diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/update_resource.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/update_resource.py new file mode 100644 index 000000000000..b1d2898ff082 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/update_resource.py @@ -0,0 +1,28 @@ +# 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 UpdateResource(Model): + """The Update Resource model definition. + + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(UpdateResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/update_resource_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/update_resource_py3.py new file mode 100644 index 000000000000..c06c17c124d9 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/update_resource_py3.py @@ -0,0 +1,28 @@ +# 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 UpdateResource(Model): + """The Update Resource model definition. + + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(UpdateResource, self).__init__(**kwargs) + self.tags = tags diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/virtual_machine_extension_update.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/virtual_machine_extension_update.py new file mode 100644 index 000000000000..b920ff57ff96 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/virtual_machine_extension_update.py @@ -0,0 +1,62 @@ +# 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 .update_resource import UpdateResource + + +class VirtualMachineExtensionUpdate(UpdateResource): + """Describes a Virtual Machine Extension. + + :param tags: Resource tags + :type tags: dict[str, str] + :param force_update_tag: How the extension handler should be forced to + update even if the extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param auto_upgrade_minor_version: Indicates whether the extension should + use a newer minor version if one is available at deployment time. Once + deployed, however, the extension will not upgrade minor versions unless + redeployed, even with this property set to true. + :type auto_upgrade_minor_version: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either + protectedSettings or protectedSettingsFromKeyVault or no protected + settings at all. + :type protected_settings: object + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'type': {'key': 'properties.type', 'type': 'str'}, + 'type_handler_version': {'key': 'properties.typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(VirtualMachineExtensionUpdate, self).__init__(**kwargs) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.publisher = kwargs.get('publisher', None) + self.type = kwargs.get('type', None) + self.type_handler_version = kwargs.get('type_handler_version', None) + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) + self.settings = kwargs.get('settings', None) + self.protected_settings = kwargs.get('protected_settings', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/virtual_machine_extension_update_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/virtual_machine_extension_update_py3.py new file mode 100644 index 000000000000..a5b8ea8c1104 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/virtual_machine_extension_update_py3.py @@ -0,0 +1,62 @@ +# 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 .update_resource import UpdateResource + + +class VirtualMachineExtensionUpdate(UpdateResource): + """Describes a Virtual Machine Extension. + + :param tags: Resource tags + :type tags: dict[str, str] + :param force_update_tag: How the extension handler should be forced to + update even if the extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param auto_upgrade_minor_version: Indicates whether the extension should + use a newer minor version if one is available at deployment time. Once + deployed, however, the extension will not upgrade minor versions unless + redeployed, even with this property set to true. + :type auto_upgrade_minor_version: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either + protectedSettings or protectedSettingsFromKeyVault or no protected + settings at all. + :type protected_settings: object + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'type': {'key': 'properties.type', 'type': 'str'}, + 'type_handler_version': {'key': 'properties.typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + } + + def __init__(self, *, tags=None, force_update_tag: str=None, publisher: str=None, type: str=None, type_handler_version: str=None, auto_upgrade_minor_version: bool=None, settings=None, protected_settings=None, **kwargs) -> None: + super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) + self.force_update_tag = force_update_tag + self.publisher = publisher + self.type = type + self.type_handler_version = type_handler_version + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.settings = settings + self.protected_settings = protected_settings diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/virtual_machine_extensions_list_result.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/virtual_machine_extensions_list_result.py new file mode 100644 index 000000000000..22ec67375b47 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/virtual_machine_extensions_list_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 VirtualMachineExtensionsListResult(Model): + """The List Extension operation response. + + :param value: The list of extensions + :type value: + list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineExtension]'}, + } + + def __init__(self, **kwargs): + super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/virtual_machine_extensions_list_result_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/virtual_machine_extensions_list_result_py3.py new file mode 100644 index 000000000000..60d057ab868a --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/virtual_machine_extensions_list_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 VirtualMachineExtensionsListResult(Model): + """The List Extension operation response. + + :param value: The list of extensions + :type value: + list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineExtension]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) + self.value = value diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/__init__.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/__init__.py index dba24407b254..bd6f5149c870 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/__init__.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/__init__.py @@ -12,10 +12,10 @@ from .availability_sets_operations import AvailabilitySetsOperations from .virtual_machine_extension_images_operations import VirtualMachineExtensionImagesOperations from .virtual_machine_extensions_operations import VirtualMachineExtensionsOperations +from .virtual_machines_operations import VirtualMachinesOperations from .virtual_machine_images_operations import VirtualMachineImagesOperations from .usage_operations import UsageOperations from .virtual_machine_sizes_operations import VirtualMachineSizesOperations -from .virtual_machines_operations import VirtualMachinesOperations from .virtual_machine_scale_sets_operations import VirtualMachineScaleSetsOperations from .virtual_machine_scale_set_vms_operations import VirtualMachineScaleSetVMsOperations @@ -23,10 +23,10 @@ 'AvailabilitySetsOperations', 'VirtualMachineExtensionImagesOperations', 'VirtualMachineExtensionsOperations', + 'VirtualMachinesOperations', 'VirtualMachineImagesOperations', 'UsageOperations', 'VirtualMachineSizesOperations', - 'VirtualMachinesOperations', 'VirtualMachineScaleSetsOperations', 'VirtualMachineScaleSetVMsOperations', ] diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/virtual_machine_extensions_operations.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/virtual_machine_extensions_operations.py index 85496d3604f2..76cf9217d944 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/virtual_machine_extensions_operations.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/virtual_machine_extensions_operations.py @@ -99,7 +99,7 @@ def create_or_update( :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 extension - should be create or updated. + should be created or updated. :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. :type vm_extension_name: str @@ -149,6 +149,113 @@ def get_long_running_output(response): create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} + def _update_initial( + self, resource_group_name, vm_name, vm_extension_name, extension_parameters, 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'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_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(extension_parameters, 'VirtualMachineExtensionUpdate') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('VirtualMachineExtension', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, vm_name, vm_extension_name, extension_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """The operation to update the extension. + + :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 extension + should be updated. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual + Machine Extension operation. + :type extension_parameters: + ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtensionUpdate + :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 VirtualMachineExtension + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('VirtualMachineExtension', 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}/extensions/{vmExtensionName}'} + + def _delete_initial( self, resource_group_name, vm_name, vm_extension_name, custom_headers=None, raw=False, **operation_config): # Construct URL diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/virtual_machines_operations.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/virtual_machines_operations.py index 25e5499522c4..20c72c5fde3c 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/virtual_machines_operations.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/virtual_machines_operations.py @@ -39,6 +39,75 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def get_extensions( + self, resource_group_name, vm_name, expand=None, custom_headers=None, raw=False, **operation_config): + """The operation to get all extensions 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 + extension. + :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: VirtualMachineExtensionsListResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtensionsListResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_extensions.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') + + # 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('VirtualMachineExtensionsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} + def _capture_initial( self, resource_group_name, vm_name, parameters, custom_headers=None, raw=False, **operation_config): diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/compute_management_client.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/compute_management_client.py index 8a0664180ae2..c58b204ba4d0 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/compute_management_client.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/compute_management_client.py @@ -16,11 +16,11 @@ from .operations.availability_sets_operations import AvailabilitySetsOperations from .operations.virtual_machine_extension_images_operations import VirtualMachineExtensionImagesOperations from .operations.virtual_machine_extensions_operations import VirtualMachineExtensionsOperations +from .operations.virtual_machines_operations import VirtualMachinesOperations from .operations.virtual_machine_images_operations import VirtualMachineImagesOperations from .operations.usage_operations import UsageOperations from .operations.virtual_machine_sizes_operations import VirtualMachineSizesOperations from .operations.images_operations import ImagesOperations -from .operations.virtual_machines_operations import VirtualMachinesOperations from .operations.virtual_machine_scale_sets_operations import VirtualMachineScaleSetsOperations from .operations.virtual_machine_scale_set_vms_operations import VirtualMachineScaleSetVMsOperations from .operations.disks_operations import DisksOperations @@ -74,6 +74,8 @@ class ComputeManagementClient(object): :vartype virtual_machine_extension_images: azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensions operations :vartype virtual_machine_extensions: azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineExtensionsOperations + :ivar virtual_machines: VirtualMachines operations + :vartype virtual_machines: azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachinesOperations :ivar virtual_machine_images: VirtualMachineImages operations :vartype virtual_machine_images: azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineImagesOperations :ivar usage: Usage operations @@ -82,8 +84,6 @@ class ComputeManagementClient(object): :vartype virtual_machine_sizes: azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineSizesOperations :ivar images: Images operations :vartype images: azure.mgmt.compute.v2016_04_30_preview.operations.ImagesOperations - :ivar virtual_machines: VirtualMachines operations - :vartype virtual_machines: azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachinesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSets operations :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMs operations @@ -120,6 +120,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_extensions = VirtualMachineExtensionsOperations( self._client, self.config, self._serialize, self._deserialize) + self.virtual_machines = VirtualMachinesOperations( + self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_images = VirtualMachineImagesOperations( self._client, self.config, self._serialize, self._deserialize) self.usage = UsageOperations( @@ -128,8 +130,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.images = ImagesOperations( self._client, self.config, self._serialize, self._deserialize) - self.virtual_machines = VirtualMachinesOperations( - self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/__init__.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/__init__.py index 2cc876579a96..159cabb3d4e6 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/__init__.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/__init__.py @@ -19,6 +19,8 @@ from .virtual_machine_image_resource_py3 import VirtualMachineImageResource from .virtual_machine_extension_instance_view_py3 import VirtualMachineExtensionInstanceView from .virtual_machine_extension_py3 import VirtualMachineExtension + from .virtual_machine_extension_update_py3 import VirtualMachineExtensionUpdate + from .virtual_machine_extensions_list_result_py3 import VirtualMachineExtensionsListResult from .purchase_plan_py3 import PurchasePlan from .os_disk_image_py3 import OSDiskImage from .data_disk_image_py3 import DataDiskImage @@ -93,6 +95,7 @@ from .api_error_py3 import ApiError from .compute_long_running_operation_properties_py3 import ComputeLongRunningOperationProperties from .resource_py3 import Resource + from .update_resource_py3 import UpdateResource from .sub_resource_read_only_py3 import SubResourceReadOnly from .operation_status_response_py3 import OperationStatusResponse from .resource_update_py3 import ResourceUpdate @@ -118,6 +121,8 @@ from .virtual_machine_image_resource import VirtualMachineImageResource from .virtual_machine_extension_instance_view import VirtualMachineExtensionInstanceView from .virtual_machine_extension import VirtualMachineExtension + from .virtual_machine_extension_update import VirtualMachineExtensionUpdate + from .virtual_machine_extensions_list_result import VirtualMachineExtensionsListResult from .purchase_plan import PurchasePlan from .os_disk_image import OSDiskImage from .data_disk_image import DataDiskImage @@ -192,6 +197,7 @@ from .api_error import ApiError from .compute_long_running_operation_properties import ComputeLongRunningOperationProperties from .resource import Resource + from .update_resource import UpdateResource from .sub_resource_read_only import SubResourceReadOnly from .operation_status_response import OperationStatusResponse from .resource_update import ResourceUpdate @@ -209,9 +215,9 @@ from .snapshot_update import SnapshotUpdate from .availability_set_paged import AvailabilitySetPaged from .virtual_machine_size_paged import VirtualMachineSizePaged +from .virtual_machine_paged import VirtualMachinePaged from .usage_paged import UsagePaged from .image_paged import ImagePaged -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_vm_paged import VirtualMachineScaleSetVMPaged @@ -247,6 +253,8 @@ 'VirtualMachineImageResource', 'VirtualMachineExtensionInstanceView', 'VirtualMachineExtension', + 'VirtualMachineExtensionUpdate', + 'VirtualMachineExtensionsListResult', 'PurchasePlan', 'OSDiskImage', 'DataDiskImage', @@ -321,6 +329,7 @@ 'ApiError', 'ComputeLongRunningOperationProperties', 'Resource', + 'UpdateResource', 'SubResourceReadOnly', 'OperationStatusResponse', 'ResourceUpdate', @@ -338,9 +347,9 @@ 'SnapshotUpdate', 'AvailabilitySetPaged', 'VirtualMachineSizePaged', + 'VirtualMachinePaged', 'UsagePaged', 'ImagePaged', - 'VirtualMachinePaged', 'VirtualMachineScaleSetPaged', 'VirtualMachineScaleSetSkuPaged', 'VirtualMachineScaleSetVMPaged', diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/update_resource.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/update_resource.py new file mode 100644 index 000000000000..b1d2898ff082 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/update_resource.py @@ -0,0 +1,28 @@ +# 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 UpdateResource(Model): + """The Update Resource model definition. + + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(UpdateResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/update_resource_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/update_resource_py3.py new file mode 100644 index 000000000000..c06c17c124d9 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/update_resource_py3.py @@ -0,0 +1,28 @@ +# 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 UpdateResource(Model): + """The Update Resource model definition. + + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(UpdateResource, self).__init__(**kwargs) + self.tags = tags diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/virtual_machine_extension_update.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/virtual_machine_extension_update.py new file mode 100644 index 000000000000..b920ff57ff96 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/virtual_machine_extension_update.py @@ -0,0 +1,62 @@ +# 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 .update_resource import UpdateResource + + +class VirtualMachineExtensionUpdate(UpdateResource): + """Describes a Virtual Machine Extension. + + :param tags: Resource tags + :type tags: dict[str, str] + :param force_update_tag: How the extension handler should be forced to + update even if the extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param auto_upgrade_minor_version: Indicates whether the extension should + use a newer minor version if one is available at deployment time. Once + deployed, however, the extension will not upgrade minor versions unless + redeployed, even with this property set to true. + :type auto_upgrade_minor_version: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either + protectedSettings or protectedSettingsFromKeyVault or no protected + settings at all. + :type protected_settings: object + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'type': {'key': 'properties.type', 'type': 'str'}, + 'type_handler_version': {'key': 'properties.typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(VirtualMachineExtensionUpdate, self).__init__(**kwargs) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.publisher = kwargs.get('publisher', None) + self.type = kwargs.get('type', None) + self.type_handler_version = kwargs.get('type_handler_version', None) + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) + self.settings = kwargs.get('settings', None) + self.protected_settings = kwargs.get('protected_settings', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/virtual_machine_extension_update_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/virtual_machine_extension_update_py3.py new file mode 100644 index 000000000000..a5b8ea8c1104 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/virtual_machine_extension_update_py3.py @@ -0,0 +1,62 @@ +# 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 .update_resource import UpdateResource + + +class VirtualMachineExtensionUpdate(UpdateResource): + """Describes a Virtual Machine Extension. + + :param tags: Resource tags + :type tags: dict[str, str] + :param force_update_tag: How the extension handler should be forced to + update even if the extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param auto_upgrade_minor_version: Indicates whether the extension should + use a newer minor version if one is available at deployment time. Once + deployed, however, the extension will not upgrade minor versions unless + redeployed, even with this property set to true. + :type auto_upgrade_minor_version: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either + protectedSettings or protectedSettingsFromKeyVault or no protected + settings at all. + :type protected_settings: object + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'type': {'key': 'properties.type', 'type': 'str'}, + 'type_handler_version': {'key': 'properties.typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + } + + def __init__(self, *, tags=None, force_update_tag: str=None, publisher: str=None, type: str=None, type_handler_version: str=None, auto_upgrade_minor_version: bool=None, settings=None, protected_settings=None, **kwargs) -> None: + super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) + self.force_update_tag = force_update_tag + self.publisher = publisher + self.type = type + self.type_handler_version = type_handler_version + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.settings = settings + self.protected_settings = protected_settings diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/virtual_machine_extensions_list_result.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/virtual_machine_extensions_list_result.py new file mode 100644 index 000000000000..97b7cf6a1608 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/virtual_machine_extensions_list_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 VirtualMachineExtensionsListResult(Model): + """The List Extension operation response. + + :param value: The list of extensions + :type value: + list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineExtension]'}, + } + + def __init__(self, **kwargs): + super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/virtual_machine_extensions_list_result_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/virtual_machine_extensions_list_result_py3.py new file mode 100644 index 000000000000..7a9843f2a6d9 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/virtual_machine_extensions_list_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 VirtualMachineExtensionsListResult(Model): + """The List Extension operation response. + + :param value: The list of extensions + :type value: + list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineExtension]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) + self.value = value diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/__init__.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/__init__.py index f3495bf4b08c..05d03de6591c 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/__init__.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/__init__.py @@ -12,11 +12,11 @@ from .availability_sets_operations import AvailabilitySetsOperations from .virtual_machine_extension_images_operations import VirtualMachineExtensionImagesOperations from .virtual_machine_extensions_operations import VirtualMachineExtensionsOperations +from .virtual_machines_operations import VirtualMachinesOperations from .virtual_machine_images_operations import VirtualMachineImagesOperations from .usage_operations import UsageOperations from .virtual_machine_sizes_operations import VirtualMachineSizesOperations from .images_operations import ImagesOperations -from .virtual_machines_operations import VirtualMachinesOperations from .virtual_machine_scale_sets_operations import VirtualMachineScaleSetsOperations from .virtual_machine_scale_set_vms_operations import VirtualMachineScaleSetVMsOperations from .disks_operations import DisksOperations @@ -26,11 +26,11 @@ 'AvailabilitySetsOperations', 'VirtualMachineExtensionImagesOperations', 'VirtualMachineExtensionsOperations', + 'VirtualMachinesOperations', 'VirtualMachineImagesOperations', 'UsageOperations', 'VirtualMachineSizesOperations', 'ImagesOperations', - 'VirtualMachinesOperations', 'VirtualMachineScaleSetsOperations', 'VirtualMachineScaleSetVMsOperations', 'DisksOperations', diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/virtual_machine_extensions_operations.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/virtual_machine_extensions_operations.py index 69098285f870..cabc0592473e 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/virtual_machine_extensions_operations.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/virtual_machine_extensions_operations.py @@ -99,7 +99,7 @@ def create_or_update( :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 extension - should be create or updated. + should be created or updated. :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. :type vm_extension_name: str @@ -149,6 +149,113 @@ def get_long_running_output(response): create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} + def _update_initial( + self, resource_group_name, vm_name, vm_extension_name, extension_parameters, 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'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_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(extension_parameters, 'VirtualMachineExtensionUpdate') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('VirtualMachineExtension', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, vm_name, vm_extension_name, extension_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """The operation to update the extension. + + :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 extension + should be updated. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual + Machine Extension operation. + :type extension_parameters: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtensionUpdate + :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 VirtualMachineExtension + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('VirtualMachineExtension', 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}/extensions/{vmExtensionName}'} + + def _delete_initial( self, resource_group_name, vm_name, vm_extension_name, custom_headers=None, raw=False, **operation_config): # Construct URL diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/virtual_machines_operations.py b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/virtual_machines_operations.py index 6abfbaf986c2..953129d99d88 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/virtual_machines_operations.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/virtual_machines_operations.py @@ -39,6 +39,75 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def get_extensions( + self, resource_group_name, vm_name, expand=None, custom_headers=None, raw=False, **operation_config): + """The operation to get all extensions 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 + extension. + :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: VirtualMachineExtensionsListResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtensionsListResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_extensions.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') + + # 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('VirtualMachineExtensionsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} + def _capture_initial( self, resource_group_name, vm_name, parameters, custom_headers=None, raw=False, **operation_config): diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/compute_management_client.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/compute_management_client.py index 51dbac3ec305..1b2633721f7e 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/compute_management_client.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/compute_management_client.py @@ -16,12 +16,12 @@ from .operations.availability_sets_operations import AvailabilitySetsOperations from .operations.virtual_machine_extension_images_operations import VirtualMachineExtensionImagesOperations from .operations.virtual_machine_extensions_operations import VirtualMachineExtensionsOperations +from .operations.virtual_machines_operations import VirtualMachinesOperations from .operations.virtual_machine_images_operations import VirtualMachineImagesOperations from .operations.usage_operations import UsageOperations from .operations.virtual_machine_sizes_operations import VirtualMachineSizesOperations from .operations.images_operations import ImagesOperations from .operations.resource_skus_operations import ResourceSkusOperations -from .operations.virtual_machines_operations import VirtualMachinesOperations from .operations.virtual_machine_scale_sets_operations import VirtualMachineScaleSetsOperations from .operations.virtual_machine_scale_set_extensions_operations import VirtualMachineScaleSetExtensionsOperations from .operations.virtual_machine_scale_set_rolling_upgrades_operations import VirtualMachineScaleSetRollingUpgradesOperations @@ -78,6 +78,8 @@ class ComputeManagementClient(object): :vartype virtual_machine_extension_images: azure.mgmt.compute.v2017_03_30.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensions operations :vartype virtual_machine_extensions: azure.mgmt.compute.v2017_03_30.operations.VirtualMachineExtensionsOperations + :ivar virtual_machines: VirtualMachines operations + :vartype virtual_machines: azure.mgmt.compute.v2017_03_30.operations.VirtualMachinesOperations :ivar virtual_machine_images: VirtualMachineImages operations :vartype virtual_machine_images: azure.mgmt.compute.v2017_03_30.operations.VirtualMachineImagesOperations :ivar usage: Usage operations @@ -88,8 +90,6 @@ class ComputeManagementClient(object): :vartype images: azure.mgmt.compute.v2017_03_30.operations.ImagesOperations :ivar resource_skus: ResourceSkus operations :vartype resource_skus: azure.mgmt.compute.v2017_03_30.operations.ResourceSkusOperations - :ivar virtual_machines: VirtualMachines operations - :vartype virtual_machines: azure.mgmt.compute.v2017_03_30.operations.VirtualMachinesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSets operations :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2017_03_30.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensions operations @@ -132,6 +132,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_extensions = VirtualMachineExtensionsOperations( self._client, self.config, self._serialize, self._deserialize) + self.virtual_machines = VirtualMachinesOperations( + self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_images = VirtualMachineImagesOperations( self._client, self.config, self._serialize, self._deserialize) self.usage = UsageOperations( @@ -142,8 +144,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.resource_skus = ResourceSkusOperations( self._client, self.config, self._serialize, self._deserialize) - self.virtual_machines = VirtualMachinesOperations( - self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_scale_set_extensions = VirtualMachineScaleSetExtensionsOperations( diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/__init__.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/__init__.py index 0fd5d783f72f..a0c09b6b7dd5 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/__init__.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/__init__.py @@ -19,6 +19,8 @@ from .virtual_machine_image_resource_py3 import VirtualMachineImageResource from .virtual_machine_extension_instance_view_py3 import VirtualMachineExtensionInstanceView from .virtual_machine_extension_py3 import VirtualMachineExtension + from .virtual_machine_extension_update_py3 import VirtualMachineExtensionUpdate + from .virtual_machine_extensions_list_result_py3 import VirtualMachineExtensionsListResult from .purchase_plan_py3 import PurchasePlan from .os_disk_image_py3 import OSDiskImage from .data_disk_image_py3 import DataDiskImage @@ -149,6 +151,8 @@ from .virtual_machine_image_resource import VirtualMachineImageResource from .virtual_machine_extension_instance_view import VirtualMachineExtensionInstanceView from .virtual_machine_extension import VirtualMachineExtension + from .virtual_machine_extension_update import VirtualMachineExtensionUpdate + from .virtual_machine_extensions_list_result import VirtualMachineExtensionsListResult from .purchase_plan import PurchasePlan from .os_disk_image import OSDiskImage from .data_disk_image import DataDiskImage @@ -271,10 +275,10 @@ from .run_command_result import RunCommandResult from .availability_set_paged import AvailabilitySetPaged from .virtual_machine_size_paged import VirtualMachineSizePaged +from .virtual_machine_paged import VirtualMachinePaged from .usage_paged import UsagePaged from .image_paged import ImagePaged from .resource_sku_paged import ResourceSkuPaged -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_extension_paged import VirtualMachineScaleSetExtensionPaged @@ -319,6 +323,8 @@ 'VirtualMachineImageResource', 'VirtualMachineExtensionInstanceView', 'VirtualMachineExtension', + 'VirtualMachineExtensionUpdate', + 'VirtualMachineExtensionsListResult', 'PurchasePlan', 'OSDiskImage', 'DataDiskImage', @@ -441,10 +447,10 @@ 'RunCommandResult', 'AvailabilitySetPaged', 'VirtualMachineSizePaged', + 'VirtualMachinePaged', 'UsagePaged', 'ImagePaged', 'ResourceSkuPaged', - 'VirtualMachinePaged', 'VirtualMachineScaleSetPaged', 'VirtualMachineScaleSetSkuPaged', 'VirtualMachineScaleSetExtensionPaged', diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_extension_update.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_extension_update.py new file mode 100644 index 000000000000..b920ff57ff96 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_extension_update.py @@ -0,0 +1,62 @@ +# 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 .update_resource import UpdateResource + + +class VirtualMachineExtensionUpdate(UpdateResource): + """Describes a Virtual Machine Extension. + + :param tags: Resource tags + :type tags: dict[str, str] + :param force_update_tag: How the extension handler should be forced to + update even if the extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param auto_upgrade_minor_version: Indicates whether the extension should + use a newer minor version if one is available at deployment time. Once + deployed, however, the extension will not upgrade minor versions unless + redeployed, even with this property set to true. + :type auto_upgrade_minor_version: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either + protectedSettings or protectedSettingsFromKeyVault or no protected + settings at all. + :type protected_settings: object + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'type': {'key': 'properties.type', 'type': 'str'}, + 'type_handler_version': {'key': 'properties.typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(VirtualMachineExtensionUpdate, self).__init__(**kwargs) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.publisher = kwargs.get('publisher', None) + self.type = kwargs.get('type', None) + self.type_handler_version = kwargs.get('type_handler_version', None) + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) + self.settings = kwargs.get('settings', None) + self.protected_settings = kwargs.get('protected_settings', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_extension_update_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_extension_update_py3.py new file mode 100644 index 000000000000..a5b8ea8c1104 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_extension_update_py3.py @@ -0,0 +1,62 @@ +# 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 .update_resource import UpdateResource + + +class VirtualMachineExtensionUpdate(UpdateResource): + """Describes a Virtual Machine Extension. + + :param tags: Resource tags + :type tags: dict[str, str] + :param force_update_tag: How the extension handler should be forced to + update even if the extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param auto_upgrade_minor_version: Indicates whether the extension should + use a newer minor version if one is available at deployment time. Once + deployed, however, the extension will not upgrade minor versions unless + redeployed, even with this property set to true. + :type auto_upgrade_minor_version: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either + protectedSettings or protectedSettingsFromKeyVault or no protected + settings at all. + :type protected_settings: object + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'type': {'key': 'properties.type', 'type': 'str'}, + 'type_handler_version': {'key': 'properties.typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + } + + def __init__(self, *, tags=None, force_update_tag: str=None, publisher: str=None, type: str=None, type_handler_version: str=None, auto_upgrade_minor_version: bool=None, settings=None, protected_settings=None, **kwargs) -> None: + super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) + self.force_update_tag = force_update_tag + self.publisher = publisher + self.type = type + self.type_handler_version = type_handler_version + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.settings = settings + self.protected_settings = protected_settings diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_extensions_list_result.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_extensions_list_result.py new file mode 100644 index 000000000000..b9ec6933233e --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_extensions_list_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 VirtualMachineExtensionsListResult(Model): + """The List Extension operation response. + + :param value: The list of extensions + :type value: + list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineExtension]'}, + } + + def __init__(self, **kwargs): + super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_extensions_list_result_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_extensions_list_result_py3.py new file mode 100644 index 000000000000..86e0ae2c7f2b --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_extensions_list_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 VirtualMachineExtensionsListResult(Model): + """The List Extension operation response. + + :param value: The list of extensions + :type value: + list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineExtension]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) + self.value = value diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/__init__.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/__init__.py index 6c02c3638094..87785cc27927 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/__init__.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/__init__.py @@ -12,12 +12,12 @@ from .availability_sets_operations import AvailabilitySetsOperations from .virtual_machine_extension_images_operations import VirtualMachineExtensionImagesOperations from .virtual_machine_extensions_operations import VirtualMachineExtensionsOperations +from .virtual_machines_operations import VirtualMachinesOperations from .virtual_machine_images_operations import VirtualMachineImagesOperations from .usage_operations import UsageOperations from .virtual_machine_sizes_operations import VirtualMachineSizesOperations from .images_operations import ImagesOperations from .resource_skus_operations import ResourceSkusOperations -from .virtual_machines_operations import VirtualMachinesOperations from .virtual_machine_scale_sets_operations import VirtualMachineScaleSetsOperations from .virtual_machine_scale_set_extensions_operations import VirtualMachineScaleSetExtensionsOperations from .virtual_machine_scale_set_rolling_upgrades_operations import VirtualMachineScaleSetRollingUpgradesOperations @@ -30,12 +30,12 @@ 'AvailabilitySetsOperations', 'VirtualMachineExtensionImagesOperations', 'VirtualMachineExtensionsOperations', + 'VirtualMachinesOperations', 'VirtualMachineImagesOperations', 'UsageOperations', 'VirtualMachineSizesOperations', 'ImagesOperations', 'ResourceSkusOperations', - 'VirtualMachinesOperations', 'VirtualMachineScaleSetsOperations', 'VirtualMachineScaleSetExtensionsOperations', 'VirtualMachineScaleSetRollingUpgradesOperations', diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/virtual_machine_extensions_operations.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/virtual_machine_extensions_operations.py index f688392c7ed1..993c0890df6a 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/virtual_machine_extensions_operations.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/virtual_machine_extensions_operations.py @@ -99,7 +99,7 @@ def create_or_update( :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 extension - should be create or updated. + should be created or updated. :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. :type vm_extension_name: str @@ -149,6 +149,113 @@ def get_long_running_output(response): create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} + def _update_initial( + self, resource_group_name, vm_name, vm_extension_name, extension_parameters, 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'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_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(extension_parameters, 'VirtualMachineExtensionUpdate') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('VirtualMachineExtension', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, vm_name, vm_extension_name, extension_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """The operation to update the extension. + + :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 extension + should be updated. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual + Machine Extension operation. + :type extension_parameters: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtensionUpdate + :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 VirtualMachineExtension + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('VirtualMachineExtension', 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}/extensions/{vmExtensionName}'} + + def _delete_initial( self, resource_group_name, vm_name, vm_extension_name, custom_headers=None, raw=False, **operation_config): # Construct URL diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/virtual_machines_operations.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/virtual_machines_operations.py index a223a0cae1fc..c64c6385fcfb 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/virtual_machines_operations.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/virtual_machines_operations.py @@ -39,6 +39,75 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def get_extensions( + self, resource_group_name, vm_name, expand=None, custom_headers=None, raw=False, **operation_config): + """The operation to get all extensions 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 + extension. + :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: VirtualMachineExtensionsListResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtensionsListResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_extensions.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') + + # 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('VirtualMachineExtensionsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} + def _capture_initial( self, resource_group_name, vm_name, parameters, custom_headers=None, raw=False, **operation_config): diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/compute_management_client.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/compute_management_client.py index 2666801ff54a..3fcf22e996e6 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/compute_management_client.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/compute_management_client.py @@ -17,11 +17,11 @@ from .operations.availability_sets_operations import AvailabilitySetsOperations from .operations.virtual_machine_extension_images_operations import VirtualMachineExtensionImagesOperations from .operations.virtual_machine_extensions_operations import VirtualMachineExtensionsOperations +from .operations.virtual_machines_operations import VirtualMachinesOperations from .operations.virtual_machine_images_operations import VirtualMachineImagesOperations from .operations.usage_operations import UsageOperations from .operations.virtual_machine_sizes_operations import VirtualMachineSizesOperations from .operations.images_operations import ImagesOperations -from .operations.virtual_machines_operations import VirtualMachinesOperations from .operations.virtual_machine_scale_sets_operations import VirtualMachineScaleSetsOperations from .operations.virtual_machine_scale_set_extensions_operations import VirtualMachineScaleSetExtensionsOperations from .operations.virtual_machine_scale_set_rolling_upgrades_operations import VirtualMachineScaleSetRollingUpgradesOperations @@ -79,6 +79,8 @@ class ComputeManagementClient(object): :vartype virtual_machine_extension_images: azure.mgmt.compute.v2017_12_01.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensions operations :vartype virtual_machine_extensions: azure.mgmt.compute.v2017_12_01.operations.VirtualMachineExtensionsOperations + :ivar virtual_machines: VirtualMachines operations + :vartype virtual_machines: azure.mgmt.compute.v2017_12_01.operations.VirtualMachinesOperations :ivar virtual_machine_images: VirtualMachineImages operations :vartype virtual_machine_images: azure.mgmt.compute.v2017_12_01.operations.VirtualMachineImagesOperations :ivar usage: Usage operations @@ -87,8 +89,6 @@ class ComputeManagementClient(object): :vartype virtual_machine_sizes: azure.mgmt.compute.v2017_12_01.operations.VirtualMachineSizesOperations :ivar images: Images operations :vartype images: azure.mgmt.compute.v2017_12_01.operations.ImagesOperations - :ivar virtual_machines: VirtualMachines operations - :vartype virtual_machines: azure.mgmt.compute.v2017_12_01.operations.VirtualMachinesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSets operations :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2017_12_01.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensions operations @@ -131,6 +131,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_extensions = VirtualMachineExtensionsOperations( self._client, self.config, self._serialize, self._deserialize) + self.virtual_machines = VirtualMachinesOperations( + self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_images = VirtualMachineImagesOperations( self._client, self.config, self._serialize, self._deserialize) self.usage = UsageOperations( @@ -139,8 +141,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.images = ImagesOperations( self._client, self.config, self._serialize, self._deserialize) - self.virtual_machines = VirtualMachinesOperations( - self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_scale_set_extensions = VirtualMachineScaleSetExtensionsOperations( 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..3b737d879dc9 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 @@ -21,6 +21,8 @@ from .virtual_machine_image_resource_py3 import VirtualMachineImageResource from .virtual_machine_extension_instance_view_py3 import VirtualMachineExtensionInstanceView from .virtual_machine_extension_py3 import VirtualMachineExtension + from .virtual_machine_extension_update_py3 import VirtualMachineExtensionUpdate + from .virtual_machine_extensions_list_result_py3 import VirtualMachineExtensionsListResult from .purchase_plan_py3 import PurchasePlan from .os_disk_image_py3 import OSDiskImage from .data_disk_image_py3 import DataDiskImage @@ -142,6 +144,8 @@ from .virtual_machine_image_resource import VirtualMachineImageResource from .virtual_machine_extension_instance_view import VirtualMachineExtensionInstanceView from .virtual_machine_extension import VirtualMachineExtension + from .virtual_machine_extension_update import VirtualMachineExtensionUpdate + from .virtual_machine_extensions_list_result import VirtualMachineExtensionsListResult from .purchase_plan import PurchasePlan from .os_disk_image import OSDiskImage from .data_disk_image import DataDiskImage @@ -254,9 +258,9 @@ from .compute_operation_value_paged import ComputeOperationValuePaged from .availability_set_paged import AvailabilitySetPaged from .virtual_machine_size_paged import VirtualMachineSizePaged +from .virtual_machine_paged import VirtualMachinePaged from .usage_paged import UsagePaged from .image_paged import ImagePaged -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_extension_paged import VirtualMachineScaleSetExtensionPaged @@ -298,6 +302,8 @@ 'VirtualMachineImageResource', 'VirtualMachineExtensionInstanceView', 'VirtualMachineExtension', + 'VirtualMachineExtensionUpdate', + 'VirtualMachineExtensionsListResult', 'PurchasePlan', 'OSDiskImage', 'DataDiskImage', @@ -410,9 +416,9 @@ 'ComputeOperationValuePaged', 'AvailabilitySetPaged', 'VirtualMachineSizePaged', + 'VirtualMachinePaged', 'UsagePaged', 'ImagePaged', - 'VirtualMachinePaged', 'VirtualMachineScaleSetPaged', 'VirtualMachineScaleSetSkuPaged', 'VirtualMachineScaleSetExtensionPaged', diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_extension_update.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_extension_update.py new file mode 100644 index 000000000000..b920ff57ff96 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_extension_update.py @@ -0,0 +1,62 @@ +# 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 .update_resource import UpdateResource + + +class VirtualMachineExtensionUpdate(UpdateResource): + """Describes a Virtual Machine Extension. + + :param tags: Resource tags + :type tags: dict[str, str] + :param force_update_tag: How the extension handler should be forced to + update even if the extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param auto_upgrade_minor_version: Indicates whether the extension should + use a newer minor version if one is available at deployment time. Once + deployed, however, the extension will not upgrade minor versions unless + redeployed, even with this property set to true. + :type auto_upgrade_minor_version: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either + protectedSettings or protectedSettingsFromKeyVault or no protected + settings at all. + :type protected_settings: object + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'type': {'key': 'properties.type', 'type': 'str'}, + 'type_handler_version': {'key': 'properties.typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(VirtualMachineExtensionUpdate, self).__init__(**kwargs) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.publisher = kwargs.get('publisher', None) + self.type = kwargs.get('type', None) + self.type_handler_version = kwargs.get('type_handler_version', None) + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) + self.settings = kwargs.get('settings', None) + self.protected_settings = kwargs.get('protected_settings', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_extension_update_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_extension_update_py3.py new file mode 100644 index 000000000000..a5b8ea8c1104 --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_extension_update_py3.py @@ -0,0 +1,62 @@ +# 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 .update_resource import UpdateResource + + +class VirtualMachineExtensionUpdate(UpdateResource): + """Describes a Virtual Machine Extension. + + :param tags: Resource tags + :type tags: dict[str, str] + :param force_update_tag: How the extension handler should be forced to + update even if the extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param auto_upgrade_minor_version: Indicates whether the extension should + use a newer minor version if one is available at deployment time. Once + deployed, however, the extension will not upgrade minor versions unless + redeployed, even with this property set to true. + :type auto_upgrade_minor_version: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either + protectedSettings or protectedSettingsFromKeyVault or no protected + settings at all. + :type protected_settings: object + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'type': {'key': 'properties.type', 'type': 'str'}, + 'type_handler_version': {'key': 'properties.typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + } + + def __init__(self, *, tags=None, force_update_tag: str=None, publisher: str=None, type: str=None, type_handler_version: str=None, auto_upgrade_minor_version: bool=None, settings=None, protected_settings=None, **kwargs) -> None: + super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) + self.force_update_tag = force_update_tag + self.publisher = publisher + self.type = type + self.type_handler_version = type_handler_version + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.settings = settings + self.protected_settings = protected_settings diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_extensions_list_result.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_extensions_list_result.py new file mode 100644 index 000000000000..ad25f11d0b5f --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_extensions_list_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 VirtualMachineExtensionsListResult(Model): + """The List Extension operation response. + + :param value: The list of extensions + :type value: + list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineExtension]'}, + } + + def __init__(self, **kwargs): + super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_extensions_list_result_py3.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_extensions_list_result_py3.py new file mode 100644 index 000000000000..39ba9f1e381e --- /dev/null +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_extensions_list_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 VirtualMachineExtensionsListResult(Model): + """The List Extension operation response. + + :param value: The list of extensions + :type value: + list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineExtension]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) + self.value = value diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/__init__.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/__init__.py index bd63cedf0141..2189f2aae9a9 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/__init__.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/__init__.py @@ -13,11 +13,11 @@ from .availability_sets_operations import AvailabilitySetsOperations from .virtual_machine_extension_images_operations import VirtualMachineExtensionImagesOperations from .virtual_machine_extensions_operations import VirtualMachineExtensionsOperations +from .virtual_machines_operations import VirtualMachinesOperations from .virtual_machine_images_operations import VirtualMachineImagesOperations from .usage_operations import UsageOperations from .virtual_machine_sizes_operations import VirtualMachineSizesOperations from .images_operations import ImagesOperations -from .virtual_machines_operations import VirtualMachinesOperations from .virtual_machine_scale_sets_operations import VirtualMachineScaleSetsOperations from .virtual_machine_scale_set_extensions_operations import VirtualMachineScaleSetExtensionsOperations from .virtual_machine_scale_set_rolling_upgrades_operations import VirtualMachineScaleSetRollingUpgradesOperations @@ -30,11 +30,11 @@ 'AvailabilitySetsOperations', 'VirtualMachineExtensionImagesOperations', 'VirtualMachineExtensionsOperations', + 'VirtualMachinesOperations', 'VirtualMachineImagesOperations', 'UsageOperations', 'VirtualMachineSizesOperations', 'ImagesOperations', - 'VirtualMachinesOperations', 'VirtualMachineScaleSetsOperations', 'VirtualMachineScaleSetExtensionsOperations', 'VirtualMachineScaleSetRollingUpgradesOperations', diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/virtual_machine_extensions_operations.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/virtual_machine_extensions_operations.py index dce894b5633a..a888f594af2a 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/virtual_machine_extensions_operations.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/virtual_machine_extensions_operations.py @@ -99,7 +99,7 @@ def create_or_update( :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 extension - should be create or updated. + should be created or updated. :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. :type vm_extension_name: str @@ -149,6 +149,113 @@ def get_long_running_output(response): create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} + def _update_initial( + self, resource_group_name, vm_name, vm_extension_name, extension_parameters, 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'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_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(extension_parameters, 'VirtualMachineExtensionUpdate') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('VirtualMachineExtension', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, vm_name, vm_extension_name, extension_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """The operation to update the extension. + + :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 extension + should be updated. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual + Machine Extension operation. + :type extension_parameters: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtensionUpdate + :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 VirtualMachineExtension + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('VirtualMachineExtension', 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}/extensions/{vmExtensionName}'} + + def _delete_initial( self, resource_group_name, vm_name, vm_extension_name, custom_headers=None, raw=False, **operation_config): # Construct URL diff --git a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/virtual_machines_operations.py b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/virtual_machines_operations.py index bcb4e2034ef2..204714dad612 100644 --- a/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/virtual_machines_operations.py +++ b/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/virtual_machines_operations.py @@ -39,6 +39,75 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def get_extensions( + self, resource_group_name, vm_name, expand=None, custom_headers=None, raw=False, **operation_config): + """The operation to get all extensions 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 + extension. + :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: VirtualMachineExtensionsListResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtensionsListResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_extensions.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') + + # 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('VirtualMachineExtensionsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} + def _capture_initial( self, resource_group_name, vm_name, parameters, custom_headers=None, raw=False, **operation_config):