pnap_rancher_api 1.0.6 → 2.0.1

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -4
  3. data/VERSION +1 -1
  4. data/docs/Cluster.md +3 -3
  5. data/docs/ClustersApi.md +6 -8
  6. data/docs/NodePool.md +2 -2
  7. data/docs/RancherClusterConfig.md +1 -1
  8. data/lib/pnap_rancher_api/api/clusters_api.rb +11 -7
  9. data/lib/pnap_rancher_api/api_client.rb +26 -23
  10. data/lib/pnap_rancher_api/api_error.rb +2 -1
  11. data/lib/pnap_rancher_api/configuration.rb +28 -9
  12. data/lib/pnap_rancher_api/models/cluster.rb +25 -24
  13. data/lib/pnap_rancher_api/models/delete_result.rb +18 -19
  14. data/lib/pnap_rancher_api/models/error.rb +16 -19
  15. data/lib/pnap_rancher_api/models/node.rb +14 -19
  16. data/lib/pnap_rancher_api/models/node_pool.rb +54 -20
  17. data/lib/pnap_rancher_api/models/rancher_cluster_certificates.rb +14 -19
  18. data/lib/pnap_rancher_api/models/rancher_cluster_config.rb +15 -20
  19. data/lib/pnap_rancher_api/models/rancher_server_metadata.rb +14 -19
  20. data/lib/pnap_rancher_api/models/ssh_config.rb +14 -19
  21. data/lib/pnap_rancher_api/models/workload_cluster_config.rb +16 -19
  22. data/lib/pnap_rancher_api/version.rb +1 -1
  23. data/lib/pnap_rancher_api.rb +1 -5
  24. data/pnap_rancher_api.gemspec +2 -2
  25. data/spec/api/clusters_api_spec.rb +7 -7
  26. data/spec/models/cluster_spec.rb +14 -12
  27. data/spec/models/delete_result_spec.rb +6 -4
  28. data/spec/models/error_spec.rb +6 -4
  29. data/spec/models/node_pool_spec.rb +9 -7
  30. data/spec/models/node_spec.rb +5 -3
  31. data/spec/models/rancher_cluster_certificates_spec.rb +7 -5
  32. data/spec/models/rancher_cluster_config_spec.rb +11 -9
  33. data/spec/models/rancher_server_metadata_spec.rb +7 -5
  34. data/spec/models/ssh_config_spec.rb +7 -5
  35. data/spec/models/workload_cluster_config_spec.rb +8 -6
  36. data/spec/spec_helper.rb +1 -1
  37. metadata +10 -30
  38. data/docs/ClusterConfiguration.md +0 -30
  39. data/docs/ClusterWorkloadConfiguration.md +0 -24
  40. data/docs/NodePoolSshConfig.md +0 -22
  41. data/docs/RancherClusterConfigCertificates.md +0 -22
  42. data/lib/pnap_rancher_api/models/cluster_configuration.rb +0 -290
  43. data/lib/pnap_rancher_api/models/cluster_workload_configuration.rb +0 -271
  44. data/lib/pnap_rancher_api/models/node_pool_ssh_config.rb +0 -253
  45. data/lib/pnap_rancher_api/models/rancher_cluster_config_certificates.rb +0 -247
  46. data/spec/api_client_spec.rb +0 -226
  47. data/spec/configuration_spec.rb +0 -42
  48. data/spec/models/cluster_configuration_spec.rb +0 -70
  49. data/spec/models/cluster_workload_configuration_spec.rb +0 -52
  50. data/spec/models/node_pool_ssh_config_spec.rb +0 -46
  51. data/spec/models/rancher_cluster_config_certificates_spec.rb +0 -46
@@ -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: 5.4.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -22,30 +22,32 @@ describe RancherApi::WorkloadClusterConfig do
22
22
 
23
23
  describe 'test an instance of WorkloadClusterConfig' do
24
24
  it 'should create an instance of WorkloadClusterConfig' do
25
- expect(instance).to be_instance_of(RancherApi::WorkloadClusterConfig)
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(RancherApi::WorkloadClusterConfig)
26
27
  end
27
28
  end
29
+
28
30
  describe 'test attribute "name"' do
