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
@@ -6,7 +6,7 @@
|
|
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
|
|
@@ -14,20 +14,20 @@ require 'date'
|
|
14
14
|
|
15
15
|
module PulpDockerClient
|
16
16
|
class InlineResponse2002
|
17
|
+
attr_accessor :count
|
18
|
+
|
17
19
|
attr_accessor :_next
|
18
20
|
|
19
21
|
attr_accessor :previous
|
20
22
|
|
21
|
-
attr_accessor :count
|
22
|
-
|
23
23
|
attr_accessor :results
|
24
24
|
|
25
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
26
|
def self.attribute_map
|
27
27
|
{
|
28
|
+
:'count' => :'count',
|
28
29
|
:'_next' => :'next',
|
29
30
|
:'previous' => :'previous',
|
30
|
-
:'count' => :'count',
|
31
31
|
:'results' => :'results'
|
32
32
|
}
|
33
33
|
end
|
@@ -35,10 +35,10 @@ module PulpDockerClient
|
|
35
35
|
# Attribute type mapping.
|
36
36
|
def self.openapi_types
|
37
37
|
{
|
38
|
+
:'count' => :'Integer',
|
38
39
|
:'_next' => :'String',
|
39
40
|
:'previous' => :'String',
|
40
|
-
:'
|
41
|
-
:'results' => :'Array<Manifest>'
|
41
|
+
:'results' => :'Array<Tag>'
|
42
42
|
}
|
43
43
|
end
|
44
44
|
|
@@ -57,6 +57,10 @@ module PulpDockerClient
|
|
57
57
|
h[k.to_sym] = v
|
58
58
|
}
|
59
59
|
|
60
|
+
if attributes.key?(:'count')
|
61
|
+
self.count = attributes[:'count']
|
62
|
+
end
|
63
|
+
|
60
64
|
if attributes.key?(:'_next')
|
61
65
|
self._next = attributes[:'_next']
|
62
66
|
end
|
@@ -65,10 +69,6 @@ module PulpDockerClient
|
|
65
69
|
self.previous = attributes[:'previous']
|
66
70
|
end
|
67
71
|
|
68
|
-
if attributes.key?(:'count')
|
69
|
-
self.count = attributes[:'count']
|
70
|
-
end
|
71
|
-
|
72
72
|
if attributes.key?(:'results')
|
73
73
|
if (value = attributes[:'results']).is_a?(Array)
|
74
74
|
self.results = value
|
@@ -104,9 +104,9 @@ module PulpDockerClient
|
|
104
104
|
def ==(o)
|
105
105
|
return true if self.equal?(o)
|
106
106
|
self.class == o.class &&
|
107
|
+
count == o.count &&
|
107
108
|
_next == o._next &&
|
108
109
|
previous == o.previous &&
|
109
|
-
count == o.count &&
|
110
110
|
results == o.results
|
111
111
|
end
|
112
112
|
|
@@ -119,7 +119,7 @@ module PulpDockerClient
|
|
119
119
|
# Calculates hash code according to all attributes.
|
120
120
|
# @return [Integer] Hash code
|
121
121
|
def hash
|
122
|
-
[_next, previous,
|
122
|
+
[count, _next, previous, results].hash
|
123
123
|
end
|
124
124
|
|
125
125
|
# Builds the object from hash
|
@@ -6,7 +6,7 @@
|
|
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
|
|
@@ -14,20 +14,20 @@ require 'date'
|
|
14
14
|
|
15
15
|
module PulpDockerClient
|
16
16
|
class InlineResponse2003
|
17
|
+
attr_accessor :count
|
18
|
+
|
17
19
|
attr_accessor :_next
|
18
20
|
|
19
21
|
attr_accessor :previous
|
20
22
|
|
21
|
-
attr_accessor :count
|
22
|
-
|
23
23
|
attr_accessor :results
|
24
24
|
|
25
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
26
|
def self.attribute_map
|
27
27
|
{
|
28
|
+
:'count' => :'count',
|
28
29
|
:'_next' => :'next',
|
29
30
|
:'previous' => :'previous',
|
30
|
-
:'count' => :'count',
|
31
31
|
:'results' => :'results'
|
32
32
|
}
|
33
33
|
end
|
@@ -35,9 +35,9 @@ module PulpDockerClient
|
|
35
35
|
# Attribute type mapping.
|
36
36
|
def self.openapi_types
|
37
37
|
{
|
38
|
+
:'count' => :'Integer',
|
38
39
|
:'_next' => :'String',
|
39
40
|
:'previous' => :'String',
|
40
|
-
:'count' => :'Integer',
|
41
41
|
:'results' => :'Array<DockerDistribution>'
|
42
42
|
}
|
43
43
|
end
|
@@ -57,6 +57,10 @@ module PulpDockerClient
|
|
57
57
|
h[k.to_sym] = v
|
58
58
|
}
|
59
59
|
|
60
|
+
if attributes.key?(:'count')
|
61
|
+
self.count = attributes[:'count']
|
62
|
+
end
|
63
|
+
|
60
64
|
if attributes.key?(:'_next')
|
61
65
|
self._next = attributes[:'_next']
|
62
66
|
end
|
@@ -65,10 +69,6 @@ module PulpDockerClient
|
|
65
69
|
self.previous = attributes[:'previous']
|
66
70
|
end
|
67
71
|
|
68
|
-
if attributes.key?(:'count')
|
69
|
-
self.count = attributes[:'count']
|
70
|
-
end
|
71
|
-
|
72
72
|
if attributes.key?(:'results')
|
73
73
|
if (value = attributes[:'results']).is_a?(Array)
|
74
74
|
self.results = value
|
@@ -104,9 +104,9 @@ module PulpDockerClient
|
|
104
104
|
def ==(o)
|
105
105
|
return true if self.equal?(o)
|
106
106
|
self.class == o.class &&
|
107
|
+
count == o.count &&
|
107
108
|
_next == o._next &&
|
108
109
|
previous == o.previous &&
|
109
|
-
count == o.count &&
|
110
110
|
results == o.results
|
111
111
|
end
|
112
112
|
|
@@ -119,7 +119,7 @@ module PulpDockerClient
|
|
119
119
|
# Calculates hash code according to all attributes.
|
120
120
|
# @return [Integer] Hash code
|
121
121
|
def hash
|
122
|
-
[_next, previous,
|
122
|
+
[count, _next, previous, results].hash
|
123
123
|
end
|
124
124
|
|
125
125
|
# Builds the object from hash
|
@@ -6,7 +6,7 @@
|
|
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
|
|
@@ -14,20 +14,20 @@ require 'date'
|
|
14
14
|
|
15
15
|
module PulpDockerClient
|
16
16
|
class InlineResponse2004
|
17
|
+
attr_accessor :count
|
18
|
+
|
17
19
|
attr_accessor :_next
|
18
20
|
|
19
21
|
attr_accessor :previous
|
20
22
|
|
21
|
-
attr_accessor :count
|
22
|
-
|
23
23
|
attr_accessor :results
|
24
24
|
|
25
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
26
|
def self.attribute_map
|
27
27
|
{
|
28
|
+
:'count' => :'count',
|
28
29
|
:'_next' => :'next',
|
29
30
|
:'previous' => :'previous',
|
30
|
-
:'count' => :'count',
|
31
31
|
:'results' => :'results'
|
32
32
|
}
|
33
33
|
end
|
@@ -35,9 +35,9 @@ module PulpDockerClient
|
|
35
35
|
# Attribute type mapping.
|
36
36
|
def self.openapi_types
|
37
37
|
{
|
38
|
+
:'count' => :'Integer',
|
38
39
|
:'_next' => :'String',
|
39
40
|
:'previous' => :'String',
|
40
|
-
:'count' => :'Integer',
|
41
41
|
:'results' => :'Array<DockerRemote>'
|
42
42
|
}
|
43
43
|
end
|
@@ -57,6 +57,10 @@ module PulpDockerClient
|
|
57
57
|
h[k.to_sym] = v
|
58
58
|
}
|
59
59
|
|
60
|
+
if attributes.key?(:'count')
|
61
|
+
self.count = attributes[:'count']
|
62
|
+
end
|
63
|
+
|
60
64
|
if attributes.key?(:'_next')
|
61
65
|
self._next = attributes[:'_next']
|
62
66
|
end
|
@@ -65,10 +69,6 @@ module PulpDockerClient
|
|
65
69
|
self.previous = attributes[:'previous']
|
66
70
|
end
|
67
71
|
|
68
|
-
if attributes.key?(:'count')
|
69
|
-
self.count = attributes[:'count']
|
70
|
-
end
|
71
|
-
|
72
72
|
if attributes.key?(:'results')
|
73
73
|
if (value = attributes[:'results']).is_a?(Array)
|
74
74
|
self.results = value
|
@@ -104,9 +104,9 @@ module PulpDockerClient
|
|
104
104
|
def ==(o)
|
105
105
|
return true if self.equal?(o)
|
106
106
|
self.class == o.class &&
|
107
|
+
count == o.count &&
|
107
108
|
_next == o._next &&
|
108
109
|
previous == o.previous &&
|
109
|
-
count == o.count &&
|
110
110
|
results == o.results
|
111
111
|
end
|
112
112
|
|
@@ -119,7 +119,7 @@ module PulpDockerClient
|
|
119
119
|
# Calculates hash code according to all attributes.
|
120
120
|
# @return [Integer] Hash code
|
121
121
|
def hash
|
122
|
-
[_next, previous,
|
122
|
+
[count, _next, previous, results].hash
|
123
123
|
end
|
124
124
|
|
125
125
|
# Builds the object from hash
|
@@ -0,0 +1,268 @@
|
|
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 ManifestCopy
|
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 manifest digests to copy.
|
27
|
+
attr_accessor :digests
|
28
|
+
|
29
|
+
# A list of media_types to copy.
|
30
|
+
attr_accessor :media_types
|
31
|
+
|
32
|
+
class EnumAttributeValidator
|
33
|
+
attr_reader :datatype
|
34
|
+
attr_reader :allowable_values
|
35
|
+
|
36
|
+
def initialize(datatype, allowable_values)
|
37
|
+
@allowable_values = allowable_values.map do |value|
|
38
|
+
case datatype.to_s
|
39
|
+
when /Integer/i
|
40
|
+
value.to_i
|
41
|
+
when /Float/i
|
42
|
+
value.to_f
|
43
|
+
else
|
44
|
+
value
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def valid?(value)
|
50
|
+
!value || allowable_values.include?(value)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
55
|
+
def self.attribute_map
|
56
|
+
{
|
57
|
+
:'source_repository' => :'source_repository',
|
58
|
+
:'source_repository_version' => :'source_repository_version',
|
59
|
+
:'destination_repository' => :'destination_repository',
|
60
|
+
:'digests' => :'digests',
|
61
|
+
:'media_types' => :'media_types'
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
# Attribute type mapping.
|
66
|
+
def self.openapi_types
|
67
|
+
{
|
68
|
+
:'source_repository' => :'String',
|
69
|
+
:'source_repository_version' => :'String',
|
70
|
+
:'destination_repository' => :'String',
|
71
|
+
:'digests' => :'Array<String>',
|
72
|
+
:'media_types' => :'Array<String>'
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
# Initializes the object
|
77
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
78
|
+
def initialize(attributes = {})
|
79
|
+
if (!attributes.is_a?(Hash))
|
80
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDockerClient::ManifestCopy` initialize method"
|
81
|
+
end
|
82
|
+
|
83
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
84
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
85
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
86
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDockerClient::ManifestCopy`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
87
|
+
end
|
88
|
+
h[k.to_sym] = v
|
89
|
+
}
|
90
|
+
|
91
|
+
if attributes.key?(:'source_repository')
|
92
|
+
self.source_repository = attributes[:'source_repository']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:'source_repository_version')
|
96
|
+
self.source_repository_version = attributes[:'source_repository_version']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:'destination_repository')
|
100
|
+
self.destination_repository = attributes[:'destination_repository']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:'digests')
|
104
|
+
if (value = attributes[:'digests']).is_a?(Array)
|
105
|
+
self.digests = value
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'media_types')
|
110
|
+
if (value = attributes[:'media_types']).is_a?(Array)
|
111
|
+
self.media_types = value
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
117
|
+
# @return Array for valid properties with the reasons
|
118
|
+
def list_invalid_properties
|
119
|
+
invalid_properties = Array.new
|
120
|
+
if @destination_repository.nil?
|
121
|
+
invalid_properties.push('invalid value for "destination_repository", destination_repository cannot be nil.')
|
122
|
+
end
|
123
|
+
|
124
|
+
invalid_properties
|
125
|
+
end
|
126
|
+
|
127
|
+
# Check to see if the all the properties in the model are valid
|
128
|
+
# @return true if the model is valid
|
129
|
+
def valid?
|
130
|
+
return false if @destination_repository.nil?
|
131
|
+
true
|
132
|
+
end
|
133
|
+
|
134
|
+
# Checks equality by comparing each attribute.
|
135
|
+
# @param [Object] Object to be compared
|
136
|
+
def ==(o)
|
137
|
+
return true if self.equal?(o)
|
138
|
+
self.class == o.class &&
|
139
|
+
source_repository == o.source_repository &&
|
140
|
+
source_repository_version == o.source_repository_version &&
|
141
|
+
destination_repository == o.destination_repository &&
|
142
|
+
digests == o.digests &&
|
143
|
+
media_types == o.media_types
|
144
|
+
end
|
145
|
+
|
146
|
+
# @see the `==` method
|
147
|
+
# @param [Object] Object to be compared
|
148
|
+
def eql?(o)
|
149
|
+
self == o
|
150
|
+
end
|
151
|
+
|
152
|
+
# Calculates hash code according to all attributes.
|
153
|
+
# @return [Integer] Hash code
|
154
|
+
def hash
|
155
|
+
[source_repository, source_repository_version, destination_repository, digests, media_types].hash
|
156
|
+
end
|
157
|
+
|
158
|
+
# Builds the object from hash
|
159
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
160
|
+
# @return [Object] Returns the model itself
|
161
|
+
def self.build_from_hash(attributes)
|
162
|
+
new.build_from_hash(attributes)
|
163
|
+
end
|
164
|
+
|
165
|
+
# Builds the object from hash
|
166
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
167
|
+
# @return [Object] Returns the model itself
|
168
|
+
def build_from_hash(attributes)
|
169
|
+
return nil unless attributes.is_a?(Hash)
|
170
|
+
self.class.openapi_types.each_pair do |key, type|
|
171
|
+
if type =~ /\AArray<(.*)>/i
|
172
|
+
# check to ensure the input is an array given that the attribute
|
173
|
+
# is documented as an array but the input is not
|
174
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
175
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
176
|
+
end
|
177
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
178
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
179
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
180
|
+
end
|
181
|
+
|
182
|
+
self
|
183
|
+
end
|
184
|
+
|
185
|
+
# Deserializes the data based on type
|
186
|
+
# @param string type Data type
|
187
|
+
# @param string value Value to be deserialized
|
188
|
+
# @return [Object] Deserialized data
|
189
|
+
def _deserialize(type, value)
|
190
|
+
case type.to_sym
|
191
|
+
when :DateTime
|
192
|
+
DateTime.parse(value)
|
193
|
+
when :Date
|
194
|
+
Date.parse(value)
|
195
|
+
when :String
|
196
|
+
value.to_s
|
197
|
+
when :Integer
|
198
|
+
value.to_i
|
199
|
+
when :Float
|
200
|
+
value.to_f
|
201
|
+
when :Boolean
|
202
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
203
|
+
true
|
204
|
+
else
|
205
|
+
false
|
206
|
+
end
|
207
|
+
when :Object
|
208
|
+
# generic object (usually a Hash), return directly
|
209
|
+
value
|
210
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
211
|
+
inner_type = Regexp.last_match[:inner_type]
|
212
|
+
value.map { |v| _deserialize(inner_type, v) }
|
213
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
214
|
+
k_type = Regexp.last_match[:k_type]
|
215
|
+
v_type = Regexp.last_match[:v_type]
|
216
|
+
{}.tap do |hash|
|
217
|
+
value.each do |k, v|
|
218
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
else # model
|
222
|
+
PulpDockerClient.const_get(type).build_from_hash(value)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
# Returns the string representation of the object
|
227
|
+
# @return [String] String presentation of the object
|
228
|
+
def to_s
|
229
|
+
to_hash.to_s
|
230
|
+
end
|
231
|
+
|
232
|
+
# to_body is an alias to to_hash (backward compatibility)
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
234
|
+
def to_body
|
235
|
+
to_hash
|
236
|
+
end
|
237
|
+
|
238
|
+
# Returns the object in the form of hash
|
239
|
+
# @return [Hash] Returns the object in the form of hash
|
240
|
+
def to_hash
|
241
|
+
hash = {}
|
242
|
+
self.class.attribute_map.each_pair do |attr, param|
|
243
|
+
value = self.send(attr)
|
244
|
+
next if value.nil?
|
245
|
+
hash[param] = _to_hash(value)
|
246
|
+
end
|
247
|
+
hash
|
248
|
+
end
|
249
|
+
|
250
|
+
# Outputs non-array value in the form of hash
|
251
|
+
# For object, use to_hash. Otherwise, just return the value
|
252
|
+
# @param [Object] value Any valid value
|
253
|
+
# @return [Hash] Returns the value in the form of hash
|
254
|
+
def _to_hash(value)
|
255
|
+
if value.is_a?(Array)
|
256
|
+
value.compact.map { |v| _to_hash(v) }
|
257
|
+
elsif value.is_a?(Hash)
|
258
|
+
{}.tap do |hash|
|
259
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
260
|
+
end
|
261
|
+
elsif value.respond_to? :to_hash
|
262
|
+
value.to_hash
|
263
|
+
else
|
264
|
+
value
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|