Class: Emasser::Controls
- Inherits:
-
SubCommandBase
- Object
- Thor
- SubCommandBase
- Emasser::Controls
- Defined in:
- lib/emasser/get.rb,
lib/emasser/put.rb
Overview
Update Security Control information of a system for both the Implementation Plan and Risk Assessment.
Endpoint:
/api/systems/{systemId}/controls - Update control information in a system for one or many controls
rubocop:disable Style/WordArray
Class Method Summary collapse
Instance Method Summary collapse
- #forSystem ⇒ Object
-
#update ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity.
Methods inherited from SubCommandBase
Methods included from OutputConverters
Methods included from InputConverters
Methods included from OptionsParser
#optional_options, #required_options
Class Method Details
.exit_on_failure? ⇒ Boolean
211 212 213 |
# File 'lib/emasser/get.rb', line 211 def self.exit_on_failure? true end |
Instance Method Details
#forSystem ⇒ Object
224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/emasser/get.rb', line 224 def forSystem = (@_initializer).keys = to_input_hash(, ) begin result = EmassClient::ControlsApi.new.get_system_controls([:systemId], ) puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling ControlsApi->get_system_controls'.red puts to_output_hash(e) end end |
#update ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
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/emasser/put.rb', line 130 def update # Required fields body = EmassClient::ControlsRequestPutBody.new body.acronym = [:acronym] body.responsible_entities = [:responsibleEntities] body.control_designation = [:controlDesignation] body.estimated_completion_date = [:estimatedCompletionDate] body.implementation_narrative = [:implementationNarrative] process_business_logic(body) # Add optional fields body.severity = [:severity] if [:severity] body.vulnerabilty_summary = [:vulnerabiltySummary] if [:vulnerabiltySummary] body.recommendations = [:recommendations] if [:recommendations] body.relevance_of_threat = [:relevanceOfThreat] if [:relevanceOfThreat] body.likelihood = [:likelihood] if [:likelihood] body.impact = [:impact] if [:impact] body.impact_description = [:impactDescription] if [:impactDescription] body.residual_risk_level = [:residualRiskLevel] if [:residualRiskLevel] body_array = Array.new(1, body) begin result = EmassClient::ControlsApi.new.update_control_by_system_id(body_array, [:systemId]) puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling ControlsApi->update_control_by_system_id'.red puts to_output_hash(e) end end |