ionoscloud-cert-manager 1.0.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.
Files changed (44) 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 +2 -0
  6. data/Rakefile +10 -0
  7. data/docs/api/CertificatesApi.md +392 -0
  8. data/docs/api/InformationApi.md +226 -0
  9. data/docs/models/ApiInfoDto.md +21 -0
  10. data/docs/models/CertificateCollectionDto.md +29 -0
  11. data/docs/models/CertificateCollectionDtoLinks.md +21 -0
  12. data/docs/models/CertificateDto.md +25 -0
  13. data/docs/models/CertificatePatchDto.md +17 -0
  14. data/docs/models/CertificatePatchPropertiesDto.md +17 -0
  15. data/docs/models/CertificatePostDto.md +17 -0
  16. data/docs/models/CertificatePostPropertiesDto.md +23 -0
  17. data/docs/models/CertificatePropertiesDto.md +21 -0
  18. data/docs/models/ConfigPropertyDto.md +23 -0
  19. data/docs/models/ResourceMetadataDto.md +31 -0
  20. data/docs/summary.md +23 -0
  21. data/git_push.sh +56 -0
  22. data/ionoscloud-cert-manager.gemspec +38 -0
  23. data/lib/ionoscloud-cert-manager/api/certificates_api.rb +345 -0
  24. data/lib/ionoscloud-cert-manager/api/information_api.rb +193 -0
  25. data/lib/ionoscloud-cert-manager/api_client.rb +471 -0
  26. data/lib/ionoscloud-cert-manager/api_error.rb +57 -0
  27. data/lib/ionoscloud-cert-manager/configuration.rb +276 -0
  28. data/lib/ionoscloud-cert-manager/models/api_info_dto.rb +263 -0
  29. data/lib/ionoscloud-cert-manager/models/certificate_collection_dto.rb +334 -0
  30. data/lib/ionoscloud-cert-manager/models/certificate_collection_dto_links.rb +262 -0
  31. data/lib/ionoscloud-cert-manager/models/certificate_dto.rb +297 -0
  32. data/lib/ionoscloud-cert-manager/models/certificate_patch_dto.rb +231 -0
  33. data/lib/ionoscloud-cert-manager/models/certificate_patch_properties_dto.rb +231 -0
  34. data/lib/ionoscloud-cert-manager/models/certificate_post_dto.rb +231 -0
  35. data/lib/ionoscloud-cert-manager/models/certificate_post_properties_dto.rb +300 -0
  36. data/lib/ionoscloud-cert-manager/models/certificate_properties_dto.rb +262 -0
  37. data/lib/ionoscloud-cert-manager/models/config_property_dto.rb +295 -0
  38. data/lib/ionoscloud-cert-manager/models/resource_metadata_dto.rb +353 -0
  39. data/lib/ionoscloud-cert-manager/version.rb +15 -0
  40. data/lib/ionoscloud-cert-manager.rb +52 -0
  41. data/spec/api_client_spec.rb +226 -0
  42. data/spec/configuration_spec.rb +42 -0
  43. data/spec/spec_helper.rb +111 -0
  44. metadata +132 -0
