cyber_trackr_live 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG-GEM.md +47 -0
  3. data/CODE_OF_CONDUCT.md +20 -0
  4. data/CONTRIBUTING.md +422 -0
  5. data/LICENSE.md +16 -0
  6. data/NOTICE.md +16 -0
  7. data/README-GEM.md +75 -0
  8. data/SECURITY.md +86 -0
  9. data/cyber_trackr_live.gemspec +56 -0
  10. data/examples/cyber_trackr_client.rb +208 -0
  11. data/examples/fetch-complete-stig +174 -0
  12. data/examples/fetch-stig-complete +67 -0
  13. data/examples/fetch-stig-direct +99 -0
  14. data/examples/use_helper.rb +50 -0
  15. data/lib/cyber_trackr_client/api/api_documentation_api.rb +79 -0
  16. data/lib/cyber_trackr_client/api/cci_api.rb +147 -0
  17. data/lib/cyber_trackr_client/api/documents_api.rb +276 -0
  18. data/lib/cyber_trackr_client/api/rmf_controls_api.rb +272 -0
  19. data/lib/cyber_trackr_client/api/scap_api.rb +276 -0
  20. data/lib/cyber_trackr_client/api_client.rb +437 -0
  21. data/lib/cyber_trackr_client/api_error.rb +58 -0
  22. data/lib/cyber_trackr_client/configuration.rb +400 -0
  23. data/lib/cyber_trackr_client/models/api_documentation.rb +238 -0
  24. data/lib/cyber_trackr_client/models/assessment_procedure.rb +321 -0
  25. data/lib/cyber_trackr_client/models/cci_detail.rb +391 -0
  26. data/lib/cyber_trackr_client/models/document_detail.rb +434 -0
  27. data/lib/cyber_trackr_client/models/document_version.rb +385 -0
  28. data/lib/cyber_trackr_client/models/error.rb +313 -0
  29. data/lib/cyber_trackr_client/models/requirement_detail.rb +580 -0
  30. data/lib/cyber_trackr_client/models/requirement_summary.rb +360 -0
  31. data/lib/cyber_trackr_client/models/rmf_control_detail.rb +436 -0
  32. data/lib/cyber_trackr_client/models/rmf_control_list.rb +241 -0
  33. data/lib/cyber_trackr_client/version.rb +15 -0
  34. data/lib/cyber_trackr_client.rb +54 -0
  35. data/lib/cyber_trackr_helper.rb +269 -0
  36. data/lib/rubocop/cop/cyber_trackr_api/README.md +81 -0
  37. data/openapi/openapi.yaml +798 -0
  38. metadata +271 -0
