Class: MistApi::MSPsLogs

Inherits:
BaseController show all
Defined in:
lib/mist_api/controllers/ms_ps_logs.rb

Overview

MSPsLogs

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent

Constructor Details

This class inherits a constructor from MistApi::BaseController

Instance Method Details

#count_msp_audit_logs(msp_id, distinct: MspLogsCountDistinctEnum::ADMIN_NAME, limit: 100) ⇒ ApiResponse

Count by Distinct Attributes of Audit Logs. here Example:admin_name

Parameters:

  • msp_id (UUID | String)

    Required parameter: TODO: type description

  • distinct (MspLogsCountDistinctEnum) (defaults to: MspLogsCountDistinctEnum::ADMIN_NAME)

    Optional parameter:

  • limit (Integer) (defaults to: 100)

    Optional parameter: Example:100

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/mist_api/controllers/ms_ps_logs.rb', line 82

def count_msp_audit_logs(msp_id,
                         distinct: MspLogsCountDistinctEnum::ADMIN_NAME,
                         limit: 100)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/msps/{msp_id}/logs/count',
                                 Server::API_HOST)
               .template_param(new_parameter(msp_id, key: 'msp_id')
                                .should_encode(true))
               .query_param(new_parameter(distinct, key: 'distinct'))
               .query_param(new_parameter(limit, key: 'limit'))
               .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken'))))
    .response(new_response_handler
                .is_nullify404(true)
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ResponseCount.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Syntax',
                             APIException)
                .local_error('401',
                             'Unauthorized',
                             APIException)
                .local_error('403',
                             'Permission Denied',
                             APIException)
                .local_error('404',
                             'Not found. The API endpoint doesn’t exist or resource doesn’ t'\
                              ' exist',
                             APIException)
                .local_error('429',
                             'Too Many Request. The API Token used for the request reached'\
                              ' the 5000 API Calls per hour threshold',
                             APIException))
    .execute
end

#list_msp_audit_logs(msp_id, site_id: nil, admin_name: nil, message: nil, sort: nil, start: nil, mend: nil, duration: '1d', limit: 100, page: 1) ⇒ ApiResponse

Get list of change logs for the current MSP here seconds, or relative string like “-1d”, “-1w”) seconds, or relative string like “-1d”, “-2h”, “now”)

Parameters:

  • msp_id (UUID | String)

    Required parameter: TODO: type description

  • site_id (String) (defaults to: nil)

    Optional parameter: Site id

  • admin_name (String) (defaults to: nil)

    Optional parameter: Admin name or email

  • message (String) (defaults to: nil)

    Optional parameter: Message

  • sort (ListMspLogsSortEnum) (defaults to: nil)

    Optional parameter: Sort order

  • start (String) (defaults to: nil)

    Optional parameter: Start time (epoch timestamp in

  • mend (String) (defaults to: nil)

    Optional parameter: End time (epoch timestamp in

  • duration (String) (defaults to: '1d')

    Optional parameter: Duration like 7d, 2w

  • limit (Integer) (defaults to: 100)

    Optional parameter: Example:100

  • page (Integer) (defaults to: 1)

    Optional parameter: Example:1

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/mist_api/controllers/ms_ps_logs.rb', line 24

def list_msp_audit_logs(msp_id,
                        site_id: nil,
                        admin_name: nil,
                        message: nil,
                        sort: nil,
                        start: nil,
                        mend: nil,
                        duration: '1d',
                        limit: 100,
                        page: 1)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/msps/{msp_id}/logs',
                                 Server::API_HOST)
               .template_param(new_parameter(msp_id, key: 'msp_id')
                                .should_encode(true))
               .query_param(new_parameter(site_id, key: 'site_id'))
               .query_param(new_parameter(admin_name, key: 'admin_name'))
               .query_param(new_parameter(message, key: 'message'))
               .query_param(new_parameter(sort, key: 'sort'))
               .query_param(new_parameter(start, key: 'start'))
               .query_param(new_parameter(mend, key: 'end'))
               .query_param(new_parameter(duration, key: 'duration'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(page, key: 'page'))
               .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken'))))
    .response(new_response_handler
                .is_nullify404(true)
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ResponseLogSearch.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Syntax',
                             APIException)
                .local_error('401',
                             'Unauthorized',
                             APIException)
                .local_error('403',
                             'Permission Denied',
                             APIException)
                .local_error('404',
                             'Not found. The API endpoint doesn’t exist or resource doesn’ t'\
                              ' exist',
                             APIException)
                .local_error('429',
                             'Too Many Request. The API Token used for the request reached'\
                              ' the 5000 API Calls per hour threshold',
                             APIException))
    .execute
end