# coding: utf-8

"""
    Command Center operations

    Command Center operations  # noqa: E501

    OpenAPI spec version: 23.03-sp1
    Contact: support@zadarastorage.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from CommandCenter.api_client import ApiClient


class LogsApi(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def add_address_to_remote_rsyslog_server_list(self, cloud_name, add_address_to_remote_rsyslog_server_list, **kwargs):  # noqa: E501
        """add_address_to_remote_rsyslog_server_list  # noqa: E501

        Adds an address to the list of remote RSYSLOG server.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.add_address_to_remote_rsyslog_server_list(cloud_name, add_address_to_remote_rsyslog_server_list, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str cloud_name: (required)
        :param AddAddressToRemoteRsyslogServerList add_address_to_remote_rsyslog_server_list: (required)
        :return: InlineResponse20036
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.add_address_to_remote_rsyslog_server_list_with_http_info(cloud_name, add_address_to_remote_rsyslog_server_list, **kwargs)  # noqa: E501
        else:
            (data) = self.add_address_to_remote_rsyslog_server_list_with_http_info(cloud_name, add_address_to_remote_rsyslog_server_list, **kwargs)  # noqa: E501
            return data

    def add_address_to_remote_rsyslog_server_list_with_http_info(self, cloud_name, add_address_to_remote_rsyslog_server_list, **kwargs):  # noqa: E501
        """add_address_to_remote_rsyslog_server_list  # noqa: E501

        Adds an address to the list of remote RSYSLOG server.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.add_address_to_remote_rsyslog_server_list_with_http_info(cloud_name, add_address_to_remote_rsyslog_server_list, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str cloud_name: (required)
        :param AddAddressToRemoteRsyslogServerList add_address_to_remote_rsyslog_server_list: (required)
        :return: InlineResponse20036
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['cloud_name', 'add_address_to_remote_rsyslog_server_list']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method add_address_to_remote_rsyslog_server_list" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'cloud_name' is set
        if self.api_client.client_side_validation and ('cloud_name' not in params or
                                                       params['cloud_name'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `cloud_name` when calling `add_address_to_remote_rsyslog_server_list`")  # noqa: E501
        # verify the required parameter 'add_address_to_remote_rsyslog_server_list' is set
        if self.api_client.client_side_validation and ('add_address_to_remote_rsyslog_server_list' not in params or
                                                       params['add_address_to_remote_rsyslog_server_list'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `add_address_to_remote_rsyslog_server_list` when calling `add_address_to_remote_rsyslog_server_list`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'cloud_name' in params:
            path_params['cloud_name'] = params['cloud_name']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'add_address_to_remote_rsyslog_server_list' in params:
            body_params = params['add_address_to_remote_rsyslog_server_list']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json', 'application/xml'])  # noqa: E501

        # Authentication setting
        auth_settings = ['api_key']  # noqa: E501

        return self.api_client.call_api(
            '/clouds/{cloud_name}/logs/add_remote_address.json', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='InlineResponse20036',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def delete_address_from_remote_rsyslog_server_list(self, cloud_name, delete_address_from_remote_rsyslog_server_list, **kwargs):  # noqa: E501
        """delete_address_from_remote_rsyslog_server_list  # noqa: E501

        Deletes the supplied address from the list of remote RSYSLOG servers.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_address_from_remote_rsyslog_server_list(cloud_name, delete_address_from_remote_rsyslog_server_list, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str cloud_name: (required)
        :param DeleteAddressFromRemoteRsyslogServerList delete_address_from_remote_rsyslog_server_list: (required)
        :return: InlineResponse20036
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.delete_address_from_remote_rsyslog_server_list_with_http_info(cloud_name, delete_address_from_remote_rsyslog_server_list, **kwargs)  # noqa: E501
        else:
            (data) = self.delete_address_from_remote_rsyslog_server_list_with_http_info(cloud_name, delete_address_from_remote_rsyslog_server_list, **kwargs)  # noqa: E501
            return data

    def delete_address_from_remote_rsyslog_server_list_with_http_info(self, cloud_name, delete_address_from_remote_rsyslog_server_list, **kwargs):  # noqa: E501
        """delete_address_from_remote_rsyslog_server_list  # noqa: E501

        Deletes the supplied address from the list of remote RSYSLOG servers.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_address_from_remote_rsyslog_server_list_with_http_info(cloud_name, delete_address_from_remote_rsyslog_server_list, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str cloud_name: (required)
        :param DeleteAddressFromRemoteRsyslogServerList delete_address_from_remote_rsyslog_server_list: (required)
        :return: InlineResponse20036
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['cloud_name', 'delete_address_from_remote_rsyslog_server_list']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method delete_address_from_remote_rsyslog_server_list" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'cloud_name' is set
        if self.api_client.client_side_validation and ('cloud_name' not in params or
                                                       params['cloud_name'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `cloud_name` when calling `delete_address_from_remote_rsyslog_server_list`")  # noqa: E501
        # verify the required parameter 'delete_address_from_remote_rsyslog_server_list' is set
        if self.api_client.client_side_validation and ('delete_address_from_remote_rsyslog_server_list' not in params or
                                                       params['delete_address_from_remote_rsyslog_server_list'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `delete_address_from_remote_rsyslog_server_list` when calling `delete_address_from_remote_rsyslog_server_list`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'cloud_name' in params:
            path_params['cloud_name'] = params['cloud_name']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'delete_address_from_remote_rsyslog_server_list' in params:
            body_params = params['delete_address_from_remote_rsyslog_server_list']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json', 'application/xml'])  # noqa: E501

        # Authentication setting
        auth_settings = ['api_key']  # noqa: E501

        return self.api_client.call_api(
            '/clouds/{cloud_name}/logs/delete_remote_addresses.json', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='InlineResponse20036',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def list_recent_event(self, cloud_name, **kwargs):  # noqa: E501
        """list_recent_event  # noqa: E501

        Gets a list of recent events.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_recent_event(cloud_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str cloud_name: (required)
        :param int min_severity:
        :param str template:
        :param str min_time:
        :param str max_time:
        :param int min_id:
        :param int max_id:
        :param str orderby:
        :param bool desc:
        :param int page: The page number to start from.
        :param int per_page: The total number of records to return.
        :param str attributes: e.g attributes[source_type]=sn&attributes[source_name]=s1
        :return: InlineResponse20035
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.list_recent_event_with_http_info(cloud_name, **kwargs)  # noqa: E501
        else:
            (data) = self.list_recent_event_with_http_info(cloud_name, **kwargs)  # noqa: E501
            return data

    def list_recent_event_with_http_info(self, cloud_name, **kwargs):  # noqa: E501
        """list_recent_event  # noqa: E501

        Gets a list of recent events.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_recent_event_with_http_info(cloud_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str cloud_name: (required)
        :param int min_severity:
        :param str template:
        :param str min_time:
        :param str max_time:
        :param int min_id:
        :param int max_id:
        :param str orderby:
        :param bool desc:
        :param int page: The page number to start from.
        :param int per_page: The total number of records to return.
        :param str attributes: e.g attributes[source_type]=sn&attributes[source_name]=s1
        :return: InlineResponse20035
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['cloud_name', 'min_severity', 'template', 'min_time', 'max_time', 'min_id', 'max_id', 'orderby', 'desc', 'page', 'per_page', 'attributes']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_recent_event" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'cloud_name' is set
        if self.api_client.client_side_validation and ('cloud_name' not in params or
                                                       params['cloud_name'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `cloud_name` when calling `list_recent_event`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'cloud_name' in params:
            path_params['cloud_name'] = params['cloud_name']  # noqa: E501

        query_params = []
        if 'min_severity' in params:
            query_params.append(('min_severity', params['min_severity']))  # noqa: E501
        if 'template' in params:
            query_params.append(('template', params['template']))  # noqa: E501
        if 'min_time' in params:
            query_params.append(('min_time', params['min_time']))  # noqa: E501
        if 'max_time' in params:
            query_params.append(('max_time', params['max_time']))  # noqa: E501
        if 'min_id' in params:
            query_params.append(('min_id', params['min_id']))  # noqa: E501
        if 'max_id' in params:
            query_params.append(('max_id', params['max_id']))  # noqa: E501
        if 'orderby' in params:
            query_params.append(('orderby', params['orderby']))  # noqa: E501
        if 'desc' in params:
            query_params.append(('desc', params['desc']))  # noqa: E501
        if 'page' in params:
            query_params.append(('page', params['page']))  # noqa: E501
        if 'per_page' in params:
            query_params.append(('per_page', params['per_page']))  # noqa: E501
        if 'attributes' in params:
            query_params.append(('attributes', params['attributes']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json', 'application/xml'])  # noqa: E501

        # Authentication setting
        auth_settings = ['api_key']  # noqa: E501

        return self.api_client.call_api(
            '/clouds/{cloud_name}/logs.json', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='InlineResponse20035',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def retrieve_address_of_remote_rsyslog_server_list(self, cloud_name, **kwargs):  # noqa: E501
        """retrieve_address_of_remote_rsyslog_server_list  # noqa: E501

        Retrieve the the address list of a remote RSYSLOG servers.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.retrieve_address_of_remote_rsyslog_server_list(cloud_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str cloud_name: (required)
        :return: InlineResponse20037
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.retrieve_address_of_remote_rsyslog_server_list_with_http_info(cloud_name, **kwargs)  # noqa: E501
        else:
            (data) = self.retrieve_address_of_remote_rsyslog_server_list_with_http_info(cloud_name, **kwargs)  # noqa: E501
            return data

    def retrieve_address_of_remote_rsyslog_server_list_with_http_info(self, cloud_name, **kwargs):  # noqa: E501
        """retrieve_address_of_remote_rsyslog_server_list  # noqa: E501

        Retrieve the the address list of a remote RSYSLOG servers.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.retrieve_address_of_remote_rsyslog_server_list_with_http_info(cloud_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str cloud_name: (required)
        :return: InlineResponse20037
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['cloud_name']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method retrieve_address_of_remote_rsyslog_server_list" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'cloud_name' is set
        if self.api_client.client_side_validation and ('cloud_name' not in params or
                                                       params['cloud_name'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `cloud_name` when calling `retrieve_address_of_remote_rsyslog_server_list`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'cloud_name' in params:
            path_params['cloud_name'] = params['cloud_name']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json', 'application/xml'])  # noqa: E501

        # Authentication setting
        auth_settings = ['api_key']  # noqa: E501

        return self.api_client.call_api(
            '/clouds/{cloud_name}/logs/remote_addresses.json', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='InlineResponse20037',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)
