# coding: utf-8

"""
    Zadara VPSA Object Storage REST API

    # Overview  This document outlines the methods available for administrating your VPSA&#174; Object Storage. The API supports form-encoded, JSON, and XML requests, and can return either JSON or XML responses.  ## Usage  The majority of the APIs available require authentication which requires an API token to use. You can retrieve this token through the Users section of your VPSA, or through the API using the \"Return a user's access key\" API in the Users Section below.  ## Authentication Methods  The authentication token can be passed either through the access_key parameter inside of the body of the REST API request, or through the X-Access-Key header. Alternately, you can use the username and password parameters for authentication, but we do not recommend this method for anything other than possibly retrieving an API key.  By default , all operations are allowed only to VPSA Object Storage admin. Some actions are allowed by an account admin and they will be marked on the action's header  ## Timeouts  By default, all operations that don't complete within five seconds will return a message informing you that the action may take some time to complete. When using the API, this can cause some actions, such as adding drives to storage policy, to be undesirably asynchronous. You can specify your own timeout with the timeout parameter, in seconds, and a timeout value of -1 specifies an infinite timeout.  ## Metering API  Metering information can be retrieved using the VPSA Object Storage API for the following components:  - Accounts - Users - Drives - Virtual Controllers - Load Balancer Groups - Storage Policies  Metering information returned by the API is subject to the following constraints:  - 10 seconds interval - 1 hour range - 1 minute interval - 1 day range - 1 hour interval - 30 days range  Values outside the accepted range will be returned as 0.  ## Questions  If you have any questions or need support involving the REST API, please contact for assistance.   # noqa: E501

    OpenAPI spec version: 23.09-sp2
    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 Zios.api_client import ApiClient


class UsageReportsApi(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 generate_usage_reports(self, **kwargs):  # noqa: E501
        """generate_usage_reports  # noqa: E501

        Generate a usage report. Each account lists the following for each policy: capacity, number of objects, number of containers, data transfer in, data transfer out  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.generate_usage_reports(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str report_time: Type of time frame for report
        :param str report_type: Type of time frame for report
        :param str fromdate: Start time (YYYY-MM-DD). Required for custom report.
        :param str todate: End time (YYYY-MM-DD). Required for custom report.
        :param str month: Month of the year, (e.g. 4). Required for monthly report.
        :param str account_id: Account id. Default is user's account.
        :return: InlineResponse20048
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.generate_usage_reports_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.generate_usage_reports_with_http_info(**kwargs)  # noqa: E501
            return data

    def generate_usage_reports_with_http_info(self, **kwargs):  # noqa: E501
        """generate_usage_reports  # noqa: E501

        Generate a usage report. Each account lists the following for each policy: capacity, number of objects, number of containers, data transfer in, data transfer out  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.generate_usage_reports_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str report_time: Type of time frame for report
        :param str report_type: Type of time frame for report
        :param str fromdate: Start time (YYYY-MM-DD). Required for custom report.
        :param str todate: End time (YYYY-MM-DD). Required for custom report.
        :param str month: Month of the year, (e.g. 4). Required for monthly report.
        :param str account_id: Account id. Default is user's account.
        :return: InlineResponse20048
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['report_time', 'report_type', 'fromdate', 'todate', 'month', 'account_id']  # 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 generate_usage_reports" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'report_time' in params:
            query_params.append(('report_time', params['report_time']))  # noqa: E501
        if 'report_type' in params:
            query_params.append(('report_type', params['report_type']))  # noqa: E501
        if 'fromdate' in params:
            query_params.append(('fromdate', params['fromdate']))  # noqa: E501
        if 'todate' in params:
            query_params.append(('todate', params['todate']))  # noqa: E501
        if 'month' in params:
            query_params.append(('month', params['month']))  # noqa: E501
        if 'account_id' in params:
            query_params.append(('account_id', params['account_id']))  # 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(
            '/zios/usage_reports/generate.json', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='InlineResponse20048',  # 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)