@@ -0,0 +1,360 @@
1
+ =begin
2
+ #Cyber Trackr API
3
+
4
+ #Complete OpenAPI 3.1.1 specification for cyber.trackr.live API. This API provides access to DISA STIGs, SRGs, RMF controls, CCIs, and SCAP data. ## DISA Cybersecurity Ecosystem Hierarchy ``` NIST RMF Controls (high-level policy framework) ↓ (decomposed into atomic, testable statements) CCIs (Control Correlation Identifiers - bridge policy to implementation) ↓ (grouped by technology class into generic requirements) SRGs (Security Requirements Guides - technology class \"what\" to do) ↓ (implemented as vendor-specific \"how\" to do it) STIGs (Security Technical Implementation Guides - vendor/product specific) ↓ (automated versions for scanning tools) SCAP (Security Content Automation Protocol documents) ``` ## Critical Relationships - **RMF Controls** contain assessment procedures that reference **CCIs** - **CCIs** map back to **RMF Controls** and forward to **STIG/SRG requirements** - **SRGs** define generic technology requirements that **STIGs** implement specifically - **V-IDs** can appear in both SRG and corresponding STIG (same requirement, different specificity) - **SV-IDs** are XCCDF rule identifiers with revision tracking across document releases
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module CyberTrackrClient
17
+ # Summary information for a requirement within a document
18
+ class RequirementSummary
19
+ attr_accessor :title
20
+
21
+ attr_accessor :rule
22
+
23
+ attr_accessor :severity
24
+
25
+ attr_accessor :link
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'title' => :'title',
53
+ :'rule' => :'rule',
54
+ :'severity' => :'severity',
55
+ :'link' => :'link'
56
+ }
57
+ end
58
+
59
+ # Returns attribute mapping this model knows about
60
+ def self.acceptable_attribute_map
61
+ attribute_map
62
+ end
63
+
64
+ # Returns all the JSON keys this model knows about
65
+ def self.acceptable_attributes
66
+ acceptable_attribute_map.values
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.openapi_types
71
+ {
72
+ :'title' => :'String',
73
+ :'rule' => :'String',
74
+ :'severity' => :'String',
75
+ :'link' => :'String'
76
+ }
77
+ end
78
+
79
+ # List of attributes with nullable: true
80
+ def self.openapi_nullable
81
+ Set.new([
82
+ ])
83
+ end
84
+
85
+ # Initializes the object
86
+ # @param [Hash] attributes Model attributes in the form of hash
87
+ def initialize(attributes = {})
88
+ if (!attributes.is_a?(Hash))
89
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CyberTrackrClient::RequirementSummary` initialize method"
90
+ end
91
+
92
+ # check to see if the attribute exists and convert string to symbol for hash key
93
+ acceptable_attribute_map = self.class.acceptable_attribute_map
94
+ attributes = attributes.each_with_object({}) { |(k, v), h|
95
+ if (!acceptable_attribute_map.key?(k.to_sym))
96
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CyberTrackrClient::RequirementSummary`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
97
+ end
98
+ h[k.to_sym] = v
99
+ }
100
+
101
+ if attributes.key?(:'title')
102
+ self.title = attributes[:'title']
103
+ else
104
+ self.title = nil
105
+ end
106
+
107
+ if attributes.key?(:'rule')
108
+ self.rule = attributes[:'rule']
109
+ else
110
+ self.rule = nil
111
+ end
112
+
113
+ if attributes.key?(:'severity')
114
+ self.severity = attributes[:'severity']
115
+ else
116
+ self.severity = nil
117
+ end
118
+
119
+ if attributes.key?(:'link')
120
+ self.link = attributes[:'link']
121
+ else
122
+ self.link = nil
123
+ end
124
+ end
125
+
126
+ # Show invalid properties with the reasons. Usually used together with valid?
127
+ # @return Array for valid properties with the reasons
128
+ def list_invalid_properties
129
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
130
+ invalid_properties = Array.new
131
+ if @title.nil?
132
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
133
+ end
134
+
135
+ if @title.to_s.length < 1
136
+ invalid_properties.push('invalid value for "title", the character length must be greater than or equal to 1.')
137
+ end
138
+
139
+ if @rule.nil?
140
+ invalid_properties.push('invalid value for "rule", rule cannot be nil.')
141
+ end
142
+
143
+ pattern = Regexp.new(/^SV-\d+r\d+_rule$/)
144
+ if @rule !~ pattern
145
+ invalid_properties.push("invalid value for \"rule\", must conform to the pattern #{pattern}.")
146
+ end
147
+
148
+ if @severity.nil?
149
+ invalid_properties.push('invalid value for "severity", severity cannot be nil.')
150
+ end
151
+
152
+ if @link.nil?
153
+ invalid_properties.push('invalid value for "link", link cannot be nil.')
154
+ end
155
+
156
+ invalid_properties
157
+ end
158
+
159
+ # Check to see if the all the properties in the model are valid
160
+ # @return true if the model is valid
161
+ def valid?
162
+ warn '[DEPRECATED] the `valid?` method is obsolete'
163
+ return false if @title.nil?
164
+ return false if @title.to_s.length < 1
165
+ return false if @rule.nil?
166
+ return false if @rule !~ Regexp.new(/^SV-\d+r\d+_rule$/)
167
+ return false if @severity.nil?
168
+ severity_validator = EnumAttributeValidator.new('String', ["high", "medium", "low"])
169
+ return false unless severity_validator.valid?(@severity)
170
+ return false if @link.nil?
171
+ true
172
+ end
173
+
174
+ # Custom attribute writer method with validation
175
+ # @param [Object] title Value to be assigned
176
+ def title=(title)
177
+ if title.nil?
178
+ fail ArgumentError, 'title cannot be nil'
179
+ end
180
+
181
+ if title.to_s.length < 1
182
+ fail ArgumentError, 'invalid value for "title", the character length must be greater than or equal to 1.'
183
+ end
184
+
185
+ @title = title
186
+ end
187
+
188
+ # Custom attribute writer method with validation
189
+ # @param [Object] rule Value to be assigned
190
+ def rule=(rule)
191
+ if rule.nil?
192
+ fail ArgumentError, 'rule cannot be nil'
193
+ end
194
+
195
+ pattern = Regexp.new(/^SV-\d+r\d+_rule$/)
196
+ if rule !~ pattern
197
+ fail ArgumentError, "invalid value for \"rule\", must conform to the pattern #{pattern}."
198
+ end
199
+
200
+ @rule = rule
201
+ end
202
+
203
+ # Custom attribute writer method checking allowed values (enum).
204
+ # @param [Object] severity Object to be assigned
205
+ def severity=(severity)
206
+ validator = EnumAttributeValidator.new('String', ["high", "medium", "low"])
207
+ unless validator.valid?(severity)
208
+ fail ArgumentError, "invalid value for \"severity\", must be one of #{validator.allowable_values}."
209
+ end
210
+ @severity = severity
211
+ end
212
+
213
+ # Custom attribute writer method with validation
214
+ # @param [Object] link Value to be assigned
215
+ def link=(link)
216
+ if link.nil?
217
+ fail ArgumentError, 'link cannot be nil'
218
+ end
219
+
220
+ @link = link
221
+ end
222
+
223
+ # Checks equality by comparing each attribute.
224
+ # @param [Object] Object to be compared
225
+ def ==(o)
226
+ return true if self.equal?(o)
227
+ self.class == o.class &&
228
+ title == o.title &&
229
+ rule == o.rule &&
230
+ severity == o.severity &&
231
+ link == o.link
232
+ end
233
+
234
+ # @see the `==` method
235
+ # @param [Object] Object to be compared
236
+ def eql?(o)
237
+ self == o
238
+ end
239
+
240
+ # Calculates hash code according to all attributes.
241
+ # @return [Integer] Hash code
242
+ def hash
243
+ [title, rule, severity, link].hash
244
+ end
245
+
246
+ # Builds the object from hash
247
+ # @param [Hash] attributes Model attributes in the form of hash
248
+ # @return [Object] Returns the model itself
249
+ def self.build_from_hash(attributes)
250
+ return nil unless attributes.is_a?(Hash)
251
+ attributes = attributes.transform_keys(&:to_sym)
252
+ transformed_hash = {}
253
+ openapi_types.each_pair do |key, type|
254
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
255
+ transformed_hash["#{key}"] = nil
256
+ elsif type =~ /\AArray<(.*)>/i
257
+ # check to ensure the input is an array given that the attribute
258
+ # is documented as an array but the input is not
259
+ if attributes[attribute_map[key]].is_a?(Array)
260
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
261
+ end
262
+ elsif !attributes[attribute_map[key]].nil?
263
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
264
+ end
265
+ end
266
+ new(transformed_hash)
267
+ end
268
+
269
+ # Deserializes the data based on type
270
+ # @param string type Data type
271
+ # @param string value Value to be deserialized
272
+ # @return [Object] Deserialized data
273
+ def self._deserialize(type, value)
274
+ case type.to_sym
275
+ when :Time
276
+ Time.parse(value)
277
+ when :Date
278
+ Date.parse(value)
279
+ when :String
280
+ value.to_s
281
+ when :Integer
282
+ value.to_i
283
+ when :Float
284
+ value.to_f
285
+ when :Boolean
286
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
287
+ true
288
+ else
289
+ false
290
+ end
291
+ when :Object
292
+ # generic object (usually a Hash), return directly
293
+ value
294
+ when /\AArray<(?<inner_type>.+)>\z/
295
+ inner_type = Regexp.last_match[:inner_type]
296
+ value.map { |v| _deserialize(inner_type, v) }
297
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
298
+ k_type = Regexp.last_match[:k_type]
299
+ v_type = Regexp.last_match[:v_type]
300
+ {}.tap do |hash|
301
+ value.each do |k, v|
302
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
303
+ end
304
+ end
305
+ else # model
306
+ # models (e.g. Pet) or oneOf
307
+ klass = CyberTrackrClient.const_get(type)
308
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
309
+ end
310
+ end
311
+
312
+ # Returns the string representation of the object
313
+ # @return [String] String presentation of the object
314
+ def to_s
315
+ to_hash.to_s
316
+ end
317
+
318
+ # to_body is an alias to to_hash (backward compatibility)
319
+ # @return [Hash] Returns the object in the form of hash
320
+ def to_body
321
+ to_hash
322
+ end
323
+
324
+ # Returns the object in the form of hash
325
+ # @return [Hash] Returns the object in the form of hash
326
+ def to_hash
327
+ hash = {}
328
+ self.class.attribute_map.each_pair do |attr, param|
329
+ value = self.send(attr)
330
+ if value.nil?
331
+ is_nullable = self.class.openapi_nullable.include?(attr)
332
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
333
+ end
334
+
335
+ hash[param] = _to_hash(value)
336
+ end
337
+ hash
338
+ end
339
+
340
+ # Outputs non-array value in the form of hash
341
+ # For object, use to_hash. Otherwise, just return the value
342
+ # @param [Object] value Any valid value
343
+ # @return [Hash] Returns the value in the form of hash
344
+ def _to_hash(value)
345
+ if value.is_a?(Array)
346
+ value.compact.map { |v| _to_hash(v) }
347
+ elsif value.is_a?(Hash)
348
+ {}.tap do |hash|
349
+ value.each { |k, v| hash[k] = _to_hash(v) }
350
+ end
351
+ elsif value.respond_to? :to_hash
352
+ value.to_hash
353
+ else
354
+ value
355
+ end
356
+ end
357
+
358
+ end
359
+
360
+ end