# 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 msrest.exceptions import HttpOperationError

from .. import models


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

    :param client: Client for service requests.
    :param config: Configuration of service client.
    :param serializer: An object model serializer.
    :param deserializer: An object model deserializer.
    :ivar api_version: The Synapse client API Version. Constant value: "2019-11-01-preview".
    """

    models = models

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

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

        self.config = config
        self.api_version = "2019-11-01-preview"

    def get_history_server_data(
            self, workspace_name, pool_name, livy_id, app_id, attempt_id, custom_headers=None, raw=False, **operation_config):
        """Get History Server Data for a given workspace, pool, livyid, appid and
        attemptId.

        :param workspace_name: The name of the workspace to execute operations
         on.
        :type workspace_name: str
        :param pool_name: The spark pool name.
        :type pool_name: str
        :param livy_id: The livy id.
        :type livy_id: str
        :param app_id: The application id.
        :type app_id: str
        :param attempt_id: The attempt id.
        :type attempt_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: HistoryServerDataResponse or ClientRawResponse if raw=true
        :rtype: ~azure.synapse.models.HistoryServerDataResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
        """
        # Construct URL
        url = self.get_history_server_data.metadata['url']
        path_format_arguments = {
            'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', skip_quote=True),
            'SynapseDnsSuffix': self._serialize.url("self.config.synapse_dns_suffix", self.config.synapse_dns_suffix, 'str', skip_quote=True),
            'poolName': self._serialize.url("pool_name", pool_name, 'str'),
            'livyId': self._serialize.url("livy_id", livy_id, 'str'),
            'appId': self._serialize.url("app_id", app_id, 'str'),
            'attemptId': self._serialize.url("attempt_id", attempt_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['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct and send request
        request = self._client.get(url, query_parameters)
        response = self._client.send(request, header_parameters, stream=False, **operation_config)

        if response.status_code not in [200, 401]:
            raise HttpOperationError(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('HistoryServerDataResponse', response)

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

        return deserialized
    get_history_server_data.metadata = {'url': '/monitoring/workloadTypes/spark/pools/{poolName}/livyIds/{livyId}/applications/{appId}/attemptIds/{attemptId}/historyServerData'}

    def get_spark_job_list(
            self, workspace_name, custom_headers=None, raw=False, **operation_config):
        """Get list of spark applications for the workspace.

        :param workspace_name: The name of the workspace to execute operations
         on.
        :type workspace_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: SparkJobListViewResponse or ClientRawResponse if raw=true
        :rtype: ~azure.synapse.models.SparkJobListViewResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
        """
        # Construct URL
        url = self.get_spark_job_list.metadata['url']
        path_format_arguments = {
            'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', skip_quote=True),
            'SynapseDnsSuffix': self._serialize.url("self.config.synapse_dns_suffix", self.config.synapse_dns_suffix, 'str', skip_quote=True)
        }
        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['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct and send request
        request = self._client.get(url, query_parameters)
        response = self._client.send(request, header_parameters, stream=False, **operation_config)

        if response.status_code not in [200, 401]:
            raise HttpOperationError(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('SparkJobListViewResponse', response)

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

        return deserialized
    get_spark_job_list.metadata = {'url': '/monitoring/workloadTypes/spark/Applications'}

    def get_application_details(
            self, workspace_name, pool_name, livy_id, custom_headers=None, raw=False, **operation_config):
        """Get one spark application details given the workspace name, pool name
        and livyid.

        :param workspace_name: The name of the workspace to execute operations
         on.
        :type workspace_name: str
        :param pool_name: The spark pool name.
        :type pool_name: str
        :param livy_id: The livy id.
        :type livy_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: SparkJobListViewResponse or ClientRawResponse if raw=true
        :rtype: ~azure.synapse.models.SparkJobListViewResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
        """
        # Construct URL
        url = self.get_application_details.metadata['url']
        path_format_arguments = {
            'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', skip_quote=True),
            'SynapseDnsSuffix': self._serialize.url("self.config.synapse_dns_suffix", self.config.synapse_dns_suffix, 'str', skip_quote=True),
            'poolName': self._serialize.url("pool_name", pool_name, 'str'),
            'livyId': self._serialize.url("livy_id", livy_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['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct and send request
        request = self._client.get(url, query_parameters)
        response = self._client.send(request, header_parameters, stream=False, **operation_config)

        if response.status_code not in [200, 401]:
            raise HttpOperationError(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('SparkJobListViewResponse', response)

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

        return deserialized
    get_application_details.metadata = {'url': '/monitoring/workloadTypes/spark/pools/{poolName}/livyIds/{livyId}'}

    def get_history_server_properties(
            self, workspace_name, custom_headers=None, raw=False, **operation_config):
        """Get History server properties.

        :param workspace_name: The name of the workspace to execute operations
         on.
        :type workspace_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: HistoryServerPropertiesResponse or ClientRawResponse if
         raw=true
        :rtype: ~azure.synapse.models.HistoryServerPropertiesResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
        """
        # Construct URL
        url = self.get_history_server_properties.metadata['url']
        path_format_arguments = {
            'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', skip_quote=True),
            'SynapseDnsSuffix': self._serialize.url("self.config.synapse_dns_suffix", self.config.synapse_dns_suffix, 'str', skip_quote=True)
        }
        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['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct and send request
        request = self._client.get(url, query_parameters)
        response = self._client.send(request, header_parameters, stream=False, **operation_config)

        if response.status_code not in [200, 401]:
            raise HttpOperationError(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('HistoryServerPropertiesResponse', response)

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

        return deserialized
    get_history_server_properties.metadata = {'url': '/monitoring/workloadTypes/spark/historyServerProperties'}

    def get_history_server_diagnostic(
            self, workspace_name, pool_name, livy_id, app_id, attempt_id, custom_headers=None, raw=False, **operation_config):
        """Get History Server Diagnostic Data for a given workspace, pool, livyid,
        appid and attemptId.

        :param workspace_name: The name of the workspace to execute operations
         on.
        :type workspace_name: str
        :param pool_name: The spark pool name.
        :type pool_name: str
        :param livy_id: The livy id.
        :type livy_id: str
        :param app_id: The application id.
        :type app_id: str
        :param attempt_id: The attempt id.
        :type attempt_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: HistoryServerDiagnosticResponse or ClientRawResponse if
         raw=true
        :rtype: ~azure.synapse.models.HistoryServerDiagnosticResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
        """
        # Construct URL
        url = self.get_history_server_diagnostic.metadata['url']
        path_format_arguments = {
            'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', skip_quote=True),
            'SynapseDnsSuffix': self._serialize.url("self.config.synapse_dns_suffix", self.config.synapse_dns_suffix, 'str', skip_quote=True),
            'poolName': self._serialize.url("pool_name", pool_name, 'str'),
            'livyId': self._serialize.url("livy_id", livy_id, 'str'),
            'appId': self._serialize.url("app_id", app_id, 'str'),
            'attemptId': self._serialize.url("attempt_id", attempt_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['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct and send request
        request = self._client.get(url, query_parameters)
        response = self._client.send(request, header_parameters, stream=False, **operation_config)

        if response.status_code not in [200, 401]:
            raise HttpOperationError(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('HistoryServerDiagnosticResponse', response)

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

        return deserialized
    get_history_server_diagnostic.metadata = {'url': '/monitoring/workloadTypes/spark/pools/{poolName}/livyIds/{livyId}/applications/{appId}/attemptIds/{attemptId}/historyServerDiagnostic'}

    def get_history_server_graph(
            self, workspace_name, pool_name, livy_id, app_id, attempt_id, custom_headers=None, raw=False, **operation_config):
        """Get History Server Graph Data for a given workspace, pool, livyid,
        appid and attemptId.

        :param workspace_name: The name of the workspace to execute operations
         on.
        :type workspace_name: str
        :param pool_name: The spark pool name.
        :type pool_name: str
        :param livy_id: The livy id.
        :type livy_id: str
        :param app_id: The application id.
        :type app_id: str
        :param attempt_id: The attempt id.
        :type attempt_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: HistoryServerGraphResponse or ClientRawResponse if raw=true
        :rtype: ~azure.synapse.models.HistoryServerGraphResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
        """
        # Construct URL
        url = self.get_history_server_graph.metadata['url']
        path_format_arguments = {
            'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', skip_quote=True),
            'SynapseDnsSuffix': self._serialize.url("self.config.synapse_dns_suffix", self.config.synapse_dns_suffix, 'str', skip_quote=True),
            'poolName': self._serialize.url("pool_name", pool_name, 'str'),
            'livyId': self._serialize.url("livy_id", livy_id, 'str'),
            'appId': self._serialize.url("app_id", app_id, 'str'),
            'attemptId': self._serialize.url("attempt_id", attempt_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['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct and send request
        request = self._client.get(url, query_parameters)
        response = self._client.send(request, header_parameters, stream=False, **operation_config)

        if response.status_code not in [200, 401]:
            raise HttpOperationError(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('HistoryServerGraphResponse', response)

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

        return deserialized
    get_history_server_graph.metadata = {'url': '/monitoring/workloadTypes/spark/pools/{poolName}/livyIds/{livyId}/applications/{appId}/attemptIds/{attemptId}/historyServerGraph'}

# 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 msrest.exceptions import HttpOperationError

from .. import models


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

    :param client: Client for service requests.
    :param config: Configuration of service client.
    :param serializer: An object model serializer.
    :param deserializer: An object model deserializer.
    :ivar api_version: The Synapse client API Version. Constant value: "2019-11-01-preview".
    """

    models = models

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

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

        self.config = config
        self.api_version = "2019-11-01-preview"

    def get_history_server_data(
            self, workspace_name, pool_name, livy_id, app_id, attempt_id, custom_headers=None, raw=False, **operation_config):
        """Get History Server Data for a given workspace, pool, livyid, appid and
        attemptId.

        :param workspace_name: The name of the workspace to execute operations
         on.
        :type workspace_name: str
        :param pool_name: The spark pool name.
        :type pool_name: str
        :param livy_id: The livy id.
        :type livy_id: str
        :param app_id: The application id.
        :type app_id: str
        :param attempt_id: The attempt id.
        :type attempt_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: HistoryServerDataResponse or ClientRawResponse if raw=true
        :rtype: ~azure.synapse.models.HistoryServerDataResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
        """
        # Construct URL
        url = self.get_history_server_data.metadata['url']
        path_format_arguments = {
            'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', skip_quote=True),
            'SynapseDnsSuffix': self._serialize.url("self.config.synapse_dns_suffix", self.config.synapse_dns_suffix, 'str', skip_quote=True),
            'poolName': self._serialize.url("pool_name", pool_name, 'str'),
            'livyId': self._serialize.url("livy_id", livy_id, 'str'),
            'appId': self._serialize.url("app_id", app_id, 'str'),
            'attemptId': self._serialize.url("attempt_id", attempt_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['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct and send request
        request = self._client.get(url, query_parameters)
        response = self._client.send(request, header_parameters, stream=False, **operation_config)

        if response.status_code not in [200, 401]:
            raise HttpOperationError(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('HistoryServerDataResponse', response)

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

        return deserialized
    get_history_server_data.metadata = {'url': '/monitoring/workloadTypes/spark/pools/{poolName}/livyIds/{livyId}/applications/{appId}/attemptIds/{attemptId}/historyServerData'}

    def get_spark_job_list(
            self, workspace_name, custom_headers=None, raw=False, **operation_config):
        """Get list of spark applications for the workspace.

        :param workspace_name: The name of the workspace to execute operations
         on.
        :type workspace_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: SparkJobListViewResponse or ClientRawResponse if raw=true
        :rtype: ~azure.synapse.models.SparkJobListViewResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
        """
        # Construct URL
        url = self.get_spark_job_list.metadata['url']
        path_format_arguments = {
            'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', skip_quote=True),
            'SynapseDnsSuffix': self._serialize.url("self.config.synapse_dns_suffix", self.config.synapse_dns_suffix, 'str', skip_quote=True)
        }
        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['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct and send request
        request = self._client.get(url, query_parameters)
        response = self._client.send(request, header_parameters, stream=False, **operation_config)

        if response.status_code not in [200, 401]:
            raise HttpOperationError(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('SparkJobListViewResponse', response)

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

        return deserialized
    get_spark_job_list.metadata = {'url': '/monitoring/workloadTypes/spark/Applications'}

    def get_application_details(
            self, workspace_name, pool_name, livy_id, custom_headers=None, raw=False, **operation_config):
        """Get one spark application details given the workspace name, pool name
        and livyid.

        :param workspace_name: The name of the workspace to execute operations
         on.
        :type workspace_name: str
        :param pool_name: The spark pool name.
        :type pool_name: str
        :param livy_id: The livy id.
        :type livy_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: SparkJobListViewResponse or ClientRawResponse if raw=true
        :rtype: ~azure.synapse.models.SparkJobListViewResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
        """
        # Construct URL
        url = self.get_application_details.metadata['url']
        path_format_arguments = {
            'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', skip_quote=True),
            'SynapseDnsSuffix': self._serialize.url("self.config.synapse_dns_suffix", self.config.synapse_dns_suffix, 'str', skip_quote=True),
            'poolName': self._serialize.url("pool_name", pool_name, 'str'),
            'livyId': self._serialize.url("livy_id", livy_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['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct and send request
        request = self._client.get(url, query_parameters)
        response = self._client.send(request, header_parameters, stream=False, **operation_config)

        if response.status_code not in [200, 401]:
            raise HttpOperationError(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('SparkJobListViewResponse', response)

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

        return deserialized
    get_application_details.metadata = {'url': '/monitoring/workloadTypes/spark/pools/{poolName}/livyIds/{livyId}'}

    def get_history_server_properties(
            self, workspace_name, custom_headers=None, raw=False, **operation_config):
        """Get History server properties.

        :param workspace_name: The name of the workspace to execute operations
         on.
        :type workspace_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: HistoryServerPropertiesResponse or ClientRawResponse if
         raw=true
        :rtype: ~azure.synapse.models.HistoryServerPropertiesResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
        """
        # Construct URL
        url = self.get_history_server_properties.metadata['url']
        path_format_arguments = {
            'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', skip_quote=True),
            'SynapseDnsSuffix': self._serialize.url("self.config.synapse_dns_suffix", self.config.synapse_dns_suffix, 'str', skip_quote=True)
        }
        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['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct and send request
        request = self._client.get(url, query_parameters)
        response = self._client.send(request, header_parameters, stream=False, **operation_config)

        if response.status_code not in [200, 401]:
            raise HttpOperationError(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('HistoryServerPropertiesResponse', response)

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

        return deserialized
    get_history_server_properties.metadata = {'url': '/monitoring/workloadTypes/spark/historyServerProperties'}

    def get_history_server_diagnostic(
            self, workspace_name, pool_name, livy_id, app_id, attempt_id, custom_headers=None, raw=False, **operation_config):
        """Get History Server Diagnostic Data for a given workspace, pool, livyid,
        appid and attemptId.

        :param workspace_name: The name of the workspace to execute operations
         on.
        :type workspace_name: str
        :param pool_name: The spark pool name.
        :type pool_name: str
        :param livy_id: The livy id.
        :type livy_id: str
        :param app_id: The application id.
        :type app_id: str
        :param attempt_id: The attempt id.
        :type attempt_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: HistoryServerDiagnosticResponse or ClientRawResponse if
         raw=true
        :rtype: ~azure.synapse.models.HistoryServerDiagnosticResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
        """
        # Construct URL
        url = self.get_history_server_diagnostic.metadata['url']
        path_format_arguments = {
            'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', skip_quote=True),
            'SynapseDnsSuffix': self._serialize.url("self.config.synapse_dns_suffix", self.config.synapse_dns_suffix, 'str', skip_quote=True),
            'poolName': self._serialize.url("pool_name", pool_name, 'str'),
            'livyId': self._serialize.url("livy_id", livy_id, 'str'),
            'appId': self._serialize.url("app_id", app_id, 'str'),
            'attemptId': self._serialize.url("attempt_id", attempt_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['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct and send request
        request = self._client.get(url, query_parameters)
        response = self._client.send(request, header_parameters, stream=False, **operation_config)

        if response.status_code not in [200, 401]:
            raise HttpOperationError(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('HistoryServerDiagnosticResponse', response)

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

        return deserialized
    get_history_server_diagnostic.metadata = {'url': '/monitoring/workloadTypes/spark/pools/{poolName}/livyIds/{livyId}/applications/{appId}/attemptIds/{attemptId}/historyServerDiagnostic'}

    def get_history_server_graph(
            self, workspace_name, pool_name, livy_id, app_id, attempt_id, custom_headers=None, raw=False, **operation_config):
        """Get History Server Graph Data for a given workspace, pool, livyid,
        appid and attemptId.

        :param workspace_name: The name of the workspace to execute operations
         on.
        :type workspace_name: str
        :param pool_name: The spark pool name.
        :type pool_name: str
        :param livy_id: The livy id.
        :type livy_id: str
        :param app_id: The application id.
        :type app_id: str
        :param attempt_id: The attempt id.
        :type attempt_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: HistoryServerGraphResponse or ClientRawResponse if raw=true
        :rtype: ~azure.synapse.models.HistoryServerGraphResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
        """
        # Construct URL
        url = self.get_history_server_graph.metadata['url']
        path_format_arguments = {
            'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', skip_quote=True),
            'SynapseDnsSuffix': self._serialize.url("self.config.synapse_dns_suffix", self.config.synapse_dns_suffix, 'str', skip_quote=True),
            'poolName': self._serialize.url("pool_name", pool_name, 'str'),
            'livyId': self._serialize.url("livy_id", livy_id, 'str'),
            'appId': self._serialize.url("app_id", app_id, 'str'),
            'attemptId': self._serialize.url("attempt_id", attempt_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['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct and send request
        request = self._client.get(url, query_parameters)
        response = self._client.send(request, header_parameters, stream=False, **operation_config)

        if response.status_code not in [200, 401]:
            raise HttpOperationError(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('HistoryServerGraphResponse', response)

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

        return deserialized
    get_history_server_graph.metadata = {'url': '/monitoring/workloadTypes/spark/pools/{poolName}/livyIds/{livyId}/applications/{appId}/attemptIds/{attemptId}/historyServerGraph'}

# 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. # -------------------------------------------------------------------------- MonitoringOperations operations.      :param client: Client for service requests.     :param config: Configuration of service client.     :param serializer: An object model serializer.     :param deserializer: An object model deserializer.     :ivar api_version: The Synapse client API Version. Constant value: "2019-11-01-preview". Get History Server Data for a given workspace, pool, livyid, appid and         attemptId.          :param workspace_name: The name of the workspace to execute operations          on.         :type workspace_name: str         :param pool_name: The spark pool name.         :type pool_name: str         :param livy_id: The livy id.         :type livy_id: str         :param app_id: The application id.         :type app_id: str         :param attempt_id: The attempt id.         :type attempt_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: HistoryServerDataResponse or ClientRawResponse if raw=true         :rtype: ~azure.synapse.models.HistoryServerDataResponse or          ~msrest.pipeline.ClientRawResponse         :raises:          :class:`HttpOperationError<msrest.exceptions.HttpOperationError>` # Construct URL # Construct parameters # Construct headers # Construct and send request Get list of spark applications for the workspace.          :param workspace_name: The name of the workspace to execute operations          on.         :type workspace_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: SparkJobListViewResponse or ClientRawResponse if raw=true         :rtype: ~azure.synapse.models.SparkJobListViewResponse or          ~msrest.pipeline.ClientRawResponse         :raises:          :class:`HttpOperationError<msrest.exceptions.HttpOperationError>` # Construct URL # Construct parameters # Construct headers # Construct and send request Get one spark application details given the workspace name, pool name         and livyid.          :param workspace_name: The name of the workspace to execute operations          on.         :type workspace_name: str         :param pool_name: The spark pool name.         :type pool_name: str         :param livy_id: The livy id.         :type livy_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: SparkJobListViewResponse or ClientRawResponse if raw=true         :rtype: ~azure.synapse.models.SparkJobListViewResponse or          ~msrest.pipeline.ClientRawResponse         :raises:          :class:`HttpOperationError<msrest.exceptions.HttpOperationError>` # Construct URL # Construct parameters # Construct headers # Construct and send request Get History server properties.          :param workspace_name: The name of the workspace to execute operations          on.         :type workspace_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: HistoryServerPropertiesResponse or ClientRawResponse if          raw=true         :rtype: ~azure.synapse.models.HistoryServerPropertiesResponse or          ~msrest.pipeline.ClientRawResponse         :raises:          :class:`HttpOperationError<msrest.exceptions.HttpOperationError>` # Construct URL # Construct parameters # Construct headers # Construct and send request Get History Server Diagnostic Data for a given workspace, pool, livyid,         appid and attemptId.          :param workspace_name: The name of the workspace to execute operations          on.         :type workspace_name: str         :param pool_name: The spark pool name.         :type pool_name: str         :param livy_id: The livy id.         :type livy_id: str         :param app_id: The application id.         :type app_id: str         :param attempt_id: The attempt id.         :type attempt_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: HistoryServerDiagnosticResponse or ClientRawResponse if          raw=true         :rtype: ~azure.synapse.models.HistoryServerDiagnosticResponse or          ~msrest.pipeline.ClientRawResponse         :raises:          :class:`HttpOperationError<msrest.exceptions.HttpOperationError>` # Construct URL # Construct parameters # Construct headers # Construct and send request Get History Server Graph Data for a given workspace, pool, livyid,         appid and attemptId.          :param workspace_name: The name of the workspace to execute operations          on.         :type workspace_name: str         :param pool_name: The spark pool name.         :type pool_name: str         :param livy_id: The livy id.         :type livy_id: str         :param app_id: The application id.         :type app_id: str         :param attempt_id: The attempt id.         :type attempt_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: HistoryServerGraphResponse or ClientRawResponse if raw=true         :rtype: ~azure.synapse.models.HistoryServerGraphResponse or          ~msrest.pipeline.ClientRawResponse         :raises:          :class:`HttpOperationError<msrest.exceptions.HttpOperationError>` # Construct URL # Construct parameters # Construct headers # Construct and send request