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 azure-mgmt-compute] Update grace period description to include maximum allowed grace peri… #769

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class AutomaticRepairsPolicy(Model):
state change has completed. This helps avoid premature or accidental
repairs. The time duration should be specified in ISO 8601 format. The
minimum allowed grace period is 30 minutes (PT30M), which is also the
default value.
default value. The maximum allowed grace period is 90 minutes (PT90M).
:type grace_period: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class AutomaticRepairsPolicy(Model):
state change has completed. This helps avoid premature or accidental
repairs. The time duration should be specified in ISO 8601 format. The
minimum allowed grace period is 30 minutes (PT30M), which is also the
default value.
default value. The maximum allowed grace period is 90 minutes (PT90M).
:type grace_period: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class AutomaticRepairsPolicy(Model):
state change has completed. This helps avoid premature or accidental
repairs. The time duration should be specified in ISO 8601 format. The
minimum allowed grace period is 30 minutes (PT30M), which is also the
default value.
default value. The maximum allowed grace period is 90 minutes (PT90M).
:type grace_period: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class AutomaticRepairsPolicy(Model):
state change has completed. This helps avoid premature or accidental
repairs. The time duration should be specified in ISO 8601 format. The
minimum allowed grace period is 30 minutes (PT30M), which is also the
default value.
default value. The maximum allowed grace period is 90 minutes (PT90M).
:type grace_period: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class AutomaticRepairsPolicy(Model):
state change has completed. This helps avoid premature or accidental
repairs. The time duration should be specified in ISO 8601 format. The
minimum allowed grace period is 30 minutes (PT30M), which is also the
default value.
default value. The maximum allowed grace period is 90 minutes (PT90M).
:type grace_period: str
"""

Expand Down Expand Up @@ -4054,7 +4054,7 @@ class OSProfile(Model):
customData property** <br><br> This property cannot be updated after the
VM is created. <br><br> customData is passed to the VM to be saved as a
file, for more information see [Custom Data on Azure
VMs](https://azure.microsoft.com/en-us/blog/custom-data-and-cloud-init-on-windows-azure/)
VMs](https://docs.microsoft.com/azure/virtual-machines/custom-data)
<br><br> For using cloud-init for your Linux VM, see [Using cloud-init to
customize a Linux VM during
creation](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class AutomaticRepairsPolicy(Model):
state change has completed. This helps avoid premature or accidental
repairs. The time duration should be specified in ISO 8601 format. The
minimum allowed grace period is 30 minutes (PT30M), which is also the
default value.
default value. The maximum allowed grace period is 90 minutes (PT90M).
:type grace_period: str
"""

