Source code for azure.servicefabric.operations._mesh_application_operations

# 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.pipeline import ClientRawResponse

from .. import models


[docs]class MeshApplicationOperations(object): """MeshApplicationOperations operations. You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. """ models = models def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer self.config = config
[docs] def create_or_update( self, application_resource_name, application_resource_description, custom_headers=None, raw=False, **operation_config): """Creates or updates a Application resource. Creates a Application resource with the specified name, description and properties. If Application resource with the same name exists, then it is updated with the specified description and properties. :param application_resource_name: The identity of the application. :type application_resource_name: str :param application_resource_description: Description for creating a Application resource. :type application_resource_description: ~azure.servicefabric.models.ApplicationResourceDescription :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: ApplicationResourceDescription or ClientRawResponse if raw=true :rtype: ~azure.servicefabric.models.ApplicationResourceDescription or ~msrest.pipeline.ClientRawResponse :raises: :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>` """ api_version = "6.4-preview" # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { 'applicationResourceName': self._serialize.url("application_resource_name", application_resource_name, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) # Construct body body_content = self._serialize.body(application_resource_description, 'ApplicationResourceDescription') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201, 202]: raise models.FabricErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('ApplicationResourceDescription', response) if response.status_code == 201: deserialized = self._deserialize('ApplicationResourceDescription', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized
create_or_update.metadata = {'url': '/Resources/Applications/{applicationResourceName}'}
[docs] def get( self, application_resource_name, custom_headers=None, raw=False, **operation_config): """Gets the Application resource with the given name. Gets the information about the Application resource with the given name. The information include the description and other properties of the Application. :param application_resource_name: The identity of the application. :type application_resource_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: ApplicationResourceDescription or ClientRawResponse if raw=true :rtype: ~azure.servicefabric.models.ApplicationResourceDescription or ~msrest.pipeline.ClientRawResponse :raises: :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>` """ api_version = "6.4-preview" # Construct URL url = self.get.metadata['url'] path_format_arguments = { 'applicationResourceName': self._serialize.url("application_resource_name", application_resource_name, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # 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]: raise models.FabricErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('ApplicationResourceDescription', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized
get.metadata = {'url': '/Resources/Applications/{applicationResourceName}'}
[docs] def delete( self, application_resource_name, custom_headers=None, raw=False, **operation_config): """Deletes the Application resource. Deletes the Application resource identified by the name. :param application_resource_name: The identity of the application. :type application_resource_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: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>` """ api_version = "6.4-preview" # Construct URL url = self.delete.metadata['url'] path_format_arguments = { 'applicationResourceName': self._serialize.url("application_resource_name", application_resource_name, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} if custom_headers: header_parameters.update(custom_headers) # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 202, 204]: raise models.FabricErrorException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response
delete.metadata = {'url': '/Resources/Applications/{applicationResourceName}'}
[docs] def list( self, custom_headers=None, raw=False, **operation_config): """Lists all the application resources. Gets the information about all application resources in a given resource group. The information include the description and other properties of the Application. :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: PagedApplicationResourceDescriptionList or ClientRawResponse if raw=true :rtype: ~azure.servicefabric.models.PagedApplicationResourceDescriptionList or ~msrest.pipeline.ClientRawResponse :raises: :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>` """ api_version = "6.4-preview" # Construct URL url = self.list.metadata['url'] # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # 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]: raise models.FabricErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('PagedApplicationResourceDescriptionList', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized
list.metadata = {'url': '/Resources/Applications'}
[docs] def get_upgrade_progress( self, application_resource_name, custom_headers=None, raw=False, **operation_config): """Gets the progress of the latest upgrade performed on this application resource. Gets the upgrade progress information about the Application resource with the given name. The information include percentage of completion and other upgrade state information of the Application resource. :param application_resource_name: The identity of the application. :type application_resource_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: ApplicationResourceUpgradeProgressInfo or ClientRawResponse if raw=true :rtype: ~azure.servicefabric.models.ApplicationResourceUpgradeProgressInfo or ~msrest.pipeline.ClientRawResponse :raises: :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>` """ api_version = "7.0" # Construct URL url = self.get_upgrade_progress.metadata['url'] path_format_arguments = { 'applicationResourceName': self._serialize.url("application_resource_name", application_resource_name, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # 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]: raise models.FabricErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('ApplicationResourceUpgradeProgressInfo', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized
get_upgrade_progress.metadata = {'url': '/Resources/Applications/{applicationResourceName}/$/GetUpgradeProgress'}