ionoscloud-container-registry 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +70 -0
  4. data/LICENSE +201 -0
  5. data/README.md +54 -0
  6. data/Rakefile +10 -0
  7. data/docs/api/LocationsApi.md +78 -0
  8. data/docs/api/NamesApi.md +82 -0
  9. data/docs/api/RegistriesApi.md +470 -0
  10. data/docs/api/RepositoriesApi.md +84 -0
  11. data/docs/api/TokensApi.md +478 -0
  12. data/docs/models/ApiErrorMessage.md +20 -0
  13. data/docs/models/ApiErrorResponse.md +20 -0
  14. data/docs/models/ApiResourceMetadata.md +30 -0
  15. data/docs/models/Credentials.md +20 -0
  16. data/docs/models/Day.md +15 -0
  17. data/docs/models/Location.md +18 -0
  18. data/docs/models/LocationsResponse.md +24 -0
  19. data/docs/models/PaginationLinks.md +22 -0
  20. data/docs/models/PatchRegistryInput.md +18 -0
  21. data/docs/models/PatchTokenInput.md +22 -0
  22. data/docs/models/PostRegistryInput.md +18 -0
  23. data/docs/models/PostRegistryOutput.md +26 -0
  24. data/docs/models/PostRegistryProperties.md +22 -0
  25. data/docs/models/PostTokenInput.md +18 -0
  26. data/docs/models/PostTokenOutput.md +26 -0
  27. data/docs/models/PostTokenProperties.md +24 -0
  28. data/docs/models/PutRegistryInput.md +18 -0
  29. data/docs/models/PutRegistryOutput.md +26 -0
  30. data/docs/models/PutTokenInput.md +18 -0
  31. data/docs/models/PutTokenOutput.md +26 -0
  32. data/docs/models/RegistriesResponse.md +30 -0
  33. data/docs/models/RegistryProperties.md +26 -0
  34. data/docs/models/RegistryResponse.md +26 -0
  35. data/docs/models/Scope.md +22 -0
  36. data/docs/models/StorageUsage.md +20 -0
  37. data/docs/models/TokenProperties.md +26 -0
  38. data/docs/models/TokenResponse.md +26 -0
  39. data/docs/models/TokensResponse.md +34 -0
  40. data/docs/models/WeeklySchedule.md +20 -0
  41. data/docs/summary.md +44 -0
  42. data/git_push.sh +56 -0
  43. data/ionoscloud-container-registry.gemspec +38 -0
  44. data/lib/ionoscloud-container-registry/api/locations_api.rb +77 -0
  45. data/lib/ionoscloud-container-registry/api/names_api.rb +90 -0
  46. data/lib/ionoscloud-container-registry/api/registries_api.rb +439 -0
  47. data/lib/ionoscloud-container-registry/api/repositories_api.rb +99 -0
  48. data/lib/ionoscloud-container-registry/api/tokens_api.rb +500 -0
  49. data/lib/ionoscloud-container-registry/api_client.rb +471 -0
  50. data/lib/ionoscloud-container-registry/api_error.rb +57 -0
  51. data/lib/ionoscloud-container-registry/configuration.rb +276 -0
  52. data/lib/ionoscloud-container-registry/models/api_error_message.rb +237 -0
  53. data/lib/ionoscloud-container-registry/models/api_error_response.rb +233 -0
  54. data/lib/ionoscloud-container-registry/models/api_resource_metadata.rb +293 -0
  55. data/lib/ionoscloud-container-registry/models/credentials.rb +237 -0
  56. data/lib/ionoscloud-container-registry/models/day.rb +42 -0
  57. data/lib/ionoscloud-container-registry/models/location.rb +218 -0
  58. data/lib/ionoscloud-container-registry/models/locations_response.rb +246 -0
  59. data/lib/ionoscloud-container-registry/models/pagination_links.rb +251 -0
  60. data/lib/ionoscloud-container-registry/models/patch_registry_input.rb +219 -0
  61. data/lib/ionoscloud-container-registry/models/patch_token_input.rb +272 -0
  62. data/lib/ionoscloud-container-registry/models/post_registry_input.rb +223 -0
  63. data/lib/ionoscloud-container-registry/models/post_registry_output.rb +256 -0
  64. data/lib/ionoscloud-container-registry/models/post_registry_properties.rb +268 -0
  65. data/lib/ionoscloud-container-registry/models/post_token_input.rb +223 -0
  66. data/lib/ionoscloud-container-registry/models/post_token_output.rb +256 -0
  67. data/lib/ionoscloud-container-registry/models/post_token_properties.rb +316 -0
  68. data/lib/ionoscloud-container-registry/models/put_registry_input.rb +223 -0
  69. data/lib/ionoscloud-container-registry/models/put_registry_output.rb +256 -0
  70. data/lib/ionoscloud-container-registry/models/put_token_input.rb +223 -0
  71. data/lib/ionoscloud-container-registry/models/put_token_output.rb +256 -0
  72. data/lib/ionoscloud-container-registry/models/registries_response.rb +288 -0
  73. data/lib/ionoscloud-container-registry/models/registry_properties.rb +287 -0
  74. data/lib/ionoscloud-container-registry/models/registry_response.rb +256 -0
  75. data/lib/ionoscloud-container-registry/models/scope.rb +247 -0
  76. data/lib/ionoscloud-container-registry/models/storage_usage.rb +229 -0
  77. data/lib/ionoscloud-container-registry/models/token_properties.rb +326 -0
  78. data/lib/ionoscloud-container-registry/models/token_response.rb +256 -0
  79. data/lib/ionoscloud-container-registry/models/tokens_response.rb +316 -0
  80. data/lib/ionoscloud-container-registry/models/weekly_schedule.rb +234 -0
  81. data/lib/ionoscloud-container-registry/version.rb +15 -0
  82. data/lib/ionoscloud-container-registry.rb +73 -0
  83. data/spec/api_client_spec.rb +226 -0
  84. data/spec/configuration_spec.rb +42 -0
  85. data/spec/spec_helper.rb +111 -0
  86. metadata +173 -0
