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] New resource: Add InGuest resource type software to Compute #3457

Closed
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 @@ -98,6 +98,7 @@
from .update_resource_py3 import UpdateResource
from .sub_resource_read_only_py3 import SubResourceReadOnly
from .operation_status_response_py3 import OperationStatusResponse
from .in_guest_software_item_py3 import InGuestSoftwareItem
from .resource_update_py3 import ResourceUpdate
from .image_disk_reference_py3 import ImageDiskReference
from .creation_data_py3 import CreationData
Expand Down Expand Up @@ -200,6 +201,7 @@
from .update_resource import UpdateResource
from .sub_resource_read_only import SubResourceReadOnly
from .operation_status_response import OperationStatusResponse
from .in_guest_software_item import InGuestSoftwareItem
from .resource_update import ResourceUpdate
from .image_disk_reference import ImageDiskReference
from .creation_data import CreationData
Expand All @@ -216,6 +218,7 @@
from .availability_set_paged import AvailabilitySetPaged
from .virtual_machine_size_paged import VirtualMachineSizePaged
from .virtual_machine_paged import VirtualMachinePaged
from .in_guest_software_item_paged import InGuestSoftwareItemPaged
from .usage_paged import UsagePaged
from .image_paged import ImagePaged
from .virtual_machine_scale_set_paged import VirtualMachineScaleSetPaged
Expand Down Expand Up @@ -332,6 +335,7 @@
'UpdateResource',
'SubResourceReadOnly',
'OperationStatusResponse',
'InGuestSoftwareItem',
'ResourceUpdate',
'ImageDiskReference',
'CreationData',
Expand All @@ -348,6 +352,7 @@
'AvailabilitySetPaged',
'VirtualMachineSizePaged',
'VirtualMachinePaged',
'InGuestSoftwareItemPaged',
'UsagePaged',
'ImagePaged',
'VirtualMachineScaleSetPaged',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# 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 .resource import Resource


class InGuestSoftwareItem(Resource):
"""Describes a InGuest software item.

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 id: Resource Id
:vartype id: str
:ivar name: Resource name
:vartype name: str
:ivar type: Resource type
:vartype type: str
:param location: Required. Resource location
:type location: str
:param tags: Resource tags
:type tags: dict[str, str]
:ivar in_guest_software_item_name: Specifies the name of the software.
:vartype in_guest_software_item_name: str
:ivar version: Specifies the version of the software.
:vartype version: str
:ivar publisher: Specifies the publisher of the software.
:vartype publisher: str
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
'in_guest_software_item_name': {'readonly': True},
'version': {'readonly': True},
'publisher': {'readonly': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'in_guest_software_item_name': {'key': 'properties.name', 'type': 'str'},
'version': {'key': 'properties.version', 'type': 'str'},
'publisher': {'key': 'properties.publisher', 'type': 'str'},
}

def __init__(self, **kwargs):
super(InGuestSoftwareItem, self).__init__(**kwargs)
self.in_guest_software_item_name = None
self.version = None
self.publisher = None
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.paging import Paged


class InGuestSoftwareItemPaged(Paged):
"""
A paging container for iterating over a list of :class:`InGuestSoftwareItem <azure.mgmt.compute.v2016_04_30_preview.models.InGuestSoftwareItem>` object
"""

_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[InGuestSoftwareItem]'}
}

def __init__(self, *args, **kwargs):

super(InGuestSoftwareItemPaged, self).__init__(*args, **kwargs)
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# 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 .resource_py3 import Resource


class InGuestSoftwareItem(Resource):
"""Describes a InGuest software item.

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 id: Resource Id
:vartype id: str
:ivar name: Resource name
:vartype name: str
:ivar type: Resource type
:vartype type: str
:param location: Required. Resource location
:type location: str
:param tags: Resource tags
:type tags: dict[str, str]
:ivar in_guest_software_item_name: Specifies the name of the software.
:vartype in_guest_software_item_name: str
:ivar version: Specifies the version of the software.
:vartype version: str
:ivar publisher: Specifies the publisher of the software.
:vartype publisher: str
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
'in_guest_software_item_name': {'readonly': True},
'version': {'readonly': True},
'publisher': {'readonly': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'in_guest_software_item_name': {'key': 'properties.name', 'type': 'str'},
'version': {'key': 'properties.version', 'type': 'str'},
'publisher': {'key': 'properties.publisher', 'type': 'str'},
}

