pnap_bmc_api 1.5.0 → 2.1.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 +7 -1
- data/VERSION +1 -1
- data/docs/DeleteResult.md +1 -1
- data/docs/EsxiDatastoreConfiguration.md +18 -0
- data/docs/EsxiOsConfiguration.md +18 -0
- data/docs/OsConfiguration.md +2 -0
- 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 +26 -23
- 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/esxi_datastore_configuration.rb +262 -0
- data/lib/pnap_bmc_api/models/{quota_edit_limit_request_details_all_of.rb → esxi_os_configuration.rb} +25 -36
- 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 +29 -21
- 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 +4 -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/esxi_datastore_configuration_spec.rb +36 -0
- data/spec/models/esxi_os_configuration_spec.rb +36 -0
- 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 +39 -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 +43 -39
- data/docs/QuotaEditLimitRequestDetailsAllOf.md +0 -18
- 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
|
|
@@ -65,6 +65,8 @@ module BmcApi
|
|
65
65
|
|
66
66
|
if attributes.key?(:'message')
|
67
67
|
self.message = attributes[:'message']
|
68
|
+
else
|
69
|
+
self.message = nil
|
68
70
|
end
|
69
71
|
|
70
72
|
if attributes.key?(:'validation_errors')
|
@@ -77,6 +79,7 @@ module BmcApi
|
|
77
79
|
# Show invalid properties with the reasons. Usually used together with valid?
|
78
80
|
# @return Array for valid properties with the reasons
|
79
81
|
def list_invalid_properties
|
82
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
80
83
|
invalid_properties = Array.new
|
81
84
|
if @message.nil?
|
82
85
|
invalid_properties.push('invalid value for "message", message cannot be nil.')
|
@@ -88,6 +91,7 @@ module BmcApi
|
|
88
91
|
# Check to see if the all the properties in the model are valid
|
89
92
|
# @return true if the model is valid
|
90
93
|
def valid?
|
94
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
91
95
|
return false if @message.nil?
|
92
96
|
true
|
93
97
|
end
|
@@ -117,37 +121,30 @@ module BmcApi
|
|
117
121
|
# @param [Hash] attributes Model attributes in the form of hash
|
118
122
|
# @return [Object] Returns the model itself
|
119
123
|
def self.build_from_hash(attributes)
|
120
|
-
new.build_from_hash(attributes)
|
121
|
-
end
|
122
|
-
|
123
|
-
# Builds the object from hash
|
124
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
125
|
-
# @return [Object] Returns the model itself
|
126
|
-
def build_from_hash(attributes)
|
127
124
|
return nil unless attributes.is_a?(Hash)
|
128
125
|
attributes = attributes.transform_keys(&:to_sym)
|
129
|
-
|
130
|
-
|
131
|
-
|
126
|
+
transformed_hash = {}
|
127
|
+
openapi_types.each_pair do |key, type|
|
128
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
129
|
+
transformed_hash["#{key}"] = nil
|
132
130
|
elsif type =~ /\AArray<(.*)>/i
|
133
131
|
# check to ensure the input is an array given that the attribute
|
134
132
|
# is documented as an array but the input is not
|
135
|
-
if attributes[
|
136
|
-
|
133
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
134
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
137
135
|
end
|
138
|
-
elsif !attributes[
|
139
|
-
|
136
|
+
elsif !attributes[attribute_map[key]].nil?
|
137
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
140
138
|
end
|
141
139
|
end
|
142
|
-
|
143
|
-
self
|
140
|
+
new(transformed_hash)
|
144
141
|
end
|
145
142
|
|
146
143
|
# Deserializes the data based on type
|
147
144
|
# @param string type Data type
|
148
145
|
# @param string value Value to be deserialized
|
149
146
|
# @return [Object] Deserialized data
|
150
|
-
def _deserialize(type, value)
|
147
|
+
def self._deserialize(type, value)
|
151
148
|
case type.to_sym
|
152
149
|
when :Time
|
153
150
|
Time.parse(value)
|
@@ -182,7 +179,7 @@ module BmcApi
|
|
182
179
|
else # model
|
183
180
|
# models (e.g. Pet) or oneOf
|
184
181
|
klass = BmcApi.const_get(type)
|
185
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
182
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
186
183
|
end
|
187
184
|
end
|
188
185
|
|
@@ -0,0 +1,262 @@
|
|
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
|
+
# Esxi data storage configuration.
|
18
|
+
class EsxiDatastoreConfiguration
|
19
|
+
# Datastore name
|
20
|
+
attr_accessor :datastore_name
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'datastore_name' => :'datastoreName'
|
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
|
+
:'datastore_name' => :'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::EsxiDatastoreConfiguration` 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::EsxiDatastoreConfiguration`. 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?(:'datastore_name')
|
63
|
+
self.datastore_name = attributes[:'datastore_name']
|
64
|
+
else
|
65
|
+
self.datastore_name = nil
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
70
|
+
# @return Array for valid properties with the reasons
|
71
|
+
def list_invalid_properties
|
72
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
73
|
+
invalid_properties = Array.new
|
74
|
+
if @datastore_name.nil?
|
75
|
+
invalid_properties.push('invalid value for "datastore_name", datastore_name cannot be nil.')
|
76
|
+
end
|
77
|
+
|
78
|
+
if @datastore_name.to_s.length > 42
|
79
|
+
invalid_properties.push('invalid value for "datastore_name", the character length must be smaller than or equal to 42.')
|
80
|
+
end
|
81
|
+
|
82
|
+
if @datastore_name.to_s.length < 1
|
83
|
+
invalid_properties.push('invalid value for "datastore_name", the character length must be great than or equal to 1.')
|
84
|
+
end
|
85
|
+
|
86
|
+
pattern = Regexp.new(/^[a-zA-Z0-9]+$/)
|
87
|
+
if @datastore_name !~ pattern
|
88
|
+
invalid_properties.push("invalid value for \"datastore_name\", must conform to the pattern #{pattern}.")
|
89
|
+
end
|
90
|
+
|
91
|
+
invalid_properties
|
92
|
+
end
|
93
|
+
|
94
|
+
# Check to see if the all the properties in the model are valid
|
95
|
+
# @return true if the model is valid
|
96
|
+
def valid?
|
97
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
98
|
+
return false if @datastore_name.nil?
|
99
|
+
return false if @datastore_name.to_s.length > 42
|
100
|
+
return false if @datastore_name.to_s.length < 1
|
101
|
+
return false if @datastore_name !~ Regexp.new(/^[a-zA-Z0-9]+$/)
|
102
|
+
true
|
103
|
+
end
|
104
|
+
|
105
|
+
# Custom attribute writer method with validation
|
106
|
+
# @param [Object] datastore_name Value to be assigned
|
107
|
+
def datastore_name=(datastore_name)
|
108
|
+
if datastore_name.nil?
|
109
|
+
fail ArgumentError, 'datastore_name cannot be nil'
|
110
|
+
end
|
111
|
+
|
112
|
+
if datastore_name.to_s.length > 42
|
113
|
+
fail ArgumentError, 'invalid value for "datastore_name", the character length must be smaller than or equal to 42.'
|
114
|
+
end
|
115
|
+
|
116
|
+
if datastore_name.to_s.length < 1
|
117
|
+
fail ArgumentError, 'invalid value for "datastore_name", the character length must be great than or equal to 1.'
|
118
|
+
end
|
119
|
+
|
120
|
+
pattern = Regexp.new(/^[a-zA-Z0-9]+$/)
|
121
|
+
if datastore_name !~ pattern
|
122
|
+
fail ArgumentError, "invalid value for \"datastore_name\", must conform to the pattern #{pattern}."
|
123
|
+
end
|
124
|
+
|
125
|
+
@datastore_name = datastore_name
|
126
|
+
end
|
127
|
+
|
128
|
+
# Checks equality by comparing each attribute.
|
129
|
+
# @param [Object] Object to be compared
|
130
|
+
def ==(o)
|
131
|
+
return true if self.equal?(o)
|
132
|
+
self.class == o.class &&
|
133
|
+
datastore_name == o.datastore_name
|
134
|
+
end
|
135
|
+
|
136
|
+
# @see the `==` method
|
137
|
+
# @param [Object] Object to be compared
|
138
|
+
def eql?(o)
|
139
|
+
self == o
|
140
|
+
end
|
141
|
+
|
142
|
+
# Calculates hash code according to all attributes.
|
143
|
+
# @return [Integer] Hash code
|
144
|
+
def hash
|
145
|
+
[datastore_name].hash
|
146
|
+
end
|
147
|
+
|
148
|
+
# Builds the object from hash
|
149
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
150
|
+
# @return [Object] Returns the model itself
|
151
|
+
def self.build_from_hash(attributes)
|
152
|
+
return nil unless attributes.is_a?(Hash)
|
153
|
+
attributes = attributes.transform_keys(&:to_sym)
|
154
|
+
transformed_hash = {}
|
155
|
+
openapi_types.each_pair do |key, type|
|
156
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
157
|
+
transformed_hash["#{key}"] = nil
|
158
|
+
elsif type =~ /\AArray<(.*)>/i
|
159
|
+
# check to ensure the input is an array given that the attribute
|
160
|
+
# is documented as an array but the input is not
|
161
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
162
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
163
|
+
end
|
164
|
+
elsif !attributes[attribute_map[key]].nil?
|
165
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
166
|
+
end
|
167
|
+
end
|
168
|
+
new(transformed_hash)
|
169
|
+
end
|
170
|
+
|
171
|
+
# Deserializes the data based on type
|
172
|
+
# @param string type Data type
|
173
|
+
# @param string value Value to be deserialized
|
174
|
+
# @return [Object] Deserialized data
|
175
|
+
def self._deserialize(type, value)
|
176
|
+
case type.to_sym
|
177
|
+
when :Time
|
178
|
+
Time.parse(value)
|
179
|
+
when :Date
|
180
|
+
Date.parse(value)
|
181
|
+
when :String
|
182
|
+
value.to_s
|
183
|
+
when :Integer
|
184
|
+
value.to_i
|
185
|
+
when :Float
|
186
|
+
value.to_f
|
187
|
+
when :Boolean
|
188
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
189
|
+
true
|
190
|
+
else
|
191
|
+
false
|
192
|
+
end
|
193
|
+
when :Object
|
194
|
+
# generic object (usually a Hash), return directly
|
195
|
+
value
|
196
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
197
|
+
inner_type = Regexp.last_match[:inner_type]
|
198
|
+
value.map { |v| _deserialize(inner_type, v) }
|
199
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
200
|
+
k_type = Regexp.last_match[:k_type]
|
201
|
+
v_type = Regexp.last_match[:v_type]
|
202
|
+
{}.tap do |hash|
|
203
|
+
value.each do |k, v|
|
204
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
205
|
+
end
|
206
|
+
end
|
207
|
+
else # model
|
208
|
+
# models (e.g. Pet) or oneOf
|
209
|
+
klass = BmcApi.const_get(type)
|
210
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
# Returns the string representation of the object
|
215
|
+
# @return [String] String presentation of the object
|
216
|
+
def to_s
|
217
|
+
to_hash.to_s
|
218
|
+
end
|
219
|
+
|
220
|
+
# to_body is an alias to to_hash (backward compatibility)
|
221
|
+
# @return [Hash] Returns the object in the form of hash
|
222
|
+
def to_body
|
223
|
+
to_hash
|
224
|
+
end
|
225
|
+
|
226
|
+
# Returns the object in the form of hash
|
227
|
+
# @return [Hash] Returns the object in the form of hash
|
228
|
+
def to_hash
|
229
|
+
hash = {}
|
230
|
+
self.class.attribute_map.each_pair do |attr, param|
|
231
|
+
value = self.send(attr)
|
232
|
+
if value.nil?
|
233
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
234
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
235
|
+
end
|
236
|
+
|
237
|
+
hash[param] = _to_hash(value)
|
238
|
+
end
|
239
|
+
hash
|
240
|
+
end
|
241
|
+
|
242
|
+
# Outputs non-array value in the form of hash
|
243
|
+
# For object, use to_hash. Otherwise, just return the value
|
244
|
+
# @param [Object] value Any valid value
|
245
|
+
# @return [Hash] Returns the value in the form of hash
|
246
|
+
def _to_hash(value)
|
247
|
+
if value.is_a?(Array)
|
248
|
+
value.compact.map { |v| _to_hash(v) }
|
249
|
+
elsif value.is_a?(Hash)
|
250
|
+
{}.tap do |hash|
|
251
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
252
|
+
end
|
253
|
+
elsif value.respond_to? :to_hash
|
254
|
+
value.to_hash
|
255
|
+
else
|
256
|
+
value
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
end
|
261
|
+
|
262
|
+
end
|
data/lib/pnap_bmc_api/models/{quota_edit_limit_request_details_all_of.rb → esxi_os_configuration.rb}
RENAMED
@@ -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,15 +14,14 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module BmcApi
|
17
|
-
#
|
18
|
-
class
|
19
|
-
|
20
|
-
attr_accessor :requested_on
|
17
|
+
# Esxi OS configuration.
|
18
|
+
class EsxiOsConfiguration
|
19
|
+
attr_accessor :datastore_configuration
|
21
20
|
|
22
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
23
22
|
def self.attribute_map
|
24
23
|
{
|
25
|
-
:'
|
24
|
+
:'datastore_configuration' => :'datastoreConfiguration'
|
26
25
|
}
|
27
26
|
end
|
28
27
|
|
@@ -34,7 +33,7 @@ module BmcApi
|
|
34
33
|
# Attribute type mapping.
|
35
34
|
def self.openapi_types
|
36
35
|
{
|
37
|
-
:'
|
36
|
+
:'datastore_configuration' => :'EsxiDatastoreConfiguration'
|
38
37
|
}
|
39
38
|
end
|
40
39
|
|
@@ -48,37 +47,34 @@ module BmcApi
|
|
48
47
|
# @param [Hash] attributes Model attributes in the form of hash
|
49
48
|
def initialize(attributes = {})
|
50
49
|
if (!attributes.is_a?(Hash))
|
51
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `BmcApi::
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BmcApi::EsxiOsConfiguration` initialize method"
|
52
51
|
end
|
53
52
|
|
54
53
|
# check to see if the attribute exists and convert string to symbol for hash key
|
55
54
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
56
55
|
if (!self.class.attribute_map.key?(k.to_sym))
|
57
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::EsxiOsConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
58
57
|
end
|
59
58
|
h[k.to_sym] = v
|
60
59
|
}
|
61
60
|
|
62
|
-
if attributes.key?(:'
|
63
|
-
self.
|
61
|
+
if attributes.key?(:'datastore_configuration')
|
62
|
+
self.datastore_configuration = attributes[:'datastore_configuration']
|
64
63
|
end
|
65
64
|
end
|
66
65
|
|
67
66
|
# Show invalid properties with the reasons. Usually used together with valid?
|
68
67
|
# @return Array for valid properties with the reasons
|
69
68
|
def list_invalid_properties
|
69
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
70
70
|
invalid_properties = Array.new
|
71
|
-
if @requested_on.nil?
|
72
|
-
invalid_properties.push('invalid value for "requested_on", requested_on cannot be nil.')
|
73
|
-
end
|
74
|
-
|
75
71
|
invalid_properties
|
76
72
|
end
|
77
73
|
|
78
74
|
# Check to see if the all the properties in the model are valid
|
79
75
|
# @return true if the model is valid
|
80
76
|
def valid?
|
81
|
-
|
77
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
82
78
|
true
|
83
79
|
end
|
84
80
|
|
@@ -87,7 +83,7 @@ module BmcApi
|
|
87
83
|
def ==(o)
|
88
84
|
return true if self.equal?(o)
|
89
85
|
self.class == o.class &&
|
90
|
-
|
86
|
+
datastore_configuration == o.datastore_configuration
|
91
87
|
end
|
92
88
|
|
93
89
|
# @see the `==` method
|
@@ -99,44 +95,37 @@ module BmcApi
|
|
99
95
|
# Calculates hash code according to all attributes.
|
100
96
|
# @return [Integer] Hash code
|
101
97
|
def hash
|
102
|
-
[
|
98
|
+
[datastore_configuration].hash
|
103
99
|
end
|
104
100
|
|
105
101
|
# Builds the object from hash
|
106
102
|
# @param [Hash] attributes Model attributes in the form of hash
|
107
103
|
# @return [Object] Returns the model itself
|
108
104
|
def self.build_from_hash(attributes)
|
109
|
-
new.build_from_hash(attributes)
|
110
|
-
end
|
111
|
-
|
112
|
-
# Builds the object from hash
|
113
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
114
|
-
# @return [Object] Returns the model itself
|
115
|
-
def build_from_hash(attributes)
|
116
105
|
return nil unless attributes.is_a?(Hash)
|
117
106
|
attributes = attributes.transform_keys(&:to_sym)
|
118
|
-
|
119
|
-
|
120
|
-
|
107
|
+
transformed_hash = {}
|
108
|
+
openapi_types.each_pair do |key, type|
|
109
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
110
|
+
transformed_hash["#{key}"] = nil
|
121
111
|
elsif type =~ /\AArray<(.*)>/i
|
122
112
|
# check to ensure the input is an array given that the attribute
|
123
113
|
# is documented as an array but the input is not
|
124
|
-
if attributes[
|
125
|
-
|
114
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
115
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
126
116
|
end
|
127
|
-
elsif !attributes[
|
128
|
-
|
117
|
+
elsif !attributes[attribute_map[key]].nil?
|
118
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
129
119
|
end
|
130
120
|
end
|
131
|
-
|
132
|
-
self
|
121
|
+
new(transformed_hash)
|
133
122
|
end
|
134
123
|
|
135
124
|
# Deserializes the data based on type
|
136
125
|
# @param string type Data type
|
137
126
|
# @param string value Value to be deserialized
|
138
127
|
# @return [Object] Deserialized data
|
139
|
-
def _deserialize(type, value)
|
128
|
+
def self._deserialize(type, value)
|
140
129
|
case type.to_sym
|
141
130
|
when :Time
|
142
131
|
Time.parse(value)
|
@@ -171,7 +160,7 @@ module BmcApi
|
|
171
160
|
else # model
|
172
161
|
# models (e.g. Pet) or oneOf
|
173
162
|
klass = BmcApi.const_get(type)
|
174
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
163
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
175
164
|
end
|
176
165
|
end
|
177
166
|
|
@@ -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
|
|
@@ -102,6 +102,7 @@ module BmcApi
|
|
102
102
|
# Show invalid properties with the reasons. Usually used together with valid?
|
103
103
|
# @return Array for valid properties with the reasons
|
104
104
|
def list_invalid_properties
|
105
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
105
106
|
invalid_properties = Array.new
|
106
107
|
if !@ip_blocks.nil? && @ip_blocks.length > 1
|
107
108
|
invalid_properties.push('invalid value for "ip_blocks", number of items must be less than or equal to 1.')
|
@@ -113,6 +114,7 @@ module BmcApi
|
|
113
114
|
# Check to see if the all the properties in the model are valid
|
114
115
|
# @return true if the model is valid
|
115
116
|
def valid?
|
117
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
116
118
|
configuration_type_validator = EnumAttributeValidator.new('String', ["PURCHASE_NEW", "USER_DEFINED", "NONE"])
|
117
119
|
return false unless configuration_type_validator.valid?(@configuration_type)
|
118
120
|
return false if !@ip_blocks.nil? && @ip_blocks.length > 1
|
@@ -132,7 +134,11 @@ module BmcApi
|
|
132
134
|
# Custom attribute writer method with validation
|
133
135
|
# @param [Object] ip_blocks Value to be assigned
|
134
136
|
def ip_blocks=(ip_blocks)
|
135
|
-
if
|
137
|
+
if ip_blocks.nil?
|
138
|
+
fail ArgumentError, 'ip_blocks cannot be nil'
|
139
|
+
end
|
140
|
+
|
141
|
+
if ip_blocks.length > 1
|
136
142
|
fail ArgumentError, 'invalid value for "ip_blocks", number of items must be less than or equal to 1.'
|
137
143
|
end
|
138
144
|
|
@@ -164,37 +170,30 @@ module BmcApi
|
|
164
170
|
# @param [Hash] attributes Model attributes in the form of hash
|
165
171
|
# @return [Object] Returns the model itself
|
166
172
|
def self.build_from_hash(attributes)
|
167
|
-
new.build_from_hash(attributes)
|
168
|
-
end
|
169
|
-
|
170
|
-
# Builds the object from hash
|
171
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
172
|
-
# @return [Object] Returns the model itself
|
173
|
-
def build_from_hash(attributes)
|
174
173
|
return nil unless attributes.is_a?(Hash)
|
175
174
|
attributes = attributes.transform_keys(&:to_sym)
|
176
|
-
|
177
|
-
|
178
|
-
|
175
|
+
transformed_hash = {}
|
176
|
+
openapi_types.each_pair do |key, type|
|
177
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
178
|
+
transformed_hash["#{key}"] = nil
|
179
179
|
elsif type =~ /\AArray<(.*)>/i
|
180
180
|
# check to ensure the input is an array given that the attribute
|
181
181
|
# is documented as an array but the input is not
|
182
|
-
if attributes[
|
183
|
-
|
182
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
183
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
184
184
|
end
|
185
|
-
elsif !attributes[
|
186
|
-
|
185
|
+
elsif !attributes[attribute_map[key]].nil?
|
186
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
187
187
|
end
|
188
188
|
end
|
189
|
-
|
190
|
-
self
|
189
|
+
new(transformed_hash)
|
191
190
|
end
|
192
191
|
|
193
192
|
# Deserializes the data based on type
|
194
193
|
# @param string type Data type
|
195
194
|
# @param string value Value to be deserialized
|
196
195
|
# @return [Object] Deserialized data
|
197
|
-
def _deserialize(type, value)
|
196
|
+
def self._deserialize(type, value)
|
198
197
|
case type.to_sym
|
199
198
|
when :Time
|
200
199
|
Time.parse(value)
|
@@ -229,7 +228,7 @@ module BmcApi
|
|
229
228
|
else # model
|
230
229
|
# models (e.g. Pet) or oneOf
|
231
230
|
klass = BmcApi.const_get(type)
|
232
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
231
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
233
232
|
end
|
234
233
|
end
|
235
234
|
|
@@ -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
|
|
@@ -91,6 +91,7 @@ module BmcApi
|
|
91
91
|
# Show invalid properties with the reasons. Usually used together with valid?
|
92
92
|
# @return Array for valid properties with the reasons
|
93
93
|
def list_invalid_properties
|
94
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
94
95
|
invalid_properties = Array.new
|
95
96
|
invalid_properties
|
96
97
|
end
|
@@ -98,6 +99,7 @@ module BmcApi
|
|
98
99
|
# Check to see if the all the properties in the model are valid
|
99
100
|
# @return true if the model is valid
|
100
101
|
def valid?
|
102
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
101
103
|
true
|
102
104
|
end
|
103
105
|
|
@@ -128,37 +130,30 @@ module BmcApi
|
|
128
130
|
# @param [Hash] attributes Model attributes in the form of hash
|
129
131
|
# @return [Object] Returns the model itself
|
130
132
|
def self.build_from_hash(attributes)
|
131
|
-
new.build_from_hash(attributes)
|
132
|
-
end
|
133
|
-
|
134
|
-
# Builds the object from hash
|
135
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
136
|
-
# @return [Object] Returns the model itself
|
137
|
-
def build_from_hash(attributes)
|
138
133
|
return nil unless attributes.is_a?(Hash)
|
139
134
|
attributes = attributes.transform_keys(&:to_sym)
|
140
|
-
|
141
|
-
|
142
|
-
|
135
|
+
transformed_hash = {}
|
136
|
+
openapi_types.each_pair do |key, type|
|
137
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
138
|
+
transformed_hash["#{key}"] = nil
|
143
139
|
elsif type =~ /\AArray<(.*)>/i
|
144
140
|
# check to ensure the input is an array given that the attribute
|
145
141
|
# is documented as an array but the input is not
|
146
|
-
if attributes[
|
147
|
-
|
142
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
143
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
148
144
|
end
|
149
|
-
elsif !attributes[
|
150
|
-
|
145
|
+
elsif !attributes[attribute_map[key]].nil?
|
146
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
151
147
|
end
|
152
148
|
end
|
153
|
-
|
154
|
-
self
|
149
|
+
new(transformed_hash)
|
155
150
|
end
|
156
151
|
|
157
152
|
# Deserializes the data based on type
|
158
153
|
# @param string type Data type
|
159
154
|
# @param string value Value to be deserialized
|
160
155
|
# @return [Object] Deserialized data
|
161
|
-
def _deserialize(type, value)
|
156
|
+
def self._deserialize(type, value)
|
162
157
|
case type.to_sym
|
163
158
|
when :Time
|
164
159
|
Time.parse(value)
|
@@ -193,7 +188,7 @@ module BmcApi
|
|
193
188
|
else # model
|
194
189
|
# models (e.g. Pet) or oneOf
|
195
190
|
klass = BmcApi.const_get(type)
|
196
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
191
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
197
192
|
end
|
198
193
|
end
|
199
194
|
|