pnap_bmc_api 1.1.0 → 1.2.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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/VERSION +1 -1
  4. data/docs/OsConfiguration.md +3 -1
  5. data/docs/OsConfigurationCloudInit.md +18 -0
  6. data/docs/Server.md +1 -1
  7. data/lib/pnap_bmc_api/api/quotas_api.rb +1 -1
  8. data/lib/pnap_bmc_api/api/servers_api.rb +1 -1
  9. data/lib/pnap_bmc_api/api/ssh_keys_api.rb +1 -1
  10. data/lib/pnap_bmc_api/api_client.rb +4 -2
  11. data/lib/pnap_bmc_api/api_error.rb +1 -1
  12. data/lib/pnap_bmc_api/configuration.rb +3 -2
  13. data/lib/pnap_bmc_api/models/action_result.rb +2 -1
  14. data/lib/pnap_bmc_api/models/delete_result.rb +2 -1
  15. data/lib/pnap_bmc_api/models/delete_ssh_key_result.rb +2 -1
  16. data/lib/pnap_bmc_api/models/error.rb +2 -1
  17. data/lib/pnap_bmc_api/models/ip_blocks_configuration.rb +2 -1
  18. data/lib/pnap_bmc_api/models/network_configuration.rb +2 -1
  19. data/lib/pnap_bmc_api/models/os_configuration.rb +15 -5
  20. data/lib/pnap_bmc_api/models/os_configuration_cloud_init.rb +221 -0
  21. data/lib/pnap_bmc_api/models/os_configuration_map.rb +2 -1
  22. data/lib/pnap_bmc_api/models/os_configuration_map_esxi.rb +2 -1
  23. data/lib/pnap_bmc_api/models/os_configuration_map_proxmox.rb +2 -1
  24. data/lib/pnap_bmc_api/models/os_configuration_windows.rb +2 -1
  25. data/lib/pnap_bmc_api/models/private_network_configuration.rb +2 -1
  26. data/lib/pnap_bmc_api/models/public_network_configuration.rb +2 -1
  27. data/lib/pnap_bmc_api/models/quota.rb +2 -1
  28. data/lib/pnap_bmc_api/models/quota_edit_limit_request.rb +2 -1
  29. data/lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb +2 -1
  30. data/lib/pnap_bmc_api/models/quota_edit_limit_request_details_all_of.rb +2 -1
  31. data/lib/pnap_bmc_api/models/relinquish_ip_block.rb +2 -1
  32. data/lib/pnap_bmc_api/models/reset_result.rb +2 -1
  33. data/lib/pnap_bmc_api/models/server.rb +7 -15
  34. data/lib/pnap_bmc_api/models/server_create.rb +2 -1
  35. data/lib/pnap_bmc_api/models/server_ip_block.rb +2 -1
  36. data/lib/pnap_bmc_api/models/server_patch.rb +2 -1
  37. data/lib/pnap_bmc_api/models/server_private_network.rb +2 -1
  38. data/lib/pnap_bmc_api/models/server_public_network.rb +2 -1
  39. data/lib/pnap_bmc_api/models/server_reserve.rb +2 -1
  40. data/lib/pnap_bmc_api/models/server_reset.rb +2 -1
  41. data/lib/pnap_bmc_api/models/ssh_key.rb +2 -1
  42. data/lib/pnap_bmc_api/models/ssh_key_create.rb +2 -1
  43. data/lib/pnap_bmc_api/models/ssh_key_update.rb +2 -1
  44. data/lib/pnap_bmc_api/models/tag_assignment.rb +2 -1
  45. data/lib/pnap_bmc_api/models/tag_assignment_request.rb +2 -1
  46. data/lib/pnap_bmc_api/version.rb +1 -1
  47. data/lib/pnap_bmc_api.rb +2 -1
  48. data/pnap_bmc_api.gemspec +1 -1
  49. data/spec/api_client_spec.rb +1 -1
  50. data/spec/configuration_spec.rb +1 -1
  51. data/spec/models/os_configuration_cloud_init_spec.rb +34 -0
  52. data/spec/spec_helper.rb +1 -1
  53. metadata +33 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a7d4011da9e9cf25920b8ab98c68659f29cc3f314ce7985a4f6ebf32487cd80