def __init__(self, *, location: str, tags=None, **kwargs) -> None:
super(InGuestSoftwareItem, self).__init__(location=location, tags=tags, **kwargs)
self.in_guest_software_item_name = None
self.version = None
self.publisher = None
Original file line number Diff line number Diff line change
Expand Up @@ -1310,3 +1310,142 @@ def get_long_running_output(response):
else: polling_method = polling
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
redeploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'}

def list_in_guest_software_items(
self, resource_group_name, vm_name, custom_headers=None, raw=False, **operation_config):
"""Lists all of the In-Guest software items of virtual machines in the
specified subscription. Use the nextLink property in the response to
get the next page of items.

: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: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: An iterator like instance of InGuestSoftwareItem
:rtype:
~azure.mgmt.compute.v2016_04_30_preview.models.InGuestSoftwareItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.InGuestSoftwareItem]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def internal_paging(next_link=None, raw=False):

if not next_link:
# Construct URL
url = self.list_in_guest_software_items.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')

else:
url = next_link
query_parameters = {}

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
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, header_parameters)
response = self._client.send(request, stream=False, **operation_config)

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

return response

# Deserialize response
deserialized = models.InGuestSoftwareItemPaged(internal_paging, self._deserialize.dependencies)

if raw:
header_dict = {}
client_raw_response = models.InGuestSoftwareItemPaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response

return deserialized
list_in_guest_software_items.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/guestResourceTypes/software/items'}

def get_in_guest_software_item(
self, resource_group_name, vm_name, item_id, custom_headers=None, raw=False, **operation_config):
"""Get the In-Guest software item of the virtual machine in the specified
subscription.

: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 item_id: Identifier of the In-Guest resource type.
:type item_id: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: InGuestSoftwareItem or ClientRawResponse if raw=true
:rtype:
~azure.mgmt.compute.v2016_04_30_preview.models.InGuestSoftwareItem or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.get_in_guest_software_item.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'),
'itemId': self._serialize.url("item_id", item_id, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

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

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
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, header_parameters)
response = self._client.send(request, 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('InGuestSoftwareItem', response)

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

return deserialized
get_in_guest_software_item.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/guestResourceTypes/software/items/{itemId}'}
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
from .log_analytics_input_base_py3 import LogAnalyticsInputBase
from .log_analytics_output_py3 import LogAnalyticsOutput
from .log_analytics_operation_result_py3 import LogAnalyticsOperationResult
from .in_guest_software_item_py3 import InGuestSoftwareItem
from .run_command_input_parameter_py3 import RunCommandInputParameter
from .run_command_input_py3 import RunCommandInput
from .run_command_parameter_definition_py3 import RunCommandParameterDefinition
Expand Down Expand Up @@ -267,6 +268,7 @@
from .log_analytics_input_base import LogAnalyticsInputBase
from .log_analytics_output import LogAnalyticsOutput
from .log_analytics_operation_result import LogAnalyticsOperationResult
from .in_guest_software_item import InGuestSoftwareItem
from .run_command_input_parameter import RunCommandInputParameter
from .run_command_input import RunCommandInput
from .run_command_parameter_definition import RunCommandParameterDefinition
Expand All @@ -278,6 +280,7 @@
from .virtual_machine_size_paged import VirtualMachineSizePaged
from .usage_paged import UsagePaged
from .virtual_machine_paged import VirtualMachinePaged
from .in_guest_software_item_paged import InGuestSoftwareItemPaged
from .image_paged import ImagePaged
from .virtual_machine_scale_set_paged import VirtualMachineScaleSetPaged
from .virtual_machine_scale_set_sku_paged import VirtualMachineScaleSetSkuPaged
Expand Down Expand Up @@ -440,6 +443,7 @@
'LogAnalyticsInputBase',
'LogAnalyticsOutput',
'LogAnalyticsOperationResult',
'InGuestSoftwareItem',
'RunCommandInputParameter',
'RunCommandInput',
'RunCommandParameterDefinition',
Expand All @@ -451,6 +455,7 @@
'VirtualMachineSizePaged',
'UsagePaged',
'VirtualMachinePaged',
'InGuestSoftwareItemPaged',
'ImagePaged',
'VirtualMachineScaleSetPaged',
'VirtualMachineScaleSetSkuPaged',
Expand Down
Loading