swagger_aem 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/Gemfile.lock +44 -43
  4. data/README.md +15 -7
  5. data/docs/ConsoleApi.md +43 -33
  6. data/docs/CqApi.md +12 -8
  7. data/docs/CrxApi.md +41 -27
  8. data/docs/CustomApi.md +19 -13
  9. data/docs/InlineObject.md +17 -0
  10. data/docs/InlineObject1.md +17 -0
  11. data/docs/InlineObject2.md +17 -0
  12. data/docs/InlineObject3.md +17 -0
  13. data/docs/InlineObject4.md +21 -0
  14. data/docs/InstallStatus.md +9 -0
  15. data/docs/InstallStatusStatus.md +11 -1
  16. data/docs/KeystoreChainItems.md +13 -0
  17. data/docs/KeystoreInfo.md +11 -1
  18. data/docs/KeystoreItems.md +13 -0
  19. data/docs/SamlConfigurationInfo.md +14 -0
  20. data/docs/SamlConfigurationProperties.md +32 -0
  21. data/docs/SamlConfigurationPropertyItemsArray.md +16 -2
  22. data/docs/SamlConfigurationPropertyItemsBoolean.md +17 -3
  23. data/docs/SamlConfigurationPropertyItemsLong.md +16 -2
  24. data/docs/SamlConfigurationPropertyItemsString.md +16 -2
  25. data/docs/SlingApi.md +320 -214
  26. data/docs/TruststoreInfo.md +11 -1
  27. data/docs/TruststoreItems.md +15 -0
  28. data/git_push.sh +10 -7
  29. data/lib/swagger_aem.rb +7 -2
  30. data/lib/swagger_aem/api/console_api.rb +118 -67
  31. data/lib/swagger_aem/api/cq_api.rb +43 -23
  32. data/lib/swagger_aem/api/crx_api.rb +154 -84
  33. data/lib/swagger_aem/api/custom_api.rb +60 -29
  34. data/lib/swagger_aem/api/sling_api.rb +850 -500
  35. data/lib/swagger_aem/api_client.rb +42 -43
  36. data/lib/swagger_aem/api_error.rb +21 -2
  37. data/lib/swagger_aem/configuration.rb +46 -7
  38. data/lib/swagger_aem/models/inline_object.rb +206 -0
  39. data/lib/swagger_aem/models/inline_object1.rb +206 -0
  40. data/lib/swagger_aem/models/inline_object2.rb +206 -0
  41. data/lib/swagger_aem/models/inline_object3.rb +206 -0
  42. data/lib/swagger_aem/models/inline_object4.rb +224 -0
  43. data/lib/swagger_aem/models/install_status.rb +35 -12
  44. data/lib/swagger_aem/models/install_status_status.rb +38 -15
  45. data/lib/swagger_aem/models/keystore_chain_items.rb +42 -19
  46. data/lib/swagger_aem/models/keystore_info.rb +37 -14
  47. data/lib/swagger_aem/models/keystore_items.rb +41 -18
  48. data/lib/swagger_aem/models/saml_configuration_info.rb +40 -17
  49. data/lib/swagger_aem/models/saml_configuration_properties.rb +81 -58
  50. data/lib/swagger_aem/models/saml_configuration_property_items_array.rb +42 -19
  51. data/lib/swagger_aem/models/saml_configuration_property_items_boolean.rb +43 -20
  52. data/lib/swagger_aem/models/saml_configuration_property_items_long.rb +42 -19
  53. data/lib/swagger_aem/models/saml_configuration_property_items_string.rb +42 -19
  54. data/lib/swagger_aem/models/truststore_info.rb +37 -14
  55. data/lib/swagger_aem/models/truststore_items.rb +46 -23
  56. data/lib/swagger_aem/version.rb +3 -3
  57. data/spec/models/inline_object1_spec.rb +41 -0
  58. data/spec/models/inline_object2_spec.rb +41 -0
  59. data/spec/models/inline_object3_spec.rb +41 -0
  60. data/spec/models/inline_object4_spec.rb +53 -0
  61. data/spec/models/inline_object_spec.rb +41 -0
  62. data/swagger_aem.gemspec +2 -8
  63. metadata +22 -122