4
- data.tar.gz: 988fb710d630cde105bc15f6dfb0ce7d7685732b296c6af6a784e83c3a3eb64d
3
+ metadata.gz: c963cbc0d6e9a73b1d20d9fc4ebdae4f26841905700f25cd1d4194b3f5389622
4
+ data.tar.gz: 2cdf867849e85e583276bc0403f3556eedc7bdc94d69fed2bbea52475d386a13
5
5
  SHA512:
6
- metadata.gz: bc50f06e11f1be83612e3f1ec1f377370fa3b351c271d5ffd5c5b43053f147b20a791daa1b460b9b9a45a277a69a78ce4d9398e9e367a5c7335aca7c17807a08
7
- data.tar.gz: 8cfb0ecbff4ba9ca7dc8f91320f4633f878a950dcabe6fb8efd85ca680011deab993de5857a408667a19154cbc8c23347588ad09f30a8bcaf7999b76d787d143
6
+ metadata.gz: 39130877d89b21a46619f58fc59549a9ff56f7d4d2f93f078c6bf13cb6a36619aab4f4cd544fc977c3ab1d7f294fa051aacaa30c56f903e4d95db2b6a4ca7808
7
+ data.tar.gz: ad7384db61dd6d4dd691b61b7f251c203dc106c92ffb75d95817c815e0113362a68486a6be92ccaa4ab7252c69ff9980559f5621e2ca215eea85fa8a5179f100
data/README.md CHANGED
@@ -158,6 +158,7 @@ Class | Method | HTTP request | Description
158
158
  - [BmcApi::IpBlocksConfiguration](docs/IpBlocksConfiguration.md)
159
159
  - [BmcApi::NetworkConfiguration](docs/NetworkConfiguration.md)
160
160
  - [BmcApi::OsConfiguration](docs/OsConfiguration.md)
161
+ - [BmcApi::OsConfigurationCloudInit](docs/OsConfigurationCloudInit.md)
161
162
  - [BmcApi::OsConfigurationMap](docs/OsConfigurationMap.md)
162
163
  - [BmcApi::OsConfigurationMapEsxi](docs/OsConfigurationMapEsxi.md)
163
164
  - [BmcApi::OsConfigurationMapProxmox](docs/OsConfigurationMapProxmox.md)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.0
@@ -9,6 +9,7 @@
9
9
  | **management_ui_url** | **String** | The URL of the management UI which will only be returned in response to provisioning a server. | [optional][readonly] |
10
10
  | **management_access_allowed_ips** | **Array<String>** | List of IPs allowed to access the Management UI. Supported in single IP, CIDR and range format. When undefined, Management UI is disabled. This will only be returned in response to provisioning a server. | [optional] |
11
11
  | **install_os_to_ram** | **Boolean** | If true, OS will be installed to and booted from the server's RAM. On restart RAM OS will be lost and the server will not be reachable unless a custom bootable OS has been deployed. Only supported for ubuntu/focal. | [optional][default to false] |
12
+ | **cloud_init** | [**OsConfigurationCloudInit**](OsConfigurationCloudInit.md) | | [optional] |
12
13
 
13
14
  ## Example
14
15
 
@@ -20,7 +21,8 @@ instance = BmcApi::OsConfiguration.new(
20
21
  root_password: MyP@ssw0rd_01,
21
22
  management_ui_url: https://172.217.22.14,
22
23
  management_access_allowed_ips: ["172.217.22.14","10.111.14.40/29","10.111.14.66 - 10.111.14.71"],
23
- install_os_to_ram: null
24
+ install_os_to_ram: null,
25
+ cloud_init: null
24
26
  )
