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,434 @@
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
+ # Complete document details with all requirements
18
+ class DocumentDetail
19
+ attr_accessor :id
20
+
21
+ attr_accessor :title
22
+
23
+ attr_accessor :description
24
+
25
+ attr_accessor :status
26
+
27
+ # Document publication date in YYYY-MM-DD format
28
+ attr_accessor :published
29
+
30
+ # Requirements mapped by V-ID (e.g., V-214518 as key)
31
+ attr_accessor :requirements
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'id' => :'id',
59
+ :'title' => :'title',
60
+ :'description' => :'description',
61
+ :'status' => :'status',
62
+ :'published' => :'published',
63
+ :'requirements' => :'requirements'
64
+ }
65
+ end
66
+
67
+ # Returns attribute mapping this model knows about
68
+ def self.acceptable_attribute_map
69
+ attribute_map
70
+ end
71
+
72
+ # Returns all the JSON keys this model knows about
73
+ def self.acceptable_attributes
74
+ acceptable_attribute_map.values
75
+ end
76
+
77
+ # Attribute type mapping.
78
+ def self.openapi_types
79
+ {
80
+ :'id' => :'String',
81
+ :'title' => :'String',
82
+ :'description' => :'String',
83
+ :'status' => :'String',
84
+ :'published' => :'String',
85
+ :'requirements' => :'Hash<String, RequirementSummary>'
86
+ }
87
+ end
88
+
89
+ # List of attributes with nullable: true
90
+ def self.openapi_nullable
91
+ Set.new([
92
+ ])
93
+ end
94
+
95
+ # Initializes the object
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ def initialize(attributes = {})
98
+ if (!attributes.is_a?(Hash))
99
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CyberTrackrClient::DocumentDetail` initialize method"
100
+ end
101
+
102
+ # check to see if the attribute exists and convert string to symbol for hash key
103
+ acceptable_attribute_map = self.class.acceptable_attribute_map
104
+ attributes = attributes.each_with_object({}) { |(k, v), h|
105
+ if (!acceptable_attribute_map.key?(k.to_sym))
106
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CyberTrackrClient::DocumentDetail`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
107
+ end
108
+ h[k.to_sym] = v
109
+ }
110
+
111
+ if attributes.key?(:'id')
112
+ self.id = attributes[:'id']
113
+ else
114
+ self.id = nil
115
+ end
116
+
117
+ if attributes.key?(:'title')
118
+ self.title = attributes[:'title']
119
+ else
120
+ self.title = nil
121
+ end
122
+
123
+ if attributes.key?(:'description')
124
+ self.description = attributes[:'description']
125
+ else
126
+ self.description = nil
127
+ end
128
+
129
+ if attributes.key?(:'status')
130
+ self.status = attributes[:'status']
131
+ else
132
+ self.status = nil
133
+ end
134
+
135
+ if attributes.key?(:'published')
136
+ self.published = attributes[:'published']
137
+ else
138
+ self.published = nil
139
+ end
140
+
141
+ if attributes.key?(:'requirements')
142
+ if (value = attributes[:'requirements']).is_a?(Hash)
143
+ self.requirements = value
144
+ end
145
+ else
146
+ self.requirements = nil
147
+ end
148
+ end
149
+
150
+ # Show invalid properties with the reasons. Usually used together with valid?
151
+ # @return Array for valid properties with the reasons
152
+ def list_invalid_properties
153
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
154
+ invalid_properties = Array.new
155
+ if @id.nil?
156
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
157
+ end
158
+
159
+ if @id.to_s.length < 1
160
+ invalid_properties.push('invalid value for "id", the character length must be greater than or equal to 1.')
161
+ end
162
+
163
+ if @title.nil?
164
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
165
+ end
166
+
167
+ if @title.to_s.length < 1
168
+ invalid_properties.push('invalid value for "title", the character length must be greater than or equal to 1.')
169
+ end
170
+
171
+ if @description.nil?
172
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
173
+ end
174
+
175
+ if @description.to_s.length < 1
176
+ invalid_properties.push('invalid value for "description", the character length must be greater than or equal to 1.')
177
+ end
178
+
179
+ if @status.nil?
180
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
181
+ end
182
+
183
+ if @published.nil?
184
+ invalid_properties.push('invalid value for "published", published cannot be nil.')
185
+ end
186
+
187
+ pattern = Regexp.new(/^\d{4}-\d{2}-\d{2}$/)
188
+ if @published !~ pattern
189
+ invalid_properties.push("invalid value for \"published\", must conform to the pattern #{pattern}.")
190
+ end
191
+
192
+ if @requirements.nil?
193
+ invalid_properties.push('invalid value for "requirements", requirements cannot be nil.')
194
+ end
195
+
196
+ invalid_properties
197
+ end
198
+
199
+ # Check to see if the all the properties in the model are valid
200
+ # @return true if the model is valid
201
+ def valid?
202
+ warn '[DEPRECATED] the `valid?` method is obsolete'
203
+ return false if @id.nil?
204
+ return false if @id.to_s.length < 1
205
+ return false if @title.nil?
206
+ return false if @title.to_s.length < 1
207
+ return false if @description.nil?
208
+ return false if @description.to_s.length < 1
209
+ return false if @status.nil?
210
+ status_validator = EnumAttributeValidator.new('String', ["accepted", "draft", "deprecated"])
211
+ return false unless status_validator.valid?(@status)
212
+ return false if @published.nil?
213
+ return false if @published !~ Regexp.new(/^\d{4}-\d{2}-\d{2}$/)
214
+ return false if @requirements.nil?
215
+ true
216
+ end
217
+
218
+ # Custom attribute writer method with validation
219
+ # @param [Object] id Value to be assigned
220
+ def id=(id)
221
+ if id.nil?
222
+ fail ArgumentError, 'id cannot be nil'
223
+ end
224
+
225
+ if id.to_s.length < 1
226
+ fail ArgumentError, 'invalid value for "id", the character length must be greater than or equal to 1.'
227
+ end
228
+
229
+ @id = id
230
+ end
231
+
232
+ # Custom attribute writer method with validation
233
+ # @param [Object] title Value to be assigned
234
+ def title=(title)
235
+ if title.nil?
236
+ fail ArgumentError, 'title cannot be nil'
237
+ end
238
+
239
+ if title.to_s.length < 1
240
+ fail ArgumentError, 'invalid value for "title", the character length must be greater than or equal to 1.'
241
+ end
242
+
243
+ @title = title
244
+ end
245
+
246
+ # Custom attribute writer method with validation
247
+ # @param [Object] description Value to be assigned
248
+ def description=(description)
249
+ if description.nil?
250
+ fail ArgumentError, 'description cannot be nil'
251
+ end
252
+
253
+ if description.to_s.length < 1
254
+ fail ArgumentError, 'invalid value for "description", the character length must be greater than or equal to 1.'
255
+ end
256
+
257
+ @description = description
258
+ end
259
+
260
+ # Custom attribute writer method checking allowed values (enum).
261
+ # @param [Object] status Object to be assigned
262
+ def status=(status)
263
+ validator = EnumAttributeValidator.new('String', ["accepted", "draft", "deprecated"])
264
+ unless validator.valid?(status)
265
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
266
+ end
267
+ @status = status
268
+ end
269
+
270
+ # Custom attribute writer method with validation
271
+ # @param [Object] published Value to be assigned
272
+ def published=(published)
273
+ if published.nil?
274
+ fail ArgumentError, 'published cannot be nil'
275
+ end
276
+
277
+ pattern = Regexp.new(/^\d{4}-\d{2}-\d{2}$/)
278
+ if published !~ pattern
279
+ fail ArgumentError, "invalid value for \"published\", must conform to the pattern #{pattern}."
280
+ end
281
+
282
+ @published = published
283
+ end
284
+
285
+ # Custom attribute writer method with validation
286
+ # @param [Object] requirements Value to be assigned
287
+ def requirements=(requirements)
288
+ if requirements.nil?
289
+ fail ArgumentError, 'requirements cannot be nil'
290
+ end
291
+
292
+ @requirements = requirements
293
+ end
294
+
295
+ # Checks equality by comparing each attribute.
296
+ # @param [Object] Object to be compared
297
+ def ==(o)
298
+ return true if self.equal?(o)
299
+ self.class == o.class &&
300
+ id == o.id &&
301
+ title == o.title &&
302
+ description == o.description &&
303
+ status == o.status &&
304
+ published == o.published &&
305
+ requirements == o.requirements
306
+ end
307
+
308
+ # @see the `==` method
309
+ # @param [Object] Object to be compared
310
+ def eql?(o)
311
+ self == o
312
+ end
313
+
314
+ # Calculates hash code according to all attributes.
315
+ # @return [Integer] Hash code
316
+ def hash
317
+ [id, title, description, status, published, requirements].hash
318
+ end
319
+
320
+ # Builds the object from hash
321
+ # @param [Hash] attributes Model attributes in the form of hash
322
+ # @return [Object] Returns the model itself
323
+ def self.build_from_hash(attributes)
324
+ return nil unless attributes.is_a?(Hash)
325
+ attributes = attributes.transform_keys(&:to_sym)
326
+ transformed_hash = {}
327
+ openapi_types.each_pair do |key, type|
328
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
329
+ transformed_hash["#{key}"] = nil
330
+ elsif type =~ /\AArray<(.*)>/i
331
+ # check to ensure the input is an array given that the attribute
332
+ # is documented as an array but the input is not
333
+ if attributes[attribute_map[key]].is_a?(Array)
334
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
335
+ end
336
+ elsif !attributes[attribute_map[key]].nil?
337
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
338
+ end
339
+ end
340
+ new(transformed_hash)
341
+ end
342
+
343
+ # Deserializes the data based on type
344
+ # @param string type Data type
345
+ # @param string value Value to be deserialized
346
+ # @return [Object] Deserialized data
347
+ def self._deserialize(type, value)
348
+ case type.to_sym
349
+ when :Time
350
+ Time.parse(value)
351
+ when :Date
352
+ Date.parse(value)
353
+ when :String
354
+ value.to_s
355
+ when :Integer
356
+ value.to_i
357
+ when :Float
358
+ value.to_f
359
+ when :Boolean
360
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
361
+ true
362
+ else
363
+ false
364
+ end
365
+ when :Object
366
+ # generic object (usually a Hash), return directly
367
+ value
368
+ when /\AArray<(?<inner_type>.+)>\z/
369
+ inner_type = Regexp.last_match[:inner_type]
370
+ value.map { |v| _deserialize(inner_type, v) }
371
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
372
+ k_type = Regexp.last_match[:k_type]
373
+ v_type = Regexp.last_match[:v_type]
374
+ {}.tap do |hash|
375
+ value.each do |k, v|
376
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
377
+ end
378
+ end
379
+ else # model
380
+ # models (e.g. Pet) or oneOf
381
+ klass = CyberTrackrClient.const_get(type)
382
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
383
+ end
384
+ end
385
+
386
+ # Returns the string representation of the object
387
+ # @return [String] String presentation of the object
388
+ def to_s
389
+ to_hash.to_s
390
+ end
391
+
392
+ # to_body is an alias to to_hash (backward compatibility)
393
+ # @return [Hash] Returns the object in the form of hash
394
+ def to_body
395
+ to_hash
396
+ end
397
+
398
+ # Returns the object in the form of hash
399
+ # @return [Hash] Returns the object in the form of hash
400
+ def to_hash
401
+ hash = {}
402
+ self.class.attribute_map.each_pair do |attr, param|
403
+ value = self.send(attr)
404
+ if value.nil?
405
+ is_nullable = self.class.openapi_nullable.include?(attr)
406
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
407
+ end
408
+
409
+ hash[param] = _to_hash(value)
410
+ end
411
+ hash
412
+ end
413
+
414
+ # Outputs non-array value in the form of hash
415
+ # For object, use to_hash. Otherwise, just return the value
416
+ # @param [Object] value Any valid value
417
+ # @return [Hash] Returns the value in the form of hash
418
+ def _to_hash(value)
419
+ if value.is_a?(Array)
420
+ value.compact.map { |v| _to_hash(v) }
421
+ elsif value.is_a?(Hash)
422
+ {}.tap do |hash|
423
+ value.each { |k, v| hash[k] = _to_hash(v) }
424
+ end
425
+ elsif value.respond_to? :to_hash
426
+ value.to_hash
427
+ else
428
+ value
429
+ end
430
+ end
431
+
432
+ end
433
+
434
+ end