Skip to content

Commit

Permalink
[AutoPR compute/resource-manager] Swagger change for listing virtual …
Browse files Browse the repository at this point in the history
…machines in a subscription by location (#3418)

* Generated from 3be1a911d16b8296adaedaa7f947fbdd04e85d19

Updated compute.json

* Generated from ae050a8fdd8c727b1344880df360fc78188bbd56

Merge branch 'master' into locations_virtualMachines

* Generated from f8fd0b64d1e5cdcbac402960aea82d5f0b2838a0

Merge branch 'master' into locations_virtualMachines
  • Loading branch information
AutorestCI authored Sep 25, 2018
1 parent 06b1027 commit a60b3d5
Show file tree
Hide file tree
Showing 10 changed files with 294 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,75 @@ def get_extensions(
return deserialized
get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'}

def list_by_location(
self, location, custom_headers=None, raw=False, **operation_config):
"""Gets all the virtual machines under the specified subscription for the
specified location.
:param location: The location for which virtual machines under the
subscription are queried.
:type location: 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 VirtualMachine
:rtype:
~azure.mgmt.compute.v2017_03_30.models.VirtualMachinePaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachine]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def internal_paging(next_link=None, raw=False):

if not next_link:
# Construct URL
url = self.list_by_location.metadata['url']
path_format_arguments = {
'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'),
'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.VirtualMachinePaged(internal_paging, self._deserialize.dependencies)

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

return deserialized
list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines'}


def _capture_initial(
self, resource_group_name, vm_name, parameters, custom_headers=None, raw=False, **operation_config):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,75 @@ def get_extensions(
return deserialized
get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'}

def list_by_location(
self, location, custom_headers=None, raw=False, **operation_config):
"""Gets all the virtual machines under the specified subscription for the
specified location.
:param location: The location for which virtual machines under the
subscription are queried.
:type location: 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 VirtualMachine
:rtype:
~azure.mgmt.compute.v2017_12_01.models.VirtualMachinePaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachine]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def internal_paging(next_link=None, raw=False):

if not next_link:
# Construct URL
url = self.list_by_location.metadata['url']
path_format_arguments = {
'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'),
'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.VirtualMachinePaged(internal_paging, self._deserialize.dependencies)

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

return deserialized
list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines'}


def _capture_initial(
self, resource_group_name, vm_name, parameters, custom_headers=None, raw=False, **operation_config):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
from .operations.virtual_machine_extensions_operations import VirtualMachineExtensionsOperations
from .operations.virtual_machine_images_operations import VirtualMachineImagesOperations
from .operations.usage_operations import UsageOperations
from .operations.virtual_machines_operations import VirtualMachinesOperations
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
Expand Down Expand Up @@ -85,12 +85,12 @@ class ComputeManagementClient(SDKClient):
:vartype virtual_machine_images: azure.mgmt.compute.v2018_04_01.operations.VirtualMachineImagesOperations
:ivar usage: Usage operations
:vartype usage: azure.mgmt.compute.v2018_04_01.operations.UsageOperations
:ivar virtual_machines: VirtualMachines operations
:vartype virtual_machines: azure.mgmt.compute.v2018_04_01.operations.VirtualMachinesOperations
:ivar virtual_machine_sizes: VirtualMachineSizes operations
:vartype virtual_machine_sizes: azure.mgmt.compute.v2018_04_01.operations.VirtualMachineSizesOperations
:ivar images: Images operations
:vartype images: azure.mgmt.compute.v2018_04_01.operations.ImagesOperations
:ivar virtual_machines: VirtualMachines operations
:vartype virtual_machines: azure.mgmt.compute.v2018_04_01.operations.VirtualMachinesOperations
:ivar virtual_machine_scale_sets: VirtualMachineScaleSets operations
:vartype virtual_machine_scale_sets: azure.mgmt.compute.v2018_04_01.operations.VirtualMachineScaleSetsOperations
:ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensions operations
Expand Down Expand Up @@ -141,12 +141,12 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.usage = UsageOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_machines = VirtualMachinesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_machine_sizes = VirtualMachineSizesOperations(
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@
from .availability_set_paged import AvailabilitySetPaged
from .virtual_machine_size_paged import VirtualMachineSizePaged
from .usage_paged import UsagePaged
from .image_paged import ImagePaged
from .virtual_machine_paged import VirtualMachinePaged
from .image_paged import ImagePaged
from .virtual_machine_scale_set_paged import VirtualMachineScaleSetPaged
from .virtual_machine_scale_set_sku_paged import VirtualMachineScaleSetSkuPaged
from .upgrade_operation_historical_status_info_paged import UpgradeOperationHistoricalStatusInfoPaged
Expand Down Expand Up @@ -480,8 +480,8 @@
'AvailabilitySetPaged',
'VirtualMachineSizePaged',
'UsagePaged',
'ImagePaged',
'VirtualMachinePaged',
'ImagePaged',
'VirtualMachineScaleSetPaged',
'VirtualMachineScaleSetSkuPaged',
'UpgradeOperationHistoricalStatusInfoPaged',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
from .virtual_machine_extensions_operations import VirtualMachineExtensionsOperations
from .virtual_machine_images_operations import VirtualMachineImagesOperations
from .usage_operations import UsageOperations
from .virtual_machines_operations import VirtualMachinesOperations
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
Expand All @@ -34,9 +34,9 @@
'VirtualMachineExtensionsOperations',
'VirtualMachineImagesOperations',
'UsageOperations',
'VirtualMachinesOperations',
'VirtualMachineSizesOperations',
'ImagesOperations',
'VirtualMachinesOperations',
'VirtualMachineScaleSetsOperations',
'VirtualMachineScaleSetExtensionsOperations',
'VirtualMachineScaleSetRollingUpgradesOperations',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,75 @@ def __init__(self, client, config, serializer, deserializer):

self.config = config

def list_by_location(
self, location, custom_headers=None, raw=False, **operation_config):
"""Gets all the virtual machines under the specified subscription for the
specified location.
:param location: The location for which virtual machines under the
subscription are queried.
:type location: 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 VirtualMachine
:rtype:
~azure.mgmt.compute.v2018_04_01.models.VirtualMachinePaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachine]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def internal_paging(next_link=None, raw=False):

if not next_link:
# Construct URL
url = self.list_by_location.metadata['url']
path_format_arguments = {
'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'),
'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.VirtualMachinePaged(internal_paging, self._deserialize.dependencies)

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

return deserialized
list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines'}


def _capture_initial(
self, resource_group_name, vm_name, parameters, custom_headers=None, raw=False, **operation_config):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
from .operations.virtual_machine_extensions_operations import VirtualMachineExtensionsOperations
from .operations.virtual_machine_images_operations import VirtualMachineImagesOperations
from .operations.usage_operations import UsageOperations
from .operations.virtual_machines_operations import VirtualMachinesOperations
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
Expand Down Expand Up @@ -88,12 +88,12 @@ class ComputeManagementClient(SDKClient):
:vartype virtual_machine_images: azure.mgmt.compute.v2018_06_01.operations.VirtualMachineImagesOperations
:ivar usage: Usage operations
:vartype usage: azure.mgmt.compute.v2018_06_01.operations.UsageOperations
:ivar virtual_machines: VirtualMachines operations
:vartype virtual_machines: azure.mgmt.compute.v2018_06_01.operations.VirtualMachinesOperations
:ivar virtual_machine_sizes: VirtualMachineSizes operations
:vartype virtual_machine_sizes: azure.mgmt.compute.v2018_06_01.operations.VirtualMachineSizesOperations
:ivar images: Images operations
:vartype images: azure.mgmt.compute.v2018_06_01.operations.ImagesOperations
:ivar virtual_machines: VirtualMachines operations
:vartype virtual_machines: azure.mgmt.compute.v2018_06_01.operations.VirtualMachinesOperations
:ivar virtual_machine_scale_sets: VirtualMachineScaleSets operations
:vartype virtual_machine_scale_sets: azure.mgmt.compute.v2018_06_01.operations.VirtualMachineScaleSetsOperations
:ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensions operations
Expand Down Expand Up @@ -150,12 +150,12 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.usage = UsageOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_machines = VirtualMachinesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_machine_sizes = VirtualMachineSizesOperations(
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@
from .availability_set_paged import AvailabilitySetPaged
from .virtual_machine_size_paged import VirtualMachineSizePaged
from .usage_paged import UsagePaged
from .image_paged import ImagePaged
from .virtual_machine_paged import VirtualMachinePaged
from .image_paged import ImagePaged
from .virtual_machine_scale_set_paged import VirtualMachineScaleSetPaged
from .virtual_machine_scale_set_sku_paged import VirtualMachineScaleSetSkuPaged
from .upgrade_operation_historical_status_info_paged import UpgradeOperationHistoricalStatusInfoPaged
Expand Down Expand Up @@ -562,8 +562,8 @@
'AvailabilitySetPaged',
'VirtualMachineSizePaged',
'UsagePaged',
'ImagePaged',
'VirtualMachinePaged',
'ImagePaged',
'VirtualMachineScaleSetPaged',
'VirtualMachineScaleSetSkuPaged',
'UpgradeOperationHistoricalStatusInfoPaged',
Expand Down
Loading

0 comments on commit a60b3d5

Please sign in to comment.