@@ -3,10 +3,10 @@
3
3
 
4
4
  #Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API
5
5
 
6
- OpenAPI spec version: 3.1.0
6
+ The version of the OpenAPI document: 3.2.0
7
7
  Contact: opensource@shinesolutions.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 3.2.1-SNAPSHOT
9
+ OpenAPI Generator version: 4.3.1-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -15,7 +15,6 @@ require 'json'
15
15
  require 'logger'
16
16
  require 'tempfile'
17
17
  require 'typhoeus'
18
- require 'uri'
19
18
 
20
19
  module SwaggerAemClient
21
20
  class ApiClient
@@ -44,7 +43,7 @@ module SwaggerAemClient
44
43
 
45
44
  # Call an API with given options.
46
45
  #
47
- # @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements:
46
+ # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
48
47
  # the data deserialized from response body (could be nil), response status code and response headers.
49
48
  def call_api(http_method, path, opts = {})
50
49
  request = build_request(http_method, path, opts)
@@ -128,6 +127,34 @@ module SwaggerAemClient
128
127
  request
129
128
  end
130
129
 
130
+ # Builds the HTTP request body
131
+ #
132
+ # @param [Hash] header_params Header parameters
133
+ # @param [Hash] form_params Query parameters
134
+ # @param [Object] body HTTP body (JSON/XML)
135
+ # @return [String] HTTP body data in the form of string
136
+ def build_request_body(header_params, form_params, body)
137
+ # http form
138
+ if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
139
+ header_params['Content-Type'] == 'multipart/form-data'
140
+ data = {}
141
+ form_params.each do |key, value|
142
+ case value
143
+ when ::File, ::Array, nil
144
+ # let typhoeus handle File, Array and nil parameters
145
+ data[key] = value
146
+ else
147
+ data[key] = value.to_s
148
+ end
149
+ end
150
+ elsif body
151
+ data = body.is_a?(String) ? body : body.to_json
152
+ else
153
+ data = nil
154
+ end
155
+ data
156
+ end
157
+
131
158
  # Check if the given MIME is a JSON MIME.
132
159
  # JSON MIME examples:
133
160
  # application/json
@@ -143,7 +170,7 @@ module SwaggerAemClient
143
170
  # Deserialize the response to the given return type.
144
171
  #
145
172
  # @param [Response] response HTTP response
146
- # @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
173
+ # @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
147
174
  def deserialize(response, return_type)
148
175
  body = response.body
149
176
 
@@ -187,7 +214,7 @@ module SwaggerAemClient
187
214
  data.to_i
188
215
  when 'Float'
189
216
  data.to_f
190
- when 'BOOLEAN'
217
+ when 'Boolean'
191
218
  data == true
192
219
  when 'DateTime'
193
220
  # parse date time (expecting ISO 8601 format)
@@ -210,9 +237,7 @@ module SwaggerAemClient
210
237
  end
211
238
  else
212
239
  # models, e.g. Pet
213
- SwaggerAemClient.const_get(return_type).new.tap do |model|
214
- model.build_from_hash data
215
- end
240
+ SwaggerAemClient.const_get(return_type).build_from_hash(data)
216
241
  end
217
242
  end
218
243
 
@@ -244,11 +269,13 @@ module SwaggerAemClient
244
269
  tempfile.write(chunk)
245
270
  end
246
271
  request.on_complete do |response|
247
- tempfile.close if tempfile
248
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
249
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
250
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
251
- "explicitly with `tempfile.delete`"
272
+ if tempfile
273
+ tempfile.close
274
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
275
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
276
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
277
+ "explicitly with `tempfile.delete`"
278
+ end
252
279
  end
253
280
  end
254
281
 
@@ -264,35 +291,7 @@ module SwaggerAemClient
264
291
  def build_request_url(path)
265
292
  # Add leading and trailing slashes to path
266
293
  path = "/#{path}".gsub(/\/+/, '/')
