emass_client 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +1284 -0
  3. data/Rakefile +8 -0
  4. data/lib/emass_client/api/artifacts_api.rb +310 -0
  5. data/lib/emass_client/api/artifacts_export_api.rb +86 -0
  6. data/lib/emass_client/api/cac_api.rb +143 -0
  7. data/lib/emass_client/api/cmmc_assessments_api.rb +77 -0
  8. data/lib/emass_client/api/controls_api.rb +143 -0
  9. data/lib/emass_client/api/milestones_api.rb +366 -0
  10. data/lib/emass_client/api/pac_api.rb +140 -0
  11. data/lib/emass_client/api/poam_api.rb +345 -0
  12. data/lib/emass_client/api/registration_api.rb +78 -0
  13. data/lib/emass_client/api/static_code_scans_api.rb +84 -0
  14. data/lib/emass_client/api/system_roles_api.rb +150 -0
  15. data/lib/emass_client/api/systems_api.rb +162 -0
  16. data/lib/emass_client/api/test_api.rb +70 -0
  17. data/lib/emass_client/api/test_results_api.rb +149 -0
  18. data/lib/emass_client/api/workflow_definitions_api.rb +76 -0
  19. data/lib/emass_client/api/workflow_instances_api.rb +153 -0
  20. data/lib/emass_client/api_client.rb +389 -0
  21. data/lib/emass_client/api_error.rb +57 -0
  22. data/lib/emass_client/configuration.rb +224 -0
  23. data/lib/emass_client/models/artifacts_delete.rb +201 -0
  24. data/lib/emass_client/models/artifacts_delete_inner.rb +207 -0
  25. data/lib/emass_client/models/artifacts_get.rb +383 -0
  26. data/lib/emass_client/models/artifacts_request_put_body.rb +363 -0
  27. data/lib/emass_client/models/artifacts_response_del.rb +217 -0
  28. data/lib/emass_client/models/artifacts_response_del_data.rb +225 -0
  29. data/lib/emass_client/models/artifacts_response_get.rb +217 -0
  30. data/lib/emass_client/models/artifacts_response_put_post.rb +217 -0
  31. data/lib/emass_client/models/cac_get.rb +301 -0
  32. data/lib/emass_client/models/cac_request_post_body.rb +217 -0
  33. data/lib/emass_client/models/cac_response_get.rb +217 -0
  34. data/lib/emass_client/models/cac_response_post.rb +217 -0
  35. data/lib/emass_client/models/cac_response_post_data.rb +225 -0
  36. data/lib/emass_client/models/cmmc_get.rb +398 -0
  37. data/lib/emass_client/models/cmmc_response_get.rb +217 -0
  38. data/lib/emass_client/models/connectivity_ccsd.rb +217 -0
  39. data/lib/emass_client/models/controls_get.rb +663 -0
  40. data/lib/emass_client/models/controls_put.rb +227 -0
  41. data/lib/emass_client/models/controls_request_put_body.rb +606 -0
  42. data/lib/emass_client/models/controls_response_get.rb +217 -0
  43. data/lib/emass_client/models/controls_response_put.rb +217 -0
  44. data/lib/emass_client/models/definition_transitions.rb +274 -0
  45. data/lib/emass_client/models/delete_milestone.rb +212 -0
  46. data/lib/emass_client/models/delete_poam.rb +212 -0
  47. data/lib/emass_client/models/empty200_response.rb +197 -0
  48. data/lib/emass_client/models/error.rb +225 -0
  49. data/lib/emass_client/models/instances_transitions.rb +327 -0
  50. data/lib/emass_client/models/milestone_response_get.rb +217 -0
  51. data/lib/emass_client/models/milestone_response_post.rb +217 -0
  52. data/lib/emass_client/models/milestone_response_put.rb +217 -0
  53. data/lib/emass_client/models/milestones_delete.rb +197 -0
  54. data/lib/emass_client/models/milestones_get.rb +291 -0
  55. data/lib/emass_client/models/milestones_post.rb +197 -0
  56. data/lib/emass_client/models/milestones_put.rb +197 -0
  57. data/lib/emass_client/models/milestones_put_post_delete.rb +247 -0
  58. data/lib/emass_client/models/milestones_request_post_body.rb +242 -0
  59. data/lib/emass_client/models/milestones_request_put_body.rb +242 -0
  60. data/lib/emass_client/models/milestones_required_post.rb +227 -0
  61. data/lib/emass_client/models/milestones_required_put.rb +242 -0
  62. data/lib/emass_client/models/model_200.rb +208 -0
  63. data/lib/emass_client/models/model_201.rb +206 -0
  64. data/lib/emass_client/models/model_201_meta.rb +219 -0
  65. data/lib/emass_client/models/model_400.rb +206 -0
  66. data/lib/emass_client/models/model_400_meta.rb +219 -0
  67. data/lib/emass_client/models/model_400_response.rb +206 -0
  68. data/lib/emass_client/models/model_401.rb +206 -0
  69. data/lib/emass_client/models/model_401_meta.rb +219 -0
  70. data/lib/emass_client/models/model_403.rb +206 -0
  71. data/lib/emass_client/models/model_403_meta.rb +219 -0
  72. data/lib/emass_client/models/model_404.rb +219 -0
  73. data/lib/emass_client/models/model_404_response.rb +206 -0
  74. data/lib/emass_client/models/model_405.rb +206 -0
  75. data/lib/emass_client/models/model_405_meta.rb +219 -0
  76. data/lib/emass_client/models/model_411.rb +206 -0
  77. data/lib/emass_client/models/model_411_meta.rb +219 -0
  78. data/lib/emass_client/models/model_490.rb +206 -0
  79. data/lib/emass_client/models/model_490_meta.rb +219 -0
  80. data/lib/emass_client/models/model_500.rb +206 -0
  81. data/lib/emass_client/models/model_500_meta.rb +219 -0
  82. data/lib/emass_client/models/pac_get.rb +311 -0
  83. data/lib/emass_client/models/pac_post.rb +259 -0
  84. data/lib/emass_client/models/pac_request_post_body.rb +261 -0
  85. data/lib/emass_client/models/pac_response_get.rb +217 -0
  86. data/lib/emass_client/models/pac_response_post.rb +217 -0
  87. data/lib/emass_client/models/poam_delete.rb +197 -0
  88. data/lib/emass_client/models/poam_get.rb +646 -0
  89. data/lib/emass_client/models/poam_post.rb +197 -0
  90. data/lib/emass_client/models/poam_post_put_del.rb +237 -0
  91. data/lib/emass_client/models/poam_put.rb +197 -0
  92. data/lib/emass_client/models/poam_request_post_body.rb +197 -0
  93. data/lib/emass_client/models/poam_request_put_body.rb +197 -0
  94. data/lib/emass_client/models/poam_required_post.rb +564 -0
  95. data/lib/emass_client/models/poam_required_put.rb +594 -0
  96. data/lib/emass_client/models/poam_response_delete.rb +217 -0
  97. data/lib/emass_client/models/poam_response_get.rb +217 -0
  98. data/lib/emass_client/models/poam_response_post.rb +217 -0
  99. data/lib/emass_client/models/poam_response_put.rb +217 -0
  100. data/lib/emass_client/models/register.rb +215 -0
  101. data/lib/emass_client/models/register_data.rb +206 -0
  102. data/lib/emass_client/models/register_user_request_post_body.rb +211 -0
  103. data/lib/emass_client/models/role_category.rb +272 -0
  104. data/lib/emass_client/models/roles.rb +274 -0
  105. data/lib/emass_client/models/ssps.rb +227 -0
  106. data/lib/emass_client/models/stage.rb +252 -0
  107. data/lib/emass_client/models/static_code_application.rb +303 -0
  108. data/lib/emass_client/models/static_code_request_post_body.rb +197 -0
  109. data/lib/emass_client/models/static_code_required_post.rb +217 -0
  110. data/lib/emass_client/models/static_code_required_post_application.rb +217 -0
  111. data/lib/emass_client/models/success200_response.rb +217 -0
  112. data/lib/emass_client/models/system_id_artifacts_body.rb +284 -0
  113. data/lib/emass_client/models/system_response.rb +217 -0
  114. data/lib/emass_client/models/system_roles_category_response.rb +217 -0
  115. data/lib/emass_client/models/system_roles_response.rb +217 -0
  116. data/lib/emass_client/models/system_roles_response_data.rb +219 -0
  117. data/lib/emass_client/models/systems.rb +1137 -0
  118. data/lib/emass_client/models/test.rb +215 -0
  119. data/lib/emass_client/models/test_data.rb +206 -0
  120. data/lib/emass_client/models/test_results_get.rb +333 -0
  121. data/lib/emass_client/models/test_results_post.rb +227 -0
  122. data/lib/emass_client/models/test_results_request_post_body.rb +306 -0
  123. data/lib/emass_client/models/test_results_response_get.rb +217 -0
  124. data/lib/emass_client/models/test_results_response_post.rb +217 -0
  125. data/lib/emass_client/models/users.rb +224 -0
  126. data/lib/emass_client/models/workflow_definition_get.rb +282 -0
  127. data/lib/emass_client/models/workflow_definition_response_get.rb +217 -0
  128. data/lib/emass_client/models/workflow_instances_get.rb +368 -0
  129. data/lib/emass_client/models/workflow_instances_response_get.rb +217 -0
  130. data/lib/emass_client/version.rb +14 -0
  131. data/lib/emass_client.rb +161 -0
  132. metadata +259 -0
