Class: MistApi::MSPsOrgs

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

Overview

MSPsOrgs

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

#create_msp_org(msp_id, body: nil) ⇒ ApiResponse

Create an Org under MSP here

Parameters:

  • msp_id (UUID | String)

    Required parameter: TODO: type description

  • body (Org) (defaults to: nil)

    Optional parameter: Request Body

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
85
86
87
# File 'lib/mist_api/controllers/ms_ps_orgs.rb', line 52

def create_msp_org(msp_id,
                   body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/v1/msps/{msp_id}/orgs',
                                 Server::API_HOST)
               .template_param(new_parameter(msp_id, key: 'msp_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .body_serializer(proc do |param| param.to_json unless param.nil? 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(Org.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

#delete_msp_org(msp_id, org_id) ⇒ ApiResponse

Delete MSP Org here here

Parameters:

  • msp_id (UUID | String)

    Required parameter: TODO: type description

  • org_id (UUID | String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/mist_api/controllers/ms_ps_orgs.rb', line 212

def delete_msp_org(msp_id,
                   org_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/api/v1/msps/{msp_id}/orgs/{org_id}',
                                 Server::API_HOST)
               .template_param(new_parameter(msp_id, key: 'msp_id')
                                .should_encode(true))
               .template_param(new_parameter(org_id, key: 'org_id')
                                .should_encode(true))
               .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken'))))
    .response(new_response_handler
                .is_nullify404(true)
                .is_response_void(true)
                .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

#get_msp_org(msp_id, org_id) ⇒ ApiResponse

Get MSP Org Details here here

Parameters:

  • msp_id (UUID | String)

    Required parameter: TODO: type description

  • org_id (UUID | String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/mist_api/controllers/ms_ps_orgs.rb', line 253

def get_msp_org(msp_id,
                org_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/msps/{msp_id}/orgs/{org_id}',
                                 Server::API_HOST)
               .template_param(new_parameter(msp_id, key: 'msp_id')
                                .should_encode(true))
               .template_param(new_parameter(org_id, key: 'org_id')
                                .should_encode(true))
               .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken'))))
    .response(new_response_handler
                .is_nullify404(true)
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Org.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_org_stats(msp_id, limit: 100, page: 1) ⇒ ApiResponse

Get List of MSP Orgs Stats here

Parameters:

  • msp_id (UUID | String)

    Required parameter: TODO: type description

  • 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.



342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/mist_api/controllers/ms_ps_orgs.rb', line 342

def list_msp_org_stats(msp_id,
                       limit: 100,
                       page: 1)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/msps/{msp_id}/stats/orgs',
                                 Server::API_HOST)
               .template_param(new_parameter(msp_id, key: 'msp_id')
                                .should_encode(true))
               .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(StatsOrg.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_msp_orgs(msp_id) ⇒ ApiResponse

Get List of MSP Orgs here

Parameters:

  • msp_id (UUID | String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



13
14
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
# File 'lib/mist_api/controllers/ms_ps_orgs.rb', line 13

def list_msp_orgs(msp_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/msps/{msp_id}/orgs',
                                 Server::API_HOST)
               .template_param(new_parameter(msp_id, key: 'msp_id')
                                .should_encode(true))
               .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken'))))
    .response(new_response_handler
                .is_nullify404(true)
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Org.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

#manage_msp_orgs(msp_id, body: nil) ⇒ ApiResponse

Assign or Unassign Orgs to an MSP account here

Parameters:

  • msp_id (UUID | String)

    Required parameter: TODO: type description

  • body (MspOrgChange) (defaults to: nil)

    Optional parameter: Request Body

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
119
120
121
122
123
124
125
126
127
128
# File 'lib/mist_api/controllers/ms_ps_orgs.rb', line 94

def manage_msp_orgs(msp_id,
                    body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/api/v1/msps/{msp_id}/orgs',
                                 Server::API_HOST)
               .template_param(new_parameter(msp_id, key: 'msp_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken'))))
    .response(new_response_handler
                .is_nullify404(true)
                .is_response_void(true)
                .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

#search_msp_orgs(msp_id, name: nil, org_id: nil, sub_insufficient: nil, trial_enabled: nil, usage_types: nil, limit: 100, sort: 'timestamp', start: nil, mend: nil, search_after: nil) ⇒ ApiResponse

Search Org in MSP here this org has sufficient subscription org is under trial period enabled by usage sorted, -prefix represents DESC order seconds, or relative string like “-1d”, “-1w”) seconds, or relative string like “-1d”, “-2h”, “now”) retrieving subsequent pages of results. This value is automatically populated by Mist in the ‘next` URL from the previous response and should not be manually constructed.

Parameters:

  • msp_id (UUID | String)

    Required parameter: TODO: type description

  • name (String) (defaults to: nil)

    Optional parameter: TODO: type description here

  • org_id (UUID | String) (defaults to: nil)

    Optional parameter: Org id

  • sub_insufficient (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: If

  • trial_enabled (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: If this

  • usage_types (Array[String]) (defaults to: nil)

    Optional parameter: List of types that

  • limit (Integer) (defaults to: 100)

    Optional parameter: Example:100

  • sort (String) (defaults to: 'timestamp')

    Optional parameter: On which field the list should be

  • start (String) (defaults to: nil)

    Optional parameter: Start time (epoch timestamp in

  • mend (String) (defaults to: nil)

    Optional parameter: End time (epoch timestamp in

  • search_after (String) (defaults to: nil)

    Optional parameter: Pagination cursor for

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/mist_api/controllers/ms_ps_orgs.rb', line 153

def search_msp_orgs(msp_id,
                    name: nil,
                    org_id: nil,
                    sub_insufficient: nil,
                    trial_enabled: nil,
                    usage_types: nil,
                    limit: 100,
                    sort: 'timestamp',
                    start: nil,
                    mend: nil,
                    search_after: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/msps/{msp_id}/orgs/search',
                                 Server::API_HOST)
               .template_param(new_parameter(msp_id, key: 'msp_id')
                                .should_encode(true))
               .query_param(new_parameter(name, key: 'name'))
               .query_param(new_parameter(org_id, key: 'org_id'))
               .query_param(new_parameter(sub_insufficient, key: 'sub_insufficient'))
               .query_param(new_parameter(trial_enabled, key: 'trial_enabled'))
               .query_param(new_parameter(usage_types, key: 'usage_types'))
               .query_param(new_parameter(limit, key: 'limit'))
               .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(search_after, key: 'search_after'))
               .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken'))))
    .response(new_response_handler
                .is_nullify404(true)
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ResponseOrgSearch.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

#update_msp_org(msp_id, org_id, body: nil) ⇒ ApiResponse

Update MSP Org here here

Parameters:

  • msp_id (UUID | String)

    Required parameter: TODO: type description

  • org_id (UUID | String)

    Required parameter: TODO: type description

  • body (Org) (defaults to: nil)

    Optional parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/mist_api/controllers/ms_ps_orgs.rb', line 296

def update_msp_org(msp_id,
                   org_id,
                   body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/api/v1/msps/{msp_id}/orgs/{org_id}',
                                 Server::API_HOST)
               .template_param(new_parameter(msp_id, key: 'msp_id')
                                .should_encode(true))
               .template_param(new_parameter(org_id, key: 'org_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .body_serializer(proc do |param| param.to_json unless param.nil? 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(Org.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