class Nodeum::NasApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/nodeum_sdk/api/nas_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

create_nas(nas_body, opts = {}) click to toggle source

Creates a new NAS. **API Key Scope**: nas / create @param nas_body [Nas] @param [Hash] opts the optional parameters @return [Nas]

# 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 = {}) click to toggle source

Creates a new NAS. **API Key Scope**: nas / create @param nas_body [Nas] @param [Hash] opts the optional parameters @return [Array<(Nas, Integer, Hash)>] Nas data, response status code and response headers

# 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 = {}) click to toggle source

Destroys a specific NAS. **API Key Scope**: nas / destroy @param nas_id [String] Numeric ID or name of NAS. @param [Hash] opts the optional parameters @return [nil]

# 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 = {}) click to toggle source

Destroys a specific NAS. **API Key Scope**: nas / destroy @param nas_id [String] Numeric ID or name of NAS. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# 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 = {}) click to toggle source

Lists all NAS. **API Key Scope**: nas / index @param [Hash] opts the optional parameters @option opts [Integer] :limit The number of items to display for pagination. @option opts [Integer] :offset The number of items to skip for pagination. @option opts [Array<String>] :sort_by 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;. @option opts [String] :id Filter on id @option opts [String] :name Filter on name @option opts [String] :comment Filter on comment @option opts [String] :host Filter on host @option opts [String] :type Filter on type @option opts [String] :price Filter on price @return [NasCollection]

# 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 = {}) click to toggle source

Lists all NAS. **API Key Scope**: nas / index @param [Hash] opts the optional parameters @option opts [Integer] :limit The number of items to display for pagination. @option opts [Integer] :offset The number of items to skip for pagination. @option opts [Array<String>] :sort_by 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;. @option opts [String] :id Filter on id @option opts [String] :name Filter on name @option opts [String] :comment Filter on comment @option opts [String] :host Filter on host @option opts [String] :type Filter on type @option opts [String] :price Filter on price @return [Array<(NasCollection, Integer, Hash)>] NasCollection data, response status code and response headers

# 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 = {}) click to toggle source

Displays a specific NAS. **API Key Scope**: nas / show @param nas_id [String] Numeric ID or name of NAS. @param [Hash] opts the optional parameters @return [Nas]

# 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 = {}) click to toggle source

Displays a specific NAS. **API Key Scope**: nas / show @param nas_id [String] Numeric ID or name of NAS. @param [Hash] opts the optional parameters @return [Array<(Nas, Integer, Hash)>] Nas data, response status code and response headers

# 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 = {}) click to toggle source

Updates a specific NAS. **API Key Scope**: nas / update @param nas_id [String] Numeric ID or name of NAS. @param nas_body [Nas] @param [Hash] opts the optional parameters @return [Nas]

# 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 = {}) click to toggle source

Updates a specific NAS. **API Key Scope**: nas / update @param nas_id [String] Numeric ID or name of NAS. @param nas_body [Nas] @param [Hash] opts the optional parameters @return [Array<(Nas, Integer, Hash)>] Nas data, response status code and response headers

# 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