pulp_container_client 2.16.0 → 2.16.1
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.
- checksums.yaml +4 -4
- data/README.md +36 -25
- data/docs/ContainerContainerDistribution.md +4 -4
- data/docs/ContainerContainerDistributionResponse.md +9 -9
- data/docs/ContainerContainerPushRepository.md +7 -7
- data/docs/ContainerContainerPushRepositoryResponse.md +10 -10
- data/docs/ContentBlobsApi.md +3 -1
- data/docs/ContentManifestsApi.md +3 -1
- data/docs/ContentSignaturesApi.md +7 -1
- data/docs/ContentTagsApi.md +3 -1
- data/docs/DistributionsContainerApi.md +132 -10
- data/docs/IndexDynamicApi.md +1 -1
- data/docs/IndexStaticApi.md +1 -1
- data/docs/PatchedcontainerContainerDistribution.md +4 -4
- data/docs/PatchedcontainerContainerPushRepository.md +7 -7
- data/docs/PulpContainerNamespacesApi.md +19 -9
- data/docs/RemotesContainerApi.md +131 -9
- data/docs/RepositoriesContainerApi.md +132 -10
- data/docs/RepositoriesContainerPushApi.md +20 -10
- data/docs/RepositoriesContainerPushVersionsApi.md +3 -1
- data/docs/RepositoriesContainerVersionsApi.md +3 -1
- data/docs/SetLabel.md +19 -0
- data/docs/SetLabelResponse.md +19 -0
- data/docs/TokenApi.md +1 -1
- data/docs/UnsetLabel.md +17 -0
- data/docs/UnsetLabelResponse.md +19 -0
- data/lib/pulp_container_client/api/content_blobs_api.rb +3 -0
- data/lib/pulp_container_client/api/content_manifests_api.rb +3 -0
- data/lib/pulp_container_client/api/content_signatures_api.rb +9 -0
- data/lib/pulp_container_client/api/content_tags_api.rb +3 -0
- data/lib/pulp_container_client/api/distributions_container_api.rb +157 -0
- data/lib/pulp_container_client/api/pulp_container_namespaces_api.rb +17 -0
- data/lib/pulp_container_client/api/remotes_container_api.rb +157 -0
- data/lib/pulp_container_client/api/repositories_container_api.rb +157 -0
- data/lib/pulp_container_client/api/repositories_container_push_api.rb +17 -0
- data/lib/pulp_container_client/api/repositories_container_push_versions_api.rb +3 -0
- data/lib/pulp_container_client/api/repositories_container_versions_api.rb +3 -0
- data/lib/pulp_container_client/configuration.rb +2 -2
- data/lib/pulp_container_client/models/container_container_distribution.rb +21 -21
- data/lib/pulp_container_client/models/container_container_distribution_response.rb +35 -35
- data/lib/pulp_container_client/models/container_container_push_repository.rb +45 -45
- data/lib/pulp_container_client/models/container_container_push_repository_response.rb +39 -39
- data/lib/pulp_container_client/models/patchedcontainer_container_distribution.rb +21 -21
- data/lib/pulp_container_client/models/patchedcontainer_container_push_repository.rb +45 -45
- data/lib/pulp_container_client/models/set_label.rb +252 -0
- data/lib/pulp_container_client/models/set_label_response.rb +243 -0
- data/lib/pulp_container_client/models/unset_label.rb +242 -0
- data/lib/pulp_container_client/models/unset_label_response.rb +242 -0
- data/lib/pulp_container_client/version.rb +1 -1
- data/lib/pulp_container_client.rb +4 -0
- data/spec/api/content_blobs_api_spec.rb +1 -0
- data/spec/api/content_manifests_api_spec.rb +1 -0
- data/spec/api/content_signatures_api_spec.rb +3 -0
- data/spec/api/content_tags_api_spec.rb +1 -0
- data/spec/api/distributions_container_api_spec.rb +33 -0
- data/spec/api/pulp_container_namespaces_api_spec.rb +7 -0
- data/spec/api/remotes_container_api_spec.rb +33 -0
- data/spec/api/repositories_container_api_spec.rb +33 -0
- data/spec/api/repositories_container_push_api_spec.rb +7 -0
- data/spec/api/repositories_container_push_versions_api_spec.rb +1 -0
- data/spec/api/repositories_container_versions_api_spec.rb +1 -0
- data/spec/configuration_spec.rb +3 -3
- data/spec/models/container_container_distribution_response_spec.rb +6 -6
- data/spec/models/container_container_distribution_spec.rb +4 -4
- data/spec/models/container_container_push_repository_response_spec.rb +6 -6
- data/spec/models/container_container_push_repository_spec.rb +4 -4
- data/spec/models/patchedcontainer_container_distribution_spec.rb +4 -4
- data/spec/models/patchedcontainer_container_push_repository_spec.rb +4 -4
- data/spec/models/set_label_response_spec.rb +47 -0
- data/spec/models/set_label_spec.rb +47 -0
- data/spec/models/unset_label_response_spec.rb +47 -0
- data/spec/models/unset_label_spec.rb +41 -0
- metadata +60 -44
@@ -20,18 +20,18 @@ module PulpContainerClient
|
|
20
20
|
|
21
21
|
attr_accessor :pulp_labels
|
22
22
|
|
23
|
-
# The latest RepositoryVersion for this Repository will be served.
|
24
|
-
attr_accessor :repository
|
25
|
-
|
26
|
-
# An optional content-guard. If none is specified, a default one will be used.
|
27
|
-
attr_accessor :content_guard
|
28
|
-
|
29
23
|
# The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
|
30
24
|
attr_accessor :base_path
|
31
25
|
|
32
26
|
# A unique name. Ex, `rawhide` and `stable`.
|
33
27
|
attr_accessor :name
|
34
28
|
|
29
|
+
# An optional content-guard. If none is specified, a default one will be used.
|
30
|
+
attr_accessor :content_guard
|
31
|
+
|
32
|
+
# The latest RepositoryVersion for this Repository will be served.
|
33
|
+
attr_accessor :repository
|
34
|
+
|
35
35
|
# RepositoryVersion to be served
|
36
36
|
attr_accessor :repository_version
|
37
37
|
|
@@ -46,10 +46,10 @@ module PulpContainerClient
|
|
46
46
|
{
|
47
47
|
:'hidden' => :'hidden',
|
48
48
|
:'pulp_labels' => :'pulp_labels',
|
49
|
-
:'repository' => :'repository',
|
50
|
-
:'content_guard' => :'content_guard',
|
51
49
|
:'base_path' => :'base_path',
|
52
50
|
:'name' => :'name',
|
51
|
+
:'content_guard' => :'content_guard',
|
52
|
+
:'repository' => :'repository',
|
53
53
|
:'repository_version' => :'repository_version',
|
54
54
|
:'private' => :'private',
|
55
55
|
:'description' => :'description'
|
@@ -61,10 +61,10 @@ module PulpContainerClient
|
|
61
61
|
{
|
62
62
|
:'hidden' => :'Boolean',
|
63
63
|
:'pulp_labels' => :'Hash<String, String>',
|
64
|
-
:'repository' => :'String',
|
65
|
-
:'content_guard' => :'String',
|
66
64
|
:'base_path' => :'String',
|
67
65
|
:'name' => :'String',
|
66
|
+
:'content_guard' => :'String',
|
67
|
+
:'repository' => :'String',
|
68
68
|
:'repository_version' => :'String',
|
69
69
|
:'private' => :'Boolean',
|
70
70
|
:'description' => :'String'
|
@@ -107,14 +107,6 @@ module PulpContainerClient
|
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
-
if attributes.key?(:'repository')
|
111
|
-
self.repository = attributes[:'repository']
|
112
|
-
end
|
113
|
-
|
114
|
-
if attributes.key?(:'content_guard')
|
115
|
-
self.content_guard = attributes[:'content_guard']
|
116
|
-
end
|
117
|
-
|
118
110
|
if attributes.key?(:'base_path')
|
119
111
|
self.base_path = attributes[:'base_path']
|
120
112
|
end
|
@@ -123,6 +115,14 @@ module PulpContainerClient
|
|
123
115
|
self.name = attributes[:'name']
|
124
116
|
end
|
125
117
|
|
118
|
+
if attributes.key?(:'content_guard')
|
119
|
+
self.content_guard = attributes[:'content_guard']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.key?(:'repository')
|
123
|
+
self.repository = attributes[:'repository']
|
124
|
+
end
|
125
|
+
|
126
126
|
if attributes.key?(:'repository_version')
|
127
127
|
self.repository_version = attributes[:'repository_version']
|
128
128
|
end
|
@@ -201,10 +201,10 @@ module PulpContainerClient
|
|
201
201
|
self.class == o.class &&
|
202
202
|
hidden == o.hidden &&
|
203
203
|
pulp_labels == o.pulp_labels &&
|
204
|
-
repository == o.repository &&
|
205
|
-
content_guard == o.content_guard &&
|
206
204
|
base_path == o.base_path &&
|
207
205
|
name == o.name &&
|
206
|
+
content_guard == o.content_guard &&
|
207
|
+
repository == o.repository &&
|
208
208
|
repository_version == o.repository_version &&
|
209
209
|
private == o.private &&
|
210
210
|
description == o.description
|
@@ -219,7 +219,7 @@ module PulpContainerClient
|
|
219
219
|
# Calculates hash code according to all attributes.
|
220
220
|
# @return [Integer] Hash code
|
221
221
|
def hash
|
222
|
-
[hidden, pulp_labels,
|
222
|
+
[hidden, pulp_labels, base_path, name, content_guard, repository, repository_version, private, description].hash
|
223
223
|
end
|
224
224
|
|
225
225
|
# Builds the object from hash
|
@@ -15,48 +15,48 @@ require 'date'
|
|
15
15
|
module PulpContainerClient
|
16
16
|
# Serializer for Container Push Repositories.
|
17
17
|
class PatchedcontainerContainerPushRepository
|
18
|
-
# A reference to an associated signing service.
|
19
|
-
attr_accessor :manifest_signing_service
|
20
|
-
|
21
|
-
attr_accessor :pulp_labels
|
22
|
-
|
23
18
|
# Retain X versions of the repository. Default is null which retains all versions.
|
24
19
|
attr_accessor :retain_repo_versions
|
25
20
|
|
26
|
-
|
27
|
-
attr_accessor :description
|
21
|
+
attr_accessor :pulp_labels
|
28
22
|
|
29
23
|
# A unique name for this repository.
|
30
24
|
attr_accessor :name
|
31
25
|
|
26
|
+
# A reference to an associated signing service.
|
27
|
+
attr_accessor :manifest_signing_service
|
28
|
+
|
29
|
+
# An optional description.
|
30
|
+
attr_accessor :description
|
31
|
+
|
32
32
|
# Attribute mapping from ruby-style variable name to JSON key.
|
33
33
|
def self.attribute_map
|
34
34
|
{
|
35
|
-
:'manifest_signing_service' => :'manifest_signing_service',
|
36
|
-
:'pulp_labels' => :'pulp_labels',
|
37
35
|
:'retain_repo_versions' => :'retain_repo_versions',
|
38
|
-
:'
|
39
|
-
:'name' => :'name'
|
36
|
+
:'pulp_labels' => :'pulp_labels',
|
37
|
+
:'name' => :'name',
|
38
|
+
:'manifest_signing_service' => :'manifest_signing_service',
|
39
|
+
:'description' => :'description'
|
40
40
|
}
|
41
41
|
end
|
42
42
|
|
43
43
|
# Attribute type mapping.
|
44
44
|
def self.openapi_types
|
45
45
|
{
|
46
|
-
:'manifest_signing_service' => :'String',
|
47
|
-
:'pulp_labels' => :'Hash<String, String>',
|
48
46
|
:'retain_repo_versions' => :'Integer',
|
49
|
-
:'
|
50
|
-
:'name' => :'String'
|
47
|
+
:'pulp_labels' => :'Hash<String, String>',
|
48
|
+
:'name' => :'String',
|
49
|
+
:'manifest_signing_service' => :'String',
|
50
|
+
:'description' => :'String'
|
51
51
|
}
|
52
52
|
end
|
53
53
|
|
54
54
|
# List of attributes with nullable: true
|
55
55
|
def self.openapi_nullable
|
56
56
|
Set.new([
|
57
|
-
:'manifest_signing_service',
|
58
57
|
:'retain_repo_versions',
|
59
|
-
:'
|
58
|
+
:'manifest_signing_service',
|
59
|
+
:'description'
|
60
60
|
])
|
61
61
|
end
|
62
62
|
|
@@ -75,8 +75,8 @@ module PulpContainerClient
|
|
75
75
|
h[k.to_sym] = v
|
76
76
|
}
|
77
77
|
|
78
|
-
if attributes.key?(:'
|
79
|
-
self.
|
78
|
+
if attributes.key?(:'retain_repo_versions')
|
79
|
+
self.retain_repo_versions = attributes[:'retain_repo_versions']
|
80
80
|
end
|
81
81
|
|
82
82
|
if attributes.key?(:'pulp_labels')
|
@@ -85,16 +85,16 @@ module PulpContainerClient
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
if attributes.key?(:'
|
89
|
-
self.
|
88
|
+
if attributes.key?(:'name')
|
89
|
+
self.name = attributes[:'name']
|
90
90
|
end
|
91
91
|
|
92
|
-
if attributes.key?(:'
|
93
|
-
self.
|
92
|
+
if attributes.key?(:'manifest_signing_service')
|
93
|
+
self.manifest_signing_service = attributes[:'manifest_signing_service']
|
94
94
|
end
|
95
95
|
|
96
|
-
if attributes.key?(:'
|
97
|
-
self.
|
96
|
+
if attributes.key?(:'description')
|
97
|
+
self.description = attributes[:'description']
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -106,14 +106,14 @@ module PulpContainerClient
|
|
106
106
|
invalid_properties.push('invalid value for "retain_repo_versions", must be greater than or equal to 1.')
|
107
107
|
end
|
108
108
|
|
109
|
-
if !@description.nil? && @description.to_s.length < 1
|
110
|
-
invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
|
111
|
-
end
|
112
|
-
|
113
109
|
if !@name.nil? && @name.to_s.length < 1
|
114
110
|
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
115
111
|
end
|
116
112
|
|
113
|
+
if !@description.nil? && @description.to_s.length < 1
|
114
|
+
invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
|
115
|
+
end
|
116
|
+
|
117
117
|
invalid_properties
|
118
118
|
end
|
119
119
|
|
@@ -121,8 +121,8 @@ module PulpContainerClient
|
|
121
121
|
# @return true if the model is valid
|
122
122
|
def valid?
|
123
123
|
return false if !@retain_repo_versions.nil? && @retain_repo_versions < 1
|
124
|
-
return false if !@description.nil? && @description.to_s.length < 1
|
125
124
|
return false if !@name.nil? && @name.to_s.length < 1
|
125
|
+
return false if !@description.nil? && @description.to_s.length < 1
|
126
126
|
true
|
127
127
|
end
|
128
128
|
|
@@ -136,16 +136,6 @@ module PulpContainerClient
|
|
136
136
|
@retain_repo_versions = retain_repo_versions
|
137
137
|
end
|
138
138
|
|
139
|
-
# Custom attribute writer method with validation
|
140
|
-
# @param [Object] description Value to be assigned
|
141
|
-
def description=(description)
|
142
|
-
if !description.nil? && description.to_s.length < 1
|
143
|
-
fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.'
|
144
|
-
end
|
145
|
-
|
146
|
-
@description = description
|
147
|
-
end
|
148
|
-
|
149
139
|
# Custom attribute writer method with validation
|
150
140
|
# @param [Object] name Value to be assigned
|
151
141
|
def name=(name)
|
@@ -156,16 +146,26 @@ module PulpContainerClient
|
|
156
146
|
@name = name
|
157
147
|
end
|
158
148
|
|
149
|
+
# Custom attribute writer method with validation
|
150
|
+
# @param [Object] description Value to be assigned
|
151
|
+
def description=(description)
|
152
|
+
if !description.nil? && description.to_s.length < 1
|
153
|
+
fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.'
|
154
|
+
end
|
155
|
+
|
156
|
+
@description = description
|
157
|
+
end
|
158
|
+
|
159
159
|
# Checks equality by comparing each attribute.
|
160
160
|
# @param [Object] Object to be compared
|
161
161
|
def ==(o)
|
162
162
|
return true if self.equal?(o)
|
163
163
|
self.class == o.class &&
|
164
|
-
manifest_signing_service == o.manifest_signing_service &&
|
165
|
-
pulp_labels == o.pulp_labels &&
|
166
164
|
retain_repo_versions == o.retain_repo_versions &&
|
167
|
-
|
168
|
-
name == o.name
|
165
|
+
pulp_labels == o.pulp_labels &&
|
166
|
+
name == o.name &&
|
167
|
+
manifest_signing_service == o.manifest_signing_service &&
|
168
|
+
description == o.description
|
169
169
|
end
|
170
170
|
|
171
171
|
# @see the `==` method
|
@@ -177,7 +177,7 @@ module PulpContainerClient
|
|
177
177
|
# Calculates hash code according to all attributes.
|
178
178
|
# @return [Integer] Hash code
|
179
179
|
def hash
|
180
|
-
[
|
180
|
+
[retain_repo_versions, pulp_labels, name, manifest_signing_service, description].hash
|
181
181
|
end
|
182
182
|
|
183
183
|
# Builds the object from hash
|
@@ -0,0 +1,252 @@
|
|
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.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpContainerClient
|
16
|
+
# Serializer for synchronously setting a label.
|
17
|
+
class SetLabel
|
18
|
+
attr_accessor :key
|
19
|
+
|
20
|
+
attr_accessor :value
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'key' => :'key',
|
26
|
+
:'value' => :'value'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.openapi_types
|
32
|
+
{
|
33
|
+
:'key' => :'String',
|
34
|
+
:'value' => :'String'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# List of attributes with nullable: true
|
39
|
+
def self.openapi_nullable
|
40
|
+
Set.new([
|
41
|
+
:'value'
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpContainerClient::SetLabel` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpContainerClient::SetLabel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'key')
|
61
|
+
self.key = attributes[:'key']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.key?(:'value')
|
65
|
+
self.value = attributes[:'value']
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
70
|
+
# @return Array for valid properties with the reasons
|
71
|
+
def list_invalid_properties
|
72
|
+
invalid_properties = Array.new
|
73
|
+
if @key.nil?
|
74
|
+
invalid_properties.push('invalid value for "key", key cannot be nil.')
|
75
|
+
end
|
76
|
+
|
77
|
+
if @key.to_s.length < 1
|
78
|
+
invalid_properties.push('invalid value for "key", the character length must be great than or equal to 1.')
|
79
|
+
end
|
80
|
+
|
81
|
+
pattern = Regexp.new(/^[-a-zA-Z0-9_]+$/)
|
82
|
+
if @key !~ pattern
|
83
|
+
invalid_properties.push("invalid value for \"key\", must conform to the pattern #{pattern}.")
|
84
|
+
end
|
85
|
+
|
86
|
+
invalid_properties
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check to see if the all the properties in the model are valid
|
90
|
+
# @return true if the model is valid
|
91
|
+
def valid?
|
92
|
+
return false if @key.nil?
|
93
|
+
return false if @key.to_s.length < 1
|
94
|
+
return false if @key !~ Regexp.new(/^[-a-zA-Z0-9_]+$/)
|
95
|
+
true
|
96
|
+
end
|
97
|
+
|
98
|
+
# Custom attribute writer method with validation
|
99
|
+
# @param [Object] key Value to be assigned
|
100
|
+
def key=(key)
|
101
|
+
if key.nil?
|
102
|
+
fail ArgumentError, 'key cannot be nil'
|
103
|
+
end
|
104
|
+
|
105
|
+
if key.to_s.length < 1
|
106
|
+
fail ArgumentError, 'invalid value for "key", the character length must be great than or equal to 1.'
|
107
|
+
end
|
108
|
+
|
109
|
+
pattern = Regexp.new(/^[-a-zA-Z0-9_]+$/)
|
110
|
+
if key !~ pattern
|
111
|
+
fail ArgumentError, "invalid value for \"key\", must conform to the pattern #{pattern}."
|
112
|
+
end
|
113
|
+
|
114
|
+
@key = key
|
115
|
+
end
|
116
|
+
|
117
|
+
# Checks equality by comparing each attribute.
|
118
|
+
# @param [Object] Object to be compared
|
119
|
+
def ==(o)
|
120
|
+
return true if self.equal?(o)
|
121
|
+
self.class == o.class &&
|
122
|
+
key == o.key &&
|
123
|
+
value == o.value
|
124
|
+
end
|
125
|
+
|
126
|
+
# @see the `==` method
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def eql?(o)
|
129
|
+
self == o
|
130
|
+
end
|
131
|
+
|
132
|
+
# Calculates hash code according to all attributes.
|
133
|
+
# @return [Integer] Hash code
|
134
|
+
def hash
|
135
|
+
[key, value].hash
|
136
|
+
end
|
137
|
+
|
138
|
+
# Builds the object from hash
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
140
|
+
# @return [Object] Returns the model itself
|
141
|
+
def self.build_from_hash(attributes)
|
142
|
+
new.build_from_hash(attributes)
|
143
|
+
end
|
144
|
+
|
145
|
+
# Builds the object from hash
|
146
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
147
|
+
# @return [Object] Returns the model itself
|
148
|
+
def build_from_hash(attributes)
|
149
|
+
return nil unless attributes.is_a?(Hash)
|
150
|
+
self.class.openapi_types.each_pair do |key, type|
|
151
|
+
if type =~ /\AArray<(.*)>/i
|
152
|
+
# check to ensure the input is an array given that the attribute
|
153
|
+
# is documented as an array but the input is not
|
154
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
155
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
156
|
+
end
|
157
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
158
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
159
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
160
|
+
end
|
161
|
+
|
162
|
+
self
|
163
|
+
end
|
164
|
+
|
165
|
+
# Deserializes the data based on type
|
166
|
+
# @param string type Data type
|
167
|
+
# @param string value Value to be deserialized
|
168
|
+
# @return [Object] Deserialized data
|
169
|
+
def _deserialize(type, value)
|
170
|
+
case type.to_sym
|
171
|
+
when :DateTime
|
172
|
+
DateTime.parse(value)
|
173
|
+
when :Date
|
174
|
+
Date.parse(value)
|
175
|
+
when :String
|
176
|
+
value.to_s
|
177
|
+
when :Integer
|
178
|
+
value.to_i
|
179
|
+
when :Float
|
180
|
+
value.to_f
|
181
|
+
when :Boolean
|
182
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
183
|
+
true
|
184
|
+
else
|
185
|
+
false
|
186
|
+
end
|
187
|
+
when :Object
|
188
|
+
# generic object (usually a Hash), return directly
|
189
|
+
value
|
190
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
191
|
+
inner_type = Regexp.last_match[:inner_type]
|
192
|
+
value.map { |v| _deserialize(inner_type, v) }
|
193
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
194
|
+
k_type = Regexp.last_match[:k_type]
|
195
|
+
v_type = Regexp.last_match[:v_type]
|
196
|
+
{}.tap do |hash|
|
197
|
+
value.each do |k, v|
|
198
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
else # model
|
202
|
+
PulpContainerClient.const_get(type).build_from_hash(value)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
# Returns the string representation of the object
|
207
|
+
# @return [String] String presentation of the object
|
208
|
+
def to_s
|
209
|
+
to_hash.to_s
|
210
|
+
end
|
211
|
+
|
212
|
+
# to_body is an alias to to_hash (backward compatibility)
|
213
|
+
# @return [Hash] Returns the object in the form of hash
|
214
|
+
def to_body
|
215
|
+
to_hash
|
216
|
+
end
|
217
|
+
|
218
|
+
# Returns the object in the form of hash
|
219
|
+
# @return [Hash] Returns the object in the form of hash
|
220
|
+
def to_hash
|
221
|
+
hash = {}
|
222
|
+
self.class.attribute_map.each_pair do |attr, param|
|
223
|
+
value = self.send(attr)
|
224
|
+
if value.nil?
|
225
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
226
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
227
|
+
end
|
228
|
+
|
229
|
+
hash[param] = _to_hash(value)
|
230
|
+
end
|
231
|
+
hash
|
232
|
+
end
|
233
|
+
|
234
|
+
# Outputs non-array value in the form of hash
|
235
|
+
# For object, use to_hash. Otherwise, just return the value
|
236
|
+
# @param [Object] value Any valid value
|
237
|
+
# @return [Hash] Returns the value in the form of hash
|
238
|
+
def _to_hash(value)
|
239
|
+
if value.is_a?(Array)
|
240
|
+
value.compact.map { |v| _to_hash(v) }
|
241
|
+
elsif value.is_a?(Hash)
|
242
|
+
{}.tap do |hash|
|
243
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
244
|
+
end
|
245
|
+
elsif value.respond_to? :to_hash
|
246
|
+
value.to_hash
|
247
|
+
else
|
248
|
+
value
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|