harbor2_client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/README.md +186 -0
- data/Rakefile +8 -0
- data/docs/AdditionLink.md +9 -0
- data/docs/AdditionLinks.md +7 -0
- data/docs/Annotations.md +7 -0
- data/docs/Artifact.md +25 -0
- data/docs/ArtifactApi.md +694 -0
- data/docs/AuditLog.md +13 -0
- data/docs/AuditlogApi.md +69 -0
- data/docs/CVEAllowlist.md +13 -0
- data/docs/CVEAllowlistItem.md +8 -0
- data/docs/Error.md +9 -0
- data/docs/Errors.md +8 -0
- data/docs/Execution.md +17 -0
- data/docs/ExtraAttrs.md +7 -0
- data/docs/Icon.md +9 -0
- data/docs/IconApi.md +66 -0
- data/docs/Instance.md +19 -0
- data/docs/Label.md +15 -0
- data/docs/Metadata.md +13 -0
- data/docs/Metrics.md +14 -0
- data/docs/NativeReportSummary.md +15 -0
- data/docs/Platform.md +12 -0
- data/docs/PreheatApi.md +1176 -0
- data/docs/PreheatPolicy.md +18 -0
- data/docs/Project.md +22 -0
- data/docs/ProjectApi.md +542 -0
- data/docs/ProjectDeletable.md +9 -0
- data/docs/ProjectMetadata.md +14 -0
- data/docs/ProjectReq.md +13 -0
- data/docs/ProjectSummary.md +16 -0
- data/docs/ProjectSummaryQuota.md +9 -0
- data/docs/ProviderUnderProject.md +11 -0
- data/docs/Reference.md +13 -0
- data/docs/Registry.md +17 -0
- data/docs/RegistryCredential.md +10 -0
- data/docs/Repository.md +15 -0
- data/docs/RepositoryApi.md +256 -0
- data/docs/ResourceList.md +7 -0
- data/docs/ScanApi.md +138 -0
- data/docs/ScanOverview.md +7 -0
- data/docs/Tag.md +15 -0
- data/docs/Task.md +17 -0
- data/docs/VulnerabilitySummary.md +10 -0
- data/git_push.sh +55 -0
- data/harbor2_client.gemspec +46 -0
- data/lib/harbor2_client.rb +81 -0
- data/lib/harbor2_client/api/artifact_api.rb +848 -0
- data/lib/harbor2_client/api/auditlog_api.rb +91 -0
- data/lib/harbor2_client/api/icon_api.rb +84 -0
- data/lib/harbor2_client/api/preheat_api.rb +1327 -0
- data/lib/harbor2_client/api/project_api.rb +601 -0
- data/lib/harbor2_client/api/repository_api.rb +302 -0
- data/lib/harbor2_client/api/scan_api.rb +174 -0
- data/lib/harbor2_client/api_client.rb +391 -0
- data/lib/harbor2_client/api_error.rb +38 -0
- data/lib/harbor2_client/configuration.rb +209 -0
- data/lib/harbor2_client/models/addition_link.rb +195 -0
- data/lib/harbor2_client/models/addition_links.rb +175 -0
- data/lib/harbor2_client/models/annotations.rb +175 -0
- data/lib/harbor2_client/models/artifact.rb +355 -0
- data/lib/harbor2_client/models/audit_log.rb +235 -0
- data/lib/harbor2_client/models/cve_allowlist.rb +237 -0
- data/lib/harbor2_client/models/cve_allowlist_item.rb +186 -0
- data/lib/harbor2_client/models/error.rb +196 -0
- data/lib/harbor2_client/models/errors.rb +187 -0
- data/lib/harbor2_client/models/execution.rb +273 -0
- data/lib/harbor2_client/models/extra_attrs.rb +175 -0
- data/lib/harbor2_client/models/icon.rb +195 -0
- data/lib/harbor2_client/models/instance.rb +297 -0
- data/lib/harbor2_client/models/label.rb +255 -0
- data/lib/harbor2_client/models/metadata.rb +237 -0
- data/lib/harbor2_client/models/metrics.rb +245 -0
- data/lib/harbor2_client/models/native_report_summary.rb +255 -0
- data/lib/harbor2_client/models/platform.rb +227 -0
- data/lib/harbor2_client/models/preheat_policy.rb +285 -0
- data/lib/harbor2_client/models/project.rb +327 -0
- data/lib/harbor2_client/models/project_deletable.rb +195 -0
- data/lib/harbor2_client/models/project_metadata.rb +245 -0
- data/lib/harbor2_client/models/project_req.rb +235 -0
- data/lib/harbor2_client/models/project_summary.rb +263 -0
- data/lib/harbor2_client/models/project_summary_quota.rb +195 -0
- data/lib/harbor2_client/models/provider_under_project.rb +211 -0
- data/lib/harbor2_client/models/reference.rb +235 -0
- data/lib/harbor2_client/models/registry.rb +274 -0
- data/lib/harbor2_client/models/registry_credential.rb +205 -0
- data/lib/harbor2_client/models/repository.rb +255 -0
- data/lib/harbor2_client/models/resource_list.rb +175 -0
- data/lib/harbor2_client/models/scan_overview.rb +176 -0
- data/lib/harbor2_client/models/tag.rb +255 -0
- data/lib/harbor2_client/models/task.rb +274 -0
- data/lib/harbor2_client/models/vulnerability_summary.rb +208 -0
- data/lib/harbor2_client/version.rb +15 -0
- data/spec/api/artifact_api_spec.rb +209 -0
- data/spec/api/auditlog_api_spec.rb +50 -0
- data/spec/api/icon_api_spec.rb +48 -0
- data/spec/api/preheat_api_spec.rb +311 -0
- data/spec/api/project_api_spec.rb +160 -0
- data/spec/api/repository_api_spec.rb +94 -0
- data/spec/api/scan_api_spec.rb +66 -0
- data/spec/api_client_spec.rb +243 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/addition_link_spec.rb +47 -0
- data/spec/models/addition_links_spec.rb +35 -0
- data/spec/models/annotations_spec.rb +35 -0
- data/spec/models/artifact_spec.rb +143 -0
- data/spec/models/audit_log_spec.rb +71 -0
- data/spec/models/cve_allowlist_item_spec.rb +41 -0
- data/spec/models/cve_allowlist_spec.rb +71 -0
- data/spec/models/error_spec.rb +47 -0
- data/spec/models/errors_spec.rb +41 -0
- data/spec/models/execution_spec.rb +95 -0
- data/spec/models/extra_attrs_spec.rb +35 -0
- data/spec/models/icon_spec.rb +47 -0
- data/spec/models/instance_spec.rb +107 -0
- data/spec/models/label_spec.rb +83 -0
- data/spec/models/metadata_spec.rb +71 -0
- data/spec/models/metrics_spec.rb +77 -0
- data/spec/models/native_report_summary_spec.rb +83 -0
- data/spec/models/platform_spec.rb +65 -0
- data/spec/models/preheat_policy_spec.rb +101 -0
- data/spec/models/project_deletable_spec.rb +47 -0
- data/spec/models/project_metadata_spec.rb +77 -0
- data/spec/models/project_req_spec.rb +71 -0
- data/spec/models/project_spec.rb +125 -0
- data/spec/models/project_summary_quota_spec.rb +47 -0
- data/spec/models/project_summary_spec.rb +89 -0
- data/spec/models/provider_under_project_spec.rb +59 -0
- data/spec/models/reference_spec.rb +71 -0
- data/spec/models/registry_credential_spec.rb +53 -0
- data/spec/models/registry_spec.rb +95 -0
- data/spec/models/repository_spec.rb +83 -0
- data/spec/models/resource_list_spec.rb +35 -0
- data/spec/models/scan_overview_spec.rb +35 -0
- data/spec/models/tag_spec.rb +83 -0
- data/spec/models/task_spec.rb +95 -0
- data/spec/models/vulnerability_summary_spec.rb +53 -0
- data/spec/spec_helper.rb +111 -0
- metadata +428 -0
@@ -0,0 +1,355 @@
|
|
1
|
+
=begin
|
2
|
+
#Harbor API
|
3
|
+
|
4
|
+
#These APIs provide services for manipulating Harbor project.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.17
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module Harbor2Client
|
16
|
+
class Artifact
|
17
|
+
# The ID of the artifact
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
# The type of the artifact, e.g. image, chart, etc
|
21
|
+
attr_accessor :type
|
22
|
+
|
23
|
+
# The media type of the artifact
|
24
|
+
attr_accessor :media_type
|
25
|
+
|
26
|
+
# The manifest media type of the artifact
|
27
|
+
attr_accessor :manifest_media_type
|
28
|
+
|
29
|
+
# The ID of the project that the artifact belongs to
|
30
|
+
attr_accessor :project_id
|
31
|
+
|
32
|
+
# The ID of the repository that the artifact belongs to
|
33
|
+
attr_accessor :repository_id
|
34
|
+
|
35
|
+
# The digest of the artifact
|
36
|
+
attr_accessor :digest
|
37
|
+
|
38
|
+
# The size of the artifact
|
39
|
+
attr_accessor :size
|
40
|
+
|
41
|
+
# The digest of the icon
|
42
|
+
attr_accessor :icon
|
43
|
+
|
44
|
+
# The push time of the artifact
|
45
|
+
attr_accessor :push_time
|
46
|
+
|
47
|
+
# The latest pull time of the artifact
|
48
|
+
attr_accessor :pull_time
|
49
|
+
|
50
|
+
attr_accessor :extra_attrs
|
51
|
+
|
52
|
+
attr_accessor :annotations
|
53
|
+
|
54
|
+
attr_accessor :references
|
55
|
+
|
56
|
+
attr_accessor :tags
|
57
|
+
|
58
|
+
attr_accessor :addition_links
|
59
|
+
|
60
|
+
attr_accessor :labels
|
61
|
+
|
62
|
+
# The overview of the scan result.
|
63
|
+
attr_accessor :scan_overview
|
64
|
+
|
65
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
66
|
+
def self.attribute_map
|
67
|
+
{
|
68
|
+
:'id' => :'id',
|
69
|
+
:'type' => :'type',
|
70
|
+
:'media_type' => :'media_type',
|
71
|
+
:'manifest_media_type' => :'manifest_media_type',
|
72
|
+
:'project_id' => :'project_id',
|
73
|
+
:'repository_id' => :'repository_id',
|
74
|
+
:'digest' => :'digest',
|
75
|
+
:'size' => :'size',
|
76
|
+
:'icon' => :'icon',
|
77
|
+
:'push_time' => :'push_time',
|
78
|
+
:'pull_time' => :'pull_time',
|
79
|
+
:'extra_attrs' => :'extra_attrs',
|
80
|
+
:'annotations' => :'annotations',
|
81
|
+
:'references' => :'references',
|
82
|
+
:'tags' => :'tags',
|
83
|
+
:'addition_links' => :'addition_links',
|
84
|
+
:'labels' => :'labels',
|
85
|
+
:'scan_overview' => :'scan_overview'
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
# Attribute type mapping.
|
90
|
+
def self.swagger_types
|
91
|
+
{
|
92
|
+
:'id' => :'Integer',
|
93
|
+
:'type' => :'String',
|
94
|
+
:'media_type' => :'String',
|
95
|
+
:'manifest_media_type' => :'String',
|
96
|
+
:'project_id' => :'Integer',
|
97
|
+
:'repository_id' => :'Integer',
|
98
|
+
:'digest' => :'String',
|
99
|
+
:'size' => :'Integer',
|
100
|
+
:'icon' => :'String',
|
101
|
+
:'push_time' => :'DateTime',
|
102
|
+
:'pull_time' => :'DateTime',
|
103
|
+
:'extra_attrs' => :'ExtraAttrs',
|
104
|
+
:'annotations' => :'Annotations',
|
105
|
+
:'references' => :'Array<Reference>',
|
106
|
+
:'tags' => :'Array<Tag>',
|
107
|
+
:'addition_links' => :'AdditionLinks',
|
108
|
+
:'labels' => :'Array<Label>',
|
109
|
+
:'scan_overview' => :'ScanOverview'
|
110
|
+
}
|
111
|
+
end
|
112
|
+
|
113
|
+
# Initializes the object
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
115
|
+
def initialize(attributes = {})
|
116
|
+
return unless attributes.is_a?(Hash)
|
117
|
+
|
118
|
+
# convert string to symbol for hash key
|
119
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
120
|
+
|
121
|
+
if attributes.has_key?(:'id')
|
122
|
+
self.id = attributes[:'id']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.has_key?(:'type')
|
126
|
+
self.type = attributes[:'type']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.has_key?(:'media_type')
|
130
|
+
self.media_type = attributes[:'media_type']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.has_key?(:'manifest_media_type')
|
134
|
+
self.manifest_media_type = attributes[:'manifest_media_type']
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.has_key?(:'project_id')
|
138
|
+
self.project_id = attributes[:'project_id']
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.has_key?(:'repository_id')
|
142
|
+
self.repository_id = attributes[:'repository_id']
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.has_key?(:'digest')
|
146
|
+
self.digest = attributes[:'digest']
|
147
|
+
end
|
148
|
+
|
149
|
+
if attributes.has_key?(:'size')
|
150
|
+
self.size = attributes[:'size']
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.has_key?(:'icon')
|
154
|
+
self.icon = attributes[:'icon']
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.has_key?(:'push_time')
|
158
|
+
self.push_time = attributes[:'push_time']
|
159
|
+
end
|
160
|
+
|
161
|
+
if attributes.has_key?(:'pull_time')
|
162
|
+
self.pull_time = attributes[:'pull_time']
|
163
|
+
end
|
164
|
+
|
165
|
+
if attributes.has_key?(:'extra_attrs')
|
166
|
+
self.extra_attrs = attributes[:'extra_attrs']
|
167
|
+
end
|
168
|
+
|
169
|
+
if attributes.has_key?(:'annotations')
|
170
|
+
self.annotations = attributes[:'annotations']
|
171
|
+
end
|
172
|
+
|
173
|
+
if attributes.has_key?(:'references')
|
174
|
+
if (value = attributes[:'references']).is_a?(Array)
|
175
|
+
self.references = value
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
if attributes.has_key?(:'tags')
|
180
|
+
if (value = attributes[:'tags']).is_a?(Array)
|
181
|
+
self.tags = value
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
if attributes.has_key?(:'addition_links')
|
186
|
+
self.addition_links = attributes[:'addition_links']
|
187
|
+
end
|
188
|
+
|
189
|
+
if attributes.has_key?(:'labels')
|
190
|
+
if (value = attributes[:'labels']).is_a?(Array)
|
191
|
+
self.labels = value
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
if attributes.has_key?(:'scan_overview')
|
196
|
+
self.scan_overview = attributes[:'scan_overview']
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
201
|
+
# @return Array for valid properties with the reasons
|
202
|
+
def list_invalid_properties
|
203
|
+
invalid_properties = Array.new
|
204
|
+
invalid_properties
|
205
|
+
end
|
206
|
+
|
207
|
+
# Check to see if the all the properties in the model are valid
|
208
|
+
# @return true if the model is valid
|
209
|
+
def valid?
|
210
|
+
true
|
211
|
+
end
|
212
|
+
|
213
|
+
# Checks equality by comparing each attribute.
|
214
|
+
# @param [Object] Object to be compared
|
215
|
+
def ==(o)
|
216
|
+
return true if self.equal?(o)
|
217
|
+
self.class == o.class &&
|
218
|
+
id == o.id &&
|
219
|
+
type == o.type &&
|
220
|
+
media_type == o.media_type &&
|
221
|
+
manifest_media_type == o.manifest_media_type &&
|
222
|
+
project_id == o.project_id &&
|
223
|
+
repository_id == o.repository_id &&
|
224
|
+
digest == o.digest &&
|
225
|
+
size == o.size &&
|
226
|
+
icon == o.icon &&
|
227
|
+
push_time == o.push_time &&
|
228
|
+
pull_time == o.pull_time &&
|
229
|
+
extra_attrs == o.extra_attrs &&
|
230
|
+
annotations == o.annotations &&
|
231
|
+
references == o.references &&
|
232
|
+
tags == o.tags &&
|
233
|
+
addition_links == o.addition_links &&
|
234
|
+
labels == o.labels &&
|
235
|
+
scan_overview == o.scan_overview
|
236
|
+
end
|
237
|
+
|
238
|
+
# @see the `==` method
|
239
|
+
# @param [Object] Object to be compared
|
240
|
+
def eql?(o)
|
241
|
+
self == o
|
242
|
+
end
|
243
|
+
|
244
|
+
# Calculates hash code according to all attributes.
|
245
|
+
# @return [Fixnum] Hash code
|
246
|
+
def hash
|
247
|
+
[id, type, media_type, manifest_media_type, project_id, repository_id, digest, size, icon, push_time, pull_time, extra_attrs, annotations, references, tags, addition_links, labels, scan_overview].hash
|
248
|
+
end
|
249
|
+
|
250
|
+
# Builds the object from hash
|
251
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
252
|
+
# @return [Object] Returns the model itself
|
253
|
+
def build_from_hash(attributes)
|
254
|
+
return nil unless attributes.is_a?(Hash)
|
255
|
+
self.class.swagger_types.each_pair do |key, type|
|
256
|
+
if 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[self.class.attribute_map[key]].is_a?(Array)
|
260
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
261
|
+
end
|
262
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
263
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
264
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
265
|
+
end
|
266
|
+
|
267
|
+
self
|
268
|
+
end
|
269
|
+
|
270
|
+
# Deserializes the data based on type
|
271
|
+
# @param string type Data type
|
272
|
+
# @param string value Value to be deserialized
|
273
|
+
# @return [Object] Deserialized data
|
274
|
+
def _deserialize(type, value)
|
275
|
+
case type.to_sym
|
276
|
+
when :DateTime
|
277
|
+
DateTime.parse(value)
|
278
|
+
when :Date
|
279
|
+
Date.parse(value)
|
280
|
+
when :String
|
281
|
+
value.to_s
|
282
|
+
when :Integer
|
283
|
+
value.to_i
|
284
|
+
when :Float
|
285
|
+
value.to_f
|
286
|
+
when :BOOLEAN
|
287
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
288
|
+
true
|
289
|
+
else
|
290
|
+
false
|
291
|
+
end
|
292
|
+
when :Object
|
293
|
+
# generic object (usually a Hash), return directly
|
294
|
+
value
|
295
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
296
|
+
inner_type = Regexp.last_match[:inner_type]
|
297
|
+
value.map { |v| _deserialize(inner_type, v) }
|
298
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
299
|
+
k_type = Regexp.last_match[:k_type]
|
300
|
+
v_type = Regexp.last_match[:v_type]
|
301
|
+
{}.tap do |hash|
|
302
|
+
value.each do |k, v|
|
303
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
304
|
+
end
|
305
|
+
end
|
306
|
+
else # model
|
307
|
+
temp_model = Harbor2Client.const_get(type).new
|
308
|
+
temp_model.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
|
+
next if value.nil?
|
331
|
+
hash[param] = _to_hash(value)
|
332
|
+
end
|
333
|
+
hash
|
334
|
+
end
|
335
|
+
|
336
|
+
# Outputs non-array value in the form of hash
|
337
|
+
# For object, use to_hash. Otherwise, just return the value
|
338
|
+
# @param [Object] value Any valid value
|
339
|
+
# @return [Hash] Returns the value in the form of hash
|
340
|
+
def _to_hash(value)
|
341
|
+
if value.is_a?(Array)
|
342
|
+
value.compact.map { |v| _to_hash(v) }
|
343
|
+
elsif value.is_a?(Hash)
|
344
|
+
{}.tap do |hash|
|
345
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
346
|
+
end
|
347
|
+
elsif value.respond_to? :to_hash
|
348
|
+
value.to_hash
|
349
|
+
else
|
350
|
+
value
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
end
|
355
|
+
end
|
@@ -0,0 +1,235 @@
|
|
1
|
+
=begin
|
2
|
+
#Harbor API
|
3
|
+
|
4
|
+
#These APIs provide services for manipulating Harbor project.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.17
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module Harbor2Client
|
16
|
+
class AuditLog
|
17
|
+
# The ID of the audit log entry.
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
# Username of the user in this log entry.
|
21
|
+
attr_accessor :username
|
22
|
+
|
23
|
+
# Name of the repository in this log entry.
|
24
|
+
attr_accessor :resource
|
25
|
+
|
26
|
+
# Tag of the repository in this log entry.
|
27
|
+
attr_accessor :resource_type
|
28
|
+
|
29
|
+
# The operation against the repository in this log entry.
|
30
|
+
attr_accessor :operation
|
31
|
+
|
32
|
+
# The time when this operation is triggered.
|
33
|
+
attr_accessor :op_time
|
34
|
+
|
35
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
36
|
+
def self.attribute_map
|
37
|
+
{
|
38
|
+
:'id' => :'id',
|
39
|
+
:'username' => :'username',
|
40
|
+
:'resource' => :'resource',
|
41
|
+
:'resource_type' => :'resource_type',
|
42
|
+
:'operation' => :'operation',
|
43
|
+
:'op_time' => :'op_time'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# Attribute type mapping.
|
48
|
+
def self.swagger_types
|
49
|
+
{
|
50
|
+
:'id' => :'Integer',
|
51
|
+
:'username' => :'String',
|
52
|
+
:'resource' => :'String',
|
53
|
+
:'resource_type' => :'String',
|
54
|
+
:'operation' => :'String',
|
55
|
+
:'op_time' => :'DateTime'
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
# Initializes the object
|
60
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
61
|
+
def initialize(attributes = {})
|
62
|
+
return unless attributes.is_a?(Hash)
|
63
|
+
|
64
|
+
# convert string to symbol for hash key
|
65
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
66
|
+
|
67
|
+
if attributes.has_key?(:'id')
|
68
|
+
self.id = attributes[:'id']
|
69
|
+
end
|
70
|
+
|
71
|
+
if attributes.has_key?(:'username')
|
72
|
+
self.username = attributes[:'username']
|
73
|
+
end
|
74
|
+
|
75
|
+
if attributes.has_key?(:'resource')
|
76
|
+
self.resource = attributes[:'resource']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.has_key?(:'resource_type')
|
80
|
+
self.resource_type = attributes[:'resource_type']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.has_key?(:'operation')
|
84
|
+
self.operation = attributes[:'operation']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.has_key?(:'op_time')
|
88
|
+
self.op_time = attributes[:'op_time']
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
93
|
+
# @return Array for valid properties with the reasons
|
94
|
+
def list_invalid_properties
|
95
|
+
invalid_properties = Array.new
|
96
|
+
invalid_properties
|
97
|
+
end
|
98
|
+
|
99
|
+
# Check to see if the all the properties in the model are valid
|
100
|
+
# @return true if the model is valid
|
101
|
+
def valid?
|
102
|
+
true
|
103
|
+
end
|
104
|
+
|
105
|
+
# Checks equality by comparing each attribute.
|
106
|
+
# @param [Object] Object to be compared
|
107
|
+
def ==(o)
|
108
|
+
return true if self.equal?(o)
|
109
|
+
self.class == o.class &&
|
110
|
+
id == o.id &&
|
111
|
+
username == o.username &&
|
112
|
+
resource == o.resource &&
|
113
|
+
resource_type == o.resource_type &&
|
114
|
+
operation == o.operation &&
|
115
|
+
op_time == o.op_time
|
116
|
+
end
|
117
|
+
|
118
|
+
# @see the `==` method
|
119
|
+
# @param [Object] Object to be compared
|
120
|
+
def eql?(o)
|
121
|
+
self == o
|
122
|
+
end
|
123
|
+
|
124
|
+
# Calculates hash code according to all attributes.
|
125
|
+
# @return [Fixnum] Hash code
|
126
|
+
def hash
|
127
|
+
[id, username, resource, resource_type, operation, op_time].hash
|
128
|
+
end
|
129
|
+
|
130
|
+
# Builds the object from hash
|
131
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
132
|
+
# @return [Object] Returns the model itself
|
133
|
+
def build_from_hash(attributes)
|
134
|
+
return nil unless attributes.is_a?(Hash)
|
135
|
+
self.class.swagger_types.each_pair do |key, type|
|
136
|
+
if type =~ /\AArray<(.*)>/i
|
137
|
+
# check to ensure the input is an array given that the attribute
|
138
|
+
# is documented as an array but the input is not
|
139
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
140
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
141
|
+
end
|
142
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
143
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
144
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
145
|
+
end
|
146
|
+
|
147
|
+
self
|
148
|
+
end
|
149
|
+
|
150
|
+
# Deserializes the data based on type
|
151
|
+
# @param string type Data type
|
152
|
+
# @param string value Value to be deserialized
|
153
|
+
# @return [Object] Deserialized data
|
154
|
+
def _deserialize(type, value)
|
155
|
+
case type.to_sym
|
156
|
+
when :DateTime
|
157
|
+
DateTime.parse(value)
|
158
|
+
when :Date
|
159
|
+
Date.parse(value)
|
160
|
+
when :String
|
161
|
+
value.to_s
|
162
|
+
when :Integer
|
163
|
+
value.to_i
|
164
|
+
when :Float
|
165
|
+
value.to_f
|
166
|
+
when :BOOLEAN
|
167
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
168
|
+
true
|
169
|
+
else
|
170
|
+
false
|
171
|
+
end
|
172
|
+
when :Object
|
173
|
+
# generic object (usually a Hash), return directly
|
174
|
+
value
|
175
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
176
|
+
inner_type = Regexp.last_match[:inner_type]
|
177
|
+
value.map { |v| _deserialize(inner_type, v) }
|
178
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
179
|
+
k_type = Regexp.last_match[:k_type]
|
180
|
+
v_type = Regexp.last_match[:v_type]
|
181
|
+
{}.tap do |hash|
|
182
|
+
value.each do |k, v|
|
183
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
else # model
|
187
|
+
temp_model = Harbor2Client.const_get(type).new
|
188
|
+
temp_model.build_from_hash(value)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
# Returns the string representation of the object
|
193
|
+
# @return [String] String presentation of the object
|
194
|
+
def to_s
|
195
|
+
to_hash.to_s
|
196
|
+
end
|
197
|
+
|
198
|
+
# to_body is an alias to to_hash (backward compatibility)
|
199
|
+
# @return [Hash] Returns the object in the form of hash
|
200
|
+
def to_body
|
201
|
+
to_hash
|
202
|
+
end
|
203
|
+
|
204
|
+
# Returns the object in the form of hash
|
205
|
+
# @return [Hash] Returns the object in the form of hash
|
206
|
+
def to_hash
|
207
|
+
hash = {}
|
208
|
+
self.class.attribute_map.each_pair do |attr, param|
|
209
|
+
value = self.send(attr)
|
210
|
+
next if value.nil?
|
211
|
+
hash[param] = _to_hash(value)
|
212
|
+
end
|
213
|
+
hash
|
214
|
+
end
|
215
|
+
|
216
|
+
# Outputs non-array value in the form of hash
|
217
|
+
# For object, use to_hash. Otherwise, just return the value
|
218
|
+
# @param [Object] value Any valid value
|
219
|
+
# @return [Hash] Returns the value in the form of hash
|
220
|
+
def _to_hash(value)
|
221
|
+
if value.is_a?(Array)
|
222
|
+
value.compact.map { |v| _to_hash(v) }
|
223
|
+
elsif value.is_a?(Hash)
|
224
|
+
{}.tap do |hash|
|
225
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
226
|
+
end
|
227
|
+
elsif value.respond_to? :to_hash
|
228
|
+
value.to_hash
|
229
|
+
else
|
230
|
+
value
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|
235
|
+
end
|