29
31
  it 'should work' do
30
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
31
33
  end
32
34
  end
33
35
 
34
36
  describe 'test attribute "server_count"' do
35
37
  it 'should work' do
36
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
37
39
  end
38
40
  end
39
41
 
40
42
  describe 'test attribute "server_type"' do
41
43
  it 'should work' do
42
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
43
45
  end
44
46
  end
45
47
 
46
48
  describe 'test attribute "location"' do
47
49
  it 'should work' do
48
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
49
51
  end
50
52
  end
51
53
 
data/spec/spec_helper.rb CHANGED
@@ -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: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pnap_rancher_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - PhoenixNAP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-20 00:00:00.000000000 Z
11
+ date: 2024-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -62,17 +62,13 @@ files:
62
62
  - Rakefile
63
63
  - VERSION
64
64
  - docs/Cluster.md
65
- - docs/ClusterConfiguration.md
66
- - docs/ClusterWorkloadConfiguration.md
67
65
  - docs/ClustersApi.md
68
66
  - docs/DeleteResult.md
69
67
  - docs/Error.md
70
68
  - docs/Node.md
71
69
  - docs/NodePool.md
72
- - docs/NodePoolSshConfig.md
73
70
  - docs/RancherClusterCertificates.md
74
71
  - docs/RancherClusterConfig.md
75
- - docs/RancherClusterConfigCertificates.md
76
72
  - docs/RancherServerMetadata.md
77
73
  - docs/SshConfig.md
78
74
  - docs/WorkloadClusterConfig.md
@@ -82,34 +78,24 @@ files:
82
78
  - lib/pnap_rancher_api/api_error.rb
83
79
  - lib/pnap_rancher_api/configuration.rb
84
80
  - lib/pnap_rancher_api/models/cluster.rb
85
- - lib/pnap_rancher_api/models/cluster_configuration.rb
86
- - lib/pnap_rancher_api/models/cluster_workload_configuration.rb
87
81
  - lib/pnap_rancher_api/models/delete_result.rb
88
82
  - lib/pnap_rancher_api/models/error.rb
89
83
  - lib/pnap_rancher_api/models/node.rb
90
84
  - lib/pnap_rancher_api/models/node_pool.rb
91
- - lib/pnap_rancher_api/models/node_pool_ssh_config.rb
92
85
  - lib/pnap_rancher_api/models/rancher_cluster_certificates.rb
93
86
  - lib/pnap_rancher_api/models/rancher_cluster_config.rb
94
- - lib/pnap_rancher_api/models/rancher_cluster_config_certificates.rb
95
87
  - lib/pnap_rancher_api/models/rancher_server_metadata.rb
96
88
  - lib/pnap_rancher_api/models/ssh_config.rb
97
89
  - lib/pnap_rancher_api/models/workload_cluster_config.rb
98
90
  - lib/pnap_rancher_api/version.rb
99
91
  - pnap_rancher_api.gemspec
100
92
  - spec/api/clusters_api_spec.rb
101
- - spec/api_client_spec.rb
102
- - spec/configuration_spec.rb
103
- - spec/models/cluster_configuration_spec.rb
104
93
  - spec/models/cluster_spec.rb
105
- - spec/models/cluster_workload_configuration_spec.rb
106
94
  - spec/models/delete_result_spec.rb
107
95
  - spec/models/error_spec.rb
108
96
  - spec/models/node_pool_spec.rb
109
- - spec/models/node_pool_ssh_config_spec.rb
110
97
  - spec/models/node_spec.rb
111
98
  - spec/models/rancher_cluster_certificates_spec.rb
112
- - spec/models/rancher_cluster_config_certificates_spec.rb
113
99
  - spec/models/rancher_cluster_config_spec.rb
114
100
  - spec/models/rancher_server_metadata_spec.rb
115
101
  - spec/models/ssh_config_spec.rb
@@ -128,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
128
114
  requirements:
129
115
  - - ">="
130
116
  - !ruby/object:Gem::Version
131
- version: '2.4'
117
+ version: '2.7'
132
118
  required_rubygems_version: !ruby/object:Gem::Requirement
