pnap_bmc_api 1.5.0 → 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 +5 -1
- data/VERSION +1 -1
- data/docs/DeleteResult.md +1 -1
- data/docs/OsConfigurationCloudInit.md +1 -1
- data/docs/QuotasApi.md +6 -8
- data/docs/SSHKeysApi.md +12 -16
- data/docs/Server.md +11 -7
- data/docs/ServerCreate.md +3 -3
- data/docs/ServerNetworkUpdate.md +2 -2
- data/docs/ServerPrivateNetwork.md +3 -3
- data/docs/ServerProvision.md +38 -0
- data/docs/ServerPublicNetwork.md +2 -2
- data/docs/ServersApi.md +173 -111
- data/docs/StorageConfigurationRootPartition.md +2 -2
- data/lib/pnap_bmc_api/api/quotas_api.rb +11 -7
- data/lib/pnap_bmc_api/api/servers_api.rb +200 -75
- data/lib/pnap_bmc_api/api/ssh_keys_api.rb +21 -13
- data/lib/pnap_bmc_api/api_client.rb +24 -21
- data/lib/pnap_bmc_api/api_error.rb +2 -1
- data/lib/pnap_bmc_api/configuration.rb +28 -9
- data/lib/pnap_bmc_api/models/action_result.rb +16 -19
- data/lib/pnap_bmc_api/models/delete_result.rb +18 -19
- data/lib/pnap_bmc_api/models/delete_ssh_key_result.rb +18 -19
- data/lib/pnap_bmc_api/models/error.rb +16 -19
- data/lib/pnap_bmc_api/models/ip_blocks_configuration.rb +19 -20
- data/lib/pnap_bmc_api/models/network_configuration.rb +14 -19
- data/lib/pnap_bmc_api/models/os_configuration.rb +19 -20
- data/lib/pnap_bmc_api/models/os_configuration_cloud_init.rb +15 -20
- data/lib/pnap_bmc_api/models/os_configuration_map.rb +14 -19
- data/lib/pnap_bmc_api/models/os_configuration_map_esxi.rb +19 -20
- data/lib/pnap_bmc_api/models/os_configuration_map_proxmox.rb +19 -20
- data/lib/pnap_bmc_api/models/os_configuration_netris_controller.rb +14 -19
- data/lib/pnap_bmc_api/models/os_configuration_netris_softgate.rb +25 -22
- data/lib/pnap_bmc_api/models/os_configuration_windows.rb +19 -20
- data/lib/pnap_bmc_api/models/private_network_configuration.rb +14 -19
- data/lib/pnap_bmc_api/models/public_network_configuration.rb +14 -19
- data/lib/pnap_bmc_api/models/quota.rb +30 -19
- data/lib/pnap_bmc_api/models/quota_edit_limit_request.rb +39 -19
- data/lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb +42 -21
- data/lib/pnap_bmc_api/models/relinquish_ip_block.rb +14 -19
- data/lib/pnap_bmc_api/models/reset_result.rb +16 -19
- data/lib/pnap_bmc_api/models/server.rb +79 -33
- data/lib/pnap_bmc_api/models/server_create.rb +29 -22
- data/lib/pnap_bmc_api/models/server_ip_block.rb +16 -19
- data/lib/pnap_bmc_api/models/server_network_update.rb +15 -20
- data/lib/pnap_bmc_api/models/server_patch.rb +27 -24
- data/lib/pnap_bmc_api/models/server_private_network.rb +23 -22
- data/lib/pnap_bmc_api/models/server_provision.rb +395 -0
- data/lib/pnap_bmc_api/models/server_public_network.rb +17 -20
- data/lib/pnap_bmc_api/models/server_reserve.rb +16 -19
- data/lib/pnap_bmc_api/models/server_reset.rb +14 -19
- data/lib/pnap_bmc_api/models/ssh_key.rb +28 -19
- data/lib/pnap_bmc_api/models/ssh_key_create.rb +52 -19
- data/lib/pnap_bmc_api/models/ssh_key_update.rb +29 -19
- data/lib/pnap_bmc_api/models/storage_configuration.rb +14 -19
- data/lib/pnap_bmc_api/models/storage_configuration_root_partition.rb +14 -19
- data/lib/pnap_bmc_api/models/tag_assignment.rb +20 -19
- data/lib/pnap_bmc_api/models/tag_assignment_request.rb +16 -19
- data/lib/pnap_bmc_api/version.rb +1 -1
- data/lib/pnap_bmc_api.rb +2 -2
- data/pnap_bmc_api.gemspec +2 -2
- data/spec/api/quotas_api_spec.rb +6 -6
- data/spec/api/servers_api_spec.rb +109 -36
- data/spec/api/ssh_keys_api_spec.rb +9 -9
- data/spec/models/action_result_spec.rb +6 -4
- data/spec/models/delete_result_spec.rb +7 -5
- data/spec/models/delete_ssh_key_result_spec.rb +7 -5
- data/spec/models/error_spec.rb +7 -5
- data/spec/models/ip_blocks_configuration_spec.rb +7 -5
- data/spec/models/network_configuration_spec.rb +19 -5
- data/spec/models/os_configuration_cloud_init_spec.rb +5 -3
- data/spec/models/os_configuration_map_esxi_spec.rb +8 -6
- data/spec/models/os_configuration_map_proxmox_spec.rb +8 -6
- data/spec/models/os_configuration_map_spec.rb +8 -6
- data/spec/models/os_configuration_netris_controller_spec.rb +7 -5
- data/spec/models/os_configuration_netris_softgate_spec.rb +8 -6
- data/spec/models/os_configuration_spec.rb +33 -7
- data/spec/models/os_configuration_windows_spec.rb +6 -4
- data/spec/models/private_network_configuration_spec.rb +8 -6
- data/spec/models/public_network_configuration_spec.rb +6 -4
- data/spec/models/quota_edit_limit_request_details_spec.rb +8 -6
- data/spec/models/quota_edit_limit_request_spec.rb +7 -5
- data/spec/models/quota_spec.rb +13 -15
- data/spec/models/relinquish_ip_block_spec.rb +6 -4
- data/spec/models/reset_result_spec.rb +8 -6
- data/spec/models/server_create_spec.rb +25 -17
- data/spec/models/server_ip_block_spec.rb +7 -5
- data/spec/models/server_network_update_spec.rb +5 -3
- data/spec/models/server_patch_spec.rb +7 -5
- data/spec/models/server_private_network_spec.rb +9 -7
- data/spec/models/server_provision_spec.rb +96 -0
- data/spec/models/server_public_network_spec.rb +8 -6
- data/spec/models/server_reserve_spec.rb +6 -4
- data/spec/models/server_reset_spec.rb +9 -7
- data/spec/models/server_spec.rb +47 -27
- data/spec/models/ssh_key_create_spec.rb +8 -6
- data/spec/models/ssh_key_spec.rb +12 -10
- data/spec/models/ssh_key_update_spec.rb +7 -5
- data/spec/models/storage_configuration_root_partition_spec.rb +6 -4
- data/spec/models/storage_configuration_spec.rb +5 -3
- data/spec/models/tag_assignment_request_spec.rb +7 -5
- data/spec/models/tag_assignment_spec.rb +10 -8
- data/spec/spec_helper.rb +1 -1
- metadata +38 -42
- data/docs/QuotaEditLimitRequestDetailsAllOf.md +0 -18
- data/lib/pnap_bmc_api/models/quota_edit_limit_request_details_all_of.rb +0 -226
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/quota_edit_limit_request_details_all_of_spec.rb +0 -34
@@ -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
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module BmcApi
|
17
|
-
#
|
17
|
+
# Patch bare metal server.
|
18
18
|
class ServerPatch
|
19
19
|
# Description of server.
|
20
20
|
attr_accessor :description
|
@@ -76,6 +76,7 @@ module BmcApi
|
|
76
76
|
# Show invalid properties with the reasons. Usually used together with valid?
|
77
77
|
# @return Array for valid properties with the reasons
|
78
78
|
def list_invalid_properties
|
79
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
79
80
|
invalid_properties = Array.new
|
80
81
|
if !@description.nil? && @description.to_s.length > 250
|
81
82
|
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.')
|
@@ -100,6 +101,7 @@ module BmcApi
|
|
100
101
|
# Check to see if the all the properties in the model are valid
|
101
102
|
# @return true if the model is valid
|
102
103
|
def valid?
|
104
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
103
105
|
return false if !@description.nil? && @description.to_s.length > 250
|
104
106
|
return false if !@hostname.nil? && @hostname.to_s.length > 100
|
105
107
|
return false if !@hostname.nil? && @hostname.to_s.length < 1
|
@@ -110,7 +112,11 @@ module BmcApi
|
|
110
112
|
# Custom attribute writer method with validation
|
111
113
|
# @param [Object] description Value to be assigned
|
112
114
|
def description=(description)
|
113
|
-
if
|
115
|
+
if description.nil?
|
116
|
+
fail ArgumentError, 'description cannot be nil'
|
117
|
+
end
|
118
|
+
|
119
|
+
if description.to_s.length > 250
|
114
120
|
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.'
|
115
121
|
end
|
116
122
|
|
@@ -120,16 +126,20 @@ module BmcApi
|
|
120
126
|
# Custom attribute writer method with validation
|
121
127
|
# @param [Object] hostname Value to be assigned
|
122
128
|
def hostname=(hostname)
|
123
|
-
if
|
129
|
+
if hostname.nil?
|
130
|
+
fail ArgumentError, 'hostname cannot be nil'
|
131
|
+
end
|
132
|
+
|
133
|
+
if hostname.to_s.length > 100
|
124
134
|
fail ArgumentError, 'invalid value for "hostname", the character length must be smaller than or equal to 100.'
|
125
135
|
end
|
126
136
|
|
127
|
-
if
|
137
|
+
if hostname.to_s.length < 1
|
128
138
|
fail ArgumentError, 'invalid value for "hostname", the character length must be great than or equal to 1.'
|
129
139
|
end
|
130
140
|
|
131
141
|
pattern = Regexp.new(/[a-zA-Z0-9().-]+/)
|
132
|
-
if
|
142
|
+
if hostname !~ pattern
|
133
143
|
fail ArgumentError, "invalid value for \"hostname\", must conform to the pattern #{pattern}."
|
134
144
|
end
|
135
145
|
|
@@ -161,37 +171,30 @@ module BmcApi
|
|
161
171
|
# @param [Hash] attributes Model attributes in the form of hash
|
162
172
|
# @return [Object] Returns the model itself
|
163
173
|
def self.build_from_hash(attributes)
|
164
|
-
new.build_from_hash(attributes)
|
165
|
-
end
|
166
|
-
|
167
|
-
# Builds the object from hash
|
168
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
169
|
-
# @return [Object] Returns the model itself
|
170
|
-
def build_from_hash(attributes)
|
171
174
|
return nil unless attributes.is_a?(Hash)
|
172
175
|
attributes = attributes.transform_keys(&:to_sym)
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
+
transformed_hash = {}
|
177
|
+
openapi_types.each_pair do |key, type|
|
178
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
179
|
+
transformed_hash["#{key}"] = nil
|
176
180
|
elsif type =~ /\AArray<(.*)>/i
|
177
181
|
# check to ensure the input is an array given that the attribute
|
178
182
|
# is documented as an array but the input is not
|
179
|
-
if attributes[
|
180
|
-
|
183
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
184
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
181
185
|
end
|
182
|
-
elsif !attributes[
|
183
|
-
|
186
|
+
elsif !attributes[attribute_map[key]].nil?
|
187
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
184
188
|
end
|
185
189
|
end
|
186
|
-
|
187
|
-
self
|
190
|
+
new(transformed_hash)
|
188
191
|
end
|
189
192
|
|
190
193
|
# Deserializes the data based on type
|
191
194
|
# @param string type Data type
|
192
195
|
# @param string value Value to be deserialized
|
193
196
|
# @return [Object] Deserialized data
|
194
|
-
def _deserialize(type, value)
|
197
|
+
def self._deserialize(type, value)
|
195
198
|
case type.to_sym
|
196
199
|
when :Time
|
197
200
|
Time.parse(value)
|
@@ -226,7 +229,7 @@ module BmcApi
|
|
226
229
|
else # model
|
227
230
|
# models (e.g. Pet) or oneOf
|
228
231
|
klass = BmcApi.const_get(type)
|
229
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
232
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
230
233
|
end
|
231
234
|
end
|
232
235
|
|
@@ -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
|
|
@@ -19,10 +19,10 @@ module BmcApi
|
|
19
19
|
# The network identifier.
|
20
20
|
attr_accessor :id
|
21
21
|
|
22
|
-
# IPs to configure/configured on the server.<br>
|
22
|
+
# IPs to configure/configured on the server.<br> Valid IP formats are single IPv4 addresses or IPv4 ranges. IPs must be within the network's range. Should be null or empty list if DHCP is true. <br> If field is undefined and DHCP is false, next available IP in network will be automatically allocated.<br> If the network contains a membership of type 'storage', the first twelve IPs are already reserved by BMC and not usable.<br> Setting the `force` query parameter to `true` allows you to:<ul> <li> Assign no specific IP addresses by designating an empty array of IPs. Note that at least one IP is required for the gateway address to be selected from this network. <li> Assign one or more IP addresses which are already configured on other resource(s) in network. <li> Assign IP addresses which are considered as reserved in network.</ul>
|
23
23
|
attr_accessor :ips
|
24
24
|
|
25
|
-
# Determines whether DHCP is enabled for this server. Should be false if any IPs are provided. Not supported for Proxmox OS
|
25
|
+
# Determines whether DHCP is enabled for this server. Should be false if any IPs are provided. Not supported for Proxmox OS.
|
26
26
|
attr_accessor :dhcp
|
27
27
|
|
28
28
|
# (Read-only) The status of the network.
|
@@ -76,6 +76,8 @@ module BmcApi
|
|
76
76
|
|
77
77
|
if attributes.key?(:'id')
|
78
78
|
self.id = attributes[:'id']
|
79
|
+
else
|
80
|
+
self.id = nil
|
79
81
|
end
|
80
82
|
|
81
83
|
if attributes.key?(:'ips')
|
@@ -98,6 +100,7 @@ module BmcApi
|
|
98
100
|
# Show invalid properties with the reasons. Usually used together with valid?
|
99
101
|
# @return Array for valid properties with the reasons
|
100
102
|
def list_invalid_properties
|
103
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
101
104
|
invalid_properties = Array.new
|
102
105
|
if @id.nil?
|
103
106
|
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
@@ -113,6 +116,7 @@ module BmcApi
|
|
113
116
|
# Check to see if the all the properties in the model are valid
|
114
117
|
# @return true if the model is valid
|
115
118
|
def valid?
|
119
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
116
120
|
return false if @id.nil?
|
117
121
|
return false if !@ips.nil? && @ips.length > 256
|
118
122
|
true
|
@@ -121,7 +125,11 @@ module BmcApi
|
|
121
125
|
# Custom attribute writer method with validation
|
122
126
|
# @param [Object] ips Value to be assigned
|
123
127
|
def ips=(ips)
|
124
|
-
if
|
128
|
+
if ips.nil?
|
129
|
+
fail ArgumentError, 'ips cannot be nil'
|
130
|
+
end
|
131
|
+
|
132
|
+
if ips.length > 256
|
125
133
|
fail ArgumentError, 'invalid value for "ips", number of items must be less than or equal to 256.'
|
126
134
|
end
|
127
135
|
|
@@ -155,37 +163,30 @@ module BmcApi
|
|
155
163
|
# @param [Hash] attributes Model attributes in the form of hash
|
156
164
|
# @return [Object] Returns the model itself
|
157
165
|
def self.build_from_hash(attributes)
|
158
|
-
new.build_from_hash(attributes)
|
159
|
-
end
|
160
|
-
|
161
|
-
# Builds the object from hash
|
162
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
163
|
-
# @return [Object] Returns the model itself
|
164
|
-
def build_from_hash(attributes)
|
165
166
|
return nil unless attributes.is_a?(Hash)
|
166
167
|
attributes = attributes.transform_keys(&:to_sym)
|
167
|
-
|
168
|
-
|
169
|
-
|
168
|
+
transformed_hash = {}
|
169
|
+
openapi_types.each_pair do |key, type|
|
170
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
171
|
+
transformed_hash["#{key}"] = nil
|
170
172
|
elsif type =~ /\AArray<(.*)>/i
|
171
173
|
# check to ensure the input is an array given that the attribute
|
172
174
|
# is documented as an array but the input is not
|
173
|
-
if attributes[
|
174
|
-
|
175
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
176
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
175
177
|
end
|
176
|
-
elsif !attributes[
|
177
|
-
|
178
|
+
elsif !attributes[attribute_map[key]].nil?
|
179
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
178
180
|
end
|
179
181
|
end
|
180
|
-
|
181
|
-
self
|
182
|
+
new(transformed_hash)
|
182
183
|
end
|
183
184
|
|
184
185
|
# Deserializes the data based on type
|
185
186
|
# @param string type Data type
|
186
187
|
# @param string value Value to be deserialized
|
187
188
|
# @return [Object] Deserialized data
|
188
|
-
def _deserialize(type, value)
|
189
|
+
def self._deserialize(type, value)
|
189
190
|
case type.to_sym
|
190
191
|
when :Time
|
191
192
|
Time.parse(value)
|
@@ -220,7 +221,7 @@ module BmcApi
|
|
220
221
|
else # model
|
221
222
|
# models (e.g. Pet) or oneOf
|
222
223
|
klass = BmcApi.const_get(type)
|
223
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
224
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
224
225
|
end
|
225
226
|
end
|
226
227
|
|
@@ -0,0 +1,395 @@
|
|
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: 7.2.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module BmcApi
|
17
|
+
# Provision bare metal server.
|
18
|
+
class ServerProvision
|
19
|
+
# Hostname of server.
|
20
|
+
attr_accessor :hostname
|
21
|
+
|
22
|
+
# Description of server.
|
23
|
+
attr_accessor :description
|
24
|
+
|
25
|
+
# The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `debian/bullseye`, `debian/bookworm`, `proxmox/bullseye`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`.
|
26
|
+
attr_accessor :os
|
27
|
+
|
28
|
+
# Whether or not to install SSH keys marked as default in addition to any SSH keys specified in this request.
|
29
|
+
attr_accessor :install_default_ssh_keys
|
30
|
+
|
31
|
+
# A list of SSH keys that will be installed on the server.
|
32
|
+
attr_accessor :ssh_keys
|
33
|
+
|
34
|
+
# A list of SSH key IDs that will be installed on the server in addition to any SSH keys specified in this request.
|
35
|
+
attr_accessor :ssh_key_ids
|
36
|
+
|
37
|
+
# The type of network configuration for this server.<br> Currently this field should be set to `PUBLIC_AND_PRIVATE`, `PRIVATE_ONLY`, `PUBLIC_ONLY` or `USER_DEFINED`.<br> Setting the `force` query parameter to `true` allows you to configure network configuration type as `NONE`.
|
38
|
+
attr_accessor :network_type
|
39
|
+
|
40
|
+
attr_accessor :os_configuration
|
41
|
+
|
42
|
+
# Tags to set to the server. To create a new tag or list all the existing tags that you can use, refer to [Tags API](https://developers.phoenixnap.com/docs/tags/1/overview).
|
43
|
+
attr_accessor :tags
|
44
|
+
|
45
|
+
attr_accessor :network_configuration
|
46
|
+
|
47
|
+
attr_accessor :storage_configuration
|
48
|
+
|
49
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
50
|
+
def self.attribute_map
|
51
|
+
{
|
52
|
+
:'hostname' => :'hostname',
|
53
|
+
:'description' => :'description',
|
54
|
+
:'os' => :'os',
|
55
|
+
:'install_default_ssh_keys' => :'installDefaultSshKeys',
|
56
|
+
:'ssh_keys' => :'sshKeys',
|
57
|
+
:'ssh_key_ids' => :'sshKeyIds',
|
58
|
+
:'network_type' => :'networkType',
|
59
|
+
:'os_configuration' => :'osConfiguration',
|
60
|
+
:'tags' => :'tags',
|
61
|
+
:'network_configuration' => :'networkConfiguration',
|
62
|
+
:'storage_configuration' => :'storageConfiguration'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Returns all the JSON keys this model knows about
|
67
|
+
def self.acceptable_attributes
|
68
|
+
attribute_map.values
|
69
|
+
end
|
70
|
+
|
71
|
+
# Attribute type mapping.
|
72
|
+
def self.openapi_types
|
73
|
+
{
|
74
|
+
:'hostname' => :'String',
|
75
|
+
:'description' => :'String',
|
76
|
+
:'os' => :'String',
|
77
|
+
:'install_default_ssh_keys' => :'Boolean',
|
78
|
+
:'ssh_keys' => :'Array<String>',
|
79
|
+
:'ssh_key_ids' => :'Array<String>',
|
80
|
+
:'network_type' => :'String',
|
81
|
+
:'os_configuration' => :'OsConfiguration',
|
82
|
+
:'tags' => :'Array<TagAssignmentRequest>',
|
83
|
+
:'network_configuration' => :'NetworkConfiguration',
|
84
|
+
:'storage_configuration' => :'StorageConfiguration'
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
# List of attributes with nullable: true
|
89
|
+
def self.openapi_nullable
|
90
|
+
Set.new([
|
91
|
+
])
|
92
|
+
end
|
93
|
+
|
94
|
+
# Initializes the object
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
96
|
+
def initialize(attributes = {})
|
97
|
+
if (!attributes.is_a?(Hash))
|
98
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BmcApi::ServerProvision` initialize method"
|
99
|
+
end
|
100
|
+
|
101
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
102
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
103
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
104
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::ServerProvision`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
105
|
+
end
|
106
|
+
h[k.to_sym] = v
|
107
|
+
}
|
108
|
+
|
109
|
+
if attributes.key?(:'hostname')
|
110
|
+
self.hostname = attributes[:'hostname']
|
111
|
+
else
|
112
|
+
self.hostname = nil
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'description')
|
116
|
+
self.description = attributes[:'description']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'os')
|
120
|
+
self.os = attributes[:'os']
|
121
|
+
else
|
122
|
+
self.os = nil
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'install_default_ssh_keys')
|
126
|
+
self.install_default_ssh_keys = attributes[:'install_default_ssh_keys']
|
127
|
+
else
|
128
|
+
self.install_default_ssh_keys = true
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.key?(:'ssh_keys')
|
132
|
+
if (value = attributes[:'ssh_keys']).is_a?(Array)
|
133
|
+
self.ssh_keys = value
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.key?(:'ssh_key_ids')
|
138
|
+
if (value = attributes[:'ssh_key_ids']).is_a?(Array)
|
139
|
+
self.ssh_key_ids = value
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.key?(:'network_type')
|
144
|
+
self.network_type = attributes[:'network_type']
|
145
|
+
else
|
146
|
+
self.network_type = 'PUBLIC_AND_PRIVATE'
|
147
|
+
end
|
148
|
+
|
149
|
+
if attributes.key?(:'os_configuration')
|
150
|
+
self.os_configuration = attributes[:'os_configuration']
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.key?(:'tags')
|
154
|
+
if (value = attributes[:'tags']).is_a?(Array)
|
155
|
+
self.tags = value
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
if attributes.key?(:'network_configuration')
|
160
|
+
self.network_configuration = attributes[:'network_configuration']
|
161
|
+
end
|
162
|
+
|
163
|
+
if attributes.key?(:'storage_configuration')
|
164
|
+
self.storage_configuration = attributes[:'storage_configuration']
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
169
|
+
# @return Array for valid properties with the reasons
|
170
|
+
def list_invalid_properties
|
171
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
172
|
+
invalid_properties = Array.new
|
173
|
+
if @hostname.nil?
|
174
|
+
invalid_properties.push('invalid value for "hostname", hostname cannot be nil.')
|
175
|
+
end
|
176
|
+
|
177
|
+
if @hostname.to_s.length > 100
|
178
|
+
invalid_properties.push('invalid value for "hostname", the character length must be smaller than or equal to 100.')
|
179
|
+
end
|
180
|
+
|
181
|
+
if @hostname.to_s.length < 1
|
182
|
+
invalid_properties.push('invalid value for "hostname", the character length must be great than or equal to 1.')
|
183
|
+
end
|
184
|
+
|
185
|
+
pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/)
|
186
|
+
if @hostname !~ pattern
|
187
|
+
invalid_properties.push("invalid value for \"hostname\", must conform to the pattern #{pattern}.")
|
188
|
+
end
|
189
|
+
|
190
|
+
if !@description.nil? && @description.to_s.length > 250
|
191
|
+
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.')
|
192
|
+
end
|
193
|
+
|
194
|
+
if @os.nil?
|
195
|
+
invalid_properties.push('invalid value for "os", os cannot be nil.')
|
196
|
+
end
|
197
|
+
|
198
|
+
invalid_properties
|
199
|
+
end
|
200
|
+
|
201
|
+
# Check to see if the all the properties in the model are valid
|
202
|
+
# @return true if the model is valid
|
203
|
+
def valid?
|
204
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
205
|
+
return false if @hostname.nil?
|
206
|
+
return false if @hostname.to_s.length > 100
|
207
|
+
return false if @hostname.to_s.length < 1
|
208
|
+
return false if @hostname !~ Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/)
|
209
|
+
return false if !@description.nil? && @description.to_s.length > 250
|
210
|
+
return false if @os.nil?
|
211
|
+
true
|
212
|
+
end
|
213
|
+
|
214
|
+
# Custom attribute writer method with validation
|
215
|
+
# @param [Object] hostname Value to be assigned
|
216
|
+
def hostname=(hostname)
|
217
|
+
if hostname.nil?
|
218
|
+
fail ArgumentError, 'hostname cannot be nil'
|
219
|
+
end
|
220
|
+
|
221
|
+
if hostname.to_s.length > 100
|
222
|
+
fail ArgumentError, 'invalid value for "hostname", the character length must be smaller than or equal to 100.'
|
223
|
+
end
|
224
|
+
|
225
|
+
if hostname.to_s.length < 1
|
226
|
+
fail ArgumentError, 'invalid value for "hostname", the character length must be great than or equal to 1.'
|
227
|
+
end
|
228
|
+
|
229
|
+
pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/)
|
230
|
+
if hostname !~ pattern
|
231
|
+
fail ArgumentError, "invalid value for \"hostname\", must conform to the pattern #{pattern}."
|
232
|
+
end
|
233
|
+
|
234
|
+
@hostname = hostname
|
235
|
+
end
|
236
|
+
|
237
|
+
# Custom attribute writer method with validation
|
238
|
+
# @param [Object] description Value to be assigned
|
239
|
+
def description=(description)
|
240
|
+
if description.nil?
|
241
|
+
fail ArgumentError, 'description cannot be nil'
|
242
|
+
end
|
243
|
+
|
244
|
+
if description.to_s.length > 250
|
245
|
+
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.'
|
246
|
+
end
|
247
|
+
|
248
|
+
@description = description
|
249
|
+
end
|
250
|
+
|
251
|
+
# Checks equality by comparing each attribute.
|
252
|
+
# @param [Object] Object to be compared
|
253
|
+
def ==(o)
|
254
|
+
return true if self.equal?(o)
|
255
|
+
self.class == o.class &&
|
256
|
+
hostname == o.hostname &&
|
257
|
+
description == o.description &&
|
258
|
+
os == o.os &&
|
259
|
+
install_default_ssh_keys == o.install_default_ssh_keys &&
|
260
|
+
ssh_keys == o.ssh_keys &&
|
261
|
+
ssh_key_ids == o.ssh_key_ids &&
|
262
|
+
network_type == o.network_type &&
|
263
|
+
os_configuration == o.os_configuration &&
|
264
|
+
tags == o.tags &&
|
265
|
+
network_configuration == o.network_configuration &&
|
266
|
+
storage_configuration == o.storage_configuration
|
267
|
+
end
|
268
|
+
|
269
|
+
# @see the `==` method
|
270
|
+
# @param [Object] Object to be compared
|
271
|
+
def eql?(o)
|
272
|
+
self == o
|
273
|
+
end
|
274
|
+
|
275
|
+
# Calculates hash code according to all attributes.
|
276
|
+
# @return [Integer] Hash code
|
277
|
+
def hash
|
278
|
+
[hostname, description, os, install_default_ssh_keys, ssh_keys, ssh_key_ids, network_type, os_configuration, tags, network_configuration, storage_configuration].hash
|
279
|
+
end
|
280
|
+
|
281
|
+
# Builds the object from hash
|
282
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
283
|
+
# @return [Object] Returns the model itself
|
284
|
+
def self.build_from_hash(attributes)
|
285
|
+
return nil unless attributes.is_a?(Hash)
|
286
|
+
attributes = attributes.transform_keys(&:to_sym)
|
287
|
+
transformed_hash = {}
|
288
|
+
openapi_types.each_pair do |key, type|
|
289
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
290
|
+
transformed_hash["#{key}"] = nil
|
291
|
+
elsif type =~ /\AArray<(.*)>/i
|
292
|
+
# check to ensure the input is an array given that the attribute
|
293
|
+
# is documented as an array but the input is not
|
294
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
295
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
296
|
+
end
|
297
|
+
elsif !attributes[attribute_map[key]].nil?
|
298
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
299
|
+
end
|
300
|
+
end
|
301
|
+
new(transformed_hash)
|
302
|
+
end
|
303
|
+
|
304
|
+
# Deserializes the data based on type
|
305
|
+
# @param string type Data type
|
306
|
+
# @param string value Value to be deserialized
|
307
|
+
# @return [Object] Deserialized data
|
308
|
+
def self._deserialize(type, value)
|
309
|
+
case type.to_sym
|
310
|
+
when :Time
|
311
|
+
Time.parse(value)
|
312
|
+
when :Date
|
313
|
+
Date.parse(value)
|
314
|
+
when :String
|
315
|
+
value.to_s
|
316
|
+
when :Integer
|
317
|
+
value.to_i
|
318
|
+
when :Float
|
319
|
+
value.to_f
|
320
|
+
when :Boolean
|
321
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
322
|
+
true
|
323
|
+
else
|
324
|
+
false
|
325
|
+
end
|
326
|
+
when :Object
|
327
|
+
# generic object (usually a Hash), return directly
|
328
|
+
value
|
329
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
330
|
+
inner_type = Regexp.last_match[:inner_type]
|
331
|
+
value.map { |v| _deserialize(inner_type, v) }
|
332
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
333
|
+
k_type = Regexp.last_match[:k_type]
|
334
|
+
v_type = Regexp.last_match[:v_type]
|
335
|
+
{}.tap do |hash|
|
336
|
+
value.each do |k, v|
|
337
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
338
|
+
end
|
339
|
+
end
|
340
|
+
else # model
|
341
|
+
# models (e.g. Pet) or oneOf
|
342
|
+
klass = BmcApi.const_get(type)
|
343
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
# Returns the string representation of the object
|
348
|
+
# @return [String] String presentation of the object
|
349
|
+
def to_s
|
350
|
+
to_hash.to_s
|
351
|
+
end
|
352
|
+
|
353
|
+
# to_body is an alias to to_hash (backward compatibility)
|
354
|
+
# @return [Hash] Returns the object in the form of hash
|
355
|
+
def to_body
|
356
|
+
to_hash
|
357
|
+
end
|
358
|
+
|
359
|
+
# Returns the object in the form of hash
|
360
|
+
# @return [Hash] Returns the object in the form of hash
|
361
|
+
def to_hash
|
362
|
+
hash = {}
|
363
|
+
self.class.attribute_map.each_pair do |attr, param|
|
364
|
+
value = self.send(attr)
|
365
|
+
if value.nil?
|
366
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
367
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
368
|
+
end
|
369
|
+
|
370
|
+
hash[param] = _to_hash(value)
|
371
|
+
end
|
372
|
+
hash
|
373
|
+
end
|
374
|
+
|
375
|
+
# Outputs non-array value in the form of hash
|
376
|
+
# For object, use to_hash. Otherwise, just return the value
|
377
|
+
# @param [Object] value Any valid value
|
378
|
+
# @return [Hash] Returns the value in the form of hash
|
379
|
+
def _to_hash(value)
|
380
|
+
if value.is_a?(Array)
|
381
|
+
value.compact.map { |v| _to_hash(v) }
|
382
|
+
elsif value.is_a?(Hash)
|
383
|
+
{}.tap do |hash|
|
384
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
385
|
+
end
|
386
|
+
elsif value.respond_to? :to_hash
|
387
|
+
value.to_hash
|
388
|
+
else
|
389
|
+
value
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
end
|
394
|
+
|
395
|
+
end
|