pnap_rancher_api 1.0.5 → 2.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.
- checksums.yaml +4 -4
- data/README.md +3 -4
- data/VERSION +1 -1
- data/docs/Cluster.md +3 -3
- data/docs/ClustersApi.md +6 -8
- data/docs/NodePool.md +2 -2
- data/docs/RancherClusterConfig.md +1 -1
- data/lib/pnap_rancher_api/api/clusters_api.rb +11 -7
- data/lib/pnap_rancher_api/api_client.rb +24 -21
- data/lib/pnap_rancher_api/api_error.rb +2 -1
- data/lib/pnap_rancher_api/configuration.rb +28 -9
- data/lib/pnap_rancher_api/models/cluster.rb +25 -24
- data/lib/pnap_rancher_api/models/delete_result.rb +18 -19
- data/lib/pnap_rancher_api/models/error.rb +16 -19
- data/lib/pnap_rancher_api/models/node.rb +14 -19
- data/lib/pnap_rancher_api/models/node_pool.rb +54 -20
- data/lib/pnap_rancher_api/models/rancher_cluster_certificates.rb +14 -19
- data/lib/pnap_rancher_api/models/rancher_cluster_config.rb +15 -20
- data/lib/pnap_rancher_api/models/rancher_server_metadata.rb +14 -19
- data/lib/pnap_rancher_api/models/ssh_config.rb +14 -19
- data/lib/pnap_rancher_api/models/workload_cluster_config.rb +16 -19
- data/lib/pnap_rancher_api/version.rb +1 -1
- data/lib/pnap_rancher_api.rb +1 -5
- data/pnap_rancher_api.gemspec +2 -2
- data/spec/api/clusters_api_spec.rb +7 -7
- data/spec/models/cluster_spec.rb +14 -12
- data/spec/models/delete_result_spec.rb +6 -4
- data/spec/models/error_spec.rb +6 -4
- data/spec/models/node_pool_spec.rb +9 -7
- data/spec/models/node_spec.rb +5 -3
- data/spec/models/rancher_cluster_certificates_spec.rb +7 -5
- data/spec/models/rancher_cluster_config_spec.rb +11 -9
- data/spec/models/rancher_server_metadata_spec.rb +7 -5
- data/spec/models/ssh_config_spec.rb +7 -5
- data/spec/models/workload_cluster_config_spec.rb +8 -6
- data/spec/spec_helper.rb +1 -1
- metadata +9 -29
- data/docs/ClusterConfiguration.md +0 -30
- data/docs/ClusterWorkloadConfiguration.md +0 -24
- data/docs/NodePoolSshConfig.md +0 -22
- data/docs/RancherClusterConfigCertificates.md +0 -22
- data/lib/pnap_rancher_api/models/cluster_configuration.rb +0 -290
- data/lib/pnap_rancher_api/models/cluster_workload_configuration.rb +0 -271
- data/lib/pnap_rancher_api/models/node_pool_ssh_config.rb +0 -253
- data/lib/pnap_rancher_api/models/rancher_cluster_config_certificates.rb +0 -247
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/cluster_configuration_spec.rb +0 -70
- data/spec/models/cluster_workload_configuration_spec.rb +0 -52
- data/spec/models/node_pool_ssh_config_spec.rb +0 -46
- data/spec/models/rancher_cluster_config_certificates_spec.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '01939e63fee2fce7ffad0c41324c23d2f62ffdae762671318d2f5f04bb862334'
|
4
|
+
data.tar.gz: c79c81abddc092e0a36de2dd955b2b6c8cf07af49db4bc9d931557e1ba338f66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a66d4e59b89b71323a2f742b4b0bd94c359208a26a186c449c4b25d65edf54444b912a93abd1443f243a6fc0bd38a40a0bf69f14ab8674963e87d526f32fe4ce
|
7
|
+
data.tar.gz: 70f8710e6ad93b02d458c440856d72c6c9e2c655bc8821c96d9f8584a2fb52978f057b663254f20f6105d4b3b067800c089e77d4a5aac3d7e0aefd4521b432df
|
data/README.md
CHANGED
@@ -74,6 +74,8 @@ require 'pnap_rancher_api'
|
|
74
74
|
RancherApi.configure do |config|
|
75
75
|
# Configure OAuth2 access token for authorization: OAuth2
|
76
76
|
config.access_token = 'YOUR ACCESS TOKEN'
|
77
|
+
# Configure a proc to get access tokens in lieu of the static access_token configuration
|
78
|
+
config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' }
|
77
79
|
end
|
78
80
|
|
79
81
|
api_instance = RancherApi::ClustersApi.new
|
@@ -128,16 +130,12 @@ Class | Method | HTTP request | Description
|
|
128
130
|
## Documentation for Models
|
129
131
|
|
130
132
|
- [RancherApi::Cluster](docs/Cluster.md)
|
131
|
-
- [RancherApi::ClusterConfiguration](docs/ClusterConfiguration.md)
|
132
|
-
- [RancherApi::ClusterWorkloadConfiguration](docs/ClusterWorkloadConfiguration.md)
|
133
133
|
- [RancherApi::DeleteResult](docs/DeleteResult.md)
|
134
134
|
- [RancherApi::Error](docs/Error.md)
|
135
135
|
- [RancherApi::Node](docs/Node.md)
|
136
136
|
- [RancherApi::NodePool](docs/NodePool.md)
|
137
|
-
- [RancherApi::NodePoolSshConfig](docs/NodePoolSshConfig.md)
|
138
137
|
- [RancherApi::RancherClusterCertificates](docs/RancherClusterCertificates.md)
|
139
138
|
- [RancherApi::RancherClusterConfig](docs/RancherClusterConfig.md)
|
140
|
-
- [RancherApi::RancherClusterConfigCertificates](docs/RancherClusterConfigCertificates.md)
|
141
139
|
- [RancherApi::RancherServerMetadata](docs/RancherServerMetadata.md)
|
142
140
|
- [RancherApi::SshConfig](docs/SshConfig.md)
|
143
141
|
- [RancherApi::WorkloadClusterConfig](docs/WorkloadClusterConfig.md)
|
@@ -146,6 +144,7 @@ Class | Method | HTTP request | Description
|
|
146
144
|
## Documentation for Authorization
|
147
145
|
|
148
146
|
|
147
|
+
Authentication schemes defined for the API:
|
149
148
|
### OAuth2
|
150
149
|
|
151
150
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
data/docs/Cluster.md
CHANGED
@@ -10,10 +10,10 @@
|
|
10
10
|
| **location** | **String** | Deployment location. Cannot be changed once a cluster is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. | |
|
11
11
|
| **initial_cluster_version** | **String** | (Read-only) The Rancher version that was installed on the cluster during the first creation process. | [optional][readonly] |
|
12
12
|
| **node_pools** | [**Array<NodePool>**](NodePool.md) | The node pools associated with the cluster. | [optional] |
|
13
|
-
| **configuration** | [**
|
13
|
+
| **configuration** | [**RancherClusterConfig**](RancherClusterConfig.md) | | [optional] |
|
14
14
|
| **metadata** | [**RancherServerMetadata**](RancherServerMetadata.md) | | [optional][readonly] |
|
15
|
-
| **workload_configuration** | [**
|
16
|
-
| **status_description** | **String** | The cluster status | [optional][readonly] |
|
15
|
+
| **workload_configuration** | [**WorkloadClusterConfig**](WorkloadClusterConfig.md) | | [optional] |
|
16
|
+
| **status_description** | **String** | (Read-Only) The cluster status | [optional][readonly] |
|
17
17
|
|
18
18
|
## Example
|
19
19
|
|
data/docs/ClustersApi.md
CHANGED
@@ -216,7 +216,7 @@ end
|
|
216
216
|
|
217
217
|
## clusters_post
|
218
218
|
|
219
|
-
> <Cluster> clusters_post(
|
219
|
+
> <Cluster> clusters_post(cluster)
|
220
220
|
|
221
221
|
Create a Rancher Server Deployment.
|
222
222
|
|
@@ -234,13 +234,11 @@ RancherApi.configure do |config|
|
|
234
234
|
end
|
235
235
|
|
236
236
|
api_instance = RancherApi::ClustersApi.new
|
237
|
-
|
238
|
-
cluster: RancherApi::Cluster.new({location: 'PHX'}) # Cluster |
|
239
|
-
}
|
237
|
+
cluster = RancherApi::Cluster.new({location: 'PHX'}) # Cluster |
|
240
238
|
|
241
239
|
begin
|
242
240
|
# Create a Rancher Server Deployment.
|
243
|
-
result = api_instance.clusters_post(
|
241
|
+
result = api_instance.clusters_post(cluster)
|
244
242
|
p result
|
245
243
|
rescue RancherApi::ApiError => e
|
246
244
|
puts "Error when calling ClustersApi->clusters_post: #{e}"
|
@@ -251,12 +249,12 @@ end
|
|
251
249
|
|
252
250
|
This returns an Array which contains the response data, status code and headers.
|
253
251
|
|
254
|
-
> <Array(<Cluster>, Integer, Hash)> clusters_post_with_http_info(
|
252
|
+
> <Array(<Cluster>, Integer, Hash)> clusters_post_with_http_info(cluster)
|
255
253
|
|
256
254
|
```ruby
|
257
255
|
begin
|
258
256
|
# Create a Rancher Server Deployment.
|
259
|
-
data, status_code, headers = api_instance.clusters_post_with_http_info(
|
257
|
+
data, status_code, headers = api_instance.clusters_post_with_http_info(cluster)
|
260
258
|
p status_code # => 2xx
|
261
259
|
p headers # => { ... }
|
262
260
|
p data # => <Cluster>
|
@@ -269,7 +267,7 @@ end
|
|
269
267
|
|
270
268
|
| Name | Type | Description | Notes |
|
271
269
|
| ---- | ---- | ----------- | ----- |
|
272
|
-
| **cluster** | [**Cluster**](Cluster.md) | |
|
270
|
+
| **cluster** | [**Cluster**](Cluster.md) | | |
|
273
271
|
|
274
272
|
### Return type
|
275
273
|
|
data/docs/NodePool.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
| **name** | **String** | The name of the node pool. | [optional] |
|
8
8
|
| **node_count** | **Integer** | Number of configured nodes, currently only node counts of 1 and 3 are possible. | [optional] |
|
9
9
|
| **server_type** | **String** | Node server type. Cannot be changed once a server is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`. | [optional][default to 's0.d1.small'] |
|
10
|
-
| **ssh_config** | [**
|
10
|
+
| **ssh_config** | [**SshConfig**](SshConfig.md) | | [optional] |
|
11
11
|
| **nodes** | [**Array<Node>**](Node.md) | (Read-only) The nodes associated with this node pool. | [optional][readonly] |
|
12
12
|
|
13
13
|
## Example
|
@@ -16,7 +16,7 @@
|
|
16
16
|
require 'pnap_rancher_api'
|
17
17
|
|
18
18
|
instance = RancherApi::NodePool.new(
|
19
|
-
name:
|
19
|
+
name: rancher-server-node-pool,
|
20
20
|
node_count: null,
|
21
21
|
server_type: s0.d1.small,
|
22
22
|
ssh_config: null,
|
@@ -10,7 +10,7 @@
|
|
10
10
|
| **etcd_snapshot_retention** | **Integer** | This maps to ranchers `etcd-snapshot-retention`. Number of snapshots to retain. | [optional][default to 5] |
|
11
11
|
| **node_taint** | **String** | 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. | [optional] |
|
12
12
|
| **cluster_domain** | **String** | This maps to ranchers `cluster-domain`. Cluster Domain. | [optional] |
|
13
|
-
| **certificates** | [**
|
13
|
+
| **certificates** | [**RancherClusterCertificates**](RancherClusterCertificates.md) | | [optional] |
|
14
14
|
|
15
15
|
## Example
|
16
16
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -204,23 +204,27 @@ module RancherApi
|
|
204
204
|
|
205
205
|
# Create a Rancher Server Deployment.
|
206
206
|
# Create a Rancher Server Deployment as described in <a href='https://rancher.com/docs/rancher/v2.5/en/overview/architecture/#rancher-server-architecture' target='_blank'>Rancher Docs Architecture</a>. Rancher Server allows the creation, import and management of multiple Downstream User Kubernetes Clusters. <b>This is not a Downstream User Cluster</b>. Knowledge base article to help you can be found <a href='https://phoenixnap.com/kb/bmc-rancher-workload-cluster#ftoc-heading-5' target='_blank'>here</a>.
|
207
|
+
# @param cluster [Cluster]
|
207
208
|
# @param [Hash] opts the optional parameters
|
208
|
-
# @option opts [Cluster] :cluster
|
209
209
|
# @return [Cluster]
|
210
|
-
def clusters_post(opts = {})
|
211
|
-
data, _status_code, _headers = clusters_post_with_http_info(opts)
|
210
|
+
def clusters_post(cluster, opts = {})
|
211
|
+
data, _status_code, _headers = clusters_post_with_http_info(cluster, opts)
|
212
212
|
data
|
213
213
|
end
|
214
214
|
|
215
215
|
# Create a Rancher Server Deployment.
|
216
216
|
# Create a Rancher Server Deployment as described in <a href='https://rancher.com/docs/rancher/v2.5/en/overview/architecture/#rancher-server-architecture' target='_blank'>Rancher Docs Architecture</a>. Rancher Server allows the creation, import and management of multiple Downstream User Kubernetes Clusters. <b>This is not a Downstream User Cluster</b>. Knowledge base article to help you can be found <a href='https://phoenixnap.com/kb/bmc-rancher-workload-cluster#ftoc-heading-5' target='_blank'>here</a>.
|
217
|
+
# @param cluster [Cluster]
|
217
218
|
# @param [Hash] opts the optional parameters
|
218
|
-
# @option opts [Cluster] :cluster
|
219
219
|
# @return [Array<(Cluster, Integer, Hash)>] Cluster data, response status code and response headers
|
220
|
-
def clusters_post_with_http_info(opts = {})
|
220
|
+
def clusters_post_with_http_info(cluster, opts = {})
|
221
221
|
if @api_client.config.debugging
|
222
222
|
@api_client.config.logger.debug 'Calling API: ClustersApi.clusters_post ...'
|
223
223
|
end
|
224
|
+
# verify the required parameter 'cluster' is set
|
225
|
+
if @api_client.config.client_side_validation && cluster.nil?
|
226
|
+
fail ArgumentError, "Missing the required parameter 'cluster' when calling ClustersApi.clusters_post"
|
227
|
+
end
|
224
228
|
# resource path
|
225
229
|
local_var_path = '/clusters'
|
226
230
|
|
@@ -241,7 +245,7 @@ module RancherApi
|
|
241
245
|
form_params = opts[:form_params] || {}
|
242
246
|
|
243
247
|
# http body (model)
|
244
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(
|
248
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(cluster)
|
245
249
|
|
246
250
|
# return_type
|
247
251
|
return_type = opts[:debug_return_type] || 'Cluster'
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -17,6 +17,7 @@ require 'tempfile'
|
|
17
17
|
require 'time'
|
18
18
|
require 'typhoeus'
|
19
19
|
|
20
|
+
|
20
21
|
module RancherApi
|
21
22
|
class ApiClient
|
22
23
|
# The Configuration object holding settings to be used in the API client.
|
@@ -31,6 +32,7 @@ module RancherApi
|
|
31
32
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
32
33
|
def initialize(config = Configuration.default)
|
33
34
|
@config = config
|
35
|
+
@config.params_encoding = :multi
|
34
36
|
@user_agent = "PNAP-ruby-sdk-bmc/#{ RancherApi::VERSION }"
|
35
37
|
@powered_by = "PNAP-ruby-sdk-bmc/#{ RancherApi::VERSION }"
|
36
38
|
@default_headers = {
|
@@ -47,9 +49,10 @@ module RancherApi
|
|
47
49
|
# Call an API with given options.
|
48
50
|
#
|
49
51
|
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
50
|
-
# the data deserialized from response body (
|
52
|
+
# the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
|
51
53
|
def call_api(http_method, path, opts = {})
|
52
54
|
request = build_request(http_method, path, opts)
|
55
|
+
tempfile = download_file(request) if opts[:return_type] == 'File'
|
53
56
|
response = request.run
|
54
57
|
|
55
58
|
if @config.debugging
|
@@ -71,7 +74,9 @@ module RancherApi
|
|
71
74
|
end
|
72
75
|
end
|
73
76
|
|
74
|
-
if opts[:return_type]
|
77
|
+
if opts[:return_type] == 'File'
|
78
|
+
data = tempfile
|
79
|
+
elsif opts[:return_type]
|
75
80
|
data = deserialize(response, opts[:return_type])
|
76
81
|
else
|
77
82
|
data = nil
|
@@ -127,9 +132,7 @@ module RancherApi
|
|
127
132
|
end
|
128
133
|
end
|
129
134
|
|
130
|
-
|
131
|
-
download_file(request) if opts[:return_type] == 'File'
|
132
|
-
request
|
135
|
+
Typhoeus::Request.new(url, req_opts)
|
133
136
|
end
|
134
137
|
|
135
138
|
# Builds the HTTP request body
|
@@ -167,6 +170,8 @@ module RancherApi
|
|
167
170
|
# process can use.
|
168
171
|
#
|
169
172
|
# @see Configuration#temp_folder_path
|
173
|
+
#
|
174
|
+
# @return [Tempfile] the tempfile generated
|
170
175
|
def download_file(request)
|
171
176
|
tempfile = nil
|
172
177
|
encoding = nil
|
@@ -181,21 +186,24 @@ module RancherApi
|
|
181
186
|
prefix = prefix + '-' unless prefix.end_with?('-')
|
182
187
|
encoding = response.body.encoding
|
183
188
|
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
184
|
-
@tempfile = tempfile
|
185
189
|
end
|
186
190
|
request.on_body do |chunk|
|
187
191
|
chunk.force_encoding(encoding)
|
188
192
|
tempfile.write(chunk)
|
189
193
|
end
|
190
|
-
request
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
194
|
+
# run the request to ensure the tempfile is created successfully before returning it
|
195
|
+
request.run
|
196
|
+
if tempfile
|
197
|
+
tempfile.close
|
198
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
199
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
200
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
201
|
+
"explicitly with `tempfile.delete`"
|
202
|
+
else
|
203
|
+
fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
|
198
204
|
end
|
205
|
+
|
206
|
+
tempfile
|
199
207
|
end
|
200
208
|
|
201
209
|
# Check if the given MIME is a JSON MIME.
|
@@ -216,15 +224,10 @@ module RancherApi
|
|
216
224
|
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
217
225
|
def deserialize(response, return_type)
|
218
226
|
body = response.body
|
219
|
-
|
220
|
-
# handle file downloading - return the File instance processed in request callbacks
|
221
|
-
# note that response body is empty when the file is written in chunks in request on_body callback
|
222
|
-
return @tempfile if return_type == 'File'
|
223
|
-
|
224
227
|
return nil if body.nil? || body.empty?
|
225
228
|
|
226
229
|
# return response body directly for String return type
|
227
|
-
return body if return_type == 'String'
|
230
|
+
return body.to_s if return_type == 'String'
|
228
231
|
|
229
232
|
# ensuring a default content type
|
230
233
|
content_type = response.headers['Content-Type'] || 'application/json'
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -32,6 +32,7 @@ module RancherApi
|
|
32
32
|
end
|
33
33
|
else
|
34
34
|
super arg
|
35
|
+
@message = arg
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -62,6 +62,16 @@ module RancherApi
|
|
62
62
|
# Defines the access token (Bearer) used with OAuth2.
|
63
63
|
attr_accessor :access_token
|
64
64
|
|
65
|
+
# Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
|
66
|
+
# Overrides the access_token if set
|
67
|
+
# @return [Proc]
|
68
|
+
attr_accessor :access_token_getter
|
69
|
+
|
70
|
+
# Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
|
71
|
+
# HTTP responses with return type `File` will be returned as a stream of binary data.
|
72
|
+
# Default to false.
|
73
|
+
attr_accessor :return_binary_data
|
74
|
+
|
65
75
|
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
66
76
|
# details will be logged with `logger.debug` (see the `logger` attribute).
|
67
77
|
# Default to false.
|
@@ -142,7 +152,7 @@ module RancherApi
|
|
142
152
|
@scheme = 'https'
|
143
153
|
@host = 'api.phoenixnap.com'
|
144
154
|
@base_path = '/solutions/rancher/v1beta'
|
145
|
-
@server_index =
|
155
|
+
@server_index = nil
|
146
156
|
@server_operation_index = {}
|
147
157
|
@server_variables = {}
|
148
158
|
@server_operation_variables = {}
|
@@ -190,10 +200,12 @@ module RancherApi
|
|
190
200
|
|
191
201
|
# Returns base URL for specified operation based on server settings
|
192
202
|
def base_url(operation = nil)
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
203
|
+
if operation_server_settings.key?(operation) then
|
204
|
+
index = server_operation_index.fetch(operation, server_index)
|
205
|
+
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
206
|
+
else
|
207
|
+
server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
|
208
|
+
end
|
197
209
|
end
|
198
210
|
|
199
211
|
# Gets API key (with prefix if set).
|
@@ -208,6 +220,12 @@ module RancherApi
|
|
208
220
|
end
|
209
221
|
end
|
210
222
|
|
223
|
+
# Gets access_token using access_token_getter or uses the static access_token
|
224
|
+
def access_token_with_refresh
|
225
|
+
return access_token if access_token_getter.nil?
|
226
|
+
access_token_getter.call
|
227
|
+
end
|
228
|
+
|
211
229
|
# Gets Basic Auth token string
|
212
230
|
def basic_auth_token
|
213
231
|
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
@@ -221,7 +239,7 @@ module RancherApi
|
|
221
239
|
type: 'oauth2',
|
222
240
|
in: 'header',
|
223
241
|
key: 'Authorization',
|
224
|
-
value: "Bearer #{
|
242
|
+
value: "Bearer #{access_token_with_refresh}"
|
225
243
|
},
|
226
244
|
}
|
227
245
|
end
|
@@ -249,8 +267,8 @@ module RancherApi
|
|
249
267
|
servers = server_settings if servers == nil
|
250
268
|
|
251
269
|
# check array index out of bound
|
252
|
-
if (index < 0 || index >= servers.size)
|
253
|
-
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
270
|
+
if (index.nil? || index < 0 || index >= servers.size)
|
271
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
|
254
272
|
end
|
255
273
|
|
256
274
|
server = servers[index]
|
@@ -275,5 +293,6 @@ module RancherApi
|
|
275
293
|
url
|
276
294
|
end
|
277
295
|
|
296
|
+
|
278
297
|
end
|
279
298
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -40,7 +40,7 @@ module RancherApi
|
|
40
40
|
|
41
41
|
attr_accessor :workload_configuration
|
42
42
|
|
43
|
-
# The cluster status
|
43
|
+
# (Read-Only) The cluster status
|
44
44
|
attr_accessor :status_description
|
45
45
|
|
46
46
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -73,9 +73,9 @@ module RancherApi
|
|
73
73
|
:'location' => :'String',
|
74
74
|
:'initial_cluster_version' => :'String',
|
75
75
|
:'node_pools' => :'Array<NodePool>',
|
76
|
-
:'configuration' => :'
|
76
|
+
:'configuration' => :'RancherClusterConfig',
|
77
77
|
:'metadata' => :'RancherServerMetadata',
|
78
|
-
:'workload_configuration' => :'
|
78
|
+
:'workload_configuration' => :'WorkloadClusterConfig',
|
79
79
|
:'status_description' => :'String'
|
80
80
|
}
|
81
81
|
end
|
@@ -115,6 +115,8 @@ module RancherApi
|
|
115
115
|
|
116
116
|
if attributes.key?(:'location')
|
117
117
|
self.location = attributes[:'location']
|
118
|
+
else
|
119
|
+
self.location = nil
|
118
120
|
end
|
119
121
|
|
120
122
|
if attributes.key?(:'initial_cluster_version')
|
@@ -147,6 +149,7 @@ module RancherApi
|
|
147
149
|
# Show invalid properties with the reasons. Usually used together with valid?
|
148
150
|
# @return Array for valid properties with the reasons
|
149
151
|
def list_invalid_properties
|
152
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
150
153
|
invalid_properties = Array.new
|
151
154
|
if @location.nil?
|
152
155
|
invalid_properties.push('invalid value for "location", location cannot be nil.')
|
@@ -166,6 +169,7 @@ module RancherApi
|
|
166
169
|
# Check to see if the all the properties in the model are valid
|
167
170
|
# @return true if the model is valid
|
168
171
|
def valid?
|
172
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
169
173
|
return false if @location.nil?
|
170
174
|
return false if !@node_pools.nil? && @node_pools.length > 1
|
171
175
|
return false if !@node_pools.nil? && @node_pools.length < 1
|
@@ -175,11 +179,15 @@ module RancherApi
|
|
175
179
|
# Custom attribute writer method with validation
|
176
180
|
# @param [Object] node_pools Value to be assigned
|
177
181
|
def node_pools=(node_pools)
|
178
|
-
if
|
182
|
+
if node_pools.nil?
|
183
|
+
fail ArgumentError, 'node_pools cannot be nil'
|
184
|
+
end
|
185
|
+
|
186
|
+
if node_pools.length > 1
|
179
187
|
fail ArgumentError, 'invalid value for "node_pools", number of items must be less than or equal to 1.'
|
180
188
|
end
|
181
189
|
|
182
|
-
if
|
190
|
+
if node_pools.length < 1
|
183
191
|
fail ArgumentError, 'invalid value for "node_pools", number of items must be greater than or equal to 1.'
|
184
192
|
end
|
185
193
|
|
@@ -219,37 +227,30 @@ module RancherApi
|
|
219
227
|
# @param [Hash] attributes Model attributes in the form of hash
|
220
228
|
# @return [Object] Returns the model itself
|
221
229
|
def self.build_from_hash(attributes)
|
222
|
-
new.build_from_hash(attributes)
|
223
|
-
end
|
224
|
-
|
225
|
-
# Builds the object from hash
|
226
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
227
|
-
# @return [Object] Returns the model itself
|
228
|
-
def build_from_hash(attributes)
|
229
230
|
return nil unless attributes.is_a?(Hash)
|
230
231
|
attributes = attributes.transform_keys(&:to_sym)
|
231
|
-
|
232
|
-
|
233
|
-
|
232
|
+
transformed_hash = {}
|
233
|
+
openapi_types.each_pair do |key, type|
|
234
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
235
|
+
transformed_hash["#{key}"] = nil
|
234
236
|
elsif type =~ /\AArray<(.*)>/i
|
235
237
|
# check to ensure the input is an array given that the attribute
|
236
238
|
# is documented as an array but the input is not
|
237
|
-
if attributes[
|
238
|
-
|
239
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
240
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
239
241
|
end
|
240
|
-
elsif !attributes[
|
241
|
-
|
242
|
+
elsif !attributes[attribute_map[key]].nil?
|
243
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
242
244
|
end
|
243
245
|
end
|
244
|
-
|
245
|
-
self
|
246
|
+
new(transformed_hash)
|
246
247
|
end
|
247
248
|
|
248
249
|
# Deserializes the data based on type
|
249
250
|
# @param string type Data type
|
250
251
|
# @param string value Value to be deserialized
|
251
252
|
# @return [Object] Deserialized data
|
252
|
-
def _deserialize(type, value)
|
253
|
+
def self._deserialize(type, value)
|
253
254
|
case type.to_sym
|
254
255
|
when :Time
|
255
256
|
Time.parse(value)
|
@@ -284,7 +285,7 @@ module RancherApi
|
|
284
285
|
else # model
|
285
286
|
# models (e.g. Pet) or oneOf
|
286
287
|
klass = RancherApi.const_get(type)
|
287
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
288
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
288
289
|
end
|
289
290
|
end
|
290
291
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -66,16 +66,21 @@ module RancherApi
|
|
66
66
|
|
67
67
|
if attributes.key?(:'result')
|
68
68
|
self.result = attributes[:'result']
|
69
|
+
else
|
70
|
+
self.result = nil
|
69
71
|
end
|
70
72
|
|
71
73
|
if attributes.key?(:'cluster_id')
|
72
74
|
self.cluster_id = attributes[:'cluster_id']
|
75
|
+
else
|
76
|
+
self.cluster_id = nil
|
73
77
|
end
|
74
78
|
end
|
75
79
|
|
76
80
|
# Show invalid properties with the reasons. Usually used together with valid?
|
77
81
|
# @return Array for valid properties with the reasons
|
78
82
|
def list_invalid_properties
|
83
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
79
84
|
invalid_properties = Array.new
|
80
85
|
if @result.nil?
|
81
86
|
invalid_properties.push('invalid value for "result", result cannot be nil.')
|
@@ -91,6 +96,7 @@ module RancherApi
|
|
91
96
|
# Check to see if the all the properties in the model are valid
|
92
97
|
# @return true if the model is valid
|
93
98
|
def valid?
|
99
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
94
100
|
return false if @result.nil?
|
95
101
|
return false if @cluster_id.nil?
|
96
102
|
true
|
@@ -121,37 +127,30 @@ module RancherApi
|
|
121
127
|
# @param [Hash] attributes Model attributes in the form of hash
|
122
128
|
# @return [Object] Returns the model itself
|
123
129
|
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
130
|
return nil unless attributes.is_a?(Hash)
|
132
131
|
attributes = attributes.transform_keys(&:to_sym)
|
133
|
-
|
134
|
-
|
135
|
-
|
132
|
+
transformed_hash = {}
|
133
|
+
openapi_types.each_pair do |key, type|
|
134
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
135
|
+
transformed_hash["#{key}"] = nil
|
136
136
|
elsif type =~ /\AArray<(.*)>/i
|
137
137
|
# check to ensure the input is an array given that the attribute
|
138
138
|
# is documented as an array but the input is not
|
139
|
-
if attributes[
|
140
|
-
|
139
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
140
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
141
141
|
end
|
142
|
-
elsif !attributes[
|
143
|
-
|
142
|
+
elsif !attributes[attribute_map[key]].nil?
|
143
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
144
144
|
end
|
145
145
|
end
|
146
|
-
|
147
|
-
self
|
146
|
+
new(transformed_hash)
|
148
147
|
end
|
149
148
|
|
150
149
|
# Deserializes the data based on type
|
151
150
|
# @param string type Data type
|
152
151
|
# @param string value Value to be deserialized
|
153
152
|
# @return [Object] Deserialized data
|
154
|
-
def _deserialize(type, value)
|
153
|
+
def self._deserialize(type, value)
|
155
154
|
case type.to_sym
|
156
155
|
when :Time
|
157
156
|
Time.parse(value)
|
@@ -186,7 +185,7 @@ module RancherApi
|
|
186
185
|
else # model
|
187
186
|
# models (e.g. Pet) or oneOf
|
188
187
|
klass = RancherApi.const_get(type)
|
189
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
188
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
190
189
|
end
|
191
190
|
end
|
192
191
|
|