25
27
  ```
26
28
 
@@ -0,0 +1,18 @@
1
+ # BmcApi::OsConfigurationCloudInit
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **user_data** | **String** | User data for the <a href='https://cloudinit.readthedocs.io/en/latest/' target='_blank'>cloud-init</a> configuration in base64 encoding. NoCloud format is supported. Follow the <a href='https://phoenixnap.com/kb/bmc-cloud-init' target='_blank'>instructions</a> on how to provision a server using cloud-init. Only ubuntu/bionic and ubuntu/focal are supported. User data will not be stored and cannot be retrieved once you deploy the server. Copy and save it for future reference. | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'pnap_bmc_api'
13
+
14
+ instance = BmcApi::OsConfigurationCloudInit.new(
15
+ user_data: null
16
+ )
17
+ ```
18
+
data/docs/Server.md CHANGED
@@ -18,7 +18,7 @@
18
18
  | **ram** | **String** | A description of the machine RAM. | |
19
19
  | **storage** | **String** | A description of the machine storage. | |
20
20
  | **private_ip_addresses** | **Array<String>** | Private IP addresses assigned to server. | |
21
- | **public_ip_addresses** | **Array<String>** | Public IP addresses assigned to server. | |
21
+ | **public_ip_addresses** | **Array<String>** | Public IP addresses assigned to server. | [optional] |
22
22
  | **reservation_id** | **String** | The reservation reference id if any. | [optional] |
23
23
  | **pricing_model** | **String** | The pricing model this server is being billed. Currently this field should be set to `HOURLY`, `ONE_MONTH_RESERVATION`, `TWELVE_MONTHS_RESERVATION`, `TWENTY_FOUR_MONTHS_RESERVATION` or `THIRTY_SIX_MONTHS_RESERVATION`. | [default to 'HOURLY'] |
24
24
  | **password** | **String** | Password set for user Admin on Windows server or user root on ESXi server which will only be returned in response to provisioning a server. | [optional] |
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -95,6 +95,7 @@ module BmcApi
95
95
  header_params = @default_headers.merge(opts[:header_params] || {})
96
96
  query_params = opts[:query_params] || {}
97
97
  form_params = opts[:form_params] || {}
98
+ follow_location = opts[:follow_location] || true
98
99
 
99
100
  update_params_for_auth! header_params, query_params, opts[:auth_names]
100
101
 
@@ -111,7 +112,8 @@ module BmcApi
111
112
  :ssl_verifyhost => _verify_ssl_host,
112
113
  :sslcert => @config.cert_file,
113
114
  :sslkey => @config.key_file,
114
- :verbose => @config.debugging
115
+ :verbose => @config.debugging,
116
+ :followlocation => follow_location
115
117
  }
116
118
 
117
119
  # set custom cert, if provided
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -133,6 +133,7 @@ module BmcApi
133
133
  # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
134
134
  attr_accessor :params_encoding
135
135
 
136
+
136
137
  attr_accessor :inject_format
137
138
 
138
139
  attr_accessor :force_ending_format
@@ -150,10 +151,10 @@ module BmcApi
150
151
  @client_side_validation = true
151
152
  @verify_ssl = true
152
153
  @verify_ssl_host = true
153
- @params_encoding = nil
154
154
  @cert_file = nil
155
155
  @key_file = nil
156
156
  @timeout = 0
157
+ @params_encoding = nil
157
158
  @debugging = false
158
159
  @inject_format = false
159
160
  @force_ending_format = false
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -114,6 +114,7 @@ module BmcApi
114
114
  # @return [Object] Returns the model itself
115
115
  def build_from_hash(attributes)
116
116
  return nil unless attributes.is_a?(Hash)
117
+ attributes = attributes.transform_keys(&:to_sym)
117
118
  self.class.openapi_types.each_pair do |key, type|
118
119
  if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
119
120
  self.send("#{key}=", nil)
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -129,6 +129,7 @@ module BmcApi
129
129
  # @return [Object] Returns the model itself
130
130
  def build_from_hash(attributes)
131
131
  return nil unless attributes.is_a?(Hash)
132
+ attributes = attributes.transform_keys(&:to_sym)
132
133
  self.class.openapi_types.each_pair do |key, type|
133
134
  if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
134
135
  self.send("#{key}=", nil)
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -129,6 +129,7 @@ module BmcApi
129
129
  # @return [Object] Returns the model itself
130
130
  def build_from_hash(attributes)
131
131
  return nil unless attributes.is_a?(Hash)