@@ -0,0 +1,207 @@
1
+ =begin
2
+ #Enterprise Mission Assurance Support Service (eMASS)
3
+
4
+ #The Enterprise Mission Assurance Support Service (eMASS) Representational State Transfer (REST) Application Programming Interface (API) enables users to perform assessments and complete actions associated with system records. The `emasser` is a command-line interface (CLI) tool that implements all of the eMASS endpoints defined in the eMASS REST API v3.2, dated October 21, 2021.</br><br> <strong>Register CLI</strong></br> New users will need to register an API key with the eMASS development team prior to accessing the site for the first time. The eMASS REST API requires a client certificate (SSL/TLS, DoD PKI only) where {url}/api/register (POST) is used to register the client certificate.</br></br> Every call to the eMASS REST API will require the use of the agreed upon public key certificate and API key. The API key must be provided in the request header for all endpoint calls (api-key). If the service receives an untrusted certificate or API key, a 401 error response code will be returned along with an error message.</br></br> <strong>Available Request Headers:</strong></br> <table> <tr> <th align=left>key</th> <th align=left>Example Value</th> <th align=left>Description</th> </tr> <tr> <td>`api-key`</td> <td>api-key-provided-by-emass</td> <td>This API key must be provided in the request header for all endpoint calls</td> </tr> <tr> <td>`user-uid`</td> <td>USER.UID.KEY</td> <td>This User unique identifier key must be provided in the request header for all PUT, POST, and DELETE endpoint calls</td> </tr> <tr> <td></td><td></td> <td> Note: For DoD users this is the DoD ID Number (EIDIPI) on their DoD CAC </td> </tr> </table> </br><strong>Approve API Client for Actionable Requests</strong></br> Users are required to log-in to eMASS and grant permissions for a client to update data within eMASS on their behalf. This is only required for actionable requests (PUT, POST, DELETE). The Registration Endpoint and all GET requests can be accessed without completing this process with the correct permissions. Please note that leaving a field parameter blank (for PUT/POST requests) has the potential to clear information in the active eMASS records. To establish an account with eMASS and/or acquire an api-key/user-uid, contact one of the listed POC:
5
+
6
+ OpenAPI spec version: v3.2
7
+ Contact: disa.meade.id.mbx.emass-tier-iii-support@mail.mil
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.26
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module EmassClient
15
+ class ArtifactsDeleteInner
16
+ # [Required] File name should match exactly one file within the provided zip file. 1000 Characters.
17
+ attr_accessor :filename
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'filename' => :'filename'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'filename' => :'Object'
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
36
+ ])
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `EmassClient::ArtifactsDeleteInner` initialize method"
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `EmassClient::ArtifactsDeleteInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'filename')
55
+ self.filename = attributes[:'filename']
56
+ end
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ invalid_properties
64
+ end
65
+
66
+ # Check to see if the all the properties in the model are valid
67
+ # @return true if the model is valid
68
+ def valid?
69
+ true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ filename == o.filename
78
+ end
79
+
80
+ # @see the `==` method
81
+ # @param [Object] Object to be compared
82
+ def eql?(o)
83
+ self == o
84
+ end
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Integer] Hash code
88
+ def hash
89
+ [filename].hash
90
+ end
91
+
92
+ # Builds the object from hash
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ # @return [Object] Returns the model itself
95
+ def self.build_from_hash(attributes)
96
+ new.build_from_hash(attributes)
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def build_from_hash(attributes)
103
+ return nil unless attributes.is_a?(Hash)
104
+ self.class.openapi_types.each_pair do |key, type|
105
+ if type =~ /\AArray<(.*)>/i
106
+ # check to ensure the input is an array given that the attribute
107
+ # is documented as an array but the input is not
108
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
109
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
110
+ end
111
+ elsif !attributes[self.class.attribute_map[key]].nil?
112
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
113
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
114
+ self.send("#{key}=", nil)
115
+ end
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def _deserialize(type, value)
126
+ case type.to_sym
127
+ when :DateTime
128
+ DateTime.parse(value)
129
+ when :Date
130
+ Date.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :Boolean
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ EmassClient.const_get(type).build_from_hash(value)
159
+ end
160
+ end
161
+
162
+ # Returns the string representation of the object
163
+ # @return [String] String presentation of the object
164
+ def to_s
165
+ to_hash.to_s
166
+ end
167
+
168
+ # to_body is an alias to to_hash (backward compatibility)
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_body
171
+ to_hash
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = self.send(attr)
180
+ if value.nil?
181
+ is_nullable = self.class.openapi_nullable.include?(attr)
182
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
183
+ end
184
+
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ # Outputs non-array value in the form of hash
191
+ # For object, use to_hash. Otherwise, just return the value
192
+ # @param [Object] value Any valid value
193
+ # @return [Hash] Returns the value in the form of hash
194
+ def _to_hash(value)
195
+ if value.is_a?(Array)
196
+ value.compact.map { |v| _to_hash(v) }
197
+ elsif value.is_a?(Hash)
198
+ {}.tap do |hash|
199
+ value.each { |k, v| hash[k] = _to_hash(v) }
200
+ end
201
+ elsif value.respond_to? :to_hash
202
+ value.to_hash
203
+ else
204
+ value
205
+ end
206
+ end end
207
+ end
@@ -0,0 +1,383 @@
1
+ =begin
2
+ #Enterprise Mission Assurance Support Service (eMASS)
3
+
4
+ #The Enterprise Mission Assurance Support Service (eMASS) Representational State Transfer (REST) Application Programming Interface (API) enables users to perform assessments and complete actions associated with system records. The `emasser` is a command-line interface (CLI) tool that implements all of the eMASS endpoints defined in the eMASS REST API v3.2, dated October 21, 2021.</br><br> <strong>Register CLI</strong></br> New users will need to register an API key with the eMASS development team prior to accessing the site for the first time. The eMASS REST API requires a client certificate (SSL/TLS, DoD PKI only) where {url}/api/register (POST) is used to register the client certificate.</br></br> Every call to the eMASS REST API will require the use of the agreed upon public key certificate and API key. The API key must be provided in the request header for all endpoint calls (api-key). If the service receives an untrusted certificate or API key, a 401 error response code will be returned along with an error message.</br></br> <strong>Available Request Headers:</strong></br> <table> <tr> <th align=left>key</th> <th align=left>Example Value</th> <th align=left>Description</th> </tr> <tr> <td>`api-key`</td> <td>api-key-provided-by-emass</td> <td>This API key must be provided in the request header for all endpoint calls</td> </tr> <tr> <td>`user-uid`</td> <td>USER.UID.KEY</td> <td>This User unique identifier key must be provided in the request header for all PUT, POST, and DELETE endpoint calls</td> </tr> <tr> <td></td><td></td> <td> Note: For DoD users this is the DoD ID Number (EIDIPI) on their DoD CAC </td> </tr> </table> </br><strong>Approve API Client for Actionable Requests</strong></br> Users are required to log-in to eMASS and grant permissions for a client to update data within eMASS on their behalf. This is only required for actionable requests (PUT, POST, DELETE). The Registration Endpoint and all GET requests can be accessed without completing this process with the correct permissions. Please note that leaving a field parameter blank (for PUT/POST requests) has the potential to clear information in the active eMASS records. To establish an account with eMASS and/or acquire an api-key/user-uid, contact one of the listed POC:
5
+
6
+ OpenAPI spec version: v3.2
7
+ Contact: disa.meade.id.mbx.emass-tier-iii-support@mail.mil
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.26
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module EmassClient
15
+ class ArtifactsGet
16
+ # [Required] Unique eMASS system identifier.
17
+ attr_accessor :system_id
18
+
19
+ # [Required] File name should match exactly one file within the provided zip file. 1000 Characters.
20
+ attr_accessor :filename
21
+
22
+ # [Read-only] Indicates whether an artifact is inherited.
23
+ attr_accessor :is_inherited
24
+
25
+ # [Read-only] Indicates whether an artifact template.
26
+ attr_accessor :is_template
27
+
28
+ # [Required] Artifact type options
29
+ attr_accessor :type
30
+
31
+ # [Required] Artifact category options
32
+ attr_accessor :category
33
+
34
+ # [Optional] Artifact description. 2000 Characters.
35
+ attr_accessor :description
36
+
37
+ # [Optional] Artifact reference page number. 50 Characters.
38
+ attr_accessor :ref_page_number
39
+
40
+ # [Optional] CCI associated with test result.
41
+ attr_accessor :ccis
42
+
43
+ # [Optional] Control acronym associated with the artifact. NIST SP 800-53 Revision 4 defined.
44
+ attr_accessor :controls
45
+
46
+ # [Read-Only] Standard MIME content type derived from file extension.
47
+ attr_accessor :mime_content_type
48
+
49
+ # [Read-Only] File size of attached artifact.
50
+ attr_accessor :file_size
51
+
52
+ # [Optional] Date Artifact expires and requires review. In Unix Date format.
53
+ attr_accessor :artifact_expiration_date
54
+
55
+ # [Conditional] Date Artifact was last reviewed.. Unix time format.
56
+ attr_accessor :last_reviewed_date
57
+
58
+ class EnumAttributeValidator
59
+ attr_reader :datatype
60
+ attr_reader :allowable_values
61
+
62
+ def initialize(datatype, allowable_values)
63
+ @allowable_values = allowable_values.map do |value|
64
+ case datatype.to_s
65
+ when /Integer/i
66
+ value.to_i
67
+ when /Float/i
68
+ value.to_f
69
+ else
70
+ value
71
+ end
72
+ end
73
+ end
74
+
75
+ def valid?(value)
76
+ !value || allowable_values.include?(value)
77
+ end
78
+ end
79
+
80
+ # Attribute mapping from ruby-style variable name to JSON key.
81
+ def self.attribute_map
82
+ {
83
+ :'system_id' => :'systemId',
84
+ :'filename' => :'filename',
85
+ :'is_inherited' => :'isInherited',
86
+ :'is_template' => :'isTemplate',
87
+ :'type' => :'type',
88
+ :'category' => :'category',
89
+ :'description' => :'description',
90
+ :'ref_page_number' => :'refPageNumber',
91
+ :'ccis' => :'ccis',
92
+ :'controls' => :'controls',
93
+ :'mime_content_type' => :'mimeContentType',
94
+ :'file_size' => :'fileSize',
95
+ :'artifact_expiration_date' => :'artifactExpirationDate',
96
+ :'last_reviewed_date' => :'lastReviewedDate'
97
+ }
98
+ end
99
+
100
+ # Attribute type mapping.
101
+ def self.openapi_types
102
+ {
103
+ :'system_id' => :'Object',
104
+ :'filename' => :'Object',
105
+ :'is_inherited' => :'Object',
106
+ :'is_template' => :'Object',
107
+ :'type' => :'Object',
108
+ :'category' => :'Object',
109
+ :'description' => :'Object',
110
+ :'ref_page_number' => :'Object',
111
+ :'ccis' => :'Object',
112
+ :'controls' => :'Object',
113
+ :'mime_content_type' => :'Object',
114
+ :'file_size' => :'Object',
115
+ :'artifact_expiration_date' => :'Object',
116
+ :'last_reviewed_date' => :'Object'
117
+ }
118
+ end
119
+
120
+ # List of attributes with nullable: true
121
+ def self.openapi_nullable
122
+ Set.new([
123
+ ])
124
+ end
125
+
126
+ # Initializes the object
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ def initialize(attributes = {})
129
+ if (!attributes.is_a?(Hash))
130
+ fail ArgumentError, "The input argument (attributes) must be a hash in `EmassClient::ArtifactsGet` initialize method"
131
+ end
132
+
133
+ # check to see if the attribute exists and convert string to symbol for hash key
134
+ attributes = attributes.each_with_object({}) { |(k, v), h|
135
+ if (!self.class.attribute_map.key?(k.to_sym))
136
+ fail ArgumentError, "`#{k}` is not a valid attribute in `EmassClient::ArtifactsGet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
137
+ end
138
+ h[k.to_sym] = v
139
+ }
140
+
141
+ if attributes.key?(:'system_id')
142
+ self.system_id = attributes[:'system_id']
143
+ end
144
+
145
+ if attributes.key?(:'filename')
146
+ self.filename = attributes[:'filename']
147
+ end
148
+
149
+ if attributes.key?(:'is_inherited')
150
+ self.is_inherited = attributes[:'is_inherited']
151
+ end
152
+
153
+ if attributes.key?(:'is_template')
154
+ self.is_template = attributes[:'is_template']
155
+ end
156
+
157
+ if attributes.key?(:'type')
158
+ self.type = attributes[:'type']
159
+ end
160
+
161
+ if attributes.key?(:'category')
162
+ self.category = attributes[:'category']
163
+ end
164
+
165
+ if attributes.key?(:'description')
166
+ self.description = attributes[:'description']
167
+ end
168
+
169
+ if attributes.key?(:'ref_page_number')
170
+ self.ref_page_number = attributes[:'ref_page_number']
171
+ end
172
+
173
+ if attributes.key?(:'ccis')
174
+ self.ccis = attributes[:'ccis']
175
+ end
176
+
177
+ if attributes.key?(:'controls')
178
+ self.controls = attributes[:'controls']
179
+ end
180
+
181
+ if attributes.key?(:'mime_content_type')
182
+ self.mime_content_type = attributes[:'mime_content_type']
183
+ end
184
+
185
+ if attributes.key?(:'file_size')
186
+ self.file_size = attributes[:'file_size']
187
+ end
188
+
189
+ if attributes.key?(:'artifact_expiration_date')
190
+ self.artifact_expiration_date = attributes[:'artifact_expiration_date']
191
+ end
192
+
193
+ if attributes.key?(:'last_reviewed_date')
194
+ self.last_reviewed_date = attributes[:'last_reviewed_date']
195
+ end
196
+ end
197
+
198
+ # Show invalid properties with the reasons. Usually used together with valid?
199
+ # @return Array for valid properties with the reasons
200
+ def list_invalid_properties
201
+ invalid_properties = Array.new
202
+ invalid_properties
203
+ end
204
+
205
+ # Check to see if the all the properties in the model are valid
206
+ # @return true if the model is valid
207
+ def valid?
208
+ type_validator = EnumAttributeValidator.new('Object', ['Procedure', 'Diagram', 'Policy', 'Labor', 'Document', 'Image', 'Other', 'Scan Result', 'Auditor Report'])
209
+ return false unless type_validator.valid?(@type)
210
+ category_validator = EnumAttributeValidator.new('Object', ['Implementation Guidance', 'Evidence'])
211
+ return false unless category_validator.valid?(@category)
212
+ true
213
+ end
214
+
215
+ # Custom attribute writer method checking allowed values (enum).
216
+ # @param [Object] type Object to be assigned
217
+ def type=(type)
218
+ validator = EnumAttributeValidator.new('Object', ['Procedure', 'Diagram', 'Policy', 'Labor', 'Document', 'Image', 'Other', 'Scan Result', 'Auditor Report'])
219
+ unless validator.valid?(type)
220
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
221
+ end
222
+ @type = type
223
+ end
224
+
225
+ # Custom attribute writer method checking allowed values (enum).
226
+ # @param [Object] category Object to be assigned
227
+ def category=(category)
228
+ validator = EnumAttributeValidator.new('Object', ['Implementation Guidance', 'Evidence'])
229
+ unless validator.valid?(category)
230
+ fail ArgumentError, "invalid value for \"category\", must be one of #{validator.allowable_values}."
231
+ end
232
+ @category = category
233
+ end
234
+
235
+ # Checks equality by comparing each attribute.
236
+ # @param [Object] Object to be compared
237
+ def ==(o)
238
+ return true if self.equal?(o)
239
+ self.class == o.class &&
240
+ system_id == o.system_id &&
241
+ filename == o.filename &&
242
+ is_inherited == o.is_inherited &&
243
+ is_template == o.is_template &&
244
+ type == o.type &&
245
+ category == o.category &&
246
+ description == o.description &&
247
+ ref_page_number == o.ref_page_number &&
248
+ ccis == o.ccis &&
249
+ controls == o.controls &&
250
+ mime_content_type == o.mime_content_type &&
251
+ file_size == o.file_size &&
252
+ artifact_expiration_date == o.artifact_expiration_date &&
253
+ last_reviewed_date == o.last_reviewed_date
254
+ end
255
+
256
+ # @see the `==` method
257
+ # @param [Object] Object to be compared
258
+ def eql?(o)
259
+ self == o
260
+ end
261
+
262
+ # Calculates hash code according to all attributes.
263
+ # @return [Integer] Hash code
264
+ def hash
265
+ [system_id, filename, is_inherited, is_template, type, category, description, ref_page_number, ccis, controls, mime_content_type, file_size, artifact_expiration_date, last_reviewed_date].hash
266
+ end
267
+
268
+ # Builds the object from hash
269
+ # @param [Hash] attributes Model attributes in the form of hash
270
+ # @return [Object] Returns the model itself
271
+ def self.build_from_hash(attributes)
272
+ new.build_from_hash(attributes)
273
+ end
274
+
275
+ # Builds the object from hash
276
+ # @param [Hash] attributes Model attributes in the form of hash
277
+ # @return [Object] Returns the model itself
278
+ def build_from_hash(attributes)
279
+ return nil unless attributes.is_a?(Hash)
280
+ self.class.openapi_types.each_pair do |key, type|
281
+ if type =~ /\AArray<(.*)>/i
282
+ # check to ensure the input is an array given that the attribute
283
+ # is documented as an array but the input is not
284
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
285
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
286
+ end
287
+ elsif !attributes[self.class.attribute_map[key]].nil?
288
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
289
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
290
+ self.send("#{key}=", nil)
291
+ end
292
+ end
293
+
294
+ self
295
+ end
296
+
297
+ # Deserializes the data based on type
298
+ # @param string type Data type
299
+ # @param string value Value to be deserialized
300
+ # @return [Object] Deserialized data
301
+ def _deserialize(type, value)
302
+ case type.to_sym
303
+ when :DateTime
304
+ DateTime.parse(value)
305
+ when :Date
306
+ Date.parse(value)
307
+ when :String
308
+ value.to_s
309
+ when :Integer
310
+ value.to_i
311
+ when :Float
312
+ value.to_f
313
+ when :Boolean
314
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
315
+ true
316
+ else
317
+ false
318
+ end
319
+ when :Object
320
+ # generic object (usually a Hash), return directly
321
+ value
322
+ when /\AArray<(?<inner_type>.+)>\z/
323
+ inner_type = Regexp.last_match[:inner_type]
324
+ value.map { |v| _deserialize(inner_type, v) }
325
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
326
+ k_type = Regexp.last_match[:k_type]
327
+ v_type = Regexp.last_match[:v_type]
328
+ {}.tap do |hash|
329
+ value.each do |k, v|
330
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
331
+ end
332
+ end
333
+ else # model
334
+ EmassClient.const_get(type).build_from_hash(value)
335
+ end
336
+ end
337
+
338
+ # Returns the string representation of the object
339
+ # @return [String] String presentation of the object
340
+ def to_s
341
+ to_hash.to_s
342
+ end
343
+
344
+ # to_body is an alias to to_hash (backward compatibility)
345
+ # @return [Hash] Returns the object in the form of hash
346
+ def to_body
347
+ to_hash
348
+ end
349
+
350
+ # Returns the object in the form of hash
351
+ # @return [Hash] Returns the object in the form of hash
352
+ def to_hash
353
+ hash = {}
354
+ self.class.attribute_map.each_pair do |attr, param|
355
+ value = self.send(attr)
356
+ if value.nil?
357
+ is_nullable = self.class.openapi_nullable.include?(attr)
358
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
359
+ end
360
+
361
+ hash[param] = _to_hash(value)
362
+ end
363
+ hash
364
+ end
365
+
366
+ # Outputs non-array value in the form of hash
367
+ # For object, use to_hash. Otherwise, just return the value
368
+ # @param [Object] value Any valid value
369
+ # @return [Hash] Returns the value in the form of hash
370
+ def _to_hash(value)
371
+ if value.is_a?(Array)
372
+ value.compact.map { |v| _to_hash(v) }
373
+ elsif value.is_a?(Hash)
374
+ {}.tap do |hash|
375
+ value.each { |k, v| hash[k] = _to_hash(v) }
376
+ end
377
+ elsif value.respond_to? :to_hash
378
+ value.to_hash
379
+ else
380
+ value
381
+ end
382
+ end end
383
+ end