=begin
#Nodeum API

#The Nodeum API makes it easy to tap into the digital data mesh that runs across your organisation. Make requests to our API endpoints and we’ll give you everything you need to interconnect your business workflows with your storage.  All production API requests are made to:  http://nodeumhostname/api/  The current production version of the API is v1.   **REST** The Nodeum API is a RESTful API. This means that the API is designed to allow you to get, create, update, & delete objects with the HTTP verbs GET, POST, PUT, PATCH, & DELETE.  **JSON** The Nodeum API speaks exclusively in JSON. This means that you should always set the Content-Type header to application/json to ensure that your requests are properly accepted and processed by the API.  **Authentication** All API calls require user-password authentication.   **Cross-Origin Resource Sharing** The Nodeum API supports CORS for communicating from Javascript for these endpoints. You will need to specify an Origin URI when creating your application to allow for CORS to be whitelisted for your domain.   **Pagination** Some endpoints such as File Listing return a potentially lengthy array of objects. In order to keep the response sizes manageable the API will take advantage of pagination. Pagination is a mechanism for returning a subset of the results for a request and allowing for subsequent requests to “page” through the rest of the results until the end is reached. Paginated endpoints follow a standard interface that accepts two query parameters, limit and offset, and return a payload that follows a standard form. These parameters names and their behavior are borrowed from SQL LIMIT and OFFSET keywords.  **Versioning** The Nodeum API is constantly being worked on to add features, make improvements, and fix bugs. This means that you should expect changes to be introduced and documented.   However, there are some changes or additions that are considered backwards-compatible and your applications should be flexible enough to handle them. These include:  - Adding new endpoints to the API - Adding new attributes to the response of an existing endpoint - Changing the order of attributes of responses (JSON by definition is an object of unordered key/value pairs)  **Filter parameters** When browsing a list of items, multiple filter parameters may be applied. Some operators can be added to the value as a prefix:  - `=` value is equal. Default operator, may be omitted  - `!=` value is different  - `>` greater than  - `>=` greater than or equal  - `<` lower than  - `>=` lower than or equal  - `><` included in list, items should be separated by `|`  - `!><` not included in list, items should be separated by `|`  - `~` pattern matching, may include `%` (any characters) and `_` (one character)  - `!~` pattern not matching, may include `%` (any characters) and `_` (one character)  

The version of the OpenAPI document: 2.1.0
Contact: info@nodeum.io
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.0

=end

require 'cgi'

