pnap_rancher_api 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 (48) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +154 -0
  4. data/Rakefile +10 -0
  5. data/VERSION +1 -0
  6. data/docs/Cluster.md +36 -0
  7. data/docs/ClustersApi.md +286 -0
  8. data/docs/DeleteResult.md +20 -0
  9. data/docs/Error.md +20 -0
  10. data/docs/Node.md +18 -0
  11. data/docs/NodePool.md +26 -0
  12. data/docs/RancherClusterCertificates.md +22 -0
  13. data/docs/RancherClusterConfig.md +30 -0
  14. data/docs/RancherServerMetadata.md +22 -0
  15. data/docs/SshConfig.md +22 -0
  16. data/docs/WorkloadClusterConfig.md +24 -0
  17. data/lib/pnap_rancher_api/api/clusters_api.rb +269 -0
  18. data/lib/pnap_rancher_api/api_client.rb +392 -0
  19. data/lib/pnap_rancher_api/api_error.rb +57 -0
  20. data/lib/pnap_rancher_api/configuration.rb +278 -0
  21. data/lib/pnap_rancher_api/models/cluster.rb +341 -0
  22. data/lib/pnap_rancher_api/models/delete_result.rb +235 -0
  23. data/lib/pnap_rancher_api/models/error.rb +236 -0
  24. data/lib/pnap_rancher_api/models/node.rb +220 -0
  25. data/lib/pnap_rancher_api/models/node_pool.rb +264 -0
  26. data/lib/pnap_rancher_api/models/rancher_cluster_certificates.rb +240 -0
  27. data/lib/pnap_rancher_api/models/rancher_cluster_config.rb +284 -0
  28. data/lib/pnap_rancher_api/models/rancher_server_metadata.rb +240 -0
  29. data/lib/pnap_rancher_api/models/ssh_config.rb +246 -0
  30. data/lib/pnap_rancher_api/models/workload_cluster_config.rb +264 -0
  31. data/lib/pnap_rancher_api/version.rb +19 -0
  32. data/lib/pnap_rancher_api.rb +50 -0
  33. data/pnap_rancher_api.gemspec +39 -0
  34. data/spec/api/clusters_api_spec.rb +82 -0
  35. data/spec/api_client_spec.rb +226 -0
  36. data/spec/configuration_spec.rb +42 -0
  37. data/spec/models/cluster_spec.rb +88 -0
  38. data/spec/models/delete_result_spec.rb +40 -0
  39. data/spec/models/error_spec.rb +40 -0
  40. data/spec/models/node_pool_spec.rb +58 -0
  41. data/spec/models/node_spec.rb +34 -0
  42. data/spec/models/rancher_cluster_certificates_spec.rb +46 -0
  43. data/spec/models/rancher_cluster_config_spec.rb +70 -0
  44. data/spec/models/rancher_server_metadata_spec.rb +46 -0
  45. data/spec/models/ssh_config_spec.rb +46 -0
  46. data/spec/models/workload_cluster_config_spec.rb +52 -0
  47. data/spec/spec_helper.rb +111 -0
  48. metadata +144 -0