267
- URI.encode(@config.base_url + path)
268
- end
269
-
270
- # Builds the HTTP request body
271
- #
272
- # @param [Hash] header_params Header parameters
273
- # @param [Hash] form_params Query parameters
274
- # @param [Object] body HTTP body (JSON/XML)
275
- # @return [String] HTTP body data in the form of string
276
- def build_request_body(header_params, form_params, body)
277
- # http form
278
- if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
279
- header_params['Content-Type'] == 'multipart/form-data'
280
- data = {}
281
- form_params.each do |key, value|
282
- case value
283
- when ::File, ::Array, nil
284
- # let typhoeus handle File, Array and nil parameters
285
- data[key] = value
286
- else
287
- data[key] = value.to_s
288
- end
289
- end
290
- elsif body
291
- data = body.is_a?(String) ? body : body.to_json
292
- else
293
- data = nil
294
- end
295
- data
294
+ @config.base_url + path
296
295
  end
297
296
 
298
297
  # Update hearder and query params based on authentication settings.
@@ -3,10 +3,10 @@
3
3
 
4
4
  #Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API
5
5
 
6
- OpenAPI spec version: 3.1.0
6
+ The version of the OpenAPI document: 3.2.0
7
7
  Contact: opensource@shinesolutions.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 3.2.1-SNAPSHOT
9
+ OpenAPI Generator version: 4.3.1-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -34,5 +34,24 @@ module SwaggerAemClient
34
34
  super arg
35
35
  end
36
36
  end
37
+
38
+ # Override to_s to display a friendly error message
39
+ def to_s
40
+ message
41
+ end
42
+
43
+ def message
44
+ if @message.nil?
45
+ msg = "Error message: the server returns an error"
46
+ else
47
+ msg = @message
48
+ end
49
+
50
+ msg += "\nHTTP status code: #{code}" if code
51
+ msg += "\nResponse headers: #{response_headers}" if response_headers
52
+ msg += "\nResponse body: #{response_body}" if response_body
53
+
54
+ msg
55
+ end
37
56
  end
38
57
  end
@@ -3,15 +3,13 @@
3
3
 
4
4
  #Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API
5
5
 
6
- OpenAPI spec version: 3.1.0
6
+ The version of the OpenAPI document: 3.2.0
7
7
  Contact: opensource@shinesolutions.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 3.2.1-SNAPSHOT
9
+ OpenAPI Generator version: 4.3.1-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
13
- require 'uri'
14
-
15
13
  module SwaggerAemClient
16
14
  class Configuration
17
15
  # Defines url scheme
@@ -130,7 +128,7 @@ module SwaggerAemClient
130
128
  def initialize
131
129
  @scheme = 'http'
132
130
  @host = 'localhost'
133
- @base_path = '/'
131
+ @base_path = ''
134
132
  @api_key = {}
135
133
  @api_key_prefix = {}
136
134
  @timeout = 0
@@ -174,8 +172,7 @@ module SwaggerAemClient
174
172
  end
175
173
 
176
174
  def base_url
177
- url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
178
- URI.encode(url)
175
+ "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
179
176
  end
180
177
 
181
178
  # Gets API key (with prefix if set).
@@ -205,5 +202,47 @@ module SwaggerAemClient
205
202
  },
206
203
  }
207
204
  end
205
+
206
+ # Returns an array of Server setting
207
+ def server_settings
208
+ [
209
+ {
210
+ url: "/",
211
+ description: "No description provided",
212
+ }
213
+ ]
214
+ end
215
+
216
+ # Returns URL based on server settings
217
+ #
218
+ # @param index array index of the server settings
219
+ # @param variables hash of variable and the corresponding value
220
+ def server_url(index, variables = {})
221
+ servers = server_settings
222
+
223
+ # check array index out of bound
224
+ if (index < 0 || index >= servers.size)
225
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
226
+ end
227
+
228
+ server = servers[index]
229
+ url = server[:url]
230
+
231
+ # go through variable and assign a value
232
+ server[:variables].each do |name, variable|
233
+ if variables.key?(name)
234
+ if (server[:variables][name][:enum_values].include? variables[name])
235
+ url.gsub! "{" + name.to_s + "}", variables[name]
236
+ else
237
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
238
+ end
239
+ else
240
+ # use default value
241
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
242
+ end
243
+ end
244
+
245
+ url
246
+ end
208
247
  end