module Nodeum
  class TapeLibrariesApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # Creates a new tape library.
    # **API Key Scope**: tape_libraries / create
    # @param tape_library_body [TapeLibrary] 
    # @param [Hash] opts the optional parameters
    # @return [TapeLibrary]
    def create_tape_library(tape_library_body, opts = {})
      data, _status_code, _headers = create_tape_library_with_http_info(tape_library_body, opts)
      data
    end

    # Creates a new tape library.
    # **API Key Scope**: tape_libraries / create
    # @param tape_library_body [TapeLibrary] 
    # @param [Hash] opts the optional parameters
    # @return [Array<(TapeLibrary, Integer, Hash)>] TapeLibrary data, response status code and response headers
    def create_tape_library_with_http_info(tape_library_body, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: TapeLibrariesApi.create_tape_library ...'
      end
      # verify the required parameter 'tape_library_body' is set
      if @api_client.config.client_side_validation && tape_library_body.nil?
        fail ArgumentError, "Missing the required parameter 'tape_library_body' when calling TapeLibrariesApi.create_tape_library"
      end
      # resource path
      local_var_path = '/tape_libraries'

      # 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(tape_library_body) 

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

      # 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: TapeLibrariesApi#create_tape_library\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Destroys a specific tape library.
    # **API Key Scope**: tape_libraries / destroy
    # @param tape_library_id [String] Numeric ID, serial, or name of tape library.
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def destroy_tape_library(tape_library_id, opts = {})
      destroy_tape_library_with_http_info(tape_library_id, opts)
      nil
    end

    # Destroys a specific tape library.
    # **API Key Scope**: tape_libraries / destroy
    # @param tape_library_id [String] Numeric ID, serial, or name of tape library.
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
    def destroy_tape_library_with_http_info(tape_library_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: TapeLibrariesApi.destroy_tape_library ...'
      end
      # verify the required parameter 'tape_library_id' is set
      if @api_client.config.client_side_validation && tape_library_id.nil?
        fail ArgumentError, "Missing the required parameter 'tape_library_id' when calling TapeLibrariesApi.destroy_tape_library"
      end
      # resource path
      local_var_path = '/tape_libraries/{tape_library_id}'.sub('{' + 'tape_library_id' + '}', CGI.escape(tape_library_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: TapeLibrariesApi#destroy_tape_library\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Lists all tape libraries.
    # **API Key Scope**: tape_libraries / 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] :serial Filter on serial
    # @option opts [String] :comment Filter on comment
    # @option opts [String] :protocol Filter on protocol
    # @option opts [String] :vendor Filter on vendor
    # @option opts [String] :product Filter on product
    # @option opts [String] :firmware Filter on firmware
    # @option opts [String] :device Filter on device
    # @option opts [String] :libso Filter on libso
    # @option opts [String] :acs Filter on acs
    # @option opts [String] :status Filter on status
    # @option opts [String] :storage_slots Filter on storage slots
    # @option opts [String] :storage_slots_address Filter on storage slots address
    # @option opts [String] :io_slots Filter on io slots
    # @option opts [String] :io_slots_address Filter on io slots address
    # @option opts [String] :price Filter on price
    # @return [TapeLibraryCollection]
    def index_tape_libraries(opts = {})
      data, _status_code, _headers = index_tape_libraries_with_http_info(opts)
      data
    end

    # Lists all tape libraries.
    # **API Key Scope**: tape_libraries / 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] :serial Filter on serial
    # @option opts [String] :comment Filter on comment
    # @option opts [String] :protocol Filter on protocol
    # @option opts [String] :vendor Filter on vendor
    # @option opts [String] :product Filter on product
    # @option opts [String] :firmware Filter on firmware
    # @option opts [String] :device Filter on device
    # @option opts [String] :libso Filter on libso
    # @option opts [String] :acs Filter on acs
    # @option opts [String] :status Filter on status
    # @option opts [String] :storage_slots Filter on storage slots
    # @option opts [String] :storage_slots_address Filter on storage slots address
    # @option opts [String] :io_slots Filter on io slots
    # @option opts [String] :io_slots_address Filter on io slots address
    # @option opts [String] :price Filter on price
    # @return [Array<(TapeLibraryCollection, Integer, Hash)>] TapeLibraryCollection data, response status code and response headers
    def index_tape_libraries_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: TapeLibrariesApi.index_tape_libraries ...'
      end
      # resource path
      local_var_path = '/tape_libraries'

      # 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[:'serial'] = opts[:'serial'] if !opts[:'serial'].nil?
      query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?
      query_params[:'protocol'] = opts[:'protocol'] if !opts[:'protocol'].nil?
      query_params[:'vendor'] = opts[:'vendor'] if !opts[:'vendor'].nil?
      query_params[:'product'] = opts[:'product'] if !opts[:'product'].nil?
      query_params[:'firmware'] = opts[:'firmware'] if !opts[:'firmware'].nil?
      query_params[:'device'] = opts[:'device'] if !opts[:'device'].nil?
      query_params[:'libso'] = opts[:'libso'] if !opts[:'libso'].nil?
      query_params[:'acs'] = opts[:'acs'] if !opts[:'acs'].nil?
      query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
      query_params[:'storage_slots'] = opts[:'storage_slots'] if !opts[:'storage_slots'].nil?
      query_params[:'storage_slots_address'] = opts[:'storage_slots_address'] if !opts[:'storage_slots_address'].nil?
      query_params[:'io_slots'] = opts[:'io_slots'] if !opts[:'io_slots'].nil?
      query_params[:'io_slots_address'] = opts[:'io_slots_address'] if !opts[:'io_slots_address'].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] || 'TapeLibraryCollection' 

      # 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: TapeLibrariesApi#index_tape_libraries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Lists tape libraries devices.
    # **API Key Scope**: tape_libraries / devices
    # @param job_id [String] ID of active job
    # @param [Hash] opts the optional parameters
    # @return [TapeLibraryDeviceCollection]
    def index_tape_library_devices(job_id, opts = {})
      data, _status_code, _headers = index_tape_library_devices_with_http_info(job_id, opts)
      data
    end

    # Lists tape libraries devices.
    # **API Key Scope**: tape_libraries / devices
    # @param job_id [String] ID of active job
    # @param [Hash] opts the optional parameters
    # @return [Array<(TapeLibraryDeviceCollection, Integer, Hash)>] TapeLibraryDeviceCollection data, response status code and response headers
    def index_tape_library_devices_with_http_info(job_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: TapeLibrariesApi.index_tape_library_devices ...'
      end
      # verify the required parameter 'job_id' is set
      if @api_client.config.client_side_validation && job_id.nil?
        fail ArgumentError, "Missing the required parameter 'job_id' when calling TapeLibrariesApi.index_tape_library_devices"
      end
      # resource path
      local_var_path = '/tape_libraries/-/devices'

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

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

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

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

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

      # 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: TapeLibrariesApi#index_tape_library_devices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Displays a specific tape library.
    # **API Key Scope**: tape_libraries / show
    # @param tape_library_id [String] Numeric ID, serial, or name of tape library.
    # @param [Hash] opts the optional parameters
    # @return [TapeLibrary]
    def show_tape_library(tape_library_id, opts = {})
      data, _status_code, _headers = show_tape_library_with_http_info(tape_library_id, opts)
      data
    end

    # Displays a specific tape library.
    # **API Key Scope**: tape_libraries / show
    # @param tape_library_id [String] Numeric ID, serial, or name of tape library.
    # @param [Hash] opts the optional parameters
    # @return [Array<(TapeLibrary, Integer, Hash)>] TapeLibrary data, response status code and response headers
    def show_tape_library_with_http_info(tape_library_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: TapeLibrariesApi.show_tape_library ...'
      end
      # verify the required parameter 'tape_library_id' is set
      if @api_client.config.client_side_validation && tape_library_id.nil?
        fail ArgumentError, "Missing the required parameter 'tape_library_id' when calling TapeLibrariesApi.show_tape_library"
      end
      # resource path
      local_var_path = '/tape_libraries/{tape_library_id}'.sub('{' + 'tape_library_id' + '}', CGI.escape(tape_library_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] || 'TapeLibrary' 

      # 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: TapeLibrariesApi#show_tape_library\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Updates a specific tape library.
    # **API Key Scope**: tape_libraries / update
    # @param tape_library_id [String] Numeric ID, serial, or name of tape library.
    # @param tape_library_body [TapeLibrary] 
    # @param [Hash] opts the optional parameters
    # @return [TapeLibrary]
    def update_tape_library(tape_library_id, tape_library_body, opts = {})
      data, _status_code, _headers = update_tape_library_with_http_info(tape_library_id, tape_library_body, opts)
      data
    end

    # Updates a specific tape library.
    # **API Key Scope**: tape_libraries / update
    # @param tape_library_id [String] Numeric ID, serial, or name of tape library.
    # @param tape_library_body [TapeLibrary] 
    # @param [Hash] opts the optional parameters
    # @return [Array<(TapeLibrary, Integer, Hash)>] TapeLibrary data, response status code and response headers
    def update_tape_library_with_http_info(tape_library_id, tape_library_body, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: TapeLibrariesApi.update_tape_library ...'
      end
      # verify the required parameter 'tape_library_id' is set
      if @api_client.config.client_side_validation && tape_library_id.nil?
        fail ArgumentError, "Missing the required parameter 'tape_library_id' when calling TapeLibrariesApi.update_tape_library"
      end
      # verify the required parameter 'tape_library_body' is set
      if @api_client.config.client_side_validation && tape_library_body.nil?
        fail ArgumentError, "Missing the required parameter 'tape_library_body' when calling TapeLibrariesApi.update_tape_library"
      end
      # resource path
      local_var_path = '/tape_libraries/{tape_library_id}'.sub('{' + 'tape_library_id' + '}', CGI.escape(tape_library_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(tape_library_body) 

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

      # 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: TapeLibrariesApi#update_tape_library\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end
