Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR] compute/resource-manager #2276

Merged
merged 8 commits into from
Apr 17, 2018
12 changes: 10 additions & 2 deletions azure-mgmt-compute/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@
Release History
===============

XXXXXXXXXXXX
++++++++++++
4.0.0rc2 (2018-04-17)
+++++++++++++++++++++

**Features**

- All clients now support Azure profiles.
- Add update operation to VirtualMachineExtension operations (all ApiVersions)
- Add get_extensions operation to VirtualMachine operations (all ApiVersions)
- Support eviction policy for virtual machines inside a low priority scale set (2017-12-01)
- Add get_os_upgrade_history to VMSS operations (2017-12-01)

**Bugfixes**

- Compatibility of the sdist with wheel 0.31.0
- Fix some invalid models in Python 3 (introduced in 4.0.0rc1)

4.0.0rc1 (2018-03-21)
+++++++++++++++++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -192,6 +196,7 @@
'VirtualMachineImageResource',
'VirtualMachineExtensionInstanceView',
'VirtualMachineExtension',
'VirtualMachineExtensionUpdate',
'PurchasePlan',
'OSDiskImage',
'DataDiskImage',
Expand Down Expand Up @@ -258,6 +263,7 @@
'ApiError',
'ComputeLongRunningOperationProperties',
'Resource',
'UpdateResource',
'OperationStatusResponse',
'AvailabilitySetPaged',
'VirtualMachineSizePaged',
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<VirtualMachineExtension> 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<msrestazure.azure_exceptions.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
Expand Down
Loading