Class: MistApi::ConstantsModels

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

Overview

ConstantsModels

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_gateway_default_config(model, ha: nil) ⇒ ApiResponse

Generate Default Gateway Config is intended (as the default LAN/WAN port can differ) HA

Parameters:

  • model (String)

    Required parameter: Model the default gateway config

  • ha (String) (defaults to: nil)

    Optional parameter: Whether the config is intended for

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/mist_api/controllers/constants_models.rb', line 15

def get_gateway_default_config(model,
                               ha: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/const/default_gateway_config',
                                 Server::API_HOST)
               .query_param(new_parameter(model, key: 'model'))
               .query_param(new_parameter(ha, key: 'ha'))
               .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken'))))
    .response(new_response_handler
                .is_nullify404(true)
                .deserializer(APIHelper.method(:json_deserialize))
                .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_device_modelsApiResponse

Get list of AP device models for the Mist Site

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/mist_api/controllers/constants_models.rb', line 50

def list_device_models
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/const/device_models',
                                 Server::API_HOST)
               .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken'))))
    .response(new_response_handler
                .is_nullify404(true)
                .deserializer(proc do |response, should_symbolize|
                  APIHelper.deserialize_union_type(
                    UnionTypeLookUp.get(:ConstDeviceModel),
                    response, should_symbolize, true
                  )
                end)
                .is_api_response(true)
                .is_response_array(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_mx_edge_modelsApiResponse

Get List of available Mx Edge models

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
118
# File 'lib/mist_api/controllers/constants_models.rb', line 88

def list_mx_edge_models
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/const/mxedge_models',
                                 Server::API_HOST)
               .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken'))))
    .response(new_response_handler
                .is_nullify404(true)
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ConstMxedgeModel.method(:from_hash))
                .is_api_response(true)
                .is_response_array(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_supported_other_device_modelsApiResponse

Supported OtherDevice Models

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/mist_api/controllers/constants_models.rb', line 122

def list_supported_other_device_models
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/const/otherdevice_models',
                                 Server::API_HOST)
               .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken'))))
    .response(new_response_handler
                .is_nullify404(true)
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ConstOtherDeviceModel.method(:from_hash))
                .is_api_response(true)
                .is_response_array(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