=begin Titan API The ultimate, language agnostic, container based job processing framework. OpenAPI spec version: 0.2.0 Generated by: https://github.com/swagger-api/swagger-codegen.git =end require "uri" module IronTitan class CoreApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Delete the job. # Delete only succeeds if job status is one of `succeeded\n| failed | cancelled`. Cancel a job if it is another state and needs to\nbe deleted. All information about the job, including the log, is\nirretrievably lost when this is invoked. # @param id Job id # @param [Hash] opts the optional parameters # @return [nil] def job_id_delete(id, opts = {}) job_id_delete_with_http_info(id, opts) return nil end # Delete the job. # Delete only succeeds if job status is one of `succeeded\n| failed | cancelled`. Cancel a job if it is another state and needs to\nbe deleted. All information about the job, including the log, is\nirretrievably lost when this is invoked. # @param id Job id # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def job_id_delete_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CoreApi#job_id_delete ..." end # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling job_id_delete" if id.nil? # resource path local_var_path = "/job/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: CoreApi#job_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Gets job by id # Gets a job by id. # @param id Job id # @param [Hash] opts the optional parameters # @return [JobWrapper] def job_id_get(id, opts = {}) data, status_code, headers = job_id_get_with_http_info(id, opts) return data end # Gets job by id # Gets a job by id. # @param id Job id # @param [Hash] opts the optional parameters # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers def job_id_get_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CoreApi#job_id_get ..." end # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling job_id_get" if id.nil? # resource path local_var_path = "/job/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'JobWrapper') if @api_client.config.debugging @api_client.config.logger.debug "API called: CoreApi#job_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get next job. # Gets the next job in the queue, ready for processing. Titan may return <=n jobs. Consumers should start processing jobs in order. Each returned job is set to `status` \"running\" and `started_at` is set to the current time. No other consumer can retrieve this job. # @param [Hash] opts the optional parameters # @option opts [Integer] :n Number of jobs to return. (default to 1) # @return [JobsWrapper] def jobs_consume_get(opts = {}) data, status_code, headers = jobs_consume_get_with_http_info(opts) return data end # Get next job. # Gets the next job in the queue, ready for processing. Titan may return <=n jobs. Consumers should start processing jobs in order. Each returned job is set to `status` \"running\" and `started_at` is set to the current time. No other consumer can retrieve this job. # @param [Hash] opts the optional parameters # @option opts [Integer] :n Number of jobs to return. # @return [Array<(JobsWrapper, Fixnum, Hash)>] JobsWrapper data, response status code and response headers def jobs_consume_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CoreApi#jobs_consume_get ..." end # resource path local_var_path = "/jobs/consume".sub('{format}','json') # query parameters query_params = {} query_params[:'n'] = opts[:'n'] if opts[:'n'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'JobsWrapper') if @api_client.config.debugging @api_client.config.logger.debug "API called: CoreApi#jobs_consume_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Enqueue Job # Enqueues job(s). If any of the jobs is invalid, none of the jobs are enqueued. # @param body Array of jobs to post. # @param [Hash] opts the optional parameters # @return [JobsWrapper] def jobs_post(body, opts = {}) data, status_code, headers = jobs_post_with_http_info(body, opts) return data end # Enqueue Job # Enqueues job(s). If any of the jobs is invalid, none of the jobs are enqueued. # @param body Array of jobs to post. # @param [Hash] opts the optional parameters # @return [Array<(JobsWrapper, Fixnum, Hash)>] JobsWrapper data, response status code and response headers def jobs_post_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CoreApi#jobs_post ..." end # verify the required parameter 'body' is set fail "Missing the required parameter 'body' when calling jobs_post" if body.nil? # resource path local_var_path = "/jobs".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'JobsWrapper') if @api_client.config.debugging @api_client.config.logger.debug "API called: CoreApi#jobs_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end