133
119
  requirements:
134
120
  - - ">="
@@ -141,20 +127,14 @@ specification_version: 4
141
127
  summary: Rancher Solution API Ruby Gem
142
128
  test_files:
143
129
  - spec/api/clusters_api_spec.rb
144
- - spec/api_client_spec.rb
145
- - spec/configuration_spec.rb
146
- - spec/models/node_pool_spec.rb
147
- - spec/models/ssh_config_spec.rb
148
- - spec/models/rancher_cluster_config_spec.rb
149
- - spec/models/cluster_workload_configuration_spec.rb
150
- - spec/models/rancher_server_metadata_spec.rb
151
- - spec/models/error_spec.rb
152
- - spec/models/cluster_configuration_spec.rb
153
130
  - spec/models/cluster_spec.rb
131
+ - spec/models/node_spec.rb
132
+ - spec/models/workload_cluster_config_spec.rb
154
133
  - spec/models/rancher_cluster_certificates_spec.rb
134
+ - spec/models/error_spec.rb
135
+ - spec/models/ssh_config_spec.rb
136
+ - spec/models/rancher_cluster_config_spec.rb
137
+ - spec/models/node_pool_spec.rb
155
138
  - spec/models/delete_result_spec.rb
156
- - spec/models/workload_cluster_config_spec.rb
157
- - spec/models/node_pool_ssh_config_spec.rb
158
- - spec/models/rancher_cluster_config_certificates_spec.rb
159
- - spec/models/node_spec.rb
139
+ - spec/models/rancher_server_metadata_spec.rb
160
140
  - spec/spec_helper.rb
@@ -1,30 +0,0 @@
1
- # RancherApi::ClusterConfiguration
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **token** | **String** | Shared secret used to join a server or agent to a cluster. | [optional] |
8
- | **tls_san** | **String** | This maps to ranchers `tls-san`. Add additional hostname or IP as a Subject Alternative Name in the TLS cert. | [optional] |
9
- | **etcd_snapshot_schedule_cron** | **String** | 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 | [optional][default to '0 0,12 * * *'] |
10
- | **etcd_snapshot_retention** | **Integer** | This maps to ranchers `etcd-snapshot-retention`. Number of snapshots to retain. | [optional][default to 5] |
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
- | **cluster_domain** | **String** | This maps to ranchers `cluster-domain`. Cluster Domain. | [optional] |
13
- | **certificates** | [**RancherClusterConfigCertificates**](RancherClusterConfigCertificates.md) | | [optional] |
14
-
15
- ## Example
16
-
17
- ```ruby
18
- require 'pnap_rancher_api'
19
-
20
- instance = RancherApi::ClusterConfiguration.new(
21
- token: gS7SnDnY5st0ryJxMXA7,
22
- tls_san: mydomain.com,
23
- etcd_snapshot_schedule_cron: 0 0,12 * * *,
24
- etcd_snapshot_retention: 5,
25
- node_taint: CriticalAddonsOnly=true:NoExecute,
26
- cluster_domain: cluster.local,
27
- certificates: null
28
- )
29
- ```
30
-
@@ -1,24 +0,0 @@
1
- # RancherApi::ClusterWorkloadConfiguration
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **name** | **String** | The name of the workload cluster. This field is autogenerated if not provided. | [optional] |
8
- | **server_count** | **Integer** | Number of configured servers. Currently only server counts of 1 and 3 are possible. | [optional][default to 1] |
9
- | **server_type** | **String** | Node server type. Cannot be changed once the cluster 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`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c1.small`, `d1.c2.small`, `d1.c3.small`, `d1.c4.small`, `d1.c1.medium`, `d1.c2.medium`, `d1.c3.medium`, `d1.c4.medium`, `d1.c1.large`, `d1.c2.large`, `d1.c3.large`, `d1.c4.large`, `d1.m1.medium`, `d1.m2.medium`, `d1.m3.medium`, `d1.m4.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m2.medium`, `d2.m2.large` or `d2.m2.xlarge`. | [default to 's0.d1.small'] |
10
- | **location** | **String** | Workload cluster location. Cannot be changed once cluster is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. | |
11
-
12
- ## Example
13
-
14
- ```ruby
15
- require 'pnap_rancher_api'
16
-
17
- instance = RancherApi::ClusterWorkloadConfiguration.new(
18
- name: Workload CLuster,
19
- server_count: 3,
20
- server_type: s0.d1.small,
21
- location: PHX
22
- )
23
- ```
24
-
@@ -1,22 +0,0 @@
1
- # RancherApi::NodePoolSshConfig
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **install_default_keys** | **Boolean** | Define whether public keys marked as default should be installed on this node. These are public keys that were already recorded on this system. Use <a href='https://developers.phoenixnap.com/docs/bmc/1/routes/ssh-keys/get' target='_blank'>GET /ssh-keys</a> to retrieve a list of possible values. | [optional][default to true] |
8
- | **keys** | **Array<String>** | List of public SSH keys. | [optional] |
9
- | **key_ids** | **Array<String>** | List of public SSH key identifiers. These are public keys that were already recorded on this system. Use <a href='https://developers.phoenixnap.com/docs/bmc/1/routes/ssh-keys/get' target='_blank'>GET /ssh-keys</a> to retrieve a list of possible values. | [optional] |
10
-
11
- ## Example
12
-
13
- ```ruby
14
- require 'pnap_rancher_api'
15
-
16
- instance = RancherApi::NodePoolSshConfig.new(
17
- install_default_keys: true,
18
- keys: [ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDF9LdAFElNCi7JoWh6KUcchrJ2Gac1aqGRPpdZNowObpRtmiRCecAMb7bUgNAaNfcmwiQi7tos9TlnFgprIcfMWb8MSs3ABYHmBgqEEt3RWYf0fAc9CsIpJdMCUG28TPGTlRXCEUVNKgLMdcseAlJoGp1CgbHWIN65fB3he3kAZcfpPn5mapV0tsl2p+ZyuAGRYdn5dJv2RZDHUZBkOeUobwsij+weHCKAFmKQKtCP7ybgVHaQjAPrj8MGnk1jBbjDt5ws+Be+9JNjQJee9zCKbAOsIo3i+GcUIkrw5jxPU/RTGlWBcemPaKHdciSzGcjWboapzIy49qypQhZe1U75 user],
19
- key_ids: ["5fa54d1e91867c03a0a7b4a4"]
20
- )
21
- ```
22
-
@@ -1,22 +0,0 @@
1
- # RancherApi::RancherClusterConfigCertificates
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **ca_certificate** | **String** | The SSL CA certificate to be used for rancher admin. | [optional] |
8
- | **certificate** | **String** | The SSL certificate to be used for rancher admin. | [optional] |
9
- | **certificate_key** | **String** | The SSL certificate key to be used for rancher admin. | [optional] |
10
-
11
- ## Example
12
-
13
- ```ruby
14
- require 'pnap_rancher_api'
15
-
16
- instance = RancherApi::RancherClusterConfigCertificates.new(
17
- ca_certificate: null,
18
- certificate: null,
19
- certificate_key: null
20
- )
21
- ```
22
-
@@ -1,290 +0,0 @@
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: 6.1.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module RancherApi
17
- class ClusterConfiguration
18
- # Shared secret used to join a server or agent to a cluster.
19
- attr_accessor :token
20
-
21
- # This maps to ranchers `tls-san`. Add additional hostname or IP as a Subject Alternative Name in the TLS cert.
22
- attr_accessor :tls_san
23
-
24
- # 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
25
- attr_accessor :etcd_snapshot_schedule_cron
26
-
27
- # This maps to ranchers `etcd-snapshot-retention`. Number of snapshots to retain.
28
- attr_accessor :etcd_snapshot_retention
29
-
30
- # 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.
31
- attr_accessor :node_taint
32
-
33
- # This maps to ranchers `cluster-domain`. Cluster Domain.
34
- attr_accessor :cluster_domain
35
-
36
- attr_accessor :certificates
37
-
38
- # Attribute mapping from ruby-style variable name to JSON key.
39
- def self.attribute_map
40
- {
41
- :'token' => :'token',
42
- :'tls_san' => :'tlsSan',
43
- :'etcd_snapshot_schedule_cron' => :'etcdSnapshotScheduleCron',
44
- :'etcd_snapshot_retention' => :'etcdSnapshotRetention',
45
- :'node_taint' => :'nodeTaint',
46
- :'cluster_domain' => :'clusterDomain',
47
- :'certificates' => :'certificates'
48
- }
49
- end
50
-
51
- # Returns all the JSON keys this model knows about
52
- def self.acceptable_attributes
53
- attribute_map.values
54
- end
55
-
56
- # Attribute type mapping.
57
- def self.openapi_types
58
- {
59
- :'token' => :'String',
60
- :'tls_san' => :'String',
61
- :'etcd_snapshot_schedule_cron' => :'String',
62
- :'etcd_snapshot_retention' => :'Integer',
63
- :'node_taint' => :'String',
64
- :'cluster_domain' => :'String',
65
- :'certificates' => :'RancherClusterConfigCertificates'
66
- }
67
- end
68
-
69
- # List of attributes with nullable: true
70
- def self.openapi_nullable
71
- Set.new([
72
- ])
73
- end
74
-
75
- # List of class defined in allOf (OpenAPI v3)
76
- def self.openapi_all_of
77
- [
78
- :'RancherClusterConfig'
79
- ]
80
- end
81
-
82
- # Initializes the object
83
- # @param [Hash] attributes Model attributes in the form of hash
84
- def initialize(attributes = {})
85
- if (!attributes.is_a?(Hash))
86
- fail ArgumentError, "The input argument (attributes) must be a hash in `RancherApi::ClusterConfiguration` initialize method"
87
- end
88
-
89
- # check to see if the attribute exists and convert string to symbol for hash key
90
- attributes = attributes.each_with_object({}) { |(k, v), h|
91
- if (!self.class.attribute_map.key?(k.to_sym))
92
- fail ArgumentError, "`#{k}` is not a valid attribute in `RancherApi::ClusterConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
93
- end
94
- h[k.to_sym] = v
95
- }
96
-
97
- if attributes.key?(:'token')
98
- self.token = attributes[:'token']
99
- end
100
-
101
- if attributes.key?(:'tls_san')
102
- self.tls_san = attributes[:'tls_san']
103
- end
104
-
105
- if attributes.key?(:'etcd_snapshot_schedule_cron')
106
- self.etcd_snapshot_schedule_cron = attributes[:'etcd_snapshot_schedule_cron']
107
- else
108
- self.etcd_snapshot_schedule_cron = '0 0,12 * * *'
109
- end
110
-
111
- if attributes.key?(:'etcd_snapshot_retention')
112
- self.etcd_snapshot_retention = attributes[:'etcd_snapshot_retention']
113
- else
114
- self.etcd_snapshot_retention = 5
115
- end
116
-
117
- if attributes.key?(:'node_taint')
118
- self.node_taint = attributes[:'node_taint']
119
- end
120
-
121
- if attributes.key?(:'cluster_domain')
122
- self.cluster_domain = attributes[:'cluster_domain']
123
- end
124
-
125
- if attributes.key?(:'certificates')
126
- self.certificates = attributes[:'certificates']
127
- end
128
- end
129
-
130
- # Show invalid properties with the reasons. Usually used together with valid?
131
- # @return Array for valid properties with the reasons
132
- def list_invalid_properties
133
- invalid_properties = Array.new
134
- invalid_properties
135
- end
136
-
137
- # Check to see if the all the properties in the model are valid
138
- # @return true if the model is valid
139
- def valid?
140
- true
141
- end
142
-
143
- # Checks equality by comparing each attribute.
144
- # @param [Object] Object to be compared
145
- def ==(o)
146
- return true if self.equal?(o)
147
- self.class == o.class &&
148
- token == o.token &&
149
- tls_san == o.tls_san &&
150
- etcd_snapshot_schedule_cron == o.etcd_snapshot_schedule_cron &&
151
- etcd_snapshot_retention == o.etcd_snapshot_retention &&
152
- node_taint == o.node_taint &&
153
- cluster_domain == o.cluster_domain &&
154
- certificates == o.certificates
155
- end
156
-
157
- # @see the `==` method
158
- # @param [Object] Object to be compared
159
- def eql?(o)
160
- self == o
161
- end
162
-
163
- # Calculates hash code according to all attributes.
164
- # @return [Integer] Hash code
165
- def hash
166
- [token, tls_san, etcd_snapshot_schedule_cron, etcd_snapshot_retention, node_taint, cluster_domain, certificates].hash
167
- end
168
-
169
- # Builds the object from hash
170
- # @param [Hash] attributes Model attributes in the form of hash
171
- # @return [Object] Returns the model itself
172
- def self.build_from_hash(attributes)
173
- new.build_from_hash(attributes)
174
- end
175
-
176
- # Builds the object from hash
177
- # @param [Hash] attributes Model attributes in the form of hash
178
- # @return [Object] Returns the model itself
179
- def build_from_hash(attributes)
180
- return nil unless attributes.is_a?(Hash)
181
- attributes = attributes.transform_keys(&:to_sym)
182
- self.class.openapi_types.each_pair do |key, type|
183
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
184
- self.send("#{key}=", nil)
185
- elsif type =~ /\AArray<(.*)>/i
186
- # check to ensure the input is an array given that the attribute
187
- # is documented as an array but the input is not
188
- if attributes[self.class.attribute_map[key]].is_a?(Array)
189
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
190
- end
191
- elsif !attributes[self.class.attribute_map[key]].nil?
192
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
193
- end
194
- end
195
-
196
- self
197
- end
198
-
199
- # Deserializes the data based on type
200
- # @param string type Data type
201
- # @param string value Value to be deserialized
202
- # @return [Object] Deserialized data
203
- def _deserialize(type, value)
204
- case type.to_sym
205
- when :Time
206
- Time.parse(value)
207
- when :Date
208
- Date.parse(value)
209
- when :String
210
- value.to_s
211
- when :Integer
212
- value.to_i
213
- when :Float
214
- value.to_f
215
- when :Boolean
216
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
217
- true
218
- else
219
- false
220
- end
221
- when :Object
222
- # generic object (usually a Hash), return directly
223
- value
224
- when /\AArray<(?<inner_type>.+)>\z/
225
- inner_type = Regexp.last_match[:inner_type]
226
- value.map { |v| _deserialize(inner_type, v) }
227
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
228
- k_type = Regexp.last_match[:k_type]
229
- v_type = Regexp.last_match[:v_type]
230
- {}.tap do |hash|
231
- value.each do |k, v|
232
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
233
- end
234
- end
235
- else # model
236
- # models (e.g. Pet) or oneOf
237
- klass = RancherApi.const_get(type)
238
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
239
- end
240
- end
241
-
242
- # Returns the string representation of the object
243
- # @return [String] String presentation of the object
244
- def to_s
245
- to_hash.to_s
246
- end
247
-
248
- # to_body is an alias to to_hash (backward compatibility)
249
- # @return [Hash] Returns the object in the form of hash
250
- def to_body
251
- to_hash
252
- end
253
-
254
- # Returns the object in the form of hash
255
- # @return [Hash] Returns the object in the form of hash
256
- def to_hash
257
- hash = {}
258
- self.class.attribute_map.each_pair do |attr, param|
259
- value = self.send(attr)
260
- if value.nil?
261
- is_nullable = self.class.openapi_nullable.include?(attr)
262
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
263
- end
264
-
265
- hash[param] = _to_hash(value)
266
- end
267
- hash
268
- end
269
-
270
- # Outputs non-array value in the form of hash
271
- # For object, use to_hash. Otherwise, just return the value
272
- # @param [Object] value Any valid value
273
- # @return [Hash] Returns the value in the form of hash
274
- def _to_hash(value)
275
- if value.is_a?(Array)
276
- value.compact.map { |v| _to_hash(v) }
277
- elsif value.is_a?(Hash)
278
- {}.tap do |hash|
279
- value.each { |k, v| hash[k] = _to_hash(v) }
280
- end
281
- elsif value.respond_to? :to_hash
282
- value.to_hash
283
- else
284
- value
285
- end
286
- end
287
-
288
- end
289
-
290
- end