@@ -0,0 +1,284 @@
1
+ =begin
2
+ #Rancher Solution API
3
+
4
+ #Simplify enterprise-grade Kubernetes cluster operations and management with Rancher on Bare Metal Cloud. Deploy Kubernetes clusters using a few API calls.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/rancher-bmc-integration-kubernetes' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/solutions/rancher/v1beta)</b>
5
+
6
+ The version of the OpenAPI document: 0.1
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module RancherApi
17
+ # (Write-only) Rancher configuration parameters.
18
+ class RancherClusterConfig
19
+ # Shared secret used to join a server or agent to a cluster.
20
+ attr_accessor :token
21
+
22
+ # This maps to ranchers `tls-san`. Add additional hostname or IP as a Subject Alternative Name in the TLS cert.
23
+ attr_accessor :tls_san
24
+
25
+ # This maps to ranchers `etcd-snapshot-schedule-cron`. Snapshot interval time in cron spec. eg. every 5 hours ‘0 */5 * * *’. Default: at 12 am/pm
26
+ attr_accessor :etcd_snapshot_schedule_cron
27
+
28
+ # This maps to ranchers `etcd-snapshot-retention`. Number of snapshots to retain.
29
+ attr_accessor :etcd_snapshot_retention
30
+
31
+ # This maps to ranchers `node-taint`. Registering kubelet with set of taints. By default, server nodes will be schedulable and thus your workloads can get launched on them. If you wish to have a dedicated control plane where no user workloads will run, you can use taints.
32
+ attr_accessor :node_taint
33
+
34
+ # This maps to ranchers `cluster-domain`. Cluster Domain.
35
+ attr_accessor :cluster_domain
36
+
37
+ attr_accessor :certificates
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'token' => :'token',
43
+ :'tls_san' => :'tlsSan',
44
+ :'etcd_snapshot_schedule_cron' => :'etcdSnapshotScheduleCron',
45
+ :'etcd_snapshot_retention' => :'etcdSnapshotRetention',
46
+ :'node_taint' => :'nodeTaint',
47
+ :'cluster_domain' => :'clusterDomain',
48
+ :'certificates' => :'certificates'
49
+ }
50
+ end
51
+
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ :'token' => :'String',
61
+ :'tls_san' => :'String',
62
+ :'etcd_snapshot_schedule_cron' => :'String',
63
+ :'etcd_snapshot_retention' => :'Integer',
64
+ :'node_taint' => :'String',
65
+ :'cluster_domain' => :'String',
66
+ :'certificates' => :'RancherClusterCertificates'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ :'certificates'
74
+ ])
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RancherApi::RancherClusterConfig` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!self.class.attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RancherApi::RancherClusterConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'token')
93
+ self.token = attributes[:'token']
94
+ end
95
+
96
+ if attributes.key?(:'tls_san')
97
+ self.tls_san = attributes[:'tls_san']
98
+ end
99
+
100
+ if attributes.key?(:'etcd_snapshot_schedule_cron')
101
+ self.etcd_snapshot_schedule_cron = attributes[:'etcd_snapshot_schedule_cron']
102
+ else
103
+ self.etcd_snapshot_schedule_cron = '0 0,12 * * *'
104
+ end
105
+
106
+ if attributes.key?(:'etcd_snapshot_retention')
107
+ self.etcd_snapshot_retention = attributes[:'etcd_snapshot_retention']
108
+ else
109
+ self.etcd_snapshot_retention = 5
110
+ end
111
+
112
+ if attributes.key?(:'node_taint')
113
+ self.node_taint = attributes[:'node_taint']
114
+ end
115
+
116
+ if attributes.key?(:'cluster_domain')
117
+ self.cluster_domain = attributes[:'cluster_domain']
118
+ end
119
+
120
+ if attributes.key?(:'certificates')
121
+ self.certificates = attributes[:'certificates']
122
+ end
123
+ end
124
+
125
+ # Show invalid properties with the reasons. Usually used together with valid?
126
+ # @return Array for valid properties with the reasons
127
+ def list_invalid_properties
128
+ invalid_properties = Array.new
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ true
136
+ end
137
+
138
+ # Checks equality by comparing each attribute.
139
+ # @param [Object] Object to be compared
140
+ def ==(o)
141
+ return true if self.equal?(o)
142
+ self.class == o.class &&
143
+ token == o.token &&
144
+ tls_san == o.tls_san &&
145
+ etcd_snapshot_schedule_cron == o.etcd_snapshot_schedule_cron &&
146
+ etcd_snapshot_retention == o.etcd_snapshot_retention &&
147
+ node_taint == o.node_taint &&
148
+ cluster_domain == o.cluster_domain &&
149
+ certificates == o.certificates
150
+ end
151
+
152
+ # @see the `==` method
153
+ # @param [Object] Object to be compared
154
+ def eql?(o)
155
+ self == o
156
+ end
157
+
158
+ # Calculates hash code according to all attributes.
159
+ # @return [Integer] Hash code
160
+ def hash
161
+ [token, tls_san, etcd_snapshot_schedule_cron, etcd_snapshot_retention, node_taint, cluster_domain, certificates].hash
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def self.build_from_hash(attributes)
168
+ new.build_from_hash(attributes)
169
+ end
170
+
171
+ # Builds the object from hash
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ # @return [Object] Returns the model itself
174
+ def build_from_hash(attributes)
175
+ return nil unless attributes.is_a?(Hash)
176
+ self.class.openapi_types.each_pair do |key, type|
177
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
178
+ self.send("#{key}=", nil)
179
+ elsif type =~ /\AArray<(.*)>/i
180
+ # check to ensure the input is an array given that the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
183
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
184
+ end
185
+ elsif !attributes[self.class.attribute_map[key]].nil?
186
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
187
+ end
188
+ end
189
+
190
+ self
191
+ end
192
+
193
+ # Deserializes the data based on type
194
+ # @param string type Data type
195
+ # @param string value Value to be deserialized
196
+ # @return [Object] Deserialized data
197
+ def _deserialize(type, value)
198
+ case type.to_sym
199
+ when :Time
200
+ Time.parse(value)
201
+ when :Date
202
+ Date.parse(value)
203
+ when :String
204
+ value.to_s
205
+ when :Integer
206
+ value.to_i
207
+ when :Float
208
+ value.to_f
209
+ when :Boolean
210
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
211
+ true
212
+ else
213
+ false
214
+ end
215
+ when :Object
216
+ # generic object (usually a Hash), return directly
217
+ value
218
+ when /\AArray<(?<inner_type>.+)>\z/
219
+ inner_type = Regexp.last_match[:inner_type]
220
+ value.map { |v| _deserialize(inner_type, v) }
221
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
222
+ k_type = Regexp.last_match[:k_type]
223
+ v_type = Regexp.last_match[:v_type]
224
+ {}.tap do |hash|
225
+ value.each do |k, v|
226
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
227
+ end
228
+ end
229
+ else # model
230
+ # models (e.g. Pet) or oneOf
231
+ klass = RancherApi.const_get(type)
232
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
233
+ end
234
+ end
235
+
236
+ # Returns the string representation of the object
237
+ # @return [String] String presentation of the object
238
+ def to_s
239
+ to_hash.to_s
240
+ end
241
+
242
+ # to_body is an alias to to_hash (backward compatibility)
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_body
245
+ to_hash
246
+ end
247
+
248
+ # Returns the object in the form of hash
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_hash
251
+ hash = {}
252
+ self.class.attribute_map.each_pair do |attr, param|
253
+ value = self.send(attr)
254
+ if value.nil?
255
+ is_nullable = self.class.openapi_nullable.include?(attr)
256
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
257
+ end
258
+
259
+ hash[param] = _to_hash(value)
260
+ end
261
+ hash
262
+ end
263
+
264
+ # Outputs non-array value in the form of hash
265
+ # For object, use to_hash. Otherwise, just return the value
266
+ # @param [Object] value Any valid value
267
+ # @return [Hash] Returns the value in the form of hash
268
+ def _to_hash(value)
269
+ if value.is_a?(Array)
270
+ value.compact.map { |v| _to_hash(v) }
271
+ elsif value.is_a?(Hash)
272
+ {}.tap do |hash|
273
+ value.each { |k, v| hash[k] = _to_hash(v) }
274
+ end
275
+ elsif value.respond_to? :to_hash
276
+ value.to_hash
277
+ else
278
+ value
279
+ end
280
+ end
281
+
282
+ end
283
+
284
+ end
@@ -0,0 +1,240 @@
1
+ =begin
2
+ #Rancher Solution API
3
+
4
+ #Simplify enterprise-grade Kubernetes cluster operations and management with Rancher on Bare Metal Cloud. Deploy Kubernetes clusters using a few API calls.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/rancher-bmc-integration-kubernetes' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/solutions/rancher/v1beta)</b>
5
+
6
+ The version of the OpenAPI document: 0.1
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module RancherApi
17
+ # (Read Only) Connection parameters to use to connect to the Rancher Server Administrative GUI.
18
+ class RancherServerMetadata
19
+ # The Rancher Server URL.
20
+ attr_accessor :url
21
+
22
+ # The username to use to login to the Rancher Server. This field is returned only as a response to the create cluster request. Make sure to take note or you will not be able to access the server.
23
+ attr_accessor :username
24
+
25
+ # This is the password to be used to login to the Rancher Server. This field is returned only as a response to the create cluster request. Make sure to take note or you will not be able to access the server.
26
+ attr_accessor :password
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'url' => :'url',
32
+ :'username' => :'username',
33
+ :'password' => :'password'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'url' => :'String',
46
+ :'username' => :'String',
47
+ :'password' => :'String'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RancherApi::RancherServerMetadata` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RancherApi::RancherServerMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'url')
73
+ self.url = attributes[:'url']
74
+ end
75
+
76
+ if attributes.key?(:'username')
77
+ self.username = attributes[:'username']
78
+ end
79
+
80
+ if attributes.key?(:'password')
81
+ self.password = attributes[:'password']
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = Array.new
89
+ invalid_properties
90
+ end
91
+
92
+ # Check to see if the all the properties in the model are valid
93
+ # @return true if the model is valid
94
+ def valid?
95
+ true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ url == o.url &&
104
+ username == o.username &&
105
+ password == o.password
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Integer] Hash code
116
+ def hash
117
+ [url, username, password].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def self.build_from_hash(attributes)
124
+ new.build_from_hash(attributes)
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ self.class.openapi_types.each_pair do |key, type|
133
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
134
+ self.send("#{key}=", nil)
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :Time
156
+ Time.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :Boolean
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ # models (e.g. Pet) or oneOf
187
+ klass = RancherApi.const_get(type)
188
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ if value.nil?
211
+ is_nullable = self.class.openapi_nullable.include?(attr)
212
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
213
+ end
214
+
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value)
225
+ if value.is_a?(Array)
226
+ value.compact.map { |v| _to_hash(v) }
227
+ elsif value.is_a?(Hash)
228
+ {}.tap do |hash|
229
+ value.each { |k, v| hash[k] = _to_hash(v) }
230
+ end
231
+ elsif value.respond_to? :to_hash
232
+ value.to_hash
233
+ else
234
+ value
235
+ end
236
+ end
237
+
238
+ end
239
+
240
+ end