Class: Nodeum::NasApi

Inherits:
Object
  • Object
show all
Defined in:
lib/nodeum_sdk/api/nas_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ NasApi

Returns a new instance of NasApi.



19
20
21
# File 'lib/nodeum_sdk/api/nas_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/nodeum_sdk/api/nas_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_nas(nas_body, opts = {}) ⇒ Nas

Creates a new NAS. **API Key Scope**: nas / create

Parameters:

  • nas_body (Nas)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/nodeum_sdk/api/nas_api.rb', line 27

def create_nas(nas_body, opts = {})
  data, _status_code, _headers = create_nas_with_http_info(nas_body, opts)
  data
end

#create_nas_with_http_info(nas_body, opts = {}) ⇒ Array<(Nas, Integer, Hash)>

Creates a new NAS. **API Key Scope**: nas / create

Parameters:

  • nas_body (Nas)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Nas, Integer, Hash)>)

    Nas data, response status code and response headers



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
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/nodeum_sdk/api/nas_api.rb', line 37

def create_nas_with_http_info(nas_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NasApi.create_nas ...'
  end
  # verify the required parameter 'nas_body' is set
  if @api_client.config.client_side_validation && nas_body.nil?
    fail ArgumentError, "Missing the required parameter 'nas_body' when calling NasApi.create_nas"
  end
  # resource path
  local_var_path = '/nas'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(nas_body) 

  # return_type
  return_type = opts[:return_type] || 'Nas' 

  # auth_names
  auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: NasApi#create_nas\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#destroy_nas(nas_id, opts = {}) ⇒ nil

Destroys a specific NAS. **API Key Scope**: nas / destroy

Parameters:

  • nas_id (String)

    Numeric ID or name of NAS.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


91
92
93
94
# File 'lib/nodeum_sdk/api/nas_api.rb', line 91

def destroy_nas(nas_id, opts = {})
  destroy_nas_with_http_info(nas_id, opts)
  nil
end

#destroy_nas_with_http_info(nas_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Destroys a specific NAS. **API Key Scope**: nas / destroy

Parameters:

  • nas_id (String)

    Numeric ID or name of NAS.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/nodeum_sdk/api/nas_api.rb', line 101

def destroy_nas_with_http_info(nas_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NasApi.destroy_nas ...'
  end
  # verify the required parameter 'nas_id' is set
  if @api_client.config.client_side_validation && nas_id.nil?
    fail ArgumentError, "Missing the required parameter 'nas_id' when calling NasApi.destroy_nas"
  end
  # resource path
  local_var_path = '/nas/{nas_id}'.sub('{' + 'nas_id' + '}', CGI.escape(nas_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: NasApi#destroy_nas\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#index_nas(opts = {}) ⇒ NasCollection

Lists all NAS. **API Key Scope**: nas / index

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The number of items to display for pagination.

  • :offset (Integer)

    The number of items to skip for pagination.

  • :sort_by (Array<String>)

    Sort results by attribute. Can sort on multiple attributes, separated by &#x60;|&#x60;. Order direction can be suffixing the attribute by either &#x60;:asc&#x60; (default) or &#x60;:desc&#x60;.

  • :id (String)

    Filter on id

  • :name (String)

    Filter on name

  • :comment (String)

    Filter on comment

  • :host (String)

    Filter on host

  • :type (String)

    Filter on type

  • :price (String)

    Filter on price

Returns:



159
160
161
162
# File 'lib/nodeum_sdk/api/nas_api.rb', line 159

def index_nas(opts = {})
  data, _status_code, _headers = index_nas_with_http_info(opts)
  data
end

#index_nas_with_http_info(opts = {}) ⇒ Array<(NasCollection, Integer, Hash)>

Lists all NAS. **API Key Scope**: nas / index

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The number of items to display for pagination.

  • :offset (Integer)

    The number of items to skip for pagination.

  • :sort_by (Array<String>)

    Sort results by attribute. Can sort on multiple attributes, separated by &#x60;|&#x60;. Order direction can be suffixing the attribute by either &#x60;:asc&#x60; (default) or &#x60;:desc&#x60;.

  • :id (String)

    Filter on id

  • :name (String)

    Filter on name

  • :comment (String)

    Filter on comment

  • :host (String)

    Filter on host

  • :type (String)

    Filter on type

  • :price (String)

    Filter on price

Returns:

  • (Array<(NasCollection, Integer, Hash)>)

    NasCollection data, response status code and response headers



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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/nodeum_sdk/api/nas_api.rb', line 177

def index_nas_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NasApi.index_nas ...'
  end
  # resource path
  local_var_path = '/nas'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'sort_by'] = @api_client.build_collection_param(opts[:'sort_by'], :pipe) if !opts[:'sort_by'].nil?
  query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
  query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?
  query_params[:'host'] = opts[:'host'] if !opts[:'host'].nil?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'price'] = opts[:'price'] if !opts[:'price'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'NasCollection' 

  # auth_names
  auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: NasApi#index_nas\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#show_nas(nas_id, opts = {}) ⇒ Nas

Displays a specific NAS. **API Key Scope**: nas / show

Parameters:

  • nas_id (String)

    Numeric ID or name of NAS.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



234
235
236
237
# File 'lib/nodeum_sdk/api/nas_api.rb', line 234

def show_nas(nas_id, opts = {})
  data, _status_code, _headers = show_nas_with_http_info(nas_id, opts)
  data
end

#show_nas_with_http_info(nas_id, opts = {}) ⇒ Array<(Nas, Integer, Hash)>

Displays a specific NAS. **API Key Scope**: nas / show

Parameters:

  • nas_id (String)

    Numeric ID or name of NAS.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Nas, Integer, Hash)>)

    Nas data, response status code and response headers



244
245
246
247
248
249
250
251
252
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
288
289
# File 'lib/nodeum_sdk/api/nas_api.rb', line 244

def show_nas_with_http_info(nas_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NasApi.show_nas ...'
  end
  # verify the required parameter 'nas_id' is set
  if @api_client.config.client_side_validation && nas_id.nil?
    fail ArgumentError, "Missing the required parameter 'nas_id' when calling NasApi.show_nas"
  end
  # resource path
  local_var_path = '/nas/{nas_id}'.sub('{' + 'nas_id' + '}', CGI.escape(nas_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Nas' 

  # auth_names
  auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: NasApi#show_nas\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_nas(nas_id, nas_body, opts = {}) ⇒ Nas

Updates a specific NAS. **API Key Scope**: nas / update

Parameters:

  • nas_id (String)

    Numeric ID or name of NAS.

  • nas_body (Nas)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



297
298
299
300
# File 'lib/nodeum_sdk/api/nas_api.rb', line 297

def update_nas(nas_id, nas_body, opts = {})
  data, _status_code, _headers = update_nas_with_http_info(nas_id, nas_body, opts)
  data
end

#update_nas_with_http_info(nas_id, nas_body, opts = {}) ⇒ Array<(Nas, Integer, Hash)>

Updates a specific NAS. **API Key Scope**: nas / update

Parameters:

  • nas_id (String)

    Numeric ID or name of NAS.

  • nas_body (Nas)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Nas, Integer, Hash)>)

    Nas data, response status code and response headers



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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/nodeum_sdk/api/nas_api.rb', line 308

def update_nas_with_http_info(nas_id, nas_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NasApi.update_nas ...'
  end
  # verify the required parameter 'nas_id' is set
  if @api_client.config.client_side_validation && nas_id.nil?
    fail ArgumentError, "Missing the required parameter 'nas_id' when calling NasApi.update_nas"
  end
  # verify the required parameter 'nas_body' is set
  if @api_client.config.client_side_validation && nas_body.nil?
    fail ArgumentError, "Missing the required parameter 'nas_body' when calling NasApi.update_nas"
  end
  # resource path
  local_var_path = '/nas/{nas_id}'.sub('{' + 'nas_id' + '}', CGI.escape(nas_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(nas_body) 

  # return_type
  return_type = opts[:return_type] || 'Nas' 

  # auth_names
  auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: NasApi#update_nas\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end