pnap_bmc_api 2.3.0 → 2.4.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 +4 -0
- data/VERSION +1 -1
- data/docs/OsConfiguration.md +3 -1
- data/docs/OsConfigurationCloudInit.md +1 -1
- data/docs/OsConfigurationIPXE.md +20 -0
- data/docs/OsConfigurationIPXENativeVlanConfiguration.md +22 -0
- data/docs/RebootRequest.md +20 -0
- data/docs/Server.md +2 -2
- data/docs/ServerCreate.md +1 -1
- data/docs/ServerProvision.md +1 -1
- data/docs/ServerPublicNetwork.md +1 -1
- data/docs/ServersApi.md +85 -7
- data/lib/pnap_bmc_api/api/servers_api.rb +85 -1
- data/lib/pnap_bmc_api/models/os_configuration.rb +13 -4
- data/lib/pnap_bmc_api/models/os_configuration_ipxe.rb +186 -0
- data/lib/pnap_bmc_api/models/os_configuration_ipxe_native_vlan_configuration.rb +224 -0
- data/lib/pnap_bmc_api/models/quota_edit_limit_request.rb +3 -3
- data/lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb +4 -8
- data/lib/pnap_bmc_api/models/reboot_request.rb +212 -0
- data/lib/pnap_bmc_api/models/server.rb +2 -2
- data/lib/pnap_bmc_api/models/server_create.rb +1 -1
- data/lib/pnap_bmc_api/models/server_provision.rb +1 -1
- data/lib/pnap_bmc_api/models/server_public_network.rb +18 -1
- data/lib/pnap_bmc_api.rb +3 -0
- data/spec/api/servers_api_spec.rb +15 -0
- data/spec/models/os_configuration_ipxe_native_vlan_configuration_spec.rb +52 -0
- data/spec/models/os_configuration_ipxe_spec.rb +42 -0
- data/spec/models/os_configuration_spec.rb +6 -0
- data/spec/models/reboot_request_spec.rb +46 -0
- metadata +45 -33
|
@@ -0,0 +1,186 @@
|
|
|
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
|
+
Generator version: 7.20.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module BmcApi
|
|
17
|
+
# iPXE configuration details. Configures the server to boot using the iPXE network boot firmware with a custom boot script. Only applicable when osName is 'ipxe' and must not be provided for any other OS.
|
|
18
|
+
class OsConfigurationIPXE < ApiModelBase
|
|
19
|
+
# The URL of the iPXE boot script used to start the server.
|
|
20
|
+
attr_accessor :url
|
|
21
|
+
|
|
22
|
+
attr_accessor :native_vlan_configuration
|
|
23
|
+
|
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
|
+
def self.attribute_map
|
|
26
|
+
{
|
|
27
|
+
:'url' => :'url',
|
|
28
|
+
:'native_vlan_configuration' => :'nativeVlanConfiguration'
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Returns attribute mapping this model knows about
|
|
33
|
+
def self.acceptable_attribute_map
|
|
34
|
+
attribute_map
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Returns all the JSON keys this model knows about
|
|
38
|
+
def self.acceptable_attributes
|
|
39
|
+
acceptable_attribute_map.values
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Attribute type mapping.
|
|
43
|
+
def self.openapi_types
|
|
44
|
+
{
|
|
45
|
+
:'url' => :'String',
|
|
46
|
+
:'native_vlan_configuration' => :'OsConfigurationIPXENativeVlanConfiguration'
|
|
47
|
+
}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# List of attributes with nullable: true
|
|
51
|
+
def self.openapi_nullable
|
|
52
|
+
Set.new([
|
|
53
|
+
])
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Initializes the object
|
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
58
|
+
def initialize(attributes = {})
|
|
59
|
+
if (!attributes.is_a?(Hash))
|
|
60
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BmcApi::OsConfigurationIPXE` initialize method"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
64
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
65
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
66
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
67
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::OsConfigurationIPXE`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
68
|
+
end
|
|
69
|
+
h[k.to_sym] = v
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if attributes.key?(:'url')
|
|
73
|
+
self.url = attributes[:'url']
|
|
74
|
+
else
|
|
75
|
+
self.url = nil
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
if attributes.key?(:'native_vlan_configuration')
|
|
79
|
+
self.native_vlan_configuration = attributes[:'native_vlan_configuration']
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
84
|
+
# @return Array for valid properties with the reasons
|
|
85
|
+
def list_invalid_properties
|
|
86
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
87
|
+
invalid_properties = Array.new
|
|
88
|
+
if @url.nil?
|
|
89
|
+
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
pattern = Regexp.new(/^https?:\/\/.+$/)
|
|
93
|
+
if @url !~ pattern
|
|
94
|
+
invalid_properties.push("invalid value for \"url\", must conform to the pattern #{pattern}.")
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
invalid_properties
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Check to see if the all the properties in the model are valid
|
|
101
|
+
# @return true if the model is valid
|
|
102
|
+
def valid?
|
|
103
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
104
|
+
return false if @url.nil?
|
|
105
|
+
return false if @url !~ Regexp.new(/^https?:\/\/.+$/)
|
|
106
|
+
true
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Custom attribute writer method with validation
|
|
110
|
+
# @param [Object] url Value to be assigned
|
|
111
|
+
def url=(url)
|
|
112
|
+
if url.nil?
|
|
113
|
+
fail ArgumentError, 'url cannot be nil'
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
pattern = Regexp.new(/^https?:\/\/.+$/)
|
|
117
|
+
if url !~ pattern
|
|
118
|
+
fail ArgumentError, "invalid value for \"url\", must conform to the pattern #{pattern}."
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
@url = url
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Checks equality by comparing each attribute.
|
|
125
|
+
# @param [Object] Object to be compared
|
|
126
|
+
def ==(o)
|
|
127
|
+
return true if self.equal?(o)
|
|
128
|
+
self.class == o.class &&
|
|
129
|
+
url == o.url &&
|
|
130
|
+
native_vlan_configuration == o.native_vlan_configuration
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# @see the `==` method
|
|
134
|
+
# @param [Object] Object to be compared
|
|
135
|
+
def eql?(o)
|
|
136
|
+
self == o
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Calculates hash code according to all attributes.
|
|
140
|
+
# @return [Integer] Hash code
|
|
141
|
+
def hash
|
|
142
|
+
[url, native_vlan_configuration].hash
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Builds the object from hash
|
|
146
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
147
|
+
# @return [Object] Returns the model itself
|
|
148
|
+
def self.build_from_hash(attributes)
|
|
149
|
+
return nil unless attributes.is_a?(Hash)
|
|
150
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
151
|
+
transformed_hash = {}
|
|
152
|
+
openapi_types.each_pair do |key, type|
|
|
153
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
154
|
+
transformed_hash["#{key}"] = nil
|
|
155
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
156
|
+
# check to ensure the input is an array given that the attribute
|
|
157
|
+
# is documented as an array but the input is not
|
|
158
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
159
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
160
|
+
end
|
|
161
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
162
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
new(transformed_hash)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Returns the object in the form of hash
|
|
169
|
+
# @return [Hash] Returns the object in the form of hash
|
|
170
|
+
def to_hash
|
|
171
|
+
hash = {}
|
|
172
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
173
|
+
value = self.send(attr)
|
|
174
|
+
if value.nil?
|
|
175
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
176
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
hash[param] = _to_hash(value)
|
|
180
|
+
end
|
|
181
|
+
hash
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
end
|
|
@@ -0,0 +1,224 @@
|
|
|
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
|
+
Generator version: 7.20.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module BmcApi
|
|
17
|
+
# Specifies the native VLAN configuration for the server.
|
|
18
|
+
class OsConfigurationIPXENativeVlanConfiguration < ApiModelBase
|
|
19
|
+
# The VLAN ID of the network to be used as the native VLAN. The value must reference a public network with IP V4 block(s) or a public IP V4 block network to which the server is (or will be) attached. If omitted during provisioning, the native VLAN is matched to the configured/auto-purchased public IP V4 block. If no public IP block is available, a VLAN ID must be provided. The VLAN ID must belong to one of the public networks for any of the specified servers. During post-provisioning, if Native VLAN is omitted, the server will be configured with no native VLAN. If provided, the VLAN ID must be specified and must belong to any of the existing server public networks or IP block networks attached to the server.
|
|
20
|
+
attr_accessor :vlan_id
|
|
21
|
+
|
|
22
|
+
# The static IP V4 address assigned to the server within the native VLAN. This address is set as the DHCP reservation and used for the iPXE boot process. Value must be an available/unused IP V4 address within the native network usable IP range. If omitted, the first available IP in the native network will be automatically assigned. Therefore, at least one IP must be available within the native network.
|
|
23
|
+
attr_accessor :static_dhcp_address_v4
|
|
24
|
+
|
|
25
|
+
# (Read-only) The status of the native VLAN configuration.
|
|
26
|
+
attr_accessor :status
|
|
27
|
+
|
|
28
|
+
class EnumAttributeValidator
|
|
29
|
+
attr_reader :datatype
|
|
30
|
+
attr_reader :allowable_values
|
|
31
|
+
|
|
32
|
+
def initialize(datatype, allowable_values)
|
|
33
|
+
@allowable_values = allowable_values.map do |value|
|
|
34
|
+
case datatype.to_s
|
|
35
|
+
when /Integer/i
|
|
36
|
+
value.to_i
|
|
37
|
+
when /Float/i
|
|
38
|
+
value.to_f
|
|
39
|
+
else
|
|
40
|
+
value
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def valid?(value)
|
|
46
|
+
!value || allowable_values.include?(value)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
51
|
+
def self.attribute_map
|
|
52
|
+
{
|
|
53
|
+
:'vlan_id' => :'vlanId',
|
|
54
|
+
:'static_dhcp_address_v4' => :'staticDhcpAddressV4',
|
|
55
|
+
:'status' => :'status'
|
|
56
|
+
}
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Returns attribute mapping this model knows about
|
|
60
|
+
def self.acceptable_attribute_map
|
|
61
|
+
attribute_map
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Returns all the JSON keys this model knows about
|
|
65
|
+
def self.acceptable_attributes
|
|
66
|
+
acceptable_attribute_map.values
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Attribute type mapping.
|
|
70
|
+
def self.openapi_types
|
|
71
|
+
{
|
|
72
|
+
:'vlan_id' => :'Integer',
|
|
73
|
+
:'static_dhcp_address_v4' => :'String',
|
|
74
|
+
:'status' => :'String'
|
|
75
|
+
}
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# List of attributes with nullable: true
|
|
79
|
+
def self.openapi_nullable
|
|
80
|
+
Set.new([
|
|
81
|
+
])
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Initializes the object
|
|
85
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
86
|
+
def initialize(attributes = {})
|
|
87
|
+
if (!attributes.is_a?(Hash))
|
|
88
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BmcApi::OsConfigurationIPXENativeVlanConfiguration` initialize method"
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
92
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
93
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
94
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
95
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::OsConfigurationIPXENativeVlanConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
96
|
+
end
|
|
97
|
+
h[k.to_sym] = v
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'vlan_id')
|
|
101
|
+
self.vlan_id = attributes[:'vlan_id']
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'static_dhcp_address_v4')
|
|
105
|
+
self.static_dhcp_address_v4 = attributes[:'static_dhcp_address_v4']
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'status')
|
|
109
|
+
self.status = attributes[:'status']
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
114
|
+
# @return Array for valid properties with the reasons
|
|
115
|
+
def list_invalid_properties
|
|
116
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
117
|
+
invalid_properties = Array.new
|
|
118
|
+
pattern = Regexp.new(/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.)){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/)
|
|
119
|
+
if !@static_dhcp_address_v4.nil? && @static_dhcp_address_v4 !~ pattern
|
|
120
|
+
invalid_properties.push("invalid value for \"static_dhcp_address_v4\", must conform to the pattern #{pattern}.")
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
invalid_properties
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Check to see if the all the properties in the model are valid
|
|
127
|
+
# @return true if the model is valid
|
|
128
|
+
def valid?
|
|
129
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
130
|
+
return false if !@static_dhcp_address_v4.nil? && @static_dhcp_address_v4 !~ Regexp.new(/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.)){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/)
|
|
131
|
+
status_validator = EnumAttributeValidator.new('String', ["in-progress", "assigned", "error"])
|
|
132
|
+
return false unless status_validator.valid?(@status)
|
|
133
|
+
true
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Custom attribute writer method with validation
|
|
137
|
+
# @param [Object] static_dhcp_address_v4 Value to be assigned
|
|
138
|
+
def static_dhcp_address_v4=(static_dhcp_address_v4)
|
|
139
|
+
if static_dhcp_address_v4.nil?
|
|
140
|
+
fail ArgumentError, 'static_dhcp_address_v4 cannot be nil'
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
pattern = Regexp.new(/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.)){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/)
|
|
144
|
+
if static_dhcp_address_v4 !~ pattern
|
|
145
|
+
fail ArgumentError, "invalid value for \"static_dhcp_address_v4\", must conform to the pattern #{pattern}."
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
@static_dhcp_address_v4 = static_dhcp_address_v4
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
152
|
+
# @param [Object] status Object to be assigned
|
|
153
|
+
def status=(status)
|
|
154
|
+
validator = EnumAttributeValidator.new('String', ["in-progress", "assigned", "error"])
|
|
155
|
+
unless validator.valid?(status)
|
|
156
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
|
157
|
+
end
|
|
158
|
+
@status = status
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Checks equality by comparing each attribute.
|
|
162
|
+
# @param [Object] Object to be compared
|
|
163
|
+
def ==(o)
|
|
164
|
+
return true if self.equal?(o)
|
|
165
|
+
self.class == o.class &&
|
|
166
|
+
vlan_id == o.vlan_id &&
|
|
167
|
+
static_dhcp_address_v4 == o.static_dhcp_address_v4 &&
|
|
168
|
+
status == o.status
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# @see the `==` method
|
|
172
|
+
# @param [Object] Object to be compared
|
|
173
|
+
def eql?(o)
|
|
174
|
+
self == o
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Calculates hash code according to all attributes.
|
|
178
|
+
# @return [Integer] Hash code
|
|
179
|
+
def hash
|
|
180
|
+
[vlan_id, static_dhcp_address_v4, status].hash
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Builds the object from hash
|
|
184
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
185
|
+
# @return [Object] Returns the model itself
|
|
186
|
+
def self.build_from_hash(attributes)
|
|
187
|
+
return nil unless attributes.is_a?(Hash)
|
|
188
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
189
|
+
transformed_hash = {}
|
|
190
|
+
openapi_types.each_pair do |key, type|
|
|
191
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
192
|
+
transformed_hash["#{key}"] = nil
|
|
193
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
194
|
+
# check to ensure the input is an array given that the attribute
|
|
195
|
+
# is documented as an array but the input is not
|
|
196
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
197
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
198
|
+
end
|
|
199
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
200
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
new(transformed_hash)
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Returns the object in the form of hash
|
|
207
|
+
# @return [Hash] Returns the object in the form of hash
|
|
208
|
+
def to_hash
|
|
209
|
+
hash = {}
|
|
210
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
211
|
+
value = self.send(attr)
|
|
212
|
+
if value.nil?
|
|
213
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
214
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
hash[param] = _to_hash(value)
|
|
218
|
+
end
|
|
219
|
+
hash
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
end
|
|
@@ -100,7 +100,7 @@ module BmcApi
|
|
|
100
100
|
invalid_properties.push('invalid value for "reason", reason cannot be nil.')
|
|
101
101
|
end
|
|
102
102
|
|
|
103
|
-
pattern = Regexp.new(/^
|
|
103
|
+
pattern = Regexp.new(/^[\s\S]*\S[\s\S]*$/)
|
|
104
104
|
if @reason !~ pattern
|
|
105
105
|
invalid_properties.push("invalid value for \"reason\", must conform to the pattern #{pattern}.")
|
|
106
106
|
end
|
|
@@ -115,7 +115,7 @@ module BmcApi
|
|
|
115
115
|
return false if @limit.nil?
|
|
116
116
|
return false if @limit < 0
|
|
117
117
|
return false if @reason.nil?
|
|
118
|
-
return false if @reason !~ Regexp.new(/^
|
|
118
|
+
return false if @reason !~ Regexp.new(/^[\s\S]*\S[\s\S]*$/)
|
|
119
119
|
true
|
|
120
120
|
end
|
|
121
121
|
|
|
@@ -140,7 +140,7 @@ module BmcApi
|
|
|
140
140
|
fail ArgumentError, 'reason cannot be nil'
|
|
141
141
|
end
|
|
142
142
|
|
|
143
|
-
pattern = Regexp.new(/^
|
|
143
|
+
pattern = Regexp.new(/^[\s\S]*\S[\s\S]*$/)
|
|
144
144
|
if reason !~ pattern
|
|
145
145
|
fail ArgumentError, "invalid value for \"reason\", must conform to the pattern #{pattern}."
|
|
146
146
|
end
|
|
@@ -100,7 +100,7 @@ module BmcApi
|
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
104
104
|
# @return Array for valid properties with the reasons
|
|
105
105
|
def list_invalid_properties
|
|
106
106
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
@@ -117,11 +117,7 @@ module BmcApi
|
|
|
117
117
|
invalid_properties.push('invalid value for "reason", reason cannot be nil.')
|
|
118
118
|
end
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
# (?m) was originally (?s) -- it functions the same, except Ruby doesn't understand (?s)
|
|
122
|
-
# Information here:
|
|
123
|
-
# - https://www.rexegg.com/regex-ruby.php
|
|
124
|
-
pattern = Regexp.new(/^(?m)(?!\s*$).+/)
|
|
120
|
+
pattern = Regexp.new(/^[\s\S]*\S[\s\S]*$/)
|
|
125
121
|
if @reason !~ pattern
|
|
126
122
|
invalid_properties.push("invalid value for \"reason\", must conform to the pattern #{pattern}.")
|
|
127
123
|
end
|
|
@@ -140,7 +136,7 @@ module BmcApi
|
|
|
140
136
|
return false if @limit.nil?
|
|
141
137
|
return false if @limit < 0
|
|
142
138
|
return false if @reason.nil?
|
|
143
|
-
return false if @reason !~ Regexp.new(/^
|
|
139
|
+
return false if @reason !~ Regexp.new(/^[\s\S]*\S[\s\S]*$/)
|
|
144
140
|
return false if @requested_on.nil?
|
|
145
141
|
true
|
|
146
142
|
end
|
|
@@ -166,7 +162,7 @@ module BmcApi
|
|
|
166
162
|
fail ArgumentError, 'reason cannot be nil'
|
|
167
163
|
end
|
|
168
164
|
|
|
169
|
-
pattern = Regexp.new(/^
|
|
165
|
+
pattern = Regexp.new(/^[\s\S]*\S[\s\S]*$/)
|
|
170
166
|
if reason !~ pattern
|
|
171
167
|
fail ArgumentError, "invalid value for \"reason\", must conform to the pattern #{pattern}."
|
|
172
168
|
end
|
|
@@ -0,0 +1,212 @@
|
|
|
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
|
+
Generator version: 7.20.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module BmcApi
|
|
17
|
+
class RebootRequest < ApiModelBase
|
|
18
|
+
# Specifies whether to boot via `IPXE` (requires script) or `STANDARD` (default mechanism, incompatible with `ipxeUrl`).
|
|
19
|
+
attr_accessor :boot_type
|
|
20
|
+
|
|
21
|
+
# The URL for the iPXE script, used only with `IPXE` boot type. If provided, it updates and replaces the existing stored URL; if not provided, the existing URL will be used.
|
|
22
|
+
attr_accessor :ipxe_url
|
|
23
|
+
|
|
24
|
+
class EnumAttributeValidator
|
|
25
|
+
attr_reader :datatype
|
|
26
|
+
attr_reader :allowable_values
|
|
27
|
+
|
|
28
|
+
def initialize(datatype, allowable_values)
|
|
29
|
+
@allowable_values = allowable_values.map do |value|
|
|
30
|
+
case datatype.to_s
|
|
31
|
+
when /Integer/i
|
|
32
|
+
value.to_i
|
|
33
|
+
when /Float/i
|
|
34
|
+
value.to_f
|
|
35
|
+
else
|
|
36
|
+
value
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def valid?(value)
|
|
42
|
+
!value || allowable_values.include?(value)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
47
|
+
def self.attribute_map
|
|
48
|
+
{
|
|
49
|
+
:'boot_type' => :'bootType',
|
|
50
|
+
:'ipxe_url' => :'ipxeUrl'
|
|
51
|
+
}
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Returns attribute mapping this model knows about
|
|
55
|
+
def self.acceptable_attribute_map
|
|
56
|
+
attribute_map
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Returns all the JSON keys this model knows about
|
|
60
|
+
def self.acceptable_attributes
|
|
61
|
+
acceptable_attribute_map.values
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Attribute type mapping.
|
|
65
|
+
def self.openapi_types
|
|
66
|
+
{
|
|
67
|
+
:'boot_type' => :'String',
|
|
68
|
+
:'ipxe_url' => :'String'
|
|
69
|
+
}
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# List of attributes with nullable: true
|
|
73
|
+
def self.openapi_nullable
|
|
74
|
+
Set.new([
|
|
75
|
+
:'ipxe_url'
|
|
76
|
+
])
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Initializes the object
|
|
80
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
81
|
+
def initialize(attributes = {})
|
|
82
|
+
if (!attributes.is_a?(Hash))
|
|
83
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BmcApi::RebootRequest` initialize method"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
87
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
89
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::RebootRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
91
|
+
end
|
|
92
|
+
h[k.to_sym] = v
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'boot_type')
|
|
96
|
+
self.boot_type = attributes[:'boot_type']
|
|
97
|
+
else
|
|
98
|
+
self.boot_type = 'STANDARD'
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if attributes.key?(:'ipxe_url')
|
|
102
|
+
self.ipxe_url = attributes[:'ipxe_url']
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
107
|
+
# @return Array for valid properties with the reasons
|
|
108
|
+
def list_invalid_properties
|
|
109
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
110
|
+
invalid_properties = Array.new
|
|
111
|
+
pattern = Regexp.new(/^https?:\/\/.+$/)
|
|
112
|
+
if !@ipxe_url.nil? && @ipxe_url !~ pattern
|
|
113
|
+
invalid_properties.push("invalid value for \"ipxe_url\", must conform to the pattern #{pattern}.")
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
invalid_properties
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Check to see if the all the properties in the model are valid
|
|
120
|
+
# @return true if the model is valid
|
|
121
|
+
def valid?
|
|
122
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
123
|
+
boot_type_validator = EnumAttributeValidator.new('String', ["IPXE", "STANDARD"])
|
|
124
|
+
return false unless boot_type_validator.valid?(@boot_type)
|
|
125
|
+
return false if !@ipxe_url.nil? && @ipxe_url !~ Regexp.new(/^https?:\/\/.+$/)
|
|
126
|
+
true
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
130
|
+
# @param [Object] boot_type Object to be assigned
|
|
131
|
+
def boot_type=(boot_type)
|
|
132
|
+
validator = EnumAttributeValidator.new('String', ["IPXE", "STANDARD"])
|
|
133
|
+
unless validator.valid?(boot_type)
|
|
134
|
+
fail ArgumentError, "invalid value for \"boot_type\", must be one of #{validator.allowable_values}."
|
|
135
|
+
end
|
|
136
|
+
@boot_type = boot_type
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Custom attribute writer method with validation
|
|
140
|
+
# @param [Object] ipxe_url Value to be assigned
|
|
141
|
+
def ipxe_url=(ipxe_url)
|
|
142
|
+
pattern = Regexp.new(/^https?:\/\/.+$/)
|
|
143
|
+
if !ipxe_url.nil? && ipxe_url !~ pattern
|
|
144
|
+
fail ArgumentError, "invalid value for \"ipxe_url\", must conform to the pattern #{pattern}."
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
@ipxe_url = ipxe_url
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Checks equality by comparing each attribute.
|
|
151
|
+
# @param [Object] Object to be compared
|
|
152
|
+
def ==(o)
|
|
153
|
+
return true if self.equal?(o)
|
|
154
|
+
self.class == o.class &&
|
|
155
|
+
boot_type == o.boot_type &&
|
|
156
|
+
ipxe_url == o.ipxe_url
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# @see the `==` method
|
|
160
|
+
# @param [Object] Object to be compared
|
|
161
|
+
def eql?(o)
|
|
162
|
+
self == o
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Calculates hash code according to all attributes.
|
|
166
|
+
# @return [Integer] Hash code
|
|
167
|
+
def hash
|
|
168
|
+
[boot_type, ipxe_url].hash
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# Builds the object from hash
|
|
172
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
173
|
+
# @return [Object] Returns the model itself
|
|
174
|
+
def self.build_from_hash(attributes)
|
|
175
|
+
return nil unless attributes.is_a?(Hash)
|
|
176
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
177
|
+
transformed_hash = {}
|
|
178
|
+
openapi_types.each_pair do |key, type|
|
|
179
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
180
|
+
transformed_hash["#{key}"] = nil
|
|
181
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
182
|
+
# check to ensure the input is an array given that the attribute
|
|
183
|
+
# is documented as an array but the input is not
|
|
184
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
185
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
186
|
+
end
|
|
187
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
188
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
new(transformed_hash)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Returns the object in the form of hash
|
|
195
|
+
# @return [Hash] Returns the object in the form of hash
|
|
196
|
+
def to_hash
|
|
197
|
+
hash = {}
|
|
198
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
199
|
+
value = self.send(attr)
|
|
200
|
+
if value.nil?
|
|
201
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
202
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
hash[param] = _to_hash(value)
|
|
206
|
+
end
|
|
207
|
+
hash
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
end
|