Class: MistApi::MSPsSLEs

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

Overview

MSPsSLEs

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

#get_msp_sle(msp_id, metric, sle: nil, duration: '1d', interval: nil, start: nil, mend: nil) ⇒ ApiResponse

Get MSP SLEs (all/worst Orgs …) here Metrics]($e/Constants%20Definitions/listInsightMetrics) for available metrics Metrics]($e/Constants%20Definitions/listInsightMetrics) for more details time range plus interval (e.g. 1d, 1h, 10m) where aggregation function would be applied to. 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

  • metric (String)

    Required parameter: See [List Insight

  • sle (String) (defaults to: nil)

    Optional parameter: See [List Insight

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

    Optional parameter: Duration like 7d, 2w

  • interval (String) (defaults to: nil)

    Optional parameter: Aggregation works by giving a

  • start (String) (defaults to: nil)

    Optional parameter: Start time (epoch timestamp in

  • mend (String) (defaults to: nil)

    Optional parameter: End time (epoch timestamp in

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/mist_api/controllers/ms_ps_sl_es.rb', line 26

def get_msp_sle(msp_id,
                metric,
                sle: nil,
                duration: '1d',
                interval: nil,
                start: nil,
                mend: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/msps/{msp_id}/insights/{metric}',
                                 Server::API_HOST)
               .template_param(new_parameter(msp_id, key: 'msp_id')
                                .should_encode(true))
               .template_param(new_parameter(metric, key: 'metric')
                                .should_encode(true))
               .query_param(new_parameter(sle, key: 'sle'))
               .query_param(new_parameter(duration, key: 'duration'))
               .query_param(new_parameter(interval, key: 'interval'))
               .query_param(new_parameter(start, key: 'start'))
               .query_param(new_parameter(mend, key: 'end'))
               .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken'))))
    .response(new_response_handler
                .is_nullify404(true)
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InsightMetrics.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