pulp_file_client 3.102.0 → 3.103.0

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.
@@ -0,0 +1,573 @@
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
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PulpFileClient
17
+ # Shared network configuration fields and validation logic used by both RemoteSerializer and UploadSerializerFieldsMixin.
18
+ class RemoteNetworkConfig
19
+ # A PEM encoded CA certificate used to validate the server certificate presented by the remote server.
20
+ attr_accessor :ca_cert
21
+
22
+ # A PEM encoded client certificate used for authentication.
23
+ attr_accessor :client_cert
24
+
25
+ # A PEM encoded private key used for authentication.
26
+ attr_accessor :client_key
27
+
28
+ # If True, TLS peer validation must be performed.
29
+ attr_accessor :tls_validation
30
+
31
+ # The proxy URL. Format: scheme://host:port
32
+ attr_accessor :proxy_url
33
+
34
+ # The username to authenticte to the proxy.
35
+ attr_accessor :proxy_username
36
+
37
+ # The password to authenticate to the proxy. Extra leading and trailing whitespace characters are not trimmed.
38
+ attr_accessor :proxy_password
39
+
40
+ # The username to be used for authentication when syncing.
41
+ attr_accessor :username
42
+
43
+ # The password to be used for authentication when syncing. Extra leading and trailing whitespace characters are not trimmed.
44
+ attr_accessor :password
45
+
46
+ # Maximum number of retry attempts after a download failure. If not set then the default value (3) will be used.
47
+ attr_accessor :max_retries
48
+
49
+ # aiohttp.ClientTimeout.total (q.v.) for download-connections. The default is null, which will cause the default from the aiohttp library to be used.
50
+ attr_accessor :total_timeout
51
+
52
+ # aiohttp.ClientTimeout.connect (q.v.) for download-connections. The default is null, which will cause the default from the aiohttp library to be used.
53
+ attr_accessor :connect_timeout
54
+
55
+ # aiohttp.ClientTimeout.sock_connect (q.v.) for download-connections. The default is null, which will cause the default from the aiohttp library to be used.
56
+ attr_accessor :sock_connect_timeout
57
+
58
+ # aiohttp.ClientTimeout.sock_read (q.v.) for download-connections. The default is null, which will cause the default from the aiohttp library to be used.
59
+ attr_accessor :sock_read_timeout
60
+
61
+ # Headers for aiohttp.Clientsession
62
+ attr_accessor :headers
63
+
64
+ # Total number of simultaneous connections. If not set then the default value will be used.
65
+ attr_accessor :download_concurrency
66
+
67
+ # Limits requests per second for each concurrent downloader
68
+ attr_accessor :rate_limit
69
+
70
+ # Attribute mapping from ruby-style variable name to JSON key.
71
+ def self.attribute_map
72
+ {
73
+ :'ca_cert' => :'ca_cert',
74
+ :'client_cert' => :'client_cert',
75
+ :'client_key' => :'client_key',
76
+ :'tls_validation' => :'tls_validation',
77
+ :'proxy_url' => :'proxy_url',
78
+ :'proxy_username' => :'proxy_username',
79
+ :'proxy_password' => :'proxy_password',
80
+ :'username' => :'username',
81
+ :'password' => :'password',
82
+ :'max_retries' => :'max_retries',
83
+ :'total_timeout' => :'total_timeout',
84
+ :'connect_timeout' => :'connect_timeout',
85
+ :'sock_connect_timeout' => :'sock_connect_timeout',
86
+ :'sock_read_timeout' => :'sock_read_timeout',
87
+ :'headers' => :'headers',
88
+ :'download_concurrency' => :'download_concurrency',
89
+ :'rate_limit' => :'rate_limit'
90
+ }
91
+ end
92
+
93
+ # Returns all the JSON keys this model knows about
94
+ def self.acceptable_attributes
95
+ attribute_map.values
96
+ end
97
+
98
+ # Attribute type mapping.
99
+ def self.openapi_types
100
+ {
101
+ :'ca_cert' => :'String',
102
+ :'client_cert' => :'String',
103
+ :'client_key' => :'String',
104
+ :'tls_validation' => :'Boolean',
105
+ :'proxy_url' => :'String',
106
+ :'proxy_username' => :'String',
107
+ :'proxy_password' => :'String',
108
+ :'username' => :'String',
109
+ :'password' => :'String',
110
+ :'max_retries' => :'Integer',
111
+ :'total_timeout' => :'Float',
112
+ :'connect_timeout' => :'Float',
113
+ :'sock_connect_timeout' => :'Float',
114
+ :'sock_read_timeout' => :'Float',
115
+ :'headers' => :'Array<Object>',
116
+ :'download_concurrency' => :'Integer',
117
+ :'rate_limit' => :'Integer'
118
+ }
119
+ end
120
+
121
+ # List of attributes with nullable: true
122
+ def self.openapi_nullable
123
+ Set.new([
124
+ :'ca_cert',
125
+ :'client_cert',
126
+ :'client_key',
127
+ :'proxy_url',
128
+ :'proxy_username',
129
+ :'proxy_password',
130
+ :'username',
131
+ :'password',
132
+ :'max_retries',
133
+ :'total_timeout',
134
+ :'connect_timeout',
135
+ :'sock_connect_timeout',
136
+ :'sock_read_timeout',
137
+ :'download_concurrency',
138
+ :'rate_limit'
139
+ ])
140
+ end
141
+
142
+ # Initializes the object
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ def initialize(attributes = {})
145
+ if (!attributes.is_a?(Hash))
146
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpFileClient::RemoteNetworkConfig` initialize method"
147
+ end
148
+
149
+ # check to see if the attribute exists and convert string to symbol for hash key
150
+ attributes = attributes.each_with_object({}) { |(k, v), h|
151
+ if (!self.class.attribute_map.key?(k.to_sym))
152
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpFileClient::RemoteNetworkConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
153
+ end
154
+ h[k.to_sym] = v
155
+ }
156
+
157
+ if attributes.key?(:'ca_cert')
158
+ self.ca_cert = attributes[:'ca_cert']
159
+ end
160
+
161
+ if attributes.key?(:'client_cert')
162
+ self.client_cert = attributes[:'client_cert']
163
+ end
164
+
165
+ if attributes.key?(:'client_key')
166
+ self.client_key = attributes[:'client_key']
167
+ end
168
+
169
+ if attributes.key?(:'tls_validation')
170
+ self.tls_validation = attributes[:'tls_validation']
171
+ end
172
+
173
+ if attributes.key?(:'proxy_url')
174
+ self.proxy_url = attributes[:'proxy_url']
175
+ end
176
+
177
+ if attributes.key?(:'proxy_username')
178
+ self.proxy_username = attributes[:'proxy_username']
179
+ end
180
+
181
+ if attributes.key?(:'proxy_password')
182
+ self.proxy_password = attributes[:'proxy_password']
183
+ end
184
+
185
+ if attributes.key?(:'username')
186
+ self.username = attributes[:'username']
187
+ end
188
+
189
+ if attributes.key?(:'password')
190
+ self.password = attributes[:'password']
191
+ end
192
+
193
+ if attributes.key?(:'max_retries')
194
+ self.max_retries = attributes[:'max_retries']
195
+ end
196
+
197
+ if attributes.key?(:'total_timeout')
198
+ self.total_timeout = attributes[:'total_timeout']
199
+ end
200
+
201
+ if attributes.key?(:'connect_timeout')
202
+ self.connect_timeout = attributes[:'connect_timeout']
203
+ end
204
+
205
+ if attributes.key?(:'sock_connect_timeout')
206
+ self.sock_connect_timeout = attributes[:'sock_connect_timeout']
207
+ end
208
+
209
+ if attributes.key?(:'sock_read_timeout')
210
+ self.sock_read_timeout = attributes[:'sock_read_timeout']
211
+ end
212
+
213
+ if attributes.key?(:'headers')
214
+ if (value = attributes[:'headers']).is_a?(Array)
215
+ self.headers = value
216
+ end
217
+ end
218
+
219
+ if attributes.key?(:'download_concurrency')
220
+ self.download_concurrency = attributes[:'download_concurrency']
221
+ end
222
+
223
+ if attributes.key?(:'rate_limit')
224
+ self.rate_limit = attributes[:'rate_limit']
225
+ end
226
+ end
227
+
228
+ # Show invalid properties with the reasons. Usually used together with valid?
229
+ # @return Array for valid properties with the reasons
230
+ def list_invalid_properties
231
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
232
+ invalid_properties = Array.new
233
+ if !@ca_cert.nil? && @ca_cert.to_s.length < 1
234
+ invalid_properties.push('invalid value for "ca_cert", the character length must be great than or equal to 1.')
235
+ end
236
+
237
+ if !@client_cert.nil? && @client_cert.to_s.length < 1
238
+ invalid_properties.push('invalid value for "client_cert", the character length must be great than or equal to 1.')
239
+ end
240
+
241
+ if !@client_key.nil? && @client_key.to_s.length < 1
242
+ invalid_properties.push('invalid value for "client_key", the character length must be great than or equal to 1.')
243
+ end
244
+
245
+ if !@proxy_url.nil? && @proxy_url.to_s.length < 1
246
+ invalid_properties.push('invalid value for "proxy_url", the character length must be great than or equal to 1.')
247
+ end
248
+
249
+ if !@proxy_username.nil? && @proxy_username.to_s.length < 1
250
+ invalid_properties.push('invalid value for "proxy_username", the character length must be great than or equal to 1.')
251
+ end
252
+
253
+ if !@proxy_password.nil? && @proxy_password.to_s.length < 1
254
+ invalid_properties.push('invalid value for "proxy_password", the character length must be great than or equal to 1.')
255
+ end
256
+
257
+ if !@username.nil? && @username.to_s.length < 1
258
+ invalid_properties.push('invalid value for "username", the character length must be great than or equal to 1.')
259
+ end
260
+
261
+ if !@password.nil? && @password.to_s.length < 1
262
+ invalid_properties.push('invalid value for "password", the character length must be great than or equal to 1.')
263
+ end
264
+
265
+ if !@total_timeout.nil? && @total_timeout < 0.0
266
+ invalid_properties.push('invalid value for "total_timeout", must be greater than or equal to 0.0.')
267
+ end
268
+
269
+ if !@connect_timeout.nil? && @connect_timeout < 0.0
270
+ invalid_properties.push('invalid value for "connect_timeout", must be greater than or equal to 0.0.')
271
+ end
272
+
273
+ if !@sock_connect_timeout.nil? && @sock_connect_timeout < 0.0
274
+ invalid_properties.push('invalid value for "sock_connect_timeout", must be greater than or equal to 0.0.')
275
+ end
276
+
277
+ if !@sock_read_timeout.nil? && @sock_read_timeout < 0.0
278
+ invalid_properties.push('invalid value for "sock_read_timeout", must be greater than or equal to 0.0.')
279
+ end
280
+
281
+ invalid_properties
282
+ end
283
+
284
+ # Check to see if the all the properties in the model are valid
285
+ # @return true if the model is valid
286
+ def valid?
287
+ warn '[DEPRECATED] the `valid?` method is obsolete'
288
+ return false if !@ca_cert.nil? && @ca_cert.to_s.length < 1
289
+ return false if !@client_cert.nil? && @client_cert.to_s.length < 1
290
+ return false if !@client_key.nil? && @client_key.to_s.length < 1
291
+ return false if !@proxy_url.nil? && @proxy_url.to_s.length < 1
292
+ return false if !@proxy_username.nil? && @proxy_username.to_s.length < 1
293
+ return false if !@proxy_password.nil? && @proxy_password.to_s.length < 1
294
+ return false if !@username.nil? && @username.to_s.length < 1
295
+ return false if !@password.nil? && @password.to_s.length < 1
296
+ return false if !@total_timeout.nil? && @total_timeout < 0.0
297
+ return false if !@connect_timeout.nil? && @connect_timeout < 0.0
298
+ return false if !@sock_connect_timeout.nil? && @sock_connect_timeout < 0.0
299
+ return false if !@sock_read_timeout.nil? && @sock_read_timeout < 0.0
300
+ true
301
+ end
302
+
303
+ # Custom attribute writer method with validation
304
+ # @param [Object] ca_cert Value to be assigned
305
+ def ca_cert=(ca_cert)
306
+ if !ca_cert.nil? && ca_cert.to_s.length < 1
307
+ fail ArgumentError, 'invalid value for "ca_cert", the character length must be great than or equal to 1.'
308
+ end
309
+
310
+ @ca_cert = ca_cert
311
+ end
312
+
313
+ # Custom attribute writer method with validation
314
+ # @param [Object] client_cert Value to be assigned
315
+ def client_cert=(client_cert)
316
+ if !client_cert.nil? && client_cert.to_s.length < 1
317
+ fail ArgumentError, 'invalid value for "client_cert", the character length must be great than or equal to 1.'
318
+ end
319
+
320
+ @client_cert = client_cert
321
+ end
322
+
323
+ # Custom attribute writer method with validation
324
+ # @param [Object] client_key Value to be assigned
325
+ def client_key=(client_key)
326
+ if !client_key.nil? && client_key.to_s.length < 1
327
+ fail ArgumentError, 'invalid value for "client_key", the character length must be great than or equal to 1.'
328
+ end
329
+
330
+ @client_key = client_key
331
+ end
332
+
333
+ # Custom attribute writer method with validation
334
+ # @param [Object] proxy_url Value to be assigned
335
+ def proxy_url=(proxy_url)
336
+ if !proxy_url.nil? && proxy_url.to_s.length < 1
337
+ fail ArgumentError, 'invalid value for "proxy_url", the character length must be great than or equal to 1.'
338
+ end
339
+
340
+ @proxy_url = proxy_url
341
+ end
342
+
343
+ # Custom attribute writer method with validation
344
+ # @param [Object] proxy_username Value to be assigned
345
+ def proxy_username=(proxy_username)
346
+ if !proxy_username.nil? && proxy_username.to_s.length < 1
347
+ fail ArgumentError, 'invalid value for "proxy_username", the character length must be great than or equal to 1.'
348
+ end
349
+
350
+ @proxy_username = proxy_username
351
+ end
352
+
353
+ # Custom attribute writer method with validation
354
+ # @param [Object] proxy_password Value to be assigned
355
+ def proxy_password=(proxy_password)
356
+ if !proxy_password.nil? && proxy_password.to_s.length < 1
357
+ fail ArgumentError, 'invalid value for "proxy_password", the character length must be great than or equal to 1.'
358
+ end
359
+
360
+ @proxy_password = proxy_password
361
+ end
362
+
363
+ # Custom attribute writer method with validation
364
+ # @param [Object] username Value to be assigned
365
+ def username=(username)
366
+ if !username.nil? && username.to_s.length < 1
367
+ fail ArgumentError, 'invalid value for "username", the character length must be great than or equal to 1.'
368
+ end
369
+
370
+ @username = username
371
+ end
372
+
373
+ # Custom attribute writer method with validation
374
+ # @param [Object] password Value to be assigned
375
+ def password=(password)
376
+ if !password.nil? && password.to_s.length < 1
377
+ fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 1.'
378
+ end
379
+
380
+ @password = password
381
+ end
382
+
383
+ # Custom attribute writer method with validation
384
+ # @param [Object] total_timeout Value to be assigned
385
+ def total_timeout=(total_timeout)
386
+ if !total_timeout.nil? && total_timeout < 0.0
387
+ fail ArgumentError, 'invalid value for "total_timeout", must be greater than or equal to 0.0.'
388
+ end
389
+
390
+ @total_timeout = total_timeout
391
+ end
392
+
393
+ # Custom attribute writer method with validation
394
+ # @param [Object] connect_timeout Value to be assigned
395
+ def connect_timeout=(connect_timeout)
396
+ if !connect_timeout.nil? && connect_timeout < 0.0
397
+ fail ArgumentError, 'invalid value for "connect_timeout", must be greater than or equal to 0.0.'
398
+ end
399
+
400
+ @connect_timeout = connect_timeout
401
+ end
402
+
403
+ # Custom attribute writer method with validation
404
+ # @param [Object] sock_connect_timeout Value to be assigned
405
+ def sock_connect_timeout=(sock_connect_timeout)
406
+ if !sock_connect_timeout.nil? && sock_connect_timeout < 0.0
407
+ fail ArgumentError, 'invalid value for "sock_connect_timeout", must be greater than or equal to 0.0.'
408
+ end
409
+
410
+ @sock_connect_timeout = sock_connect_timeout
411
+ end
412
+
413
+ # Custom attribute writer method with validation
414
+ # @param [Object] sock_read_timeout Value to be assigned
415
+ def sock_read_timeout=(sock_read_timeout)
416
+ if !sock_read_timeout.nil? && sock_read_timeout < 0.0
417
+ fail ArgumentError, 'invalid value for "sock_read_timeout", must be greater than or equal to 0.0.'
418
+ end
419
+
420
+ @sock_read_timeout = sock_read_timeout
421
+ end
422
+
423
+ # Checks equality by comparing each attribute.
424
+ # @param [Object] Object to be compared
425
+ def ==(o)
426
+ return true if self.equal?(o)
427
+ self.class == o.class &&
428
+ ca_cert == o.ca_cert &&
429
+ client_cert == o.client_cert &&
430
+ client_key == o.client_key &&
431
+ tls_validation == o.tls_validation &&
432
+ proxy_url == o.proxy_url &&
433
+ proxy_username == o.proxy_username &&
434
+ proxy_password == o.proxy_password &&
435
+ username == o.username &&
436
+ password == o.password &&
437
+ max_retries == o.max_retries &&
438
+ total_timeout == o.total_timeout &&
439
+ connect_timeout == o.connect_timeout &&
440
+ sock_connect_timeout == o.sock_connect_timeout &&
441
+ sock_read_timeout == o.sock_read_timeout &&
442
+ headers == o.headers &&
443
+ download_concurrency == o.download_concurrency &&
444
+ rate_limit == o.rate_limit
445
+ end
446
+
447
+ # @see the `==` method
448
+ # @param [Object] Object to be compared
449
+ def eql?(o)
450
+ self == o
451
+ end
452
+
453
+ # Calculates hash code according to all attributes.
454
+ # @return [Integer] Hash code
455
+ def hash
456
+ [ca_cert, client_cert, client_key, tls_validation, proxy_url, proxy_username, proxy_password, username, password, max_retries, total_timeout, connect_timeout, sock_connect_timeout, sock_read_timeout, headers, download_concurrency, rate_limit].hash
457
+ end
458
+
459
+ # Builds the object from hash
460
+ # @param [Hash] attributes Model attributes in the form of hash
461
+ # @return [Object] Returns the model itself
462
+ def self.build_from_hash(attributes)
463
+ return nil unless attributes.is_a?(Hash)
464
+ attributes = attributes.transform_keys(&:to_sym)
465
+ transformed_hash = {}
466
+ openapi_types.each_pair do |key, type|
467
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
468
+ transformed_hash["#{key}"] = nil
469
+ elsif type =~ /\AArray<(.*)>/i
470
+ # check to ensure the input is an array given that the attribute
471
+ # is documented as an array but the input is not
472
+ if attributes[attribute_map[key]].is_a?(Array)
473
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
474
+ end
475
+ elsif !attributes[attribute_map[key]].nil?
476
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
477
+ end
478
+ end
479
+ new(transformed_hash)
480
+ end
481
+
482
+ # Deserializes the data based on type
483
+ # @param string type Data type
484
+ # @param string value Value to be deserialized
485
+ # @return [Object] Deserialized data
486
+ def self._deserialize(type, value)
487
+ case type.to_sym
488
+ when :Time
489
+ Time.parse(value)
490
+ when :Date
491
+ Date.parse(value)
492
+ when :String
493
+ value.to_s
494
+ when :Integer
495
+ value.to_i
496
+ when :Float
497
+ value.to_f
498
+ when :Boolean
499
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
500
+ true
501
+ else
502
+ false
503
+ end
504
+ when :Object
505
+ # generic object (usually a Hash), return directly
506
+ value
507
+ when /\AArray<(?<inner_type>.+)>\z/
508
+ inner_type = Regexp.last_match[:inner_type]
509
+ value.map { |v| _deserialize(inner_type, v) }
510
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
511
+ k_type = Regexp.last_match[:k_type]
512
+ v_type = Regexp.last_match[:v_type]
513
+ {}.tap do |hash|
514
+ value.each do |k, v|
515
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
516
+ end
517
+ end
518
+ else # model
519
+ # models (e.g. Pet) or oneOf
520
+ klass = PulpFileClient.const_get(type)
521
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
522
+ end
523
+ end
524
+
525
+ # Returns the string representation of the object
526
+ # @return [String] String presentation of the object
527
+ def to_s
528
+ to_hash.to_s
529
+ end
530
+
531
+ # to_body is an alias to to_hash (backward compatibility)
532
+ # @return [Hash] Returns the object in the form of hash
533
+ def to_body
534
+ to_hash
535
+ end
536
+
537
+ # Returns the object in the form of hash
538
+ # @return [Hash] Returns the object in the form of hash
539
+ def to_hash
540
+ hash = {}
541
+ self.class.attribute_map.each_pair do |attr, param|
542
+ value = self.send(attr)
543
+ if value.nil?
544
+ is_nullable = self.class.openapi_nullable.include?(attr)
545
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
546
+ end
547
+
548
+ hash[param] = _to_hash(value)
549
+ end
550
+ hash
551
+ end
552
+
553
+ # Outputs non-array value in the form of hash
554
+ # For object, use to_hash. Otherwise, just return the value
555
+ # @param [Object] value Any valid value
556
+ # @return [Hash] Returns the value in the form of hash
557
+ def _to_hash(value)
558
+ if value.is_a?(Array)
559
+ value.compact.map { |v| _to_hash(v) }
560
+ elsif value.is_a?(Hash)
561
+ {}.tap do |hash|
562
+ value.each { |k, v| hash[k] = _to_hash(v) }
563
+ end
564
+ elsif value.respond_to? :to_hash
565
+ value.to_hash
566
+ else
567
+ value
568
+ end
569
+ end
570
+
571
+ end
572
+
573
+ end