Expand Down Expand Up @@ -4054,7 +4054,7 @@ class OSProfile(Model):
customData property** <br><br> This property cannot be updated after the
VM is created. <br><br> customData is passed to the VM to be saved as a
file, for more information see [Custom Data on Azure
VMs](https://azure.microsoft.com/en-us/blog/custom-data-and-cloud-init-on-windows-azure/)
VMs](https://docs.microsoft.com/azure/virtual-machines/custom-data)
<br><br> For using cloud-init for your Linux VM, see [Using cloud-init to
customize a Linux VM during
creation](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@
DiskCreateOptionTypes,
StorageAccountTypes,
DiffDiskOptions,
DiffDiskPlacement,
PassNames,
ComponentNames,
SettingNames,
Expand Down Expand Up @@ -693,6 +694,7 @@
'DiskCreateOptionTypes',
'StorageAccountTypes',
'DiffDiskOptions',
'DiffDiskPlacement',
'PassNames',
'ComponentNames',
'SettingNames',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ class DiffDiskOptions(str, Enum):
local = "Local"


class DiffDiskPlacement(str, Enum):

cache_disk = "CacheDisk"
resource_disk = "ResourceDisk"


class PassNames(str, Enum):

oobe_system = "OobeSystem"
Expand Down Expand Up @@ -333,6 +339,7 @@ class IPVersion(str, Enum):
class OrchestrationServiceNames(str, Enum):

automatic_repairs = "AutomaticRepairs"



class OrchestrationServiceState(str, Enum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class AutomaticRepairsPolicy(Model):
state change has completed. This helps avoid premature or accidental
repairs. The time duration should be specified in ISO 8601 format. The
minimum allowed grace period is 30 minutes (PT30M), which is also the
default value.
default value. The maximum allowed grace period is 90 minutes (PT90M).
:type grace_period: str
"""

Expand Down Expand Up @@ -1138,15 +1138,25 @@ class DiffDiskSettings(Model):
disk. Possible values include: 'Local'
:type option: str or
~azure.mgmt.compute.v2019_12_01.models.DiffDiskOptions
:param placement: Specifies the ephemeral disk placement for operating
system disk. This property is used to specify Cache disk or Resource disk
for ephemeral OS disk provisioning. By default if customer does not
specify this placement property in the request, the Ephemeral OS disk will
be provisioned using Cache disk. Possible values include: 'CacheDisk',
'ResourceDisk'
:type placement: str or
~azure.mgmt.compute.v2019_12_01.models.DiffDiskPlacement
"""

_attribute_map = {
'option': {'key': 'option', 'type': 'str'},
'placement': {'key': 'placement', 'type': 'str'},
}

def __init__(self, **kwargs):
super(DiffDiskSettings, self).__init__(**kwargs)
self.option = kwargs.get('option', None)
self.placement = kwargs.get('placement', None)


class Disallowed(Model):
Expand Down Expand Up @@ -3294,22 +3304,20 @@ def __init__(self, **kwargs):
class OrchestrationServiceStateInput(Model):
"""The input for OrchestrationServiceState.

Variables are only populated by the server, and will be ignored when
sending a request.

All required parameters must be populated in order to send to Azure.

:ivar service_name: Required. The name of the service. Default value:
"AutomaticRepairs" .
:vartype service_name: str
:param service_name: Required. The name of the service. Possible values
include: 'AutomaticRepairs'
:type service_name: str or
~azure.mgmt.compute.v2019_12_01.models.OrchestrationServiceNames
:param action: Required. The action to be performed. Possible values
include: 'Resume', 'Suspend'
:type action: str or
~azure.mgmt.compute.v2019_12_01.models.OrchestrationServiceStateAction
"""

_validation = {
'service_name': {'required': True, 'constant': True},
'service_name': {'required': True},
'action': {'required': True},
}

Expand All @@ -3318,10 +3326,9 @@ class OrchestrationServiceStateInput(Model):
'action': {'key': 'action', 'type': 'str'},
}

service_name = "AutomaticRepairs"

def __init__(self, **kwargs):
super(OrchestrationServiceStateInput, self).__init__(**kwargs)
self.service_name = kwargs.get('service_name', None)
self.action = kwargs.get('action', None)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class AutomaticRepairsPolicy(Model):
state change has completed. This helps avoid premature or accidental
repairs. The time duration should be specified in ISO 8601 format. The
minimum allowed grace period is 30 minutes (PT30M), which is also the
default value.
default value. The maximum allowed grace period is 90 minutes (PT90M).
:type grace_period: str
"""

Expand Down Expand Up @@ -1138,15 +1138,25 @@ class DiffDiskSettings(Model):
disk. Possible values include: 'Local'
:type option: str or
~azure.mgmt.compute.v2019_12_01.models.DiffDiskOptions
:param placement: Specifies the ephemeral disk placement for operating
system disk. This property is used to specify Cache disk or Resource disk
for ephemeral OS disk provisioning. By default if customer does not
specify this placement property in the request, the Ephemeral OS disk will
be provisioned using Cache disk. Possible values include: 'CacheDisk',
'ResourceDisk'
:type placement: str or
~azure.mgmt.compute.v2019_12_01.models.DiffDiskPlacement
"""

_attribute_map = {
'option': {'key': 'option', 'type': 'str'},
'placement': {'key': 'placement', 'type': 'str'},
}

def __init__(self, *, option=None, **kwargs) -> None:
def __init__(self, *, option=None, placement=None, **kwargs) -> None:
super(DiffDiskSettings, self).__init__(**kwargs)
self.option = option
self.placement = placement


class Disallowed(Model):
Expand Down Expand Up @@ -3294,22 +3304,20 @@ def __init__(self, *, network_interfaces=None, **kwargs) -> None:
class OrchestrationServiceStateInput(Model):
"""The input for OrchestrationServiceState.

Variables are only populated by the server, and will be ignored when
sending a request.

All required parameters must be populated in order to send to Azure.

:ivar service_name: Required. The name of the service. Default value:
"AutomaticRepairs" .
:vartype service_name: str
:param service_name: Required. The name of the service. Possible values
include: 'AutomaticRepairs'
:type service_name: str or
~azure.mgmt.compute.v2019_12_01.models.OrchestrationServiceNames
:param action: Required. The action to be performed. Possible values
include: 'Resume', 'Suspend'
:type action: str or
~azure.mgmt.compute.v2019_12_01.models.OrchestrationServiceStateAction
"""

_validation = {
'service_name': {'required': True, 'constant': True},
'service_name': {'required': True},
'action': {'required': True},
}

Expand All @@ -3318,10 +3326,9 @@ class OrchestrationServiceStateInput(Model):
'action': {'key': 'action', 'type': 'str'},
}

service_name = "AutomaticRepairs"

def __init__(self, *, action, **kwargs) -> None:
def __init__(self, *, service_name, action, **kwargs) -> None:
super(OrchestrationServiceStateInput, self).__init__(**kwargs)
self.service_name = service_name
self.action = action


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1840,8 +1840,8 @@ def convert_to_single_placement_group(


def _set_orchestration_service_state_initial(
self, resource_group_name, vm_scale_set_name, action, custom_headers=None, raw=False, **operation_config):
parameters = models.OrchestrationServiceStateInput(action=action)
self, resource_group_name, vm_scale_set_name, service_name, action, custom_headers=None, raw=False, **operation_config):
parameters = models.OrchestrationServiceStateInput(service_name=service_name, action=action)

# Construct URL
url = self.set_orchestration_service_state.metadata['url']
Expand Down Expand Up @@ -1883,14 +1883,18 @@ def _set_orchestration_service_state_initial(
return client_raw_response

def set_orchestration_service_state(
self, resource_group_name, vm_scale_set_name, action, custom_headers=None, raw=False, polling=True, **operation_config):
self, resource_group_name, vm_scale_set_name, service_name, action, custom_headers=None, raw=False, polling=True, **operation_config):
"""Changes ServiceState property for a given service.

:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param vm_scale_set_name: The name of the virtual machine scale set to
create or update.
:type vm_scale_set_name: str
:param service_name: The name of the service. Possible values include:
'AutomaticRepairs'
:type service_name: str or
~azure.mgmt.compute.v2019_12_01.models.OrchestrationServiceNames
:param action: The action to be performed. Possible values include:
'Resume', 'Suspend'
:type action: str or
Expand All @@ -1909,6 +1913,7 @@ def set_orchestration_service_state(
raw_result = self._set_orchestration_service_state_initial(
resource_group_name=resource_group_name,
vm_scale_set_name=vm_scale_set_name,
service_name=service_name,
action=action,
custom_headers=custom_headers,
raw=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1654,6 +1654,85 @@ def get_long_running_output(response):
perform_maintenance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'}


def _simulate_eviction_initial(
self, resource_group_name, vm_name, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.simulate_eviction.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'vmName': self._serialize.url("vm_name", vm_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

# Construct headers
header_parameters = {}
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.post(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [204]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp

if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response

def simulate_eviction(
self, resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config):
"""The operation to simulate the eviction of spot 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.
:type vm_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: The poller return type is ClientRawResponse, the
direct response alongside the deserialized response
:param polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:return: An instance of LROPoller that returns None or
ClientRawResponse<None> if raw==True
:rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or
~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
raw_result = self._simulate_eviction_initial(
resource_group_name=resource_group_name,
vm_name=vm_name,
custom_headers=custom_headers,
raw=True,
**operation_config
)

def get_long_running_output(response):
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response

lro_delay = operation_config.get(
'long_running_operation_timeout',
self.config.long_running_operation_timeout)
if polling is True: polling_method = ARMPolling(lro_delay, **operation_config)
elif polling is False: polling_method = NoPolling()
else: polling_method = polling
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
simulate_eviction.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/SimulateEviction'}


def _run_command_initial(
self, resource_group_name, vm_name, parameters, custom_headers=None, raw=False, **operation_config):
# Construct URL
Expand Down