# coding: utf-8

"""
    Fabric Orchestrator API
    This is Fabric Orchestrator API  # noqa: E501
    OpenAPI spec version: 1.0.1
    Contact: kthare10@unc.edu
    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 fabric_cf.orchestrator.swagger_client.api_client import ApiClient


class ResourcesApi(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 portalresources_get(self, graph_format, **kwargs):  # noqa: E501
        """Retrieve a listing and description of available resources for portal  # noqa: E501

        Retrieve a listing and description of available resources for portal  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.portalresources_get(graph_format, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str graph_format: graph format (required)
        :param int level: Level of details
        :param bool force_refresh: Force to retrieve current available resource information.
        :param str start_date: starting date to check availability from
        :param str end_date: end date to check availability until
        :param str includes: comma separated lists of sites to include
        :param str excludes: comma separated lists of sites to exclude
        :return: Resources
                 If the method is called asynchronously,
                 returns the request thread.
        """
        # Remove all arguments with None value from kwargs
        kwargs = {key: value for key, value in kwargs.items() if value is not None}
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.portalresources_get_with_http_info(graph_format, **kwargs)  # noqa: E501
        else:
            (data) = self.portalresources_get_with_http_info(graph_format, **kwargs)  # noqa: E501
            return data

    def portalresources_get_with_http_info(self, graph_format, **kwargs):  # noqa: E501
        """Retrieve a listing and description of available resources for portal  # noqa: E501

        Retrieve a listing and description of available resources for portal  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.portalresources_get_with_http_info(graph_format, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str graph_format: graph format (required)
        :param int level: Level of details
        :param bool force_refresh: Force to retrieve current available resource information.
        :param str start_date: starting date to check availability from
        :param str end_date: end date to check availability until
        :param str includes: comma separated lists of sites to include
        :param str excludes: comma separated lists of sites to exclude
        :return: Resources
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['graph_format', 'level', 'force_refresh', 'start_date', 'end_date', 'includes', 'excludes']  # 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 portalresources_get" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'graph_format' is set
        if ('graph_format' not in params or
                params['graph_format'] is None):
            raise ValueError("Missing the required parameter `graph_format` when calling `portalresources_get`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'graph_format' in params:
            query_params.append(('graph_format', params['graph_format']))  # noqa: E501
        if 'level' in params:
            query_params.append(('level', params['level']))  # noqa: E501
        if 'force_refresh' in params:
            query_params.append(('force_refresh', params['force_refresh']))  # noqa: E501
        if 'start_date' in params:
            query_params.append(('start_date', params['start_date']))  # noqa: E501
        if 'end_date' in params:
            query_params.append(('end_date', params['end_date']))  # noqa: E501
        if 'includes' in params:
            query_params.append(('includes', params['includes']))  # noqa: E501
        if 'excludes' in params:
            query_params.append(('excludes', params['excludes']))  # 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'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/portalresources', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Resources',  # 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 resources_get(self, level, force_refresh, **kwargs):  # noqa: E501
        """Retrieve a listing and description of available resources. By default, a cached available resource information is returned. User can force to request the current available resources.  # noqa: E501

        Retrieve a listing and description of available resources. By default, a cached available resource information is returned. User can force to request the current available resources.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.resources_get(level, force_refresh, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int level: Level of details (required)
        :param bool force_refresh: Force to retrieve current available resource information. (required)
        :param str start_date: starting date to check availability from
        :param str end_date: end date to check availability until
        :param str includes: comma separated lists of sites to include
        :param str excludes: comma separated lists of sites to exclude
        :return: Resources
                 If the method is called asynchronously,
                 returns the request thread.
        """
        # Remove all arguments with None value from kwargs
        kwargs = {key: value for key, value in kwargs.items() if value is not None}
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.resources_get_with_http_info(level, force_refresh, **kwargs)  # noqa: E501
        else:
            (data) = self.resources_get_with_http_info(level, force_refresh, **kwargs)  # noqa: E501
            return data

    def resources_get_with_http_info(self, level, force_refresh, **kwargs):  # noqa: E501
        """Retrieve a listing and description of available resources. By default, a cached available resource information is returned. User can force to request the current available resources.  # noqa: E501
        Retrieve a listing and description of available resources. By default, a cached available resource information is returned. User can force to request the current available resources.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.resources_get_with_http_info(level, force_refresh, async_req=True)
        >>> result = thread.get()
        :param async_req bool
        :param int level: Level of details (required)
        :param bool force_refresh: Force to retrieve current available resource information. (required)
        :param str start_date: starting date to check availability from
        :param str end_date: end date to check availability until
        :param str includes: comma separated lists of sites to include
        :param str excludes: comma separated lists of sites to exclude
        :return: Resources
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['level', 'force_refresh', 'start_date', 'end_date', 'includes', 'excludes']  # 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 resources_get" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'level' is set
        if ('level' not in params or
                params['level'] is None):
            raise ValueError("Missing the required parameter `level` when calling `resources_get`")  # noqa: E501
        # verify the required parameter 'force_refresh' is set
        if ('force_refresh' not in params or
                params['force_refresh'] is None):
            raise ValueError("Missing the required parameter `force_refresh` when calling `resources_get`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'level' in params:
            query_params.append(('level', params['level']))  # noqa: E501
        if 'force_refresh' in params:
            query_params.append(('force_refresh', params['force_refresh']))  # noqa: E501
        if 'start_date' in params:
            query_params.append(('start_date', params['start_date']))  # noqa: E501
        if 'end_date' in params:
            query_params.append(('end_date', params['end_date']))  # noqa: E501
        if 'includes' in params:
            query_params.append(('includes', params['includes']))  # noqa: E501
        if 'excludes' in params:
            query_params.append(('excludes', params['excludes']))  # 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'])  # noqa: E501

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

        return self.api_client.call_api(
            '/resources', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Resources',  # 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)