132
+ attributes = attributes.transform_keys(&:to_sym)
132
133
  self.class.openapi_types.each_pair do |key, type|
133
134
  if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
134
135
  self.send("#{key}=", nil)
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -125,6 +125,7 @@ module BmcApi
125
125
  # @return [Object] Returns the model itself
126
126
  def build_from_hash(attributes)
127
127
  return nil unless attributes.is_a?(Hash)
128
+ attributes = attributes.transform_keys(&:to_sym)
128
129
  self.class.openapi_types.each_pair do |key, type|
129
130
  if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
130
131
  self.send("#{key}=", nil)
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -172,6 +172,7 @@ module BmcApi
172
172
  # @return [Object] Returns the model itself
173
173
  def build_from_hash(attributes)
174
174
  return nil unless attributes.is_a?(Hash)
175
+ attributes = attributes.transform_keys(&:to_sym)
175
176
  self.class.openapi_types.each_pair do |key, type|
176
177
  if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
177
178
  self.send("#{key}=", nil)
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -136,6 +136,7 @@ module BmcApi
136
136
  # @return [Object] Returns the model itself
137
137
  def build_from_hash(attributes)
138
138
  return nil unless attributes.is_a?(Hash)
139
+ attributes = attributes.transform_keys(&:to_sym)
139
140
  self.class.openapi_types.each_pair do |key, type|
140
141
  if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
141
142
  self.send("#{key}=", nil)
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -30,6 +30,8 @@ module BmcApi
30
30
  # If true, OS will be installed to and booted from the server's RAM. On restart RAM OS will be lost and the server will not be reachable unless a custom bootable OS has been deployed. Only supported for ubuntu/focal.
31
31
  attr_accessor :install_os_to_ram
32
32
 
33
+ attr_accessor :cloud_init
34
+
33
35
  # Attribute mapping from ruby-style variable name to JSON key.
34
36
  def self.attribute_map
35
37
  {
@@ -37,7 +39,8 @@ module BmcApi
37
39
  :'root_password' => :'rootPassword',
38
40
  :'management_ui_url' => :'managementUiUrl',
39
41
  :'management_access_allowed_ips' => :'managementAccessAllowedIps',
40
- :'install_os_to_ram' => :'installOsToRam'
42
+ :'install_os_to_ram' => :'installOsToRam',
43
+ :'cloud_init' => :'cloudInit'
41
44
  }
42
45
  end
43
46
 
@@ -53,7 +56,8 @@ module BmcApi
53
56
  :'root_password' => :'String',
54
57
  :'management_ui_url' => :'String',
55
58
  :'management_access_allowed_ips' => :'Array<String>',
56
- :'install_os_to_ram' => :'Boolean'
59
+ :'install_os_to_ram' => :'Boolean',
60
+ :'cloud_init' => :'OsConfigurationCloudInit'
57
61
  }
58
62
  end
59
63
 
@@ -101,6 +105,10 @@ module BmcApi
101
105
  else
102
106
  self.install_os_to_ram = false
103
107
  end
108
+
109
+ if attributes.key?(:'cloud_init')
110
+ self.cloud_init = attributes[:'cloud_init']
111
+ end
104
112
  end
105
113
 
106
114
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -140,7 +148,8 @@ module BmcApi
140
148
  root_password == o.root_password &&
141
149
  management_ui_url == o.management_ui_url &&
142
150
  management_access_allowed_ips == o.management_access_allowed_ips &&
143
- install_os_to_ram == o.install_os_to_ram
151
+ install_os_to_ram == o.install_os_to_ram &&
152
+ cloud_init == o.cloud_init
144
153
  end
145
154
 
146
155
  # @see the `==` method
@@ -152,7 +161,7 @@ module BmcApi
152
161
  # Calculates hash code according to all attributes.
153
162
  # @return [Integer] Hash code
154
163
  def hash
155
- [windows, root_password, management_ui_url, management_access_allowed_ips, install_os_to_ram].hash
164
+ [windows, root_password, management_ui_url, management_access_allowed_ips, install_os_to_ram, cloud_init].hash
156
165
  end
157
166
 
158
167
  # Builds the object from hash