209
248
  end
@@ -0,0 +1,206 @@
1
+ =begin
2
+ #Adobe Experience Manager (AEM) API
3
+
4
+ #Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API
5
+
6
+ The version of the OpenAPI document: 3.2.0
7
+ Contact: opensource@shinesolutions.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SwaggerAemClient
16
+ class InlineObject
17
+ attr_accessor :file
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'file' => :'file'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'file' => :'File'
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
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 `SwaggerAemClient::InlineObject` 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 `SwaggerAemClient::InlineObject`. 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?(:'file')
55
+ self.file = attributes[:'file']
56
+ end
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ invalid_properties
64
+ end
65
+
66
+ # Check to see if the all the properties in the model are valid
67
+ # @return true if the model is valid
68
+ def valid?
69
+ true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ file == o.file
78
+ end
79
+
80
+ # @see the `==` method
81
+ # @param [Object] Object to be compared
82
+ def eql?(o)
83
+ self == o
84
+ end
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Integer] Hash code
88
+ def hash
89
+ [file].hash
90
+ end
91
+
92
+ # Builds the object from hash
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ # @return [Object] Returns the model itself
95
+ def self.build_from_hash(attributes)
96
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
103
+ return nil unless attributes.is_a?(Hash)
104
+ self.class.openapi_types.each_pair do |key, type|
105
+ if type =~ /\AArray<(.*)>/i
106
+ # check to ensure the input is an array given that the attribute
107
+ # is documented as an array but the input is not
108
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
109
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
110
+ end
111
+ elsif !attributes[self.class.attribute_map[key]].nil?
112
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
113
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
114
+ end
115
+
116
+ self
117
+ end
118
+
119
+ # Deserializes the data based on type
120
+ # @param string type Data type
121
+ # @param string value Value to be deserialized
122
+ # @return [Object] Deserialized data
123
+ def _deserialize(type, value)
124
+ case type.to_sym
125
+ when :DateTime
126
+ DateTime.parse(value)
127
+ when :Date
128
+ Date.parse(value)
129
+ when :String
130
+ value.to_s
131
+ when :Integer
132
+ value.to_i
133
+ when :Float
134
+ value.to_f
135
+ when :Boolean
136
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
137
+ true
138
+ else
139
+ false
140
+ end
141
+ when :Object
142
+ # generic object (usually a Hash), return directly
143
+ value
144
+ when /\AArray<(?<inner_type>.+)>\z/
145
+ inner_type = Regexp.last_match[:inner_type]
146
+ value.map { |v| _deserialize(inner_type, v) }
147
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
148
+ k_type = Regexp.last_match[:k_type]
149
+ v_type = Regexp.last_match[:v_type]
150
+ {}.tap do |hash|
151
+ value.each do |k, v|
152
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
153
+ end
154
+ end
155
+ else # model
156
+ SwaggerAemClient.const_get(type).build_from_hash(value)
157
+ end
158
+ end
159
+
160
+ # Returns the string representation of the object
161
+ # @return [String] String presentation of the object
162
+ def to_s
163
+ to_hash.to_s
164
+ end
165
+
166
+ # to_body is an alias to to_hash (backward compatibility)
167
+ # @return [Hash] Returns the object in the form of hash
168
+ def to_body
169
+ to_hash
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ if value.nil?
179
+ is_nullable = self.class.openapi_nullable.include?(attr)
180
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
181
+ end
182
+
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ # Outputs non-array value in the form of hash
189
+ # For object, use to_hash. Otherwise, just return the value
190
+ # @param [Object] value Any valid value
191
+ # @return [Hash] Returns the value in the form of hash
192
+ def _to_hash(value)
193
+ if value.is_a?(Array)
194
+ value.compact.map { |v| _to_hash(v) }
195
+ elsif value.is_a?(Hash)
196
+ {}.tap do |hash|
197
+ value.each { |k, v| hash[k] = _to_hash(v) }
198
+ end
199
+ elsif value.respond_to? :to_hash
200
+ value.to_hash
201
+ else
202
+ value
203
+ end
204
+ end
205
+ end
206
+ end