@@ -0,0 +1,276 @@
1
+ =begin
2
+ #Container Registry service
3
+
4
+ #Container Registry service enables IONOS clients to manage docker and OCI compliant registries for use by their managed Kubernetes clusters. Use a Container Registry to ensure you have a privately accessed registry to efficiently support image pulls.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@cloud.ionos.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ module IonoscloudContainerRegistry
14
+ class Configuration
15
+ # Defines url scheme
16
+ attr_accessor :scheme
17
+
18
+ # Defines url host
19
+ attr_accessor :host
20
+
21
+ # Defines url base path
22
+ attr_accessor :base_path
23
+
24
+ # Define server configuration index
25
+ attr_accessor :server_index
26
+
27
+ # Define server operation configuration index
28
+ attr_accessor :server_operation_index
29
+
30
+ # Default server variables
31
+ attr_accessor :server_variables
32
+
33
+ # Default server operation variables
34
+ attr_accessor :server_operation_variables
35
+
36
+ # Defines Tokens used with Token authentications.
37
+ #
38
+ # @return [String]
39
+ attr_accessor :token
40
+
41
+ # Defines Token prefixes used with Token authentications.
42
+ # Default to 'Bearer'.
43
+ #
44
+ # @return [String]
45
+ attr_accessor :token_prefix
46
+
47
+ # Defines the username used with HTTP basic authentication.
48
+ #
49
+ # @return [String]
50
+ attr_accessor :username
51
+
52
+ # Defines the password used with HTTP basic authentication.
53
+ #
54
+ # @return [String]
55
+ attr_accessor :password
56
+
57
+ # Defines the access token (Bearer) used with OAuth2.
58
+ attr_accessor :access_token
59
+
60
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
61
+ # details will be logged with `logger.debug` (see the `logger` attribute).
62
+ # Default to false.
63
+ #
64
+ # @return [true, false]
65
+ attr_accessor :debugging
66
+
67
+ # Defines the logger used for debugging.
68
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
69
+ #
70
+ # @return [#debug]
71
+ attr_accessor :logger
72
+
73
+ # Defines the temporary folder to store downloaded files
74
+ # (for API endpoints that have file response).
75
+ # Default to use `Tempfile`.
76
+ #
77
+ # @return [String]
78
+ attr_accessor :temp_folder_path
79
+
80
+ # The time limit for HTTP request in seconds.
81
+ # Default to 0 (never times out).
82
+ attr_accessor :timeout
83
+
84
+ # Set this to false to skip client side validation in the operation.
85
+ # Default to true.
86
+ # @return [true, false]
87
+ attr_accessor :client_side_validation
88
+
89
+ ### TLS/SSL setting
90
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
91
+ # Default to true.
92
+ #
93
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
94
+ #
95
+ # @return [true, false]
96
+ attr_accessor :verify_ssl
97
+
98
+ ### TLS/SSL setting
99
+ # Set this to false to skip verifying SSL host name
100
+ # Default to true.
101
+ #
102
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
103
+ #
104
+ # @return [true, false]
105
+ attr_accessor :verify_ssl_host
106
+
107
+ ### TLS/SSL setting
108
+ # Set this to customize the certificate file to verify the peer.
109
+ #
110
+ # @return [String] the path to the certificate file
111
+ #
112
+ # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
113
+ # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
114
+ attr_accessor :ssl_ca_cert
115
+
116
+ ### TLS/SSL setting
117
+ # Client certificate file (for client certificate)
118
+ attr_accessor :cert_file
119
+
120
+ ### TLS/SSL setting
121
+ # Client private key file (for client certificate)
122
+ attr_accessor :key_file
123
+
124
+ # Set this to customize parameters encoding of array parameter with multi collectionFormat.
125
+ # Default to nil.
126
+ #
127
+ # @see The params_encoding option of Ethon. Related source code:
128
+ # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
129
+ attr_accessor :params_encoding
130
+
131
+ attr_accessor :inject_format
132
+
133
+ attr_accessor :force_ending_format
134
+
135
+ attr_accessor :max_retries
136
+
137
+ attr_accessor :wait_time
138
+
139
+ attr_accessor :max_wait_time
140
+
141
+ def initialize
142
+ @scheme = 'https'
143
+ @host = 'api.ionos.com'
144
+ @base_path = '/containerregistries'
145
+ @server_index = 0
146
+ @server_operation_index = {}
147
+ @server_variables = {}
148
+ @server_operation_variables = {}
149
+ @token = nil
150
+ @token_prefix = 'Bearer'
151
+ @timeout = 0
152
+ @client_side_validation = true
153
+ @verify_ssl = true
154
+ @verify_ssl_host = true
155
+ @params_encoding = nil
156
+ @cert_file = nil
157
+ @key_file = nil
158
+ @debugging = false
159
+ @inject_format = false
160
+ @force_ending_format = false
161
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
162
+ @max_retries = 3
163
+ @wait_time = 0.1
164
+ @max_wait_time = 2
165
+
166
+ yield(self) if block_given?
167
+ end
168
+
169
+ # The default Configuration object.
170
+ def self.default
171
+ @@default ||= Configuration.new
172
+ end
173
+
174
+ def configure
175
+ yield(self) if block_given?
176
+ end
177
+
178
+ def scheme=(scheme)
179
+ # remove :// from scheme
180
+ @scheme = scheme.sub(/:\/\//, '')
181
+ end
182
+
183
+ def host=(host)
184
+ # remove http(s):// and anything after a slash
185
+ @host = host.sub(/https?:\/\//, '').split('/').first
186
+ end
187
+
188
+ def base_path=(base_path)
189
+ # Add leading and trailing slashes to base_path
190
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
191
+ @base_path = '' if @base_path == '/'
192
+ end
193
+
194
+ # Returns base URL for specified operation based on server settings
195
+ def base_url(operation = nil)
196
+ index = server_operation_index.fetch(operation, server_index)
197
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
198
+
199
+ server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
200
+ end
201
+
202
+ # Gets Basic Auth token string
203
+ def basic_auth_token
204
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
205
+ end
206
+
207
+ # Returns Auth Settings hash for api client.
208
+ def auth_settings
209
+ {
210
+ 'basicAuth' =>
211
+ {
212
+ type: 'basic',
213
+ in: 'header',
214
+ key: 'Authorization',
215
+ value: basic_auth_token
216
+ },
217
+ 'tokenAuth' =>
218
+ {
219
+ type: 'token',
220
+ in: 'header',
221
+ key: 'Authorization',
222
+ value: token.nil? ? nil : "#{token_prefix} #{token}"
223
+ },
224
+ }
225
+ end
226
+
227
+ # Returns an array of Server setting
228
+ def server_settings
229
+ [
230
+ {
231
+ url: "https://api.ionos.com/containerregistries",
232
+ description: "Production",
233
+ }
234
+ ]
235
+ end
236
+
237
+ def operation_server_settings
238
+ {
239
+ }
240
+ end
241
+
242
+ # Returns URL based on server settings
243
+ #
244
+ # @param index array index of the server settings
245
+ # @param variables hash of variable and the corresponding value
246
+ def server_url(index, variables = {}, servers = nil)
247
+ servers = server_settings if servers == nil
248
+
249
+ # check array index out of bound
250
+ if (index < 0 || index >= servers.size)
251
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
252
+ end
253
+
254
+ server = servers[index]
255
+ url = server[:url]
256
+
257
+ return url unless server.key? :variables
258
+
259
+ # go through variable and assign a value
260
+ server[:variables].each do |name, variable|
261
+ if variables.key?(name)
262
+ if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
263
+ url.gsub! "{" + name.to_s + "}", variables[name]
264
+ else
265
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
266
+ end
267
+ else
268
+ # use default value
269
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
270
+ end
271
+ end
272
+
273
+ url
274
+ end
275
+ end
276
+ end
@@ -0,0 +1,237 @@
1
+ =begin
2
+ #Container Registry service
3
+
4
+ #Container Registry service enables IONOS clients to manage docker and OCI compliant registries for use by their managed Kubernetes clusters. Use a Container Registry to ensure you have a privately accessed registry to efficiently support image pulls.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@cloud.ionos.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module IonoscloudContainerRegistry
17
+ class ApiErrorMessage
18
+ attr_accessor :error_code
19
+
20
+ attr_accessor :message
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'error_code' => :'errorCode',
26
+ :'message' => :'message'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'error_code' => :'String',
39
+ :'message' => :'String'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
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 `IonoscloudContainerRegistry::ApiErrorMessage` 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 `IonoscloudContainerRegistry::ApiErrorMessage`. 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?(:'error_code')
65
+ self.error_code = attributes[:'error_code']
66
+ end
67
+
68
+ if attributes.key?(:'message')
69
+ self.message = attributes[:'message']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ if @error_code.nil?
78
+ invalid_properties.push('invalid value for "error_code", error_code cannot be nil.')
79
+ end
80
+
81
+ if @message.nil?
82
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
83
+ end
84
+
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ return false if @error_code.nil?
92
+ return false if @message.nil?
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ error_code == o.error_code &&
102
+ message == o.message
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [error_code, message].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ self.class.openapi_types.each_pair do |key, type|
130
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
131
+ self.send("#{key}=", nil)
132
+ elsif type =~ /\AArray<(.*)>/i
133
+ # check to ensure the input is an array given that the attribute
134
+ # is documented as an array but the input is not
135
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
136
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
137
+ end
138
+ elsif !attributes[self.class.attribute_map[key]].nil?
139
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
140
+ end
141
+ end
142
+
143
+ self
144
+ end
145
+
146
+ # Deserializes the data based on type
147
+ # @param string type Data type
148
+ # @param string value Value to be deserialized
149
+ # @return [Object] Deserialized data
150
+ def _deserialize(type, value)
151
+ case type.to_sym
152
+ when :Time
153
+ Time.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ # models (e.g. Pet) or oneOf
184
+ klass = IonoscloudContainerRegistry.const_get(type)
185
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
186
+ end
187
+ end
188
+
189
+ # Returns the string representation of the object
190
+ # @return [String] String presentation of the object
191
+ def to_s
192
+ to_hash.to_s
193
+ end
194
+
195
+ # to_body is an alias to to_hash (backward compatibility)
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_body
198
+ to_hash
199
+ end
200
+
201
+ # Returns the object in the form of hash
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_hash
204
+ hash = {}
205
+ self.class.attribute_map.each_pair do |attr, param|
206
+ value = self.send(attr)
207
+ if value.nil?
208
+ is_nullable = self.class.openapi_nullable.include?(attr)
209
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
210
+ end
211
+
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+
237
+ end