@@ -0,0 +1,57 @@
1
+ =begin
2
+ #Certificate Manager Service API
3
+
4
+ #Using the Certificate Manager Service, you can conveniently provision and manage SSL certificates with IONOS services and your internal connected resources. For the [Application Load Balancer](https://api.ionos.com/docs/cloud/v6/#Application-Load-Balancers-get-datacenters-datacenterId-applicationloadbalancers), you usually need a certificate to encrypt your HTTPS traffic. The service provides the basic functions of uploading and deleting your certificates for this purpose.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ module IonoscloudCertManager
14
+ class ApiError < StandardError
15
+ attr_reader :code, :response_headers, :response_body
16
+
17
+ # Usage examples:
18
+ # ApiError.new
19
+ # ApiError.new("message")
20
+ # ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
21
+ # ApiError.new(:code => 404, :message => "Not Found")
22
+ def initialize(arg = nil)
23
+ if arg.is_a? Hash
24
+ if arg.key?(:message) || arg.key?('message')
25
+ super(arg[:message] || arg['message'])
26
+ else
27
+ super arg
28
+ end
29
+
30
+ arg.each do |k, v|
31
+ instance_variable_set "@#{k}", v
32
+ end
33
+ else
34
+ super arg
35
+ end
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
56
+ end
57
+ end
@@ -0,0 +1,276 @@
1
+ =begin
2
+ #Certificate Manager Service API
3
+
4
+ #Using the Certificate Manager Service, you can conveniently provision and manage SSL certificates with IONOS services and your internal connected resources. For the [Application Load Balancer](https://api.ionos.com/docs/cloud/v6/#Application-Load-Balancers-get-datacenters-datacenterId-applicationloadbalancers), you usually need a certificate to encrypt your HTTPS traffic. The service provides the basic functions of uploading and deleting your certificates for this purpose.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ module IonoscloudCertManager
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 = ''
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",
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,263 @@
1
+ =begin
2
+ #Certificate Manager Service API
3
+
4
+ #Using the Certificate Manager Service, you can conveniently provision and manage SSL certificates with IONOS services and your internal connected resources. For the [Application Load Balancer](https://api.ionos.com/docs/cloud/v6/#Application-Load-Balancers-get-datacenters-datacenterId-applicationloadbalancers), you usually need a certificate to encrypt your HTTPS traffic. The service provides the basic functions of uploading and deleting your certificates for this purpose.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
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 IonoscloudCertManager
17
+ # The information about the API.
18
+ class ApiInfoDto
19
+
20
+ # The API entry point.
21
+ attr_accessor :href
22
+
23
+
24
+ # The API name.
25
+ attr_accessor :name
26
+
27
+
28
+ # The API version.
29
+ attr_accessor :version
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+
35
+ :'href' => :'href',
36
+
37
+ :'name' => :'name',
38
+
39
+ :'version' => :'version'
40
+ }
41
+ end
42
+
43
+ # Returns all the JSON keys this model knows about
44
+ def self.acceptable_attributes
45
+ attribute_map.values
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+
52
+ :'href' => :'String',
53
+
54
+ :'name' => :'String',
55
+
56
+ :'version' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+
64
+
65
+
66
+ ])
67
+ end
68
+
69
+ # Initializes the object
70
+ # @param [Hash] attributes Model attributes in the form of hash
71
+ def initialize(attributes = {})
72
+ if (!attributes.is_a?(Hash))
73
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IonoscloudCertManager::ApiInfoDto` initialize method"
74
+ end
75
+
76
+ # check to see if the attribute exists and convert string to symbol for hash key
77
+ attributes = attributes.each_with_object({}) { |(k, v), h|
78
+ if (!self.class.attribute_map.key?(k.to_sym))
79
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IonoscloudCertManager::ApiInfoDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
80
+ end
81
+ h[k.to_sym] = v
82
+ }
83
+
84
+
85
+ if attributes.key?(:'href')
86
+ self.href = attributes[:'href']
87
+ end
88
+
89
+
90
+ if attributes.key?(:'name')
91
+ self.name = attributes[:'name']
92
+ end
93
+
94
+
95
+ if attributes.key?(:'version')
96
+ self.version = attributes[:'version']
97
+ end
98
+ end
99
+
100
+ # Show invalid properties with the reasons. Usually used together with valid?
101
+ # @return Array for valid properties with the reasons
102
+ def list_invalid_properties
103
+ invalid_properties = Array.new
104
+
105
+
106
+
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+
114
+
115
+
116
+ true
117
+ end
118
+
119
+
120
+
121
+
122
+ # Checks equality by comparing each attribute.
123
+ # @param [Object] Object to be compared
124
+ def ==(o)
125
+ return true if self.equal?(o)
126
+ self.class == o.class &&
127
+ href == o.href &&
128
+ name == o.name &&
129
+ version == o.version
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Integer] Hash code
140
+ def hash
141
+ [href, name, version].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def self.build_from_hash(attributes)
148
+ new.build_from_hash(attributes)
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ self.class.openapi_types.each_pair do |key, type|
157
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
158
+ self.send("#{key}=", nil)
159
+ elsif type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
163
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
164
+ end
165
+ elsif !attributes[self.class.attribute_map[key]].nil?
166
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
167
+ end
168
+ end
169
+
170
+ self
171
+ end
172
+
173
+ # Deserializes the data based on type
174
+ # @param string type Data type
175
+ # @param string value Value to be deserialized
176
+ # @return [Object] Deserialized data
177
+ def _deserialize(type, value)
178
+ case type.to_sym
179
+ when :Time
180
+ Time.parse(value)
181
+ when :Date
182
+ Date.parse(value)
183
+ when :String
184
+ value.to_s
185
+ when :Integer
186
+ value.to_i
187
+ when :Float
188
+ value.to_f
189
+ when :Boolean
190
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
191
+ true
192
+ else
193
+ false
194
+ end
195
+ when :Object
196
+ # generic object (usually a Hash), return directly
197
+ value
198
+ when /\AArray<(?<inner_type>.+)>\z/
199
+ inner_type = Regexp.last_match[:inner_type]
200
+ value.map { |v| _deserialize(inner_type, v) }
201
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
202
+ k_type = Regexp.last_match[:k_type]
203
+ v_type = Regexp.last_match[:v_type]
204
+ {}.tap do |hash|
205
+ value.each do |k, v|
206
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
207
+ end
208
+ end
209
+ else # model
210
+ # models (e.g. Pet) or oneOf
211
+ klass = IonoscloudCertManager.const_get(type)
212
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
213
+ end
214
+ end
215
+
216
+ # Returns the string representation of the object
217
+ # @return [String] String presentation of the object
218
+ def to_s
219
+ to_hash.to_s
220
+ end
221
+
222
+ # to_body is an alias to to_hash (backward compatibility)
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_body
225
+ to_hash
226
+ end
227
+
228
+ # Returns the object in the form of hash
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_hash
231
+ hash = {}
232
+ self.class.attribute_map.each_pair do |attr, param|
233
+ value = self.send(attr)
234
+ if value.nil?
235
+ is_nullable = self.class.openapi_nullable.include?(attr)
236
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
237
+ end
238
+
239
+ hash[param] = _to_hash(value)
240
+ end
241
+ hash
242
+ end
243
+
244
+ # Outputs non-array value in the form of hash
245
+ # For object, use to_hash. Otherwise, just return the value
246
+ # @param [Object] value Any valid value
247
+ # @return [Hash] Returns the value in the form of hash
248
+ def _to_hash(value)
249
+ if value.is_a?(Array)
250
+ value.compact.map { |v| _to_hash(v) }
251
+ elsif value.is_a?(Hash)
252
+ {}.tap do |hash|
253
+ value.each { |k, v| hash[k] = _to_hash(v) }
254
+ end
255
+ elsif value.respond_to? :to_hash
256
+ value.to_hash
257
+ else
258
+ value
259
+ end
260
+ end
261
+
262
+ end
263
+ end