pulp_docker_client 4.0.0b5 → 4.0.0b6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -14
- data/docs/ContentBlobsApi.md +24 -20
- data/docs/ContentManifestsApi.md +12 -6
- data/docs/{ContentManifestTagsApi.md → ContentTagsApi.md} +40 -34
- data/docs/DistributionsDockerApi.md +4 -4
- data/docs/DockerCopyApi.md +114 -0
- data/docs/DockerDistribution.md +9 -9
- data/docs/DockerRecursiveAddApi.md +61 -0
- data/docs/DockerRecursiveRemoveApi.md +61 -0
- data/docs/DockerTagApi.md +61 -0
- data/docs/DockerUntagApi.md +61 -0
- data/docs/InlineResponse200.md +3 -3
- data/docs/InlineResponse2001.md +4 -4
- data/docs/InlineResponse2002.md +4 -4
- data/docs/InlineResponse2003.md +3 -3
- data/docs/InlineResponse2004.md +3 -3
- data/docs/ManifestCopy.md +25 -0
- data/docs/RecursiveManage.md +19 -0
- data/docs/RemotesDockerApi.md +4 -4
- data/docs/{ManifestTag.md → Tag.md} +2 -2
- data/docs/TagCopy.md +23 -0
- data/docs/TagImage.md +21 -0
- data/docs/UnTagImage.md +19 -0
- data/git_push.sh +10 -7
- data/lib/pulp_docker_client/api/content_blobs_api.rb +35 -29
- data/lib/pulp_docker_client/api/content_manifests_api.rb +21 -12
- data/lib/pulp_docker_client/api/{content_manifest_tags_api.rb → content_tags_api.rb} +59 -50
- data/lib/pulp_docker_client/api/distributions_docker_api.rb +12 -12
- data/lib/pulp_docker_client/api/docker_copy_api.rb +146 -0
- data/lib/pulp_docker_client/api/docker_recursive_add_api.rb +84 -0
- data/lib/pulp_docker_client/api/docker_recursive_remove_api.rb +84 -0
- data/lib/pulp_docker_client/api/docker_tag_api.rb +84 -0
- data/lib/pulp_docker_client/api/docker_untag_api.rb +84 -0
- data/lib/pulp_docker_client/api/remotes_docker_api.rb +13 -13
- data/lib/pulp_docker_client/api_client.rb +77 -62
- data/lib/pulp_docker_client/api_error.rb +1 -1
- data/lib/pulp_docker_client/configuration.rb +13 -21
- data/lib/pulp_docker_client/models/async_operation_response.rb +1 -1
- data/lib/pulp_docker_client/models/blob.rb +1 -1
- data/lib/pulp_docker_client/models/docker_distribution.rb +37 -37
- data/lib/pulp_docker_client/models/docker_remote.rb +1 -1
- data/lib/pulp_docker_client/models/inline_response200.rb +11 -11
- data/lib/pulp_docker_client/models/inline_response2001.rb +12 -12
- data/lib/pulp_docker_client/models/inline_response2002.rb +12 -12
- data/lib/pulp_docker_client/models/inline_response2003.rb +11 -11
- data/lib/pulp_docker_client/models/inline_response2004.rb +11 -11
- data/lib/pulp_docker_client/models/manifest.rb +1 -1
- data/lib/pulp_docker_client/models/manifest_copy.rb +268 -0
- data/lib/pulp_docker_client/models/recursive_manage.rb +214 -0
- data/lib/pulp_docker_client/models/repository_sync_url.rb +1 -1
- data/lib/pulp_docker_client/models/{manifest_tag.rb → tag.rb} +4 -4
- data/lib/pulp_docker_client/models/tag_copy.rb +234 -0
- data/lib/pulp_docker_client/models/tag_image.rb +270 -0
- data/lib/pulp_docker_client/models/un_tag_image.rb +236 -0
- data/lib/pulp_docker_client/version.rb +2 -2
- data/lib/pulp_docker_client.rb +13 -3
- data/pulp_docker_client.gemspec +3 -9
- data/spec/api/content_blobs_api_spec.rb +12 -10
- data/spec/api/content_manifests_api_spec.rb +7 -4
- data/spec/api/{content_manifest_tags_api_spec.rb → content_tags_api_spec.rb} +22 -19
- data/spec/api/distributions_docker_api_spec.rb +3 -3
- data/spec/api/docker_copy_api_spec.rb +57 -0
- data/spec/api/docker_recursive_add_api_spec.rb +46 -0
- data/spec/api/docker_recursive_remove_api_spec.rb +46 -0
- data/spec/api/docker_tag_api_spec.rb +46 -0
- data/spec/api/docker_untag_api_spec.rb +46 -0
- data/spec/api/remotes_docker_api_spec.rb +3 -3
- data/spec/api_client_spec.rb +1 -39
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/async_operation_response_spec.rb +1 -1
- data/spec/models/blob_spec.rb +1 -1
- data/spec/models/docker_distribution_spec.rb +7 -7
- data/spec/models/docker_remote_spec.rb +1 -1
- data/spec/models/inline_response2001_spec.rb +4 -4
- data/spec/models/inline_response2002_spec.rb +4 -4
- data/spec/models/inline_response2003_spec.rb +4 -4
- data/spec/models/inline_response2004_spec.rb +4 -4
- data/spec/models/inline_response200_spec.rb +4 -4
- data/spec/models/manifest_copy_spec.rb +69 -0
- data/spec/models/manifest_spec.rb +1 -1
- data/spec/models/recursive_manage_spec.rb +47 -0
- data/spec/models/repository_sync_url_spec.rb +1 -1
- data/spec/models/tag_copy_spec.rb +59 -0
- data/spec/models/tag_image_spec.rb +53 -0
- data/spec/models/{manifest_tag_spec.rb → tag_spec.rb} +7 -7
- data/spec/models/un_tag_image_spec.rb +47 -0
- data/spec/spec_helper.rb +1 -1
- metadata +54 -141
- data/Gemfile.lock +0 -79
@@ -0,0 +1,214 @@
|
|
1
|
+
=begin
|
2
|
+
#Pulp 3 API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.1.2-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpDockerClient
|
16
|
+
class RecursiveManage
|
17
|
+
# A URI of the repository to add content.
|
18
|
+
attr_accessor :repository
|
19
|
+
|
20
|
+
# A list of content units to operate on.
|
21
|
+
attr_accessor :content_units
|
22
|
+
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
24
|
+
def self.attribute_map
|
25
|
+
{
|
26
|
+
:'repository' => :'repository',
|
27
|
+
:'content_units' => :'content_units'
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Attribute type mapping.
|
32
|
+
def self.openapi_types
|
33
|
+
{
|
34
|
+
:'repository' => :'String',
|
35
|
+
:'content_units' => :'Array<String>'
|
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 `PulpDockerClient::RecursiveManage` 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 `PulpDockerClient::RecursiveManage`. 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?(:'repository')
|
55
|
+
self.repository = attributes[:'repository']
|
56
|
+
end
|
57
|
+
|
58
|
+
if attributes.key?(:'content_units')
|
59
|
+
if (value = attributes[:'content_units']).is_a?(Array)
|
60
|
+
self.content_units = value
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
+
# @return Array for valid properties with the reasons
|
67
|
+
def list_invalid_properties
|
68
|
+
invalid_properties = Array.new
|
69
|
+
if @repository.nil?
|
70
|
+
invalid_properties.push('invalid value for "repository", repository cannot be nil.')
|
71
|
+
end
|
72
|
+
|
73
|
+
invalid_properties
|
74
|
+
end
|
75
|
+
|
76
|
+
# Check to see if the all the properties in the model are valid
|
77
|
+
# @return true if the model is valid
|
78
|
+
def valid?
|
79
|
+
return false if @repository.nil?
|
80
|
+
true
|
81
|
+
end
|
82
|
+
|
83
|
+
# Checks equality by comparing each attribute.
|
84
|
+
# @param [Object] Object to be compared
|
85
|
+
def ==(o)
|
86
|
+
return true if self.equal?(o)
|
87
|
+
self.class == o.class &&
|
88
|
+
repository == o.repository &&
|
89
|
+
content_units == o.content_units
|
90
|
+
end
|
91
|
+
|
92
|
+
# @see the `==` method
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def eql?(o)
|
95
|
+
self == o
|
96
|
+
end
|
97
|
+
|
98
|
+
# Calculates hash code according to all attributes.
|
99
|
+
# @return [Integer] Hash code
|
100
|
+
def hash
|
101
|
+
[repository, content_units].hash
|
102
|
+
end
|
103
|
+
|
104
|
+
# Builds the object from hash
|
105
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
106
|
+
# @return [Object] Returns the model itself
|
107
|
+
def self.build_from_hash(attributes)
|
108
|
+
new.build_from_hash(attributes)
|
109
|
+
end
|
110
|
+
|
111
|
+
# Builds the object from hash
|
112
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
113
|
+
# @return [Object] Returns the model itself
|
114
|
+
def build_from_hash(attributes)
|
115
|
+
return nil unless attributes.is_a?(Hash)
|
116
|
+
self.class.openapi_types.each_pair do |key, type|
|
117
|
+
if type =~ /\AArray<(.*)>/i
|
118
|
+
# check to ensure the input is an array given that the attribute
|
119
|
+
# is documented as an array but the input is not
|
120
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
121
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
122
|
+
end
|
123
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
124
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
125
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
126
|
+
end
|
127
|
+
|
128
|
+
self
|
129
|
+
end
|
130
|
+
|
131
|
+
# Deserializes the data based on type
|
132
|
+
# @param string type Data type
|
133
|
+
# @param string value Value to be deserialized
|
134
|
+
# @return [Object] Deserialized data
|
135
|
+
def _deserialize(type, value)
|
136
|
+
case type.to_sym
|
137
|
+
when :DateTime
|
138
|
+
DateTime.parse(value)
|
139
|
+
when :Date
|
140
|
+
Date.parse(value)
|
141
|
+
when :String
|
142
|
+
value.to_s
|
143
|
+
when :Integer
|
144
|
+
value.to_i
|
145
|
+
when :Float
|
146
|
+
value.to_f
|
147
|
+
when :Boolean
|
148
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
149
|
+
true
|
150
|
+
else
|
151
|
+
false
|
152
|
+
end
|
153
|
+
when :Object
|
154
|
+
# generic object (usually a Hash), return directly
|
155
|
+
value
|
156
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
157
|
+
inner_type = Regexp.last_match[:inner_type]
|
158
|
+
value.map { |v| _deserialize(inner_type, v) }
|
159
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
160
|
+
k_type = Regexp.last_match[:k_type]
|
161
|
+
v_type = Regexp.last_match[:v_type]
|
162
|
+
{}.tap do |hash|
|
163
|
+
value.each do |k, v|
|
164
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
else # model
|
168
|
+
PulpDockerClient.const_get(type).build_from_hash(value)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# Returns the string representation of the object
|
173
|
+
# @return [String] String presentation of the object
|
174
|
+
def to_s
|
175
|
+
to_hash.to_s
|
176
|
+
end
|
177
|
+
|
178
|
+
# to_body is an alias to to_hash (backward compatibility)
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_body
|
181
|
+
to_hash
|
182
|
+
end
|
183
|
+
|
184
|
+
# Returns the object in the form of hash
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_hash
|
187
|
+
hash = {}
|
188
|
+
self.class.attribute_map.each_pair do |attr, param|
|
189
|
+
value = self.send(attr)
|
190
|
+
next if value.nil?
|
191
|
+
hash[param] = _to_hash(value)
|
192
|
+
end
|
193
|
+
hash
|
194
|
+
end
|
195
|
+
|
196
|
+
# Outputs non-array value in the form of hash
|
197
|
+
# For object, use to_hash. Otherwise, just return the value
|
198
|
+
# @param [Object] value Any valid value
|
199
|
+
# @return [Hash] Returns the value in the form of hash
|
200
|
+
def _to_hash(value)
|
201
|
+
if value.is_a?(Array)
|
202
|
+
value.compact.map { |v| _to_hash(v) }
|
203
|
+
elsif value.is_a?(Hash)
|
204
|
+
{}.tap do |hash|
|
205
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
206
|
+
end
|
207
|
+
elsif value.respond_to? :to_hash
|
208
|
+
value.to_hash
|
209
|
+
else
|
210
|
+
value
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
@@ -6,14 +6,14 @@
|
|
6
6
|
The version of the OpenAPI document: v3
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
9
|
+
OpenAPI Generator version: 4.1.2-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module PulpDockerClient
|
16
|
-
class
|
16
|
+
class Tag
|
17
17
|
attr_accessor :_href
|
18
18
|
|
19
19
|
# Timestamp of creation.
|
@@ -63,13 +63,13 @@ module PulpDockerClient
|
|
63
63
|
# @param [Hash] attributes Model attributes in the form of hash
|
64
64
|
def initialize(attributes = {})
|
65
65
|
if (!attributes.is_a?(Hash))
|
66
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDockerClient::
|
66
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDockerClient::Tag` initialize method"
|
67
67
|
end
|
68
68
|
|
69
69
|
# check to see if the attribute exists and convert string to symbol for hash key
|
70
70
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
71
71
|
if (!self.class.attribute_map.key?(k.to_sym))
|
72
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDockerClient::
|
72
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDockerClient::Tag`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
73
73
|
end
|
74
74
|
h[k.to_sym] = v
|
75
75
|
}
|
@@ -0,0 +1,234 @@
|
|
1
|
+
=begin
|
2
|
+
#Pulp 3 API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.1.2-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpDockerClient
|
16
|
+
class TagCopy
|
17
|
+
# A URI of the repository to copy content from.
|
18
|
+
attr_accessor :source_repository
|
19
|
+
|
20
|
+
# A URI of the repository version to copy content from.
|
21
|
+
attr_accessor :source_repository_version
|
22
|
+
|
23
|
+
# A URI of the repository to copy content to.
|
24
|
+
attr_accessor :destination_repository
|
25
|
+
|
26
|
+
# A list of tag names to copy.
|
27
|
+
attr_accessor :names
|
28
|
+
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
30
|
+
def self.attribute_map
|
31
|
+
{
|
32
|
+
:'source_repository' => :'source_repository',
|
33
|
+
:'source_repository_version' => :'source_repository_version',
|
34
|
+
:'destination_repository' => :'destination_repository',
|
35
|
+
:'names' => :'names'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.openapi_types
|
41
|
+
{
|
42
|
+
:'source_repository' => :'String',
|
43
|
+
:'source_repository_version' => :'String',
|
44
|
+
:'destination_repository' => :'String',
|
45
|
+
:'names' => :'Array<String>'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Initializes the object
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
+
def initialize(attributes = {})
|
52
|
+
if (!attributes.is_a?(Hash))
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDockerClient::TagCopy` initialize method"
|
54
|
+
end
|
55
|
+
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDockerClient::TagCopy`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
60
|
+
end
|
61
|
+
h[k.to_sym] = v
|
62
|
+
}
|
63
|
+
|
64
|
+
if attributes.key?(:'source_repository')
|
65
|
+
self.source_repository = attributes[:'source_repository']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.key?(:'source_repository_version')
|
69
|
+
self.source_repository_version = attributes[:'source_repository_version']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'destination_repository')
|
73
|
+
self.destination_repository = attributes[:'destination_repository']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.key?(:'names')
|
77
|
+
if (value = attributes[:'names']).is_a?(Array)
|
78
|
+
self.names = value
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
84
|
+
# @return Array for valid properties with the reasons
|
85
|
+
def list_invalid_properties
|
86
|
+
invalid_properties = Array.new
|
87
|
+
if @destination_repository.nil?
|
88
|
+
invalid_properties.push('invalid value for "destination_repository", destination_repository cannot be nil.')
|
89
|
+
end
|
90
|
+
|
91
|
+
invalid_properties
|
92
|
+
end
|
93
|
+
|
94
|
+
# Check to see if the all the properties in the model are valid
|
95
|
+
# @return true if the model is valid
|
96
|
+
def valid?
|
97
|
+
return false if @destination_repository.nil?
|
98
|
+
true
|
99
|
+
end
|
100
|
+
|
101
|
+
# Checks equality by comparing each attribute.
|
102
|
+
# @param [Object] Object to be compared
|
103
|
+
def ==(o)
|
104
|
+
return true if self.equal?(o)
|
105
|
+
self.class == o.class &&
|
106
|
+
source_repository == o.source_repository &&
|
107
|
+
source_repository_version == o.source_repository_version &&
|
108
|
+
destination_repository == o.destination_repository &&
|
109
|
+
names == o.names
|
110
|
+
end
|
111
|
+
|
112
|
+
# @see the `==` method
|
113
|
+
# @param [Object] Object to be compared
|
114
|
+
def eql?(o)
|
115
|
+
self == o
|
116
|
+
end
|
117
|
+
|
118
|
+
# Calculates hash code according to all attributes.
|
119
|
+
# @return [Integer] Hash code
|
120
|
+
def hash
|
121
|
+
[source_repository, source_repository_version, destination_repository, names].hash
|
122
|
+
end
|
123
|
+
|
124
|
+
# Builds the object from hash
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
126
|
+
# @return [Object] Returns the model itself
|
127
|
+
def self.build_from_hash(attributes)
|
128
|
+
new.build_from_hash(attributes)
|
129
|
+
end
|
130
|
+
|
131
|
+
# Builds the object from hash
|
132
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
133
|
+
# @return [Object] Returns the model itself
|
134
|
+
def build_from_hash(attributes)
|
135
|
+
return nil unless attributes.is_a?(Hash)
|
136
|
+
self.class.openapi_types.each_pair do |key, type|
|
137
|
+
if type =~ /\AArray<(.*)>/i
|
138
|
+
# check to ensure the input is an array given that the attribute
|
139
|
+
# is documented as an array but the input is not
|
140
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
141
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
142
|
+
end
|
143
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
144
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
145
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
146
|
+
end
|
147
|
+
|
148
|
+
self
|
149
|
+
end
|
150
|
+
|
151
|
+
# Deserializes the data based on type
|
152
|
+
# @param string type Data type
|
153
|
+
# @param string value Value to be deserialized
|
154
|
+
# @return [Object] Deserialized data
|
155
|
+
def _deserialize(type, value)
|
156
|
+
case type.to_sym
|
157
|
+
when :DateTime
|
158
|
+
DateTime.parse(value)
|
159
|
+
when :Date
|
160
|
+
Date.parse(value)
|
161
|
+
when :String
|
162
|
+
value.to_s
|
163
|
+
when :Integer
|
164
|
+
value.to_i
|
165
|
+
when :Float
|
166
|
+
value.to_f
|
167
|
+
when :Boolean
|
168
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
169
|
+
true
|
170
|
+
else
|
171
|
+
false
|
172
|
+
end
|
173
|
+
when :Object
|
174
|
+
# generic object (usually a Hash), return directly
|
175
|
+
value
|
176
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
177
|
+
inner_type = Regexp.last_match[:inner_type]
|
178
|
+
value.map { |v| _deserialize(inner_type, v) }
|
179
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
180
|
+
k_type = Regexp.last_match[:k_type]
|
181
|
+
v_type = Regexp.last_match[:v_type]
|
182
|
+
{}.tap do |hash|
|
183
|
+
value.each do |k, v|
|
184
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
else # model
|
188
|
+
PulpDockerClient.const_get(type).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
|
+
end
|
234
|
+
end
|