pulp_container_client 2.4.0.dev01613964104 → 2.4.0.dev1614828140
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.
Potentially problematic release.
This version of pulp_container_client might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +6 -4
- data/docs/ContainerContainerDistribution.md +6 -6
- data/docs/ContainerContainerDistributionResponse.md +8 -8
- data/docs/ContainerContainerRemoteResponse.md +0 -6
- data/docs/PatchedcontainerContainerDistribution.md +6 -6
- data/docs/RemoveImage.md +17 -0
- data/docs/RepositoriesContainerPushApi.md +56 -0
- data/lib/pulp_container_client.rb +1 -0
- data/lib/pulp_container_client/api/repositories_container_push_api.rb +70 -0
- data/lib/pulp_container_client/models/container_container_distribution.rb +28 -28
- data/lib/pulp_container_client/models/container_container_distribution_response.rb +37 -37
- data/lib/pulp_container_client/models/container_container_remote_response.rb +1 -34
- data/lib/pulp_container_client/models/patchedcontainer_container_distribution.rb +28 -28
- data/lib/pulp_container_client/models/remove_image.rb +213 -0
- data/lib/pulp_container_client/version.rb +1 -1
- data/spec/api/repositories_container_push_api_spec.rb +13 -0
- data/spec/models/container_container_distribution_response_spec.rb +7 -7
- data/spec/models/container_container_distribution_spec.rb +5 -5
- data/spec/models/container_container_remote_response_spec.rb +0 -18
- data/spec/models/patchedcontainer_container_distribution_spec.rb +5 -5
- data/spec/models/remove_image_spec.rb +41 -0
- metadata +6 -2
@@ -15,12 +15,19 @@ require 'date'
|
|
15
15
|
module PulpContainerClient
|
16
16
|
# A serializer for ContainerDistribution.
|
17
17
|
class ContainerContainerDistributionResponse
|
18
|
-
#
|
19
|
-
attr_accessor :
|
18
|
+
# RepositoryVersion to be served
|
19
|
+
attr_accessor :repository_version
|
20
20
|
|
21
21
|
# A unique name. Ex, `rawhide` and `stable`.
|
22
22
|
attr_accessor :name
|
23
23
|
|
24
|
+
# An optional content-guard. If none is specified, a default one will be used.
|
25
|
+
attr_accessor :content_guard
|
26
|
+
|
27
|
+
attr_accessor :pulp_labels
|
28
|
+
|
29
|
+
attr_accessor :pulp_href
|
30
|
+
|
24
31
|
# The latest RepositoryVersion for this Repository will be served.
|
25
32
|
attr_accessor :repository
|
26
33
|
|
@@ -30,13 +37,6 @@ module PulpContainerClient
|
|
30
37
|
# Timestamp of creation.
|
31
38
|
attr_accessor :pulp_created
|
32
39
|
|
33
|
-
attr_accessor :pulp_labels
|
34
|
-
|
35
|
-
# RepositoryVersion to be served
|
36
|
-
attr_accessor :repository_version
|
37
|
-
|
38
|
-
attr_accessor :pulp_href
|
39
|
-
|
40
40
|
# The Registry hostame/name/ to use with docker pull command defined by this distribution.
|
41
41
|
attr_accessor :registry_path
|
42
42
|
|
@@ -52,14 +52,14 @@ module PulpContainerClient
|
|
52
52
|
# Attribute mapping from ruby-style variable name to JSON key.
|
53
53
|
def self.attribute_map
|
54
54
|
{
|
55
|
-
:'
|
55
|
+
:'repository_version' => :'repository_version',
|
56
56
|
:'name' => :'name',
|
57
|
+
:'content_guard' => :'content_guard',
|
58
|
+
:'pulp_labels' => :'pulp_labels',
|
59
|
+
:'pulp_href' => :'pulp_href',
|
57
60
|
:'repository' => :'repository',
|
58
61
|
:'base_path' => :'base_path',
|
59
62
|
:'pulp_created' => :'pulp_created',
|
60
|
-
:'pulp_labels' => :'pulp_labels',
|
61
|
-
:'repository_version' => :'repository_version',
|
62
|
-
:'pulp_href' => :'pulp_href',
|
63
63
|
:'registry_path' => :'registry_path',
|
64
64
|
:'namespace' => :'namespace',
|
65
65
|
:'private' => :'private',
|
@@ -70,14 +70,14 @@ module PulpContainerClient
|
|
70
70
|
# Attribute type mapping.
|
71
71
|
def self.openapi_types
|
72
72
|
{
|
73
|
-
:'
|
73
|
+
:'repository_version' => :'String',
|
74
74
|
:'name' => :'String',
|
75
|
+
:'content_guard' => :'String',
|
76
|
+
:'pulp_labels' => :'Object',
|
77
|
+
:'pulp_href' => :'String',
|
75
78
|
:'repository' => :'String',
|
76
79
|
:'base_path' => :'String',
|
77
80
|
:'pulp_created' => :'DateTime',
|
78
|
-
:'pulp_labels' => :'Object',
|
79
|
-
:'repository_version' => :'String',
|
80
|
-
:'pulp_href' => :'String',
|
81
81
|
:'registry_path' => :'String',
|
82
82
|
:'namespace' => :'String',
|
83
83
|
:'private' => :'Boolean',
|
@@ -88,8 +88,8 @@ module PulpContainerClient
|
|
88
88
|
# List of attributes with nullable: true
|
89
89
|
def self.openapi_nullable
|
90
90
|
Set.new([
|
91
|
-
:'repository',
|
92
91
|
:'repository_version',
|
92
|
+
:'repository',
|
93
93
|
:'description'
|
94
94
|
])
|
95
95
|
end
|
@@ -109,36 +109,36 @@ module PulpContainerClient
|
|
109
109
|
h[k.to_sym] = v
|
110
110
|
}
|
111
111
|
|
112
|
-
if attributes.key?(:'
|
113
|
-
self.
|
112
|
+
if attributes.key?(:'repository_version')
|
113
|
+
self.repository_version = attributes[:'repository_version']
|
114
114
|
end
|
115
115
|
|
116
116
|
if attributes.key?(:'name')
|
117
117
|
self.name = attributes[:'name']
|
118
118
|
end
|
119
119
|
|
120
|
-
if attributes.key?(:'
|
121
|
-
self.
|
120
|
+
if attributes.key?(:'content_guard')
|
121
|
+
self.content_guard = attributes[:'content_guard']
|
122
122
|
end
|
123
123
|
|
124
|
-
if attributes.key?(:'
|
125
|
-
self.
|
124
|
+
if attributes.key?(:'pulp_labels')
|
125
|
+
self.pulp_labels = attributes[:'pulp_labels']
|
126
126
|
end
|
127
127
|
|
128
|
-
if attributes.key?(:'
|
129
|
-
self.
|
128
|
+
if attributes.key?(:'pulp_href')
|
129
|
+
self.pulp_href = attributes[:'pulp_href']
|
130
130
|
end
|
131
131
|
|
132
|
-
if attributes.key?(:'
|
133
|
-
self.
|
132
|
+
if attributes.key?(:'repository')
|
133
|
+
self.repository = attributes[:'repository']
|
134
134
|
end
|
135
135
|
|
136
|
-
if attributes.key?(:'
|
137
|
-
self.
|
136
|
+
if attributes.key?(:'base_path')
|
137
|
+
self.base_path = attributes[:'base_path']
|
138
138
|
end
|
139
139
|
|
140
|
-
if attributes.key?(:'
|
141
|
-
self.
|
140
|
+
if attributes.key?(:'pulp_created')
|
141
|
+
self.pulp_created = attributes[:'pulp_created']
|
142
142
|
end
|
143
143
|
|
144
144
|
if attributes.key?(:'registry_path')
|
@@ -186,14 +186,14 @@ module PulpContainerClient
|
|
186
186
|
def ==(o)
|
187
187
|
return true if self.equal?(o)
|
188
188
|
self.class == o.class &&
|
189
|
-
|
189
|
+
repository_version == o.repository_version &&
|
190
190
|
name == o.name &&
|
191
|
+
content_guard == o.content_guard &&
|
192
|
+
pulp_labels == o.pulp_labels &&
|
193
|
+
pulp_href == o.pulp_href &&
|
191
194
|
repository == o.repository &&
|
192
195
|
base_path == o.base_path &&
|
193
196
|
pulp_created == o.pulp_created &&
|
194
|
-
pulp_labels == o.pulp_labels &&
|
195
|
-
repository_version == o.repository_version &&
|
196
|
-
pulp_href == o.pulp_href &&
|
197
197
|
registry_path == o.registry_path &&
|
198
198
|
namespace == o.namespace &&
|
199
199
|
private == o.private &&
|
@@ -209,7 +209,7 @@ module PulpContainerClient
|
|
209
209
|
# Calculates hash code according to all attributes.
|
210
210
|
# @return [Integer] Hash code
|
211
211
|
def hash
|
212
|
-
[
|
212
|
+
[repository_version, name, content_guard, pulp_labels, pulp_href, repository, base_path, pulp_created, registry_path, namespace, private, description].hash
|
213
213
|
end
|
214
214
|
|
215
215
|
# Builds the object from hash
|
@@ -32,21 +32,12 @@ module PulpContainerClient
|
|
32
32
|
# A PEM encoded client certificate used for authentication.
|
33
33
|
attr_accessor :client_cert
|
34
34
|
|
35
|
-
# A PEM encoded private key used for authentication.
|
36
|
-
attr_accessor :client_key
|
37
|
-
|
38
35
|
# If True, TLS peer validation must be performed.
|
39
36
|
attr_accessor :tls_validation
|
40
37
|
|
41
38
|
# The proxy URL. Format: scheme://user:password@host:port
|
42
39
|
attr_accessor :proxy_url
|
43
40
|
|
44
|
-
# The username to be used for authentication when syncing.
|
45
|
-
attr_accessor :username
|
46
|
-
|
47
|
-
# The password to be used for authentication when syncing.
|
48
|
-
attr_accessor :password
|
49
|
-
|
50
41
|
attr_accessor :pulp_labels
|
51
42
|
|
52
43
|
# Timestamp of the most recent update of the remote.
|
@@ -91,11 +82,8 @@ module PulpContainerClient
|
|
91
82
|
:'url' => :'url',
|
92
83
|
:'ca_cert' => :'ca_cert',
|
93
84
|
:'client_cert' => :'client_cert',
|
94
|
-
:'client_key' => :'client_key',
|
95
85
|
:'tls_validation' => :'tls_validation',
|
96
86
|
:'proxy_url' => :'proxy_url',
|
97
|
-
:'username' => :'username',
|
98
|
-
:'password' => :'password',
|
99
87
|
:'pulp_labels' => :'pulp_labels',
|
100
88
|
:'pulp_last_updated' => :'pulp_last_updated',
|
101
89
|
:'download_concurrency' => :'download_concurrency',
|
@@ -120,11 +108,8 @@ module PulpContainerClient
|
|
120
108
|
:'url' => :'String',
|
121
109
|
:'ca_cert' => :'String',
|
122
110
|
:'client_cert' => :'String',
|
123
|
-
:'client_key' => :'String',
|
124
111
|
:'tls_validation' => :'Boolean',
|
125
112
|
:'proxy_url' => :'String',
|
126
|
-
:'username' => :'String',
|
127
|
-
:'password' => :'String',
|
128
113
|
:'pulp_labels' => :'Object',
|
129
114
|
:'pulp_last_updated' => :'DateTime',
|
130
115
|
:'download_concurrency' => :'Integer',
|
@@ -145,10 +130,7 @@ module PulpContainerClient
|
|
145
130
|
Set.new([
|
146
131
|
:'ca_cert',
|
147
132
|
:'client_cert',
|
148
|
-
:'client_key',
|
149
133
|
:'proxy_url',
|
150
|
-
:'username',
|
151
|
-
:'password',
|
152
134
|
:'total_timeout',
|
153
135
|
:'connect_timeout',
|
154
136
|
:'sock_connect_timeout',
|
@@ -198,10 +180,6 @@ module PulpContainerClient
|
|
198
180
|
self.client_cert = attributes[:'client_cert']
|
199
181
|
end
|
200
182
|
|
201
|
-
if attributes.key?(:'client_key')
|
202
|
-
self.client_key = attributes[:'client_key']
|
203
|
-
end
|
204
|
-
|
205
183
|
if attributes.key?(:'tls_validation')
|
206
184
|
self.tls_validation = attributes[:'tls_validation']
|
207
185
|
end
|
@@ -210,14 +188,6 @@ module PulpContainerClient
|
|
210
188
|
self.proxy_url = attributes[:'proxy_url']
|
211
189
|
end
|
212
190
|
|
213
|
-
if attributes.key?(:'username')
|
214
|
-
self.username = attributes[:'username']
|
215
|
-
end
|
216
|
-
|
217
|
-
if attributes.key?(:'password')
|
218
|
-
self.password = attributes[:'password']
|
219
|
-
end
|
220
|
-
|
221
191
|
if attributes.key?(:'pulp_labels')
|
222
192
|
self.pulp_labels = attributes[:'pulp_labels']
|
223
193
|
end
|
@@ -385,11 +355,8 @@ module PulpContainerClient
|
|
385
355
|
url == o.url &&
|
386
356
|
ca_cert == o.ca_cert &&
|
387
357
|
client_cert == o.client_cert &&
|
388
|
-
client_key == o.client_key &&
|
389
358
|
tls_validation == o.tls_validation &&
|
390
359
|
proxy_url == o.proxy_url &&
|
391
|
-
username == o.username &&
|
392
|
-
password == o.password &&
|
393
360
|
pulp_labels == o.pulp_labels &&
|
394
361
|
pulp_last_updated == o.pulp_last_updated &&
|
395
362
|
download_concurrency == o.download_concurrency &&
|
@@ -413,7 +380,7 @@ module PulpContainerClient
|
|
413
380
|
# Calculates hash code according to all attributes.
|
414
381
|
# @return [Integer] Hash code
|
415
382
|
def hash
|
416
|
-
[pulp_href, pulp_created, name, url, ca_cert, client_cert,
|
383
|
+
[pulp_href, pulp_created, name, url, ca_cert, client_cert, tls_validation, proxy_url, pulp_labels, pulp_last_updated, download_concurrency, policy, total_timeout, connect_timeout, sock_connect_timeout, sock_read_timeout, rate_limit, upstream_name, include_tags, exclude_tags].hash
|
417
384
|
end
|
418
385
|
|
419
386
|
# Builds the object from hash
|
@@ -15,23 +15,23 @@ require 'date'
|
|
15
15
|
module PulpContainerClient
|
16
16
|
# A serializer for ContainerDistribution.
|
17
17
|
class PatchedcontainerContainerDistribution
|
18
|
-
#
|
19
|
-
attr_accessor :
|
18
|
+
# RepositoryVersion to be served
|
19
|
+
attr_accessor :repository_version
|
20
20
|
|
21
21
|
# A unique name. Ex, `rawhide` and `stable`.
|
22
22
|
attr_accessor :name
|
23
23
|
|
24
|
+
# An optional content-guard. If none is specified, a default one will be used.
|
25
|
+
attr_accessor :content_guard
|
26
|
+
|
27
|
+
attr_accessor :pulp_labels
|
28
|
+
|
24
29
|
# The latest RepositoryVersion for this Repository will be served.
|
25
30
|
attr_accessor :repository
|
26
31
|
|
27
32
|
# The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
|
28
33
|
attr_accessor :base_path
|
29
34
|
|
30
|
-
attr_accessor :pulp_labels
|
31
|
-
|
32
|
-
# RepositoryVersion to be served
|
33
|
-
attr_accessor :repository_version
|
34
|
-
|
35
35
|
# Restrict pull access to explicitly authorized users. Defaults to unrestricted pull access.
|
36
36
|
attr_accessor :private
|
37
37
|
|
@@ -41,12 +41,12 @@ module PulpContainerClient
|
|
41
41
|
# Attribute mapping from ruby-style variable name to JSON key.
|
42
42
|
def self.attribute_map
|
43
43
|
{
|
44
|
-
:'
|
44
|
+
:'repository_version' => :'repository_version',
|
45
45
|
:'name' => :'name',
|
46
|
+
:'content_guard' => :'content_guard',
|
47
|
+
:'pulp_labels' => :'pulp_labels',
|
46
48
|
:'repository' => :'repository',
|
47
49
|
:'base_path' => :'base_path',
|
48
|
-
:'pulp_labels' => :'pulp_labels',
|
49
|
-
:'repository_version' => :'repository_version',
|
50
50
|
:'private' => :'private',
|
51
51
|
:'description' => :'description'
|
52
52
|
}
|
@@ -55,12 +55,12 @@ module PulpContainerClient
|
|
55
55
|
# Attribute type mapping.
|
56
56
|
def self.openapi_types
|
57
57
|
{
|
58
|
-
:'
|
58
|
+
:'repository_version' => :'String',
|
59
59
|
:'name' => :'String',
|
60
|
+
:'content_guard' => :'String',
|
61
|
+
:'pulp_labels' => :'Object',
|
60
62
|
:'repository' => :'String',
|
61
63
|
:'base_path' => :'String',
|
62
|
-
:'pulp_labels' => :'Object',
|
63
|
-
:'repository_version' => :'String',
|
64
64
|
:'private' => :'Boolean',
|
65
65
|
:'description' => :'String'
|
66
66
|
}
|
@@ -69,8 +69,8 @@ module PulpContainerClient
|
|
69
69
|
# List of attributes with nullable: true
|
70
70
|
def self.openapi_nullable
|
71
71
|
Set.new([
|
72
|
-
:'repository',
|
73
72
|
:'repository_version',
|
73
|
+
:'repository',
|
74
74
|
:'description'
|
75
75
|
])
|
76
76
|
end
|
@@ -90,28 +90,28 @@ module PulpContainerClient
|
|
90
90
|
h[k.to_sym] = v
|
91
91
|
}
|
92
92
|
|
93
|
-
if attributes.key?(:'
|
94
|
-
self.
|
93
|
+
if attributes.key?(:'repository_version')
|
94
|
+
self.repository_version = attributes[:'repository_version']
|
95
95
|
end
|
96
96
|
|
97
97
|
if attributes.key?(:'name')
|
98
98
|
self.name = attributes[:'name']
|
99
99
|
end
|
100
100
|
|
101
|
-
if attributes.key?(:'
|
102
|
-
self.
|
103
|
-
end
|
104
|
-
|
105
|
-
if attributes.key?(:'base_path')
|
106
|
-
self.base_path = attributes[:'base_path']
|
101
|
+
if attributes.key?(:'content_guard')
|
102
|
+
self.content_guard = attributes[:'content_guard']
|
107
103
|
end
|
108
104
|
|
109
105
|
if attributes.key?(:'pulp_labels')
|
110
106
|
self.pulp_labels = attributes[:'pulp_labels']
|
111
107
|
end
|
112
108
|
|
113
|
-
if attributes.key?(:'
|
114
|
-
self.
|
109
|
+
if attributes.key?(:'repository')
|
110
|
+
self.repository = attributes[:'repository']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'base_path')
|
114
|
+
self.base_path = attributes[:'base_path']
|
115
115
|
end
|
116
116
|
|
117
117
|
if attributes.key?(:'private')
|
@@ -141,12 +141,12 @@ module PulpContainerClient
|
|
141
141
|
def ==(o)
|
142
142
|
return true if self.equal?(o)
|
143
143
|
self.class == o.class &&
|
144
|
-
|
144
|
+
repository_version == o.repository_version &&
|
145
145
|
name == o.name &&
|
146
|
+
content_guard == o.content_guard &&
|
147
|
+
pulp_labels == o.pulp_labels &&
|
146
148
|
repository == o.repository &&
|
147
149
|
base_path == o.base_path &&
|
148
|
-
pulp_labels == o.pulp_labels &&
|
149
|
-
repository_version == o.repository_version &&
|
150
150
|
private == o.private &&
|
151
151
|
description == o.description
|
152
152
|
end
|
@@ -160,7 +160,7 @@ module PulpContainerClient
|
|
160
160
|
# Calculates hash code according to all attributes.
|
161
161
|
# @return [Integer] Hash code
|
162
162
|
def hash
|
163
|
-
[
|
163
|
+
[repository_version, name, content_guard, pulp_labels, repository, base_path, private, description].hash
|
164
164
|
end
|
165
165
|
|
166
166
|
# Builds the object from hash
|
@@ -0,0 +1,213 @@
|
|
1
|
+
=begin
|
2
|
+
#Pulp 3 API
|
3
|
+
|
4
|
+
#Fetch, Upload, Organize, and Distribute Software Packages
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3
|
7
|
+
Contact: pulp-list@redhat.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.2.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpContainerClient
|
16
|
+
# A serializer for parsing and validating data associated with the image removal.
|
17
|
+
class RemoveImage
|
18
|
+
# sha256 of the Manifest file
|
19
|
+
attr_accessor :digest
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'digest' => :'digest'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.openapi_types
|
30
|
+
{
|
31
|
+
:'digest' => :'String'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# List of attributes with nullable: true
|
36
|
+
def self.openapi_nullable
|
37
|
+
Set.new([
|
38
|
+
])
|
39
|
+
end
|
40
|
+
|
41
|
+
# Initializes the object
|
42
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
43
|
+
def initialize(attributes = {})
|
44
|
+
if (!attributes.is_a?(Hash))
|
45
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpContainerClient::RemoveImage` initialize method"
|
46
|
+
end
|
47
|
+
|
48
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
49
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
50
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
51
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpContainerClient::RemoveImage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
52
|
+
end
|
53
|
+
h[k.to_sym] = v
|
54
|
+
}
|
55
|
+
|
56
|
+
if attributes.key?(:'digest')
|
57
|
+
self.digest = attributes[:'digest']
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
62
|
+
# @return Array for valid properties with the reasons
|
63
|
+
def list_invalid_properties
|
64
|
+
invalid_properties = Array.new
|
65
|
+
if @digest.nil?
|
66
|
+
invalid_properties.push('invalid value for "digest", digest cannot be nil.')
|
67
|
+
end
|
68
|
+
|
69
|
+
invalid_properties
|
70
|
+
end
|
71
|
+
|
72
|
+
# Check to see if the all the properties in the model are valid
|
73
|
+
# @return true if the model is valid
|
74
|
+
def valid?
|
75
|
+
return false if @digest.nil?
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Checks equality by comparing each attribute.
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def ==(o)
|
82
|
+
return true if self.equal?(o)
|
83
|
+
self.class == o.class &&
|
84
|
+
digest == o.digest
|
85
|
+
end
|
86
|
+
|
87
|
+
# @see the `==` method
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def eql?(o)
|
90
|
+
self == o
|
91
|
+
end
|
92
|
+
|
93
|
+
# Calculates hash code according to all attributes.
|
94
|
+
# @return [Integer] Hash code
|
95
|
+
def hash
|
96
|
+
[digest].hash
|
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 self.build_from_hash(attributes)
|
103
|
+
new.build_from_hash(attributes)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Builds the object from hash
|
107
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
108
|
+
# @return [Object] Returns the model itself
|
109
|
+
def build_from_hash(attributes)
|
110
|
+
return nil unless attributes.is_a?(Hash)
|
111
|
+
self.class.openapi_types.each_pair do |key, type|
|
112
|
+
if type =~ /\AArray<(.*)>/i
|
113
|
+
# check to ensure the input is an array given that the attribute
|
114
|
+
# is documented as an array but the input is not
|
115
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
116
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
117
|
+
end
|
118
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
119
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
120
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
121
|
+
end
|
122
|
+
|
123
|
+
self
|
124
|
+
end
|
125
|
+
|
126
|
+
# Deserializes the data based on type
|
127
|
+
# @param string type Data type
|
128
|
+
# @param string value Value to be deserialized
|
129
|
+
# @return [Object] Deserialized data
|
130
|
+
def _deserialize(type, value)
|
131
|
+
case type.to_sym
|
132
|
+
when :DateTime
|
133
|
+
DateTime.parse(value)
|
134
|
+
when :Date
|
135
|
+
Date.parse(value)
|
136
|
+
when :String
|
137
|
+
value.to_s
|
138
|
+
when :Integer
|
139
|
+
value.to_i
|
140
|
+
when :Float
|
141
|
+
value.to_f
|
142
|
+
when :Boolean
|
143
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
144
|
+
true
|
145
|
+
else
|
146
|
+
false
|
147
|
+
end
|
148
|
+
when :Object
|
149
|
+
# generic object (usually a Hash), return directly
|
150
|
+
value
|
151
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
152
|
+
inner_type = Regexp.last_match[:inner_type]
|
153
|
+
value.map { |v| _deserialize(inner_type, v) }
|
154
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
155
|
+
k_type = Regexp.last_match[:k_type]
|
156
|
+
v_type = Regexp.last_match[:v_type]
|
157
|
+
{}.tap do |hash|
|
158
|
+
value.each do |k, v|
|
159
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
else # model
|
163
|
+
PulpContainerClient.const_get(type).build_from_hash(value)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# Returns the string representation of the object
|
168
|
+
# @return [String] String presentation of the object
|
169
|
+
def to_s
|
170
|
+
to_hash.to_s
|
171
|
+
end
|
172
|
+
|
173
|
+
# to_body is an alias to to_hash (backward compatibility)
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
175
|
+
def to_body
|
176
|
+
to_hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Returns the object in the form of hash
|
180
|
+
# @return [Hash] Returns the object in the form of hash
|
181
|
+
def to_hash
|
182
|
+
hash = {}
|
183
|
+
self.class.attribute_map.each_pair do |attr, param|
|
184
|
+
value = self.send(attr)
|
185
|
+
if value.nil?
|
186
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
187
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
188
|
+
end
|
189
|
+
|
190
|
+
hash[param] = _to_hash(value)
|
191
|
+
end
|
192
|
+
hash
|
193
|
+
end
|
194
|
+
|
195
|
+
# Outputs non-array value in the form of hash
|
196
|
+
# For object, use to_hash. Otherwise, just return the value
|
197
|
+
# @param [Object] value Any valid value
|
198
|
+
# @return [Hash] Returns the value in the form of hash
|
199
|
+
def _to_hash(value)
|
200
|
+
if value.is_a?(Array)
|
201
|
+
value.compact.map { |v| _to_hash(v) }
|
202
|
+
elsif value.is_a?(Hash)
|
203
|
+
{}.tap do |hash|
|
204
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
205
|
+
end
|
206
|
+
elsif value.respond_to? :to_hash
|
207
|
+
value.to_hash
|
208
|
+
else
|
209
|
+
value
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|