# 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 LogsApi(object):
[docs] def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
[docs] def get_audit_logs(self, size=None, _from=None, action_type=None, actor_type=None, actor_id=None, object_id=None, severity=None, range_from=None, range_to=None, async_call=False, **kwargs):
"""
Get audit log entries matching the requested filters.
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type size: `int`
:param size: Maximum number of entries to return. The input value can't be greater than 1000. If a higher value is specifed, only 1000 results are returned.
:type _from: `int`
:param _from: For pagination, starting offset
:type action_type: `str`
:param action_type: Event action type
:type actor_type: `str`
:param actor_type: Event actor type
:type actor_id: `str`
:param actor_id: Actor (User or App) Identifier
:type object_id: `str`
:param object_id: Object (User or App) Identifier for event
:type severity: `str`
:param severity: Event severity type
: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
:rtype: `AuditLogResponse`
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.get_audit_logs_with_http_info(size=size, _from=_from, action_type=action_type, actor_type=actor_type, actor_id=actor_id, object_id=object_id, severity=severity, range_from=range_from, range_to=range_to, async_call=async_call, **kwargs)
else:
(data) = self.get_audit_logs_with_http_info(size=size, _from=_from, action_type=action_type, actor_type=actor_type, actor_id=actor_id, object_id=object_id, severity=severity, range_from=range_from, range_to=range_to, async_call=async_call, **kwargs)
return data
def get_audit_logs_with_http_info(self, size=None, _from=None, action_type=None, actor_type=None, actor_id=None, object_id=None, severity=None, range_from=None, range_to=None, async_call=False, **kwargs):
"""
Get audit log entries matching the requested filters.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.get_audit_logs_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 size: `int`
:param size: Maximum number of entries to return. The input value can't be greater than 1000. If a higher value is specifed, only 1000 results are returned.
:type _from: `int`
:param _from: For pagination, starting offset
:type action_type: `str`
:param action_type: Event action type
:type actor_type: `str`
:param actor_type: Event actor type
:type actor_id: `str`
:param actor_id: Actor (User or App) Identifier
:type object_id: `str`
:param object_id: Object (User or App) Identifier for event
:type severity: `str`
:param severity: Event severity type
: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
:rtype: `AuditLogResponse`
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['size', '_from', 'action_type', 'actor_type', 'actor_id', 'object_id', 'severity', 'range_from', 'range_to']
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_audit_logs" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
if 'size' in params:
query_params.append(('size', params['size']))
if '_from' in params:
query_params.append(('from', params['_from']))
if 'action_type' in params:
query_params.append(('action_type', params['action_type']))
if 'actor_type' in params:
query_params.append(('actor_type', params['actor_type']))
if 'actor_id' in params:
query_params.append(('actor_id', params['actor_id']))
if 'object_id' in params:
query_params.append(('object_id', params['object_id']))
if 'severity' in params:
query_params.append(('severity', params['severity']))
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']))
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/logs', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='AuditLogResponse',
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)