Class: ApprovalApiClient::WorkflowApi

Inherits:
Object
  • Object
show all
Defined in:
lib/insights-approval-api-client/api/workflow_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ WorkflowApi

Returns a new instance of WorkflowApi.



19
20
21
# File 'lib/insights-approval-api-client/api/workflow_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/insights-approval-api-client/api/workflow_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_workflow_to_template(template_id, workflow, opts = {}) ⇒ Workflow

Add a workflow by given template id, only available for admin Add a workflow by given template id

Parameters:

  • template_id (String)

    Id of template

  • workflow (Workflow)

    Parameters need to create workflow

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

    the optional parameters

Returns:



28
29
30
31
# 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 = {}) ⇒ Array<(Workflow, Integer, Hash)>

Add a workflow by given template id, only available for admin Add a workflow by given template id

Parameters:

  • template_id (String)

    Id of template

  • workflow (Workflow)

    Parameters need to create workflow

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

    the optional parameters

Returns:

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

    Workflow data, response status code and response headers



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
85
86
87
88
89
90
91
92
93
94
95
# 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 = {}) ⇒ nil

Delete approval workflow by given id, only available for admin Delete approval workflow by given id

Parameters:

  • id (String)

    Query by id

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

    the optional parameters

Returns:

  • (nil)


102
103
104
105
# 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 = {}) ⇒ Array<(nil, Integer, Hash)>

Delete approval workflow by given id, only available for admin Delete approval workflow by given id

Parameters:

  • id (String)

    Query by id

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# 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

Create a resource link to a given workflow Link a resource object to a given workflow

Parameters:

  • id (String)

    Query by id

  • resource_object (ResourceObject)

    Parameters needed to create a link

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

    the optional parameters

Returns:

  • (nil)


168
169
170
171
# File 'lib/insights-approval-api-client/api/workflow_api.rb', line 168

def link_workflow(id, resource_object, opts = {})
  link_workflow_with_http_info(id, resource_object, opts)
  nil
end

Create a resource link to a given workflow Link a resource object to a given workflow

Parameters:

  • id (String)

    Query by id

  • resource_object (ResourceObject)

    Parameters needed to create a link

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
228
229
230
231
232
233
# File 'lib/insights-approval-api-client/api/workflow_api.rb', line 179

def link_workflow_with_http_info(id, resource_object, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowApi.link_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.link_workflow"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && id !~ pattern
    fail ArgumentError, "invalid value for 'id' when calling WorkflowApi.link_workflow, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'resource_object' is set
  if @api_client.config.client_side_validation && resource_object.nil?
    fail ArgumentError, "Missing the required parameter 'resource_object' when calling WorkflowApi.link_workflow"
  end
  # resource path
  local_var_path = '/workflows/{id}/link'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # 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(resource_object) 

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

#list_workflows(opts = {}) ⇒ WorkflowCollection

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

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :app_name (String)

    Name of the application

  • :object_id (String)

    Id of the resource object

  • :object_type (String)

    Type of the resource object

  • :limit (Integer)

    How many items to return at one time (max 1000) (default to 100)

  • :offset (Integer)

    Starting Offset (default to 0)

  • :filter (Object)

    Filter for querying collections.

  • :sort_by (String)

    Parameter to sort collection

Returns:



246
247
248
249
# 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 = {}) ⇒ WorkflowCollection

Return an array of workflows by given template id, only available for admin Return an array of workflows by given template id

Parameters:

  • template_id (String)

    Id of template

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    How many items to return at one time (max 1000) (default to 100)

  • :offset (Integer)

    Starting Offset (default to 0)

  • :filter (Object)

    Filter for querying collections.

  • :sort_by (String)

    Parameter to sort collection

Returns:



333
334
335
336
# 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 = {}) ⇒ Array<(WorkflowCollection, Integer, Hash)>

Return an array of workflows by given template id, only available for admin Return an array of workflows by given template id

Parameters:

  • template_id (String)

    Id of template

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    How many items to return at one time (max 1000)

  • :offset (Integer)

    Starting Offset

  • :filter (Object)

    Filter for querying collections.

  • :sort_by (String)

    Parameter to sort collection

Returns:

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

    WorkflowCollection data, response status code and response headers



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# 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 = {}) ⇒ Array<(WorkflowCollection, Integer, Hash)>

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

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :app_name (String)

    Name of the application

  • :object_id (String)

    Id of the resource object

  • :object_type (String)

    Type of the resource object

  • :limit (Integer)

    How many items to return at one time (max 1000)

  • :offset (Integer)

    Starting Offset

  • :filter (Object)

    Filter for querying collections.

  • :sort_by (String)

    Parameter to sort collection

Returns:

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

    WorkflowCollection data, response status code and response headers



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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# 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 = {}) ⇒ Workflow

Return an approval workflow by given id, only available for admin Return an approval workflow by given id

Parameters:

  • id (String)

    Query by id

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

    the optional parameters

Returns:



420
421
422
423
# 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 = {}) ⇒ Array<(Workflow, Integer, Hash)>

Return an approval workflow by given id, only available for admin Return an approval workflow by given id

Parameters:

  • id (String)

    Query by id

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

    the optional parameters

Returns:

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

    Workflow data, response status code and response headers



430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
# 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

Break the link between a resource object and selected workflow Break the link between a resource object and selected workflow

Parameters:

  • id (String)

    Query by id

  • resource_object (ResourceObject)

    Parameters needed to remove a link

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

    the optional parameters

Returns:

  • (nil)


488
489
490
491
# File 'lib/insights-approval-api-client/api/workflow_api.rb', line 488

def unlink_workflow(id, resource_object, opts = {})
  unlink_workflow_with_http_info(id, resource_object, opts)
  nil
end

Break the link between a resource object and selected workflow Break the link between a resource object and selected workflow

Parameters:

  • id (String)

    Query by id

  • resource_object (ResourceObject)

    Parameters needed to remove a link

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/insights-approval-api-client/api/workflow_api.rb', line 499

def unlink_workflow_with_http_info(id, resource_object, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowApi.unlink_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.unlink_workflow"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && id !~ pattern
    fail ArgumentError, "invalid value for 'id' when calling WorkflowApi.unlink_workflow, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'resource_object' is set
  if @api_client.config.client_side_validation && resource_object.nil?
    fail ArgumentError, "Missing the required parameter 'resource_object' when calling WorkflowApi.unlink_workflow"
  end
  # resource path
  local_var_path = '/workflows/{id}/unlink'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # 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(resource_object) 

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

#update_workflow(id, workflow, opts = {}) ⇒ Workflow

Update an approval workflow by given id, only available for admin Update an approval workflow by given id

Parameters:

  • id (String)

    Query by id

  • workflow (Workflow)

    Parameters need to update approval workflow

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

    the optional parameters

Returns:



561
562
563
564
# 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 = {}) ⇒ Array<(Workflow, Integer, Hash)>

Update an approval workflow by given id, only available for admin Update an approval workflow by given id

Parameters:

  • id (String)

    Query by id

  • workflow (Workflow)

    Parameters need to update approval workflow

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

    the optional parameters

Returns:

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

    Workflow data, response status code and response headers



572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
# 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