Class: Emasser::Roles

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

Overview

The System Roles endpoints provides the ability to access user data assigned to systems. Notes:

The endpoint can access three different role categories: PAC, CAC, and Other.
If a system is dual-policy enabled, the returned system role information will default
to the RMF policy information unless otherwise specified.

Endpoint:

/api/system-roles                - Get all available roles
/api/system-roles/{roleCategory} - Get system roles for provided role catgory

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

Returns:

  • (Boolean)


166
167
168
# File 'lib/emasser/get.rb', line 166

def self.exit_on_failure?
  true
end

Instance Method Details

#allObject



172
173
174
175
176
177
178
# File 'lib/emasser/get.rb', line 172

def all
  result = EmassClient::SystemRolesApi.new.get_system_roles
  puts to_output_hash(result).green
rescue EmassClient::ApiError => e
  puts 'Exception when calling SystemRolesApi->get_system_roles'.red
  puts to_output_hash(e)
end

#byCategoryObject



190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/emasser/get.rb', line 190

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

  begin
    result = EmassClient::SystemRolesApi.new.get_system_roles_by_category_id(options[:roleCategory],
                                                                             options[:role], optional_options)
    puts to_output_hash(result).green
  rescue EmassClient::ApiError => e
    puts 'Exception when calling SystemRolesApi->get_system_by_role_category_id'.red
    puts to_output_hash(e)
  end
end