class ApprovalApiClient::WorkflowApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/insights-approval-api-client/api/workflow_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

add_workflow_to_template(template_id, workflow, opts = {}) click to toggle source

Add a workflow by given template id, only available for admin Add a workflow by given template id @param template_id [String] Id of template @param workflow [Workflow] Parameters need to create workflow @param [Hash] opts the optional parameters @return [Workflow]

# File lib/insights-approval-api-client/api/workflow_api.rb, line 28
def add_workflow_to_template(template_id, workflow, opts = {})
  data, _status_code, _headers = add_workflow_to_template_with_http_info(template_id, workflow, opts)
  data
end
add_workflow_to_template_with_http_info(template_id, workflow, opts = {}) click to toggle source

Add a workflow by given template id, only available for admin Add a workflow by given template id @param template_id [String] Id of template @param workflow [Workflow] Parameters need to create workflow @param [Hash] opts the optional parameters @return [Array<(Workflow, Integer, Hash)>] Workflow data, response status code and response headers

# File lib/insights-approval-api-client/api/workflow_api.rb, line 39
def add_workflow_to_template_with_http_info(template_id, workflow, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowApi.add_workflow_to_template ...'
  end
  # verify the required parameter 'template_id' is set
  if @api_client.config.client_side_validation && template_id.nil?
    fail ArgumentError, "Missing the required parameter 'template_id' when calling WorkflowApi.add_workflow_to_template"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && template_id !~ pattern
    fail ArgumentError, "invalid value for 'template_id' when calling WorkflowApi.add_workflow_to_template, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'workflow' is set
  if @api_client.config.client_side_validation && workflow.nil?
    fail ArgumentError, "Missing the required parameter 'workflow' when calling WorkflowApi.add_workflow_to_template"
  end
  # resource path
  local_var_path = '/templates/{template_id}/workflows'.sub('{' + 'template_id' + '}', CGI.escape(template_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(workflow) 

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

  # auth_names
  auth_names = opts[:auth_names] || ['Basic_auth']

  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: WorkflowApi#add_workflow_to_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
destroy_workflow(id, opts = {}) click to toggle source

Delete approval workflow by given id, only available for admin Delete approval workflow by given id @param id [String] Query by id @param [Hash] opts the optional parameters @return [nil]

# File lib/insights-approval-api-client/api/workflow_api.rb, line 102
def destroy_workflow(id, opts = {})
  destroy_workflow_with_http_info(id, opts)
  nil
end
destroy_workflow_with_http_info(id, opts = {}) click to toggle source

Delete approval workflow by given id, only available for admin Delete approval workflow by given id @param id [String] Query by id @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/insights-approval-api-client/api/workflow_api.rb, line 112
def destroy_workflow_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowApi.destroy_workflow ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling WorkflowApi.destroy_workflow"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && id !~ pattern
    fail ArgumentError, "invalid value for 'id' when calling WorkflowApi.destroy_workflow, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/workflows/{id}'.sub('{' + 'id' + '}', CGI.escape(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] || ['Basic_auth']

  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: WorkflowApi#destroy_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_workflows(opts = {}) click to toggle source

Return all approval workflows, only available for admin Depends on the query parameters, either return all workflows in ascending sequence order when no parameters are provided; or return the workflows linking to the resource object whose app_name, object_type and object_id are specified by query parameters @param [Hash] opts the optional parameters @option opts [String] :app_name Name of the application @option opts [String] :object_id Id of the resource object @option opts [String] :object_type Type of the resource object @option opts [Integer] :limit How many items to return at one time (max 1000) (default to 100) @option opts [Integer] :offset Starting Offset (default to 0) @option opts [Object] :filter Filter for querying collections. @option opts [String] :sort_by Parameter to sort collection @return [WorkflowCollection]

# File lib/insights-approval-api-client/api/workflow_api.rb, line 246
def list_workflows(opts = {})
  data, _status_code, _headers = list_workflows_with_http_info(opts)
  data
end
list_workflows_by_template(template_id, opts = {}) click to toggle source

Return an array of workflows by given template id, only available for admin Return an array of workflows by given template id @param template_id [String] Id of template @param [Hash] opts the optional parameters @option opts [Integer] :limit How many items to return at one time (max 1000) (default to 100) @option opts [Integer] :offset Starting Offset (default to 0) @option opts [Object] :filter Filter for querying collections. @option opts [String] :sort_by Parameter to sort collection @return [WorkflowCollection]

# File lib/insights-approval-api-client/api/workflow_api.rb, line 333
def list_workflows_by_template(template_id, opts = {})
  data, _status_code, _headers = list_workflows_by_template_with_http_info(template_id, opts)
  data
end
list_workflows_by_template_with_http_info(template_id, opts = {}) click to toggle source

Return an array of workflows by given template id, only available for admin Return an array of workflows by given template id @param template_id [String] Id of template @param [Hash] opts the optional parameters @option opts [Integer] :limit How many items to return at one time (max 1000) @option opts [Integer] :offset Starting Offset @option opts [Object] :filter Filter for querying collections. @option opts [String] :sort_by Parameter to sort collection @return [Array<(WorkflowCollection, Integer, Hash)>] WorkflowCollection data, response status code and response headers

# File lib/insights-approval-api-client/api/workflow_api.rb, line 347
def list_workflows_by_template_with_http_info(template_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowApi.list_workflows_by_template ...'
  end
  # verify the required parameter 'template_id' is set
  if @api_client.config.client_side_validation && template_id.nil?
    fail ArgumentError, "Missing the required parameter 'template_id' when calling WorkflowApi.list_workflows_by_template"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && template_id !~ pattern
    fail ArgumentError, "invalid value for 'template_id' when calling WorkflowApi.list_workflows_by_template, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WorkflowApi.list_workflows_by_template, must be smaller than or equal to 1000.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WorkflowApi.list_workflows_by_template, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
    fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling WorkflowApi.list_workflows_by_template, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = '/templates/{template_id}/workflows'.sub('{' + 'template_id' + '}', CGI.escape(template_id.to_s))

  # 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[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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] || 'WorkflowCollection' 

  # auth_names
  auth_names = opts[:auth_names] || ['Basic_auth']

  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: WorkflowApi#list_workflows_by_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_workflows_with_http_info(opts = {}) click to toggle source

Return all approval workflows, only available for admin Depends on the query parameters, either return all workflows in ascending sequence order when no parameters are provided; or return the workflows linking to the resource object whose app_name, object_type and object_id are specified by query parameters @param [Hash] opts the optional parameters @option opts [String] :app_name Name of the application @option opts [String] :object_id Id of the resource object @option opts [String] :object_type Type of the resource object @option opts [Integer] :limit How many items to return at one time (max 1000) @option opts [Integer] :offset Starting Offset @option opts [Object] :filter Filter for querying collections. @option opts [String] :sort_by Parameter to sort collection @return [Array<(WorkflowCollection, Integer, Hash)>] WorkflowCollection data, response status code and response headers

# File lib/insights-approval-api-client/api/workflow_api.rb, line 262
def list_workflows_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowApi.list_workflows ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WorkflowApi.list_workflows, must be smaller than or equal to 1000.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WorkflowApi.list_workflows, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
    fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling WorkflowApi.list_workflows, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = '/workflows'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'app_name'] = opts[:'app_name'] if !opts[:'app_name'].nil?
  query_params[:'object_id'] = opts[:'object_id'] if !opts[:'object_id'].nil?
  query_params[:'object_type'] = opts[:'object_type'] if !opts[:'object_type'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?

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

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

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

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

  # auth_names
  auth_names = opts[:auth_names] || ['Basic_auth']

  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: WorkflowApi#list_workflows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
show_workflow(id, opts = {}) click to toggle source

Return an approval workflow by given id, only available for admin Return an approval workflow by given id @param id [String] Query by id @param [Hash] opts the optional parameters @return [Workflow]

# File lib/insights-approval-api-client/api/workflow_api.rb, line 420
def show_workflow(id, opts = {})
  data, _status_code, _headers = show_workflow_with_http_info(id, opts)
  data
end
show_workflow_with_http_info(id, opts = {}) click to toggle source

Return an approval workflow by given id, only available for admin Return an approval workflow by given id @param id [String] Query by id @param [Hash] opts the optional parameters @return [Array<(Workflow, Integer, Hash)>] Workflow data, response status code and response headers

# File lib/insights-approval-api-client/api/workflow_api.rb, line 430
def show_workflow_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowApi.show_workflow ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling WorkflowApi.show_workflow"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && id !~ pattern
    fail ArgumentError, "invalid value for 'id' when calling WorkflowApi.show_workflow, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/workflows/{id}'.sub('{' + 'id' + '}', CGI.escape(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(['*/*'])

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

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

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

  # auth_names
  auth_names = opts[:auth_names] || ['Basic_auth']

  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: WorkflowApi#show_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_workflow(id, workflow, opts = {}) click to toggle source

Update an approval workflow by given id, only available for admin Update an approval workflow by given id @param id [String] Query by id @param workflow [Workflow] Parameters need to update approval workflow @param [Hash] opts the optional parameters @return [Workflow]

# File lib/insights-approval-api-client/api/workflow_api.rb, line 561
def update_workflow(id, workflow, opts = {})
  data, _status_code, _headers = update_workflow_with_http_info(id, workflow, opts)
  data
end
update_workflow_with_http_info(id, workflow, opts = {}) click to toggle source

Update an approval workflow by given id, only available for admin Update an approval workflow by given id @param id [String] Query by id @param workflow [Workflow] Parameters need to update approval workflow @param [Hash] opts the optional parameters @return [Array<(Workflow, Integer, Hash)>] Workflow data, response status code and response headers

# File lib/insights-approval-api-client/api/workflow_api.rb, line 572
def update_workflow_with_http_info(id, workflow, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowApi.update_workflow ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling WorkflowApi.update_workflow"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && id !~ pattern
    fail ArgumentError, "invalid value for 'id' when calling WorkflowApi.update_workflow, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'workflow' is set
  if @api_client.config.client_side_validation && workflow.nil?
    fail ArgumentError, "Missing the required parameter 'workflow' when calling WorkflowApi.update_workflow"
  end
  # resource path
  local_var_path = '/workflows/{id}'.sub('{' + 'id' + '}', CGI.escape(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(['*/*'])
  # 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(workflow) 

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

  # auth_names
  auth_names = opts[:auth_names] || ['Basic_auth']

  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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowApi#update_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end