# Source code for azure.mgmt.batch.operations.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 msrestazure.azure_exceptions import CloudError
    import uuid

    from .. import models

    class ApplicationOperations(object):
        """ApplicationOperations operations.

        :param client: Client for service requests.
        :param config: Configuration of service client.
        :param serializer: An object model serializer.
        :param deserializer: An objec model deserializer.
        """

        def __init__(self, client, config, serializer, deserializer):

            self._client = client
            self._serialize = serializer
            self._deserialize = deserializer

            self.config = config

        def activate_application_package(
                self, resource_group_name, account_name, id, version, format, custom_headers=None, raw=False, **operation_config):
            """Activates the specified application package.

            :param resource_group_name: The name of the resource group that
             contains the Batch account.
            :type resource_group_name: str
            :param account_name: The name of the Batch account.
            :type account_name: str
            :param id: The id of the application.
            :type id: str
            :param version: The version of the application to activate.
            :type version: str
            :param format: The format of the application package binary file.
            :type format: 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>`.
            :rtype: None
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            parameters = models.ActivateApplicationPackageParameters(format=format)

            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{id}/versions/{version}/activate'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern='^[-\w\._]+$'),
                'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern='^[-\w\._]+$'),
                'id': self._serialize.url("id", id, 'str'),
                'version': self._serialize.url("version", version, '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.config.api_version", self.config.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(parameters, 'ActivateApplicationPackageParameters')

            # Construct and send request
            request = self._client.post(url, query_parameters)
            response = self._client.send(
                request, header_parameters, body_content, **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 add_application(
                self, resource_group_name, account_name, application_id, allow_updates=None, display_name=None, custom_headers=None, raw=False, **operation_config):
            """Adds an application to the specified Batch account.

            :param resource_group_name: The name of the resource group that
             contains the Batch account.
            :type resource_group_name: str
            :param account_name: The name of the Batch account.
            :type account_name: str
            :param application_id: The id of the application.
            :type application_id: str
            :param allow_updates: A value indicating whether packages within the
             application may be overwritten using the same version string.
            :type allow_updates: bool
            :param display_name: The display name for the application.
            :type display_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>`.
            :rtype: :class:`Application <azure.mgmt.batch.models.Application>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            parameters = None
            if allow_updates is not None or display_name is not None:
                parameters = models.AddApplicationParameters(allow_updates=allow_updates, display_name=display_name)

            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern='^[-\w\._]+$'),
                'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern='^[-\w\._]+$'),
                'applicationId': self._serialize.url("application_id", application_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.config.api_version", self.config.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
            if parameters is not None:
                body_content = self._serialize.body(parameters, 'AddApplicationParameters')
            else:
                body_content = None

            # Construct and send request
            request = self._client.put(url, query_parameters)
            response = self._client.send(
                request, header_parameters, body_content, **operation_config)

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

            deserialized = None

            if response.status_code == 201:
                deserialized = self._deserialize('Application', response)

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

            return deserialized

        def delete_application(
                self, resource_group_name, account_name, application_id, custom_headers=None, raw=False, **operation_config):
            """Deletes an application.

            :param resource_group_name: The name of the resource group that
             contains the Batch account.
            :type resource_group_name: str
            :param account_name: The name of the Batch account.
            :type account_name: str
            :param application_id: The id of the application.
            :type application_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>`.
            :rtype: None
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern='^[-\w\._]+$'),
                'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern='^[-\w\._]+$'),
                'applicationId': self._serialize.url("application_id", application_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.config.api_version", self.config.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 and send request
            request = self._client.delete(url, query_parameters)
            response = self._client.send(request, header_parameters, **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 get_application(
                self, resource_group_name, account_name, application_id, custom_headers=None, raw=False, **operation_config):
            """Gets information about the specified application.

            :param resource_group_name: The name of the resource group that
             contains the Batch account.
            :type resource_group_name: str
            :param account_name: The name of the Batch account.
            :type account_name: str
            :param application_id: The id of the application.
            :type application_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>`.
            :rtype: :class:`Application <azure.mgmt.batch.models.Application>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern='^[-\w\._]+$'),
                'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern='^[-\w\._]+$'),
                'applicationId': self._serialize.url("application_id", application_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.config.api_version", self.config.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 and send request
            request = self._client.get(url, query_parameters)
            response = self._client.send(request, header_parameters, **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('Application', response)

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

            return deserialized

        def update_application(
                self, resource_group_name, account_name, application_id, parameters, custom_headers=None, raw=False, **operation_config):
            """Updates settings for the specified application.

            :param resource_group_name: The name of the resource group that
             contains the Batch account.
            :type resource_group_name: str
            :param account_name: The name of the Batch account.
            :type account_name: str
            :param application_id: The id of the application.
            :type application_id: str
            :param parameters: The parameters for the request.
            :type parameters: :class:`UpdateApplicationParameters
             <azure.mgmt.batch.models.UpdateApplicationParameters>`
            :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>`.
            :rtype: None
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern='^[-\w\._]+$'),
                'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern='^[-\w\._]+$'),
                'applicationId': self._serialize.url("application_id", application_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.config.api_version", self.config.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(parameters, 'UpdateApplicationParameters')

            # Construct and send request
            request = self._client.patch(url, query_parameters)
            response = self._client.send(
                request, header_parameters, body_content, **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 add_application_package(
                self, resource_group_name, account_name, application_id, version, custom_headers=None, raw=False, **operation_config):
            """Creates an application package record.

            :param resource_group_name: The name of the resource group that
             contains the Batch account.
            :type resource_group_name: str
            :param account_name: The name of the Batch account.
            :type account_name: str
            :param application_id: The id of the application.
            :type application_id: str
            :param version: The version of the application.
            :type version: 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>`.
            :rtype: :class:`AddApplicationPackageResult
             <azure.mgmt.batch.models.AddApplicationPackageResult>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern='^[-\w\._]+$'),
                'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern='^[-\w\._]+$'),
                'applicationId': self._serialize.url("application_id", application_id, 'str'),
                'version': self._serialize.url("version", version, '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.config.api_version", self.config.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 and send request
            request = self._client.put(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

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

            deserialized = None

            if response.status_code == 201:
                deserialized = self._deserialize('AddApplicationPackageResult', response)

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

            return deserialized

        def delete_application_package(
                self, resource_group_name, account_name, application_id, version, custom_headers=None, raw=False, **operation_config):
            """Deletes an application package record and its associated binary file.

            :param resource_group_name: The name of the resource group that
             contains the Batch account.
            :type resource_group_name: str
            :param account_name: The name of the Batch account.
            :type account_name: str
            :param application_id: The id of the application.
            :type application_id: str
            :param version: The version of the application to delete.
            :type version: 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>`.
            :rtype: None
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern='^[-\w\._]+$'),
                'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern='^[-\w\._]+$'),
                'applicationId': self._serialize.url("application_id", application_id, 'str'),
                'version': self._serialize.url("version", version, '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.config.api_version", self.config.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 and send request
            request = self._client.delete(url, query_parameters)
            response = self._client.send(request, header_parameters, **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 get_application_package(
                self, resource_group_name, account_name, application_id, version, custom_headers=None, raw=False, **operation_config):
            """Gets information about the specified application package.

            :param resource_group_name: The name of the resource group that
             contains the Batch account.
            :type resource_group_name: str
            :param account_name: The name of the Batch account.
            :type account_name: str
            :param application_id: The id of the application.
            :type application_id: str
            :param version: The version of the application.
            :type version: 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>`.
            :rtype: :class:`GetApplicationPackageResult
             <azure.mgmt.batch.models.GetApplicationPackageResult>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern='^[-\w\._]+$'),
                'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern='^[-\w\._]+$'),
                'applicationId': self._serialize.url("application_id", application_id, 'str'),
                'version': self._serialize.url("version", version, '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.config.api_version", self.config.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 and send request
            request = self._client.get(url, query_parameters)
            response = self._client.send(request, header_parameters, **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('GetApplicationPackageResult', response)

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

            return deserialized

        def list(
                self, resource_group_name, account_name, maxresults=None, custom_headers=None, raw=False, **operation_config):
            """Lists all of the applications in the specified account.

            :param resource_group_name: The name of the resource group that
             contains the Batch account.
            :type resource_group_name: str
            :param account_name: The name of the Batch account.
            :type account_name: str
            :param maxresults: The maximum number of items to return in the
             response.
            :type maxresults: int
            :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>`.
            :rtype: :class:`ApplicationPaged
             <azure.mgmt.batch.models.ApplicationPaged>`
            """
            def internal_paging(next_link=None, raw=False):

                if not next_link:
                    # Construct URL
                    url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications'
                    path_format_arguments = {
                        'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern='^[-\w\._]+$'),
                        'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern='^[-\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 = {}
                    if maxresults is not None:
                        query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int')
                    query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

                else:
                    url = next_link
                    query_parameters = {}

                # 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 and send request
                request = self._client.get(url, query_parameters)
                response = self._client.send(
                    request, header_parameters, **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.ApplicationPaged(internal_paging, self._deserialize.dependencies)

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

            return deserialized