Class: Emasser::CAC

Inherits:
SubCommandBase show all
Defined in:
lib/emasser/get.rb,
lib/emasser/post.rb

Overview

Add a Control Approval Chain (CAC)

Endpoints:

/api/systems/{systemId}/approval/cac - Submit control to second stage of CAC

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SubCommandBase

banner

Methods included from OutputConverters

#to_output_hash

Methods included from InputConverters

#to_input_hash

Methods included from OptionsParser

#optional_options, #required_options

Class Method Details

.exit_on_failure?Boolean



463
464
465
# File 'lib/emasser/get.rb', line 463

def self.exit_on_failure?
  true
end

Instance Method Details

#addObject



433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/emasser/post.rb', line 433

def add
  body = SwaggerClient::CacRequestPostBody.new
  body.control_acronym = options[:controlAcronym]
  body.comments = options[:comments]

  body_array = Array.new(1, body)

  begin
    # Get location of one or many controls in CAC
    result = SwaggerClient::CacApi.new.add_s_ystem_c_ac(body_array, options[:systemId])
    puts to_output_hash(result).green
  rescue SwaggerClient::ApiError => e
    puts 'Exception when calling ApprovalChainApi->add_s_ystem_c_ac'.red
    puts to_output_hash(e)
  end
end

#controlsObject



476
477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/emasser/get.rb', line 476

def controls
  optional_options_keys = optional_options(@_initializer).keys
  optional_options = to_input_hash(optional_options_keys, options)

  begin
    # Get location of one or many controls in CAC
    result = SwaggerClient::CACApi.new.get_system_cac(options[:systemId], optional_options)
    puts to_output_hash(result).green
  rescue SwaggerClient::ApiError => e
    puts 'Exception when calling ApprovalChainApi->get_system_cac'.red
    puts to_output_hash(e)
  end
end