Source code for sdkms.v1.apis.stats_api

# coding: utf-8

"""
    Fortanix DSM REST API

    This is a set of REST APIs for accessing the Fortanix Data Security Manager. This includes APIs for managing accounts, and for performing cryptographic and key management operations. 

    OpenAPI spec version: 1.0.0-20200608
    Contact: support@fortanix.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
    
        http://www.apache.org/licenses/LICENSE-2.0
    
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""


from __future__ import absolute_import

import sys
import os
import re

# python 2 and python 3 compatibility library
from six import iteritems

from ..api_client import ApiClient


# 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
[docs]class StatsApi(object):
[docs] def __init__(self, api_client=None): if api_client is None: api_client = ApiClient() self.api_client = api_client
[docs] def get_app_stats(self, app_id, range_from=None, range_to=None, num_points=None, async_call=False, **kwargs): """ This API is for obtaining transaction statistics for a specific application. API supports query parameters for fetchings stats for specific time period and with number of data points desired. :type async_call: bool :param async_call: Whether the call should be performed asynchronously. (Default is False). :type app_id: `str` :param app_id: Application Identifier (required) :type range_from: `int` :param range_from: Starting time for search , this is EPOCH value :type range_to: `int` :param range_to: Ending time for search , this is EPOCH value :type num_points: `int` :param num_points: Number of data points desired :rtype: `StatsResponse` :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if async_call: return self.get_app_stats_with_http_info(app_id, range_from=range_from, range_to=range_to, num_points=num_points, async_call=async_call, **kwargs) else: (data) = self.get_app_stats_with_http_info(app_id, range_from=range_from, range_to=range_to, num_points=num_points, async_call=async_call, **kwargs) return data
def get_app_stats_with_http_info(self, app_id, range_from=None, range_to=None, num_points=None, async_call=False, **kwargs): """ This API is for obtaining transaction statistics for a specific application. API supports query parameters for fetchings stats for specific time period and with number of data points desired. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_call=True:: >>> thread = api.get_app_stats_with_http_info(app_id, async_call=True) >>> result = thread.get() :type async_call: bool :param async_call: Whether the call should be performed asynchronously. (Default is False). :type app_id: `str` :param app_id: Application Identifier (required) :type range_from: `int` :param range_from: Starting time for search , this is EPOCH value :type range_to: `int` :param range_to: Ending time for search , this is EPOCH value :type num_points: `int` :param num_points: Number of data points desired :rtype: `StatsResponse` :return: If the method is called asynchronously, returns the request thread. """ all_params = ['app_id', 'range_from', 'range_to', 'num_points'] all_params.append('async_call') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_app_stats" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'app_id' is set if ('app_id' not in params) or (params['app_id'] is None): raise ValueError("Missing the required parameter `app_id` when calling `get_app_stats`") collection_formats = {} path_params = {} if 'app_id' in params: path_params['app-id'] = params['app_id'] query_params = [] if 'range_from' in params: query_params.append(('range_from', params['range_from'])) if 'range_to' in params: query_params.append(('range_to', params['range_to'])) if 'num_points' in params: query_params.append(('num_points', params['num_points'])) header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) # Authentication setting auth_settings = ['bearerToken'] return self.api_client.call_api('/sys/v1/stats/{app-id}/app', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='StatsResponse', auth_settings=auth_settings, async_call=params.get('async_call'), _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)
[docs] def get_apps_stats(self, range_from=None, range_to=None, top_count=None, num_points=None, async_call=False, **kwargs): """ This is for obtaining app level aggregate transaction statistics to find top apps by transaction. API supports query parameters for fetchings stats for specific time period, for maximum top count and with number of data points desired. :type async_call: bool :param async_call: Whether the call should be performed asynchronously. (Default is False). :type range_from: `int` :param range_from: Starting time for search , this is EPOCH value :type range_to: `int` :param range_to: Ending time for search , this is EPOCH value :type top_count: `int` :param top_count: Maximum top count for statistics query :type num_points: `int` :param num_points: Number of data points desired :rtype: `StatsResponse` :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if async_call: return self.get_apps_stats_with_http_info(range_from=range_from, range_to=range_to, top_count=top_count, num_points=num_points, async_call=async_call, **kwargs) else: (data) = self.get_apps_stats_with_http_info(range_from=range_from, range_to=range_to, top_count=top_count, num_points=num_points, async_call=async_call, **kwargs) return data
def get_apps_stats_with_http_info(self, range_from=None, range_to=None, top_count=None, num_points=None, async_call=False, **kwargs): """ This is for obtaining app level aggregate transaction statistics to find top apps by transaction. API supports query parameters for fetchings stats for specific time period, for maximum top count and with number of data points desired. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_call=True:: >>> thread = api.get_apps_stats_with_http_info(async_call=True) >>> result = thread.get() :type async_call: bool :param async_call: Whether the call should be performed asynchronously. (Default is False). :type range_from: `int` :param range_from: Starting time for search , this is EPOCH value :type range_to: `int` :param range_to: Ending time for search , this is EPOCH value :type top_count: `int` :param top_count: Maximum top count for statistics query :type num_points: `int` :param num_points: Number of data points desired :rtype: `StatsResponse` :return: If the method is called asynchronously, returns the request thread. """ all_params = ['range_from', 'range_to', 'top_count', 'num_points'] all_params.append('async_call') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_apps_stats" % key ) params[key] = val del params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'range_from' in params: query_params.append(('range_from', params['range_from'])) if 'range_to' in params: query_params.append(('range_to', params['range_to'])) if 'top_count' in params: query_params.append(('top_count', params['top_count'])) if 'num_points' in params: query_params.append(('num_points', params['num_points'])) header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) # Authentication setting auth_settings = ['bearerToken'] return self.api_client.call_api('/sys/v1/stats/apps', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='StatsResponse', auth_settings=auth_settings, async_call=params.get('async_call'), _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)
[docs] def get_group_stats(self, group_id, range_from=None, range_to=None, num_points=None, async_call=False, **kwargs): """ This API is for obtaining transaction statistics for a specific group. API supports query parameters for fetchings stats for specific time period and with number of data points desired. :type async_call: bool :param async_call: Whether the call should be performed asynchronously. (Default is False). :type group_id: `str` :param group_id: Group Identifier (required) :type range_from: `int` :param range_from: Starting time for search , this is EPOCH value :type range_to: `int` :param range_to: Ending time for search , this is EPOCH value :type num_points: `int` :param num_points: Number of data points desired :rtype: `StatsResponse` :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if async_call: return self.get_group_stats_with_http_info(group_id, range_from=range_from, range_to=range_to, num_points=num_points, async_call=async_call, **kwargs) else: (data) = self.get_group_stats_with_http_info(group_id, range_from=range_from, range_to=range_to, num_points=num_points, async_call=async_call, **kwargs) return data
def get_group_stats_with_http_info(self, group_id, range_from=None, range_to=None, num_points=None, async_call=False, **kwargs): """ This API is for obtaining transaction statistics for a specific group. API supports query parameters for fetchings stats for specific time period and with number of data points desired. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_call=True:: >>> thread = api.get_group_stats_with_http_info(group_id, async_call=True) >>> result = thread.get() :type async_call: bool :param async_call: Whether the call should be performed asynchronously. (Default is False). :type group_id: `str` :param group_id: Group Identifier (required) :type range_from: `int` :param range_from: Starting time for search , this is EPOCH value :type range_to: `int` :param range_to: Ending time for search , this is EPOCH value :type num_points: `int` :param num_points: Number of data points desired :rtype: `StatsResponse` :return: If the method is called asynchronously, returns the request thread. """ all_params = ['group_id', 'range_from', 'range_to', 'num_points'] all_params.append('async_call') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_group_stats" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'group_id' is set if ('group_id' not in params) or (params['group_id'] is None): raise ValueError("Missing the required parameter `group_id` when calling `get_group_stats`") collection_formats = {} path_params = {} if 'group_id' in params: path_params['group-id'] = params['group_id'] query_params = [] if 'range_from' in params: query_params.append(('range_from', params['range_from'])) if 'range_to' in params: query_params.append(('range_to', params['range_to'])) if 'num_points' in params: query_params.append(('num_points', params['num_points'])) header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) # Authentication setting auth_settings = ['bearerToken'] return self.api_client.call_api('/sys/v1/stats/{group-id}/group', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='StatsResponse', auth_settings=auth_settings, async_call=params.get('async_call'), _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)
[docs] def get_groups_stats(self, range_from=None, range_to=None, top_count=None, num_points=None, async_call=False, **kwargs): """ This is for obtaining group level aggregate transaction statistics to find top groups by transaction. API supports query parameters for fetchings stats for specific time period, for maximum top count and with number of data points desired. :type async_call: bool :param async_call: Whether the call should be performed asynchronously. (Default is False). :type range_from: `int` :param range_from: Starting time for search , this is EPOCH value :type range_to: `int` :param range_to: Ending time for search , this is EPOCH value :type top_count: `int` :param top_count: Maximum top count for statistics query :type num_points: `int` :param num_points: Number of data points desired :rtype: `StatsResponse` :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if async_call: return self.get_groups_stats_with_http_info(range_from=range_from, range_to=range_to, top_count=top_count, num_points=num_points, async_call=async_call, **kwargs) else: (data) = self.get_groups_stats_with_http_info(range_from=range_from, range_to=range_to, top_count=top_count, num_points=num_points, async_call=async_call, **kwargs) return data
def get_groups_stats_with_http_info(self, range_from=None, range_to=None, top_count=None, num_points=None, async_call=False, **kwargs): """ This is for obtaining group level aggregate transaction statistics to find top groups by transaction. API supports query parameters for fetchings stats for specific time period, for maximum top count and with number of data points desired. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_call=True:: >>> thread = api.get_groups_stats_with_http_info(async_call=True) >>> result = thread.get() :type async_call: bool :param async_call: Whether the call should be performed asynchronously. (Default is False). :type range_from: `int` :param range_from: Starting time for search , this is EPOCH value :type range_to: `int` :param range_to: Ending time for search , this is EPOCH value :type top_count: `int` :param top_count: Maximum top count for statistics query :type num_points: `int` :param num_points: Number of data points desired :rtype: `StatsResponse` :return: If the method is called asynchronously, returns the request thread. """ all_params = ['range_from', 'range_to', 'top_count', 'num_points'] all_params.append('async_call') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_groups_stats" % key ) params[key] = val del params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'range_from' in params: query_params.append(('range_from', params['range_from'])) if 'range_to' in params: query_params.append(('range_to', params['range_to'])) if 'top_count' in params: query_params.append(('top_count', params['top_count'])) if 'num_points' in params: query_params.append(('num_points', params['num_points'])) header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) # Authentication setting auth_settings = ['bearerToken'] return self.api_client.call_api('/sys/v1/stats/groups', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='StatsResponse', auth_settings=auth_settings, async_call=params.get('async_call'), _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)
[docs] def get_security_object_stats(self, key_id, range_from=None, range_to=None, num_points=None, async_call=False, **kwargs): """ This API is for obtaining transaction statistics for a specific security object. API supports query parameters for fetchings stats for specific time period and with number of data points desired. :type async_call: bool :param async_call: Whether the call should be performed asynchronously. (Default is False). :type key_id: `str` :param key_id: kid of security object (required) :type range_from: `int` :param range_from: Starting time for search , this is EPOCH value :type range_to: `int` :param range_to: Ending time for search , this is EPOCH value :type num_points: `int` :param num_points: Number of data points desired :rtype: `StatsResponse` :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if async_call: return self.get_security_object_stats_with_http_info(key_id, range_from=range_from, range_to=range_to, num_points=num_points, async_call=async_call, **kwargs) else: (data) = self.get_security_object_stats_with_http_info(key_id, range_from=range_from, range_to=range_to, num_points=num_points, async_call=async_call, **kwargs) return data
def get_security_object_stats_with_http_info(self, key_id, range_from=None, range_to=None, num_points=None, async_call=False, **kwargs): """ This API is for obtaining transaction statistics for a specific security object. API supports query parameters for fetchings stats for specific time period and with number of data points desired. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_call=True:: >>> thread = api.get_security_object_stats_with_http_info(key_id, async_call=True) >>> result = thread.get() :type async_call: bool :param async_call: Whether the call should be performed asynchronously. (Default is False). :type key_id: `str` :param key_id: kid of security object (required) :type range_from: `int` :param range_from: Starting time for search , this is EPOCH value :type range_to: `int` :param range_to: Ending time for search , this is EPOCH value :type num_points: `int` :param num_points: Number of data points desired :rtype: `StatsResponse` :return: If the method is called asynchronously, returns the request thread. """ all_params = ['key_id', 'range_from', 'range_to', 'num_points'] all_params.append('async_call') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_security_object_stats" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'key_id' is set if ('key_id' not in params) or (params['key_id'] is None): raise ValueError("Missing the required parameter `key_id` when calling `get_security_object_stats`") collection_formats = {} path_params = {} if 'key_id' in params: path_params['key-id'] = params['key_id'] query_params = [] if 'range_from' in params: query_params.append(('range_from', params['range_from'])) if 'range_to' in params: query_params.append(('range_to', params['range_to'])) if 'num_points' in params: query_params.append(('num_points', params['num_points'])) header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) # Authentication setting auth_settings = ['bearerToken'] return self.api_client.call_api('/sys/v1/stats/{key-id}/key', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='StatsResponse', auth_settings=auth_settings, async_call=params.get('async_call'), _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)