@@ -167,6 +176,7 @@ module BmcApi
167
176
  # @return [Object] Returns the model itself
168
177
  def build_from_hash(attributes)
169
178
  return nil unless attributes.is_a?(Hash)
179
+ attributes = attributes.transform_keys(&:to_sym)
170
180
  self.class.openapi_types.each_pair do |key, type|
171
181
  if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
172
182
  self.send("#{key}=", nil)
@@ -0,0 +1,221 @@
1
+ =begin
2
+ #Bare Metal Cloud API
3
+
4
+ #Create, power off, power on, reset, reboot, or shut down your server with the Bare Metal Cloud API. Deprovision servers, get or edit SSH key details, assign public IPs, assign servers to networks and a lot more. Manage your infrastructure more efficiently using just a few simple 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/how-to-deploy-bare-metal-cloud-server' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/bmc/v1/)</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 BmcApi
17
+ # Cloud-init configuration details.
18
+ class OsConfigurationCloudInit
19
+ # User data for the <a href='https://cloudinit.readthedocs.io/en/latest/' target='_blank'>cloud-init</a> configuration in base64 encoding. NoCloud format is supported. Follow the <a href='https://phoenixnap.com/kb/bmc-cloud-init' target='_blank'>instructions</a> on how to provision a server using cloud-init. Only ubuntu/bionic and ubuntu/focal are supported. User data will not be stored and cannot be retrieved once you deploy the server. Copy and save it for future reference.
20
+ attr_accessor :user_data
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'user_data' => :'userData'
26
+ }
27
+ end
28
+
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'user_data' => :'String'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ ])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BmcApi::OsConfigurationCloudInit` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::OsConfigurationCloudInit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'user_data')
63
+ self.user_data = attributes[:'user_data']
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ user_data == o.user_data
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [user_data].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ new.build_from_hash(attributes)
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ self.class.openapi_types.each_pair do |key, type|
114
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
115
+ self.send("#{key}=", nil)
116
+ elsif type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ # models (e.g. Pet) or oneOf
168
+ klass = BmcApi.const_get(type)
169
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map { |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+
219
+ end
220
+
221
+ 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: 5.4.0
9
+ OpenAPI Generator version: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -126,6 +126,7 @@ module BmcApi
126
126
  # @return [Object] Returns the model itself
127
127
  def build_from_hash(attributes)
128
128
  return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
129
130
  self.class.openapi_types.each_pair do |key, type|
130
131
  if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
131
132
  self.send("#{key}=", nil)
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -146,6 +146,7 @@ module BmcApi
146
146
  # @return [Object] Returns the model itself
147
147
  def build_from_hash(attributes)
148
148
  return nil unless attributes.is_a?(Hash)
149
+ attributes = attributes.transform_keys(&:to_sym)
149
150
  self.class.openapi_types.each_pair do |key, type|
150
151
  if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
151
152
  self.send("#{key}=", nil)
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -146,6 +146,7 @@ module BmcApi
146
146
  # @return [Object] Returns the model itself
147
147
  def build_from_hash(attributes)
148
148
  return nil unless attributes.is_a?(Hash)
149
+ attributes = attributes.transform_keys(&:to_sym)
149
150
  self.class.openapi_types.each_pair do |key, type|
150
151
  if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
151
152
  self.send("#{key}=", nil)
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -126,6 +126,7 @@ module BmcApi
126
126
  # @return [Object] Returns the model itself
127
127
  def build_from_hash(attributes)
128
128
  return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
129
130
  self.class.openapi_types.each_pair do |key, type|
130
131
  if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
131
132
  self.send("#{key}=", nil)
@@ -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: 6.1.0
10
10
 
11
11
  =end
12
12
 
@@ -133,6 +133,7 @@ module BmcApi
133
133
  # @return [Object] Returns the model itself
134
134
  def build_from_hash(attributes)
135
135
  return nil unless attributes.is_a?(Hash)
136
+ attributes = attributes.transform_keys(&:to_sym)
136
137
  self.class.openapi_types.each_pair do |key, type|
137
138
  if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
138
139
  self.send("#{key}=", nil)