pnap_bmc_api 2.2.2 → 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.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -0
  3. data/VERSION +1 -1
  4. data/docs/IpBlocksConfiguration.md +1 -1
  5. data/docs/OsConfiguration.md +3 -1
  6. data/docs/OsConfigurationCloudInit.md +1 -1
  7. data/docs/OsConfigurationIPXE.md +20 -0
  8. data/docs/OsConfigurationIPXENativeVlanConfiguration.md +22 -0
  9. data/docs/OsConfigurationWindows.md +3 -1
  10. data/docs/PrivateNetworkConfiguration.md +1 -1
  11. data/docs/PublicNetworkConfiguration.md +1 -1
  12. data/docs/RebootRequest.md +20 -0
  13. data/docs/ReservationTransferDetails.md +18 -0
  14. data/docs/Server.md +4 -4
  15. data/docs/ServerCreate.md +3 -3
  16. data/docs/ServerNetworkUpdate.md +1 -1
  17. data/docs/ServerPrivateNetwork.md +3 -1
  18. data/docs/ServerProvision.md +1 -1
  19. data/docs/ServerPublicNetwork.md +5 -3
  20. data/docs/ServersApi.md +157 -7
  21. data/lib/pnap_bmc_api/api/quotas_api.rb +4 -4
  22. data/lib/pnap_bmc_api/api/servers_api.rb +182 -24
  23. data/lib/pnap_bmc_api/api/ssh_keys_api.rb +6 -6
  24. data/lib/pnap_bmc_api/api_client.rb +17 -14
  25. data/lib/pnap_bmc_api/api_error.rb +1 -1
  26. data/lib/pnap_bmc_api/api_model_base.rb +88 -0
  27. data/lib/pnap_bmc_api/configuration.rb +11 -1
  28. data/lib/pnap_bmc_api/models/action_result.rb +21 -78
  29. data/lib/pnap_bmc_api/models/delete_result.rb +31 -78
  30. data/lib/pnap_bmc_api/models/delete_ssh_key_result.rb +31 -78
  31. data/lib/pnap_bmc_api/models/error.rb +21 -78
  32. data/lib/pnap_bmc_api/models/esxi_datastore_configuration.rb +13 -80
  33. data/lib/pnap_bmc_api/models/esxi_os_configuration.rb +11 -78
  34. data/lib/pnap_bmc_api/models/gpu_configuration.rb +11 -78
  35. data/lib/pnap_bmc_api/models/ip_blocks_configuration.rb +12 -79
  36. data/lib/pnap_bmc_api/models/network_configuration.rb +11 -78
  37. data/lib/pnap_bmc_api/models/os_configuration.rb +24 -82
  38. data/lib/pnap_bmc_api/models/os_configuration_cloud_init.rb +11 -78
  39. data/lib/pnap_bmc_api/models/os_configuration_ipxe.rb +186 -0
  40. data/lib/pnap_bmc_api/models/os_configuration_ipxe_native_vlan_configuration.rb +224 -0
  41. data/lib/pnap_bmc_api/models/os_configuration_map.rb +11 -78
  42. data/lib/pnap_bmc_api/models/os_configuration_map_esxi.rb +11 -78
  43. data/lib/pnap_bmc_api/models/os_configuration_map_proxmox.rb +11 -78
  44. data/lib/pnap_bmc_api/models/os_configuration_netris_controller.rb +11 -78
  45. data/lib/pnap_bmc_api/models/os_configuration_netris_softgate.rb +11 -78
  46. data/lib/pnap_bmc_api/models/os_configuration_windows.rb +27 -82
  47. data/lib/pnap_bmc_api/models/private_network_configuration.rb +12 -79
  48. data/lib/pnap_bmc_api/models/public_network_configuration.rb +12 -79
  49. data/lib/pnap_bmc_api/models/quota.rb +61 -78
  50. data/lib/pnap_bmc_api/models/quota_edit_limit_request.rb +14 -81
  51. data/lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb +25 -86
  52. data/lib/pnap_bmc_api/models/reboot_request.rb +212 -0
  53. data/lib/pnap_bmc_api/models/relinquish_ip_block.rb +11 -78
  54. data/lib/pnap_bmc_api/models/reservation_transfer_details.rb +166 -0
  55. data/lib/pnap_bmc_api/models/reset_result.rb +21 -78
  56. data/lib/pnap_bmc_api/models/server.rb +117 -84
  57. data/lib/pnap_bmc_api/models/server_create.rb +46 -83
  58. data/lib/pnap_bmc_api/models/server_ip_block.rb +21 -78
  59. data/lib/pnap_bmc_api/models/server_network_update.rb +12 -79
  60. data/lib/pnap_bmc_api/models/server_patch.rb +13 -80
  61. data/lib/pnap_bmc_api/models/server_private_network.rb +35 -82
  62. data/lib/pnap_bmc_api/models/server_provision.rb +24 -81
  63. data/lib/pnap_bmc_api/models/server_public_network.rb +53 -83
  64. data/lib/pnap_bmc_api/models/server_reserve.rb +21 -78
  65. data/lib/pnap_bmc_api/models/server_reset.rb +11 -78
  66. data/lib/pnap_bmc_api/models/ssh_key.rb +81 -78
  67. data/lib/pnap_bmc_api/models/ssh_key_create.rb +23 -80
  68. data/lib/pnap_bmc_api/models/ssh_key_update.rb +23 -80
  69. data/lib/pnap_bmc_api/models/storage_configuration.rb +11 -78
  70. data/lib/pnap_bmc_api/models/storage_configuration_root_partition.rb +11 -78
  71. data/lib/pnap_bmc_api/models/tag_assignment.rb +41 -78
  72. data/lib/pnap_bmc_api/models/tag_assignment_request.rb +21 -78
  73. data/lib/pnap_bmc_api/version.rb +1 -2
  74. data/lib/pnap_bmc_api.rb +6 -1
  75. data/pnap_bmc_api.gemspec +6 -6
  76. data/spec/api/quotas_api_spec.rb +1 -1
  77. data/spec/api/servers_api_spec.rb +29 -1
  78. data/spec/api/ssh_keys_api_spec.rb +1 -1
  79. data/spec/models/action_result_spec.rb +2 -2
  80. data/spec/models/delete_result_spec.rb +2 -2
  81. data/spec/models/delete_ssh_key_result_spec.rb +2 -2
  82. data/spec/models/error_spec.rb +2 -2
  83. data/spec/models/esxi_datastore_configuration_spec.rb +2 -2
  84. data/spec/models/esxi_os_configuration_spec.rb +2 -2
  85. data/spec/models/gpu_configuration_spec.rb +2 -2
  86. data/spec/models/ip_blocks_configuration_spec.rb +2 -2
  87. data/spec/models/network_configuration_spec.rb +2 -2
  88. data/spec/models/os_configuration_cloud_init_spec.rb +2 -2
  89. data/spec/models/os_configuration_ipxe_native_vlan_configuration_spec.rb +52 -0
  90. data/spec/models/os_configuration_ipxe_spec.rb +42 -0
  91. data/spec/models/os_configuration_map_esxi_spec.rb +2 -2
  92. data/spec/models/os_configuration_map_proxmox_spec.rb +2 -2
  93. data/spec/models/os_configuration_map_spec.rb +2 -2
  94. data/spec/models/os_configuration_netris_controller_spec.rb +2 -2
  95. data/spec/models/os_configuration_netris_softgate_spec.rb +2 -2
  96. data/spec/models/os_configuration_spec.rb +8 -2
  97. data/spec/models/os_configuration_windows_spec.rb +8 -2
  98. data/spec/models/private_network_configuration_spec.rb +2 -2
  99. data/spec/models/public_network_configuration_spec.rb +2 -2
  100. data/spec/models/quota_edit_limit_request_details_spec.rb +2 -2
  101. data/spec/models/quota_edit_limit_request_spec.rb +2 -2
  102. data/spec/models/quota_spec.rb +2 -2
  103. data/spec/models/reboot_request_spec.rb +46 -0
  104. data/spec/models/relinquish_ip_block_spec.rb +2 -2
  105. data/spec/models/reservation_transfer_details_spec.rb +36 -0
  106. data/spec/models/reset_result_spec.rb +2 -2
  107. data/spec/models/server_create_spec.rb +2 -2
  108. data/spec/models/server_ip_block_spec.rb +2 -2
  109. data/spec/models/server_network_update_spec.rb +2 -2
  110. data/spec/models/server_patch_spec.rb +2 -2
  111. data/spec/models/server_private_network_spec.rb +8 -2
  112. data/spec/models/server_provision_spec.rb +2 -2
  113. data/spec/models/server_public_network_spec.rb +8 -2
  114. data/spec/models/server_reserve_spec.rb +2 -2
  115. data/spec/models/server_reset_spec.rb +2 -2
  116. data/spec/models/server_spec.rb +2 -2
  117. data/spec/models/ssh_key_create_spec.rb +2 -2
  118. data/spec/models/ssh_key_spec.rb +2 -2
  119. data/spec/models/ssh_key_update_spec.rb +2 -2
  120. data/spec/models/storage_configuration_root_partition_spec.rb +2 -2
  121. data/spec/models/storage_configuration_spec.rb +2 -2
  122. data/spec/models/tag_assignment_request_spec.rb +2 -2
  123. data/spec/models/tag_assignment_spec.rb +2 -2
  124. data/spec/spec_helper.rb +1 -1
  125. metadata +60 -39
@@ -0,0 +1,88 @@
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
+ module BmcApi
14
+ class ApiModelBase
15
+ # Deserializes the data based on type
16
+ # @param string type Data type
17
+ # @param string value Value to be deserialized
18
+ # @return [Object] Deserialized data
19
+ def self._deserialize(type, value)
20
+ case type.to_sym
21
+ when :Time
22
+ Time.parse(value)
23
+ when :Date
24
+ Date.parse(value)
25
+ when :String
26
+ value.to_s
27
+ when :Integer
28
+ value.to_i
29
+ when :Float
30
+ value.to_f
31
+ when :Boolean
32
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
33
+ true
34
+ else
35
+ false
36
+ end
37
+ when :Object
38
+ # generic object (usually a Hash), return directly
39
+ value
40
+ when /\AArray<(?<inner_type>.+)>\z/
41
+ inner_type = Regexp.last_match[:inner_type]
42
+ value.map { |v| _deserialize(inner_type, v) }
43
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
44
+ k_type = Regexp.last_match[:k_type]
45
+ v_type = Regexp.last_match[:v_type]
46
+ {}.tap do |hash|
47
+ value.each do |k, v|
48
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
49
+ end
50
+ end
51
+ else # model
52
+ # models (e.g. Pet) or oneOf
53
+ klass = BmcApi.const_get(type)
54
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
55
+ end
56
+ end
57
+
58
+ # Returns the string representation of the object
59
+ # @return [String] String presentation of the object
60
+ def to_s
61
+ to_hash.to_s
62
+ end
63
+
64
+ # to_body is an alias to to_hash (backward compatibility)
65
+ # @return [Hash] Returns the object in the form of hash
66
+ def to_body
67
+ to_hash
68
+ end
69
+
70
+ # Outputs non-array value in the form of hash
71
+ # For object, use to_hash. Otherwise, just return the value
72
+ # @param [Object] value Any valid value
73
+ # @return [Hash] Returns the value in the form of hash
74
+ def _to_hash(value)
75
+ if value.is_a?(Array)
76
+ value.compact.map { |v| _to_hash(v) }
77
+ elsif value.is_a?(Hash)
78
+ {}.tap do |hash|
79
+ value.each { |k, v| hash[k] = _to_hash(v) }
80
+ end
81
+ elsif value.respond_to? :to_hash
82
+ value.to_hash
83
+ else
84
+ value
85
+ end
86
+ end
87
+ end
88
+ end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -79,6 +79,14 @@ module BmcApi
79
79
  # @return [true, false]
80
80
  attr_accessor :debugging
81
81
 
82
+ # Set this to ignore operation servers for the API client. This is useful when you need to
83
+ # send requests to a different server than the one specified in the OpenAPI document.
84
+ # Will default to the base url defined in the spec but can be overridden by setting
85
+ # `scheme`, `host`, `base_path` directly.
86
+ # Default to false.
87
+ # @return [true, false]
88
+ attr_accessor :ignore_operation_servers
89
+
82
90
  # Defines the logger used for debugging.
83
91
  # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
84
92
  #
@@ -166,6 +174,7 @@ module BmcApi
166
174
  @timeout = 0
167
175
  @params_encoding = nil
168
176
  @debugging = false
177
+ @ignore_operation_servers = false
169
178
  @inject_format = false
170
179
  @force_ending_format = false
171
180
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
@@ -200,6 +209,7 @@ module BmcApi
200
209
 
201
210
  # Returns base URL for specified operation based on server settings
202
211
  def base_url(operation = nil)
212
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
203
213
  if operation_server_settings.key?(operation) then
204
214
  index = server_operation_index.fetch(operation, server_index)
205
215
  server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
@@ -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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module BmcApi
17
17
  # Result of a successful action.
18
- class ActionResult
18
+ class ActionResult < ApiModelBase
19
19
  # Message describing the action's result.
20
20
  attr_accessor :result
21
21
 
@@ -26,9 +26,14 @@ module BmcApi
26
26
  }
27
27
  end
28
28
 
29
+ # Returns attribute mapping this model knows about
30
+ def self.acceptable_attribute_map
31
+ attribute_map
32
+ end
33
+
29
34
  # Returns all the JSON keys this model knows about
30
35
  def self.acceptable_attributes
31
- attribute_map.values
36
+ acceptable_attribute_map.values
32
37
  end
33
38
 
34
39
  # Attribute type mapping.
@@ -52,9 +57,10 @@ module BmcApi
52
57
  end
53
58
 
54
59
  # check to see if the attribute exists and convert string to symbol for hash key
60
+ acceptable_attribute_map = self.class.acceptable_attribute_map
55
61
  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::ActionResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ if (!acceptable_attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::ActionResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
58
64
  end
59
65
  h[k.to_sym] = v
60
66
  }
@@ -86,6 +92,16 @@ module BmcApi
86
92
  true
87
93
  end
88
94
 
95
+ # Custom attribute writer method with validation
96
+ # @param [Object] result Value to be assigned
97
+ def result=(result)
98
+ if result.nil?
99
+ fail ArgumentError, 'result cannot be nil'
100
+ end
101
+
102
+ @result = result
103
+ end
104
+
89
105
  # Checks equality by comparing each attribute.
90
106
  # @param [Object] Object to be compared
91
107
  def ==(o)
@@ -129,61 +145,6 @@ module BmcApi
129
145
  new(transformed_hash)
130
146
  end
131
147
 
132
- # Deserializes the data based on type
133
- # @param string type Data type
134
- # @param string value Value to be deserialized
135
- # @return [Object] Deserialized data
136
- def self._deserialize(type, value)
137
- case type.to_sym
138
- when :Time
139
- Time.parse(value)
140
- when :Date
141
- Date.parse(value)
142
- when :String
143
- value.to_s
144
- when :Integer
145
- value.to_i
146
- when :Float
147
- value.to_f
148
- when :Boolean
149
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
- true
151
- else
152
- false
153
- end
154
- when :Object
155
- # generic object (usually a Hash), return directly
156
- value
157
- when /\AArray<(?<inner_type>.+)>\z/
158
- inner_type = Regexp.last_match[:inner_type]
159
- value.map { |v| _deserialize(inner_type, v) }
160
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
- k_type = Regexp.last_match[:k_type]
162
- v_type = Regexp.last_match[:v_type]
163
- {}.tap do |hash|
164
- value.each do |k, v|
165
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
- end
167
- end
168
- else # model
169
- # models (e.g. Pet) or oneOf
170
- klass = BmcApi.const_get(type)
171
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
- end
173
- end
174
-
175
- # Returns the string representation of the object
176
- # @return [String] String presentation of the object
177
- def to_s
178
- to_hash.to_s
179
- end
180
-
181
- # to_body is an alias to to_hash (backward compatibility)
182
- # @return [Hash] Returns the object in the form of hash
183
- def to_body
184
- to_hash
185
- end
186
-
187
148
  # Returns the object in the form of hash
188
149
  # @return [Hash] Returns the object in the form of hash
189
150
  def to_hash
@@ -200,24 +161,6 @@ module BmcApi
200
161
  hash
201
162
  end
202
163
 
203
- # Outputs non-array value in the form of hash
204
- # For object, use to_hash. Otherwise, just return the value
205
- # @param [Object] value Any valid value
206
- # @return [Hash] Returns the value in the form of hash
207
- def _to_hash(value)
208
- if value.is_a?(Array)
209
- value.compact.map { |v| _to_hash(v) }
210
- elsif value.is_a?(Hash)
211
- {}.tap do |hash|
212
- value.each { |k, v| hash[k] = _to_hash(v) }
213
- end
214
- elsif value.respond_to? :to_hash
215
- value.to_hash
216
- else
217
- value
218
- end
219
- end
220
-
221
164
  end
222
165
 
223
166
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module BmcApi
17
17
  # Result of a successful delete action.
18
- class DeleteResult
18
+ class DeleteResult < ApiModelBase
19
19
  # Server has been deleted.
20
20
  attr_accessor :result
21
21
 
@@ -30,9 +30,14 @@ module BmcApi
30
30
  }
31
31
  end
32
32
 
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
33
38
  # Returns all the JSON keys this model knows about
34
39
  def self.acceptable_attributes
35
- attribute_map.values
40
+ acceptable_attribute_map.values
36
41
  end
37
42
 
38
43
  # Attribute type mapping.
@@ -57,9 +62,10 @@ module BmcApi
57
62
  end
58
63
 
59
64
  # check to see if the attribute exists and convert string to symbol for hash key
65
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
66
  attributes = attributes.each_with_object({}) { |(k, v), h|
61
- if (!self.class.attribute_map.key?(k.to_sym))
62
- fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::DeleteResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ if (!acceptable_attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::DeleteResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
69
  end
64
70
  h[k.to_sym] = v
65
71
  }
@@ -102,6 +108,26 @@ module BmcApi
102
108
  true
103
109
  end
104
110
 
111
+ # Custom attribute writer method with validation
112
+ # @param [Object] result Value to be assigned
113
+ def result=(result)
114
+ if result.nil?
115
+ fail ArgumentError, 'result cannot be nil'
116
+ end
117
+
118
+ @result = result
119
+ end
120
+
121
+ # Custom attribute writer method with validation
122
+ # @param [Object] server_id Value to be assigned
123
+ def server_id=(server_id)
124
+ if server_id.nil?
125
+ fail ArgumentError, 'server_id cannot be nil'
126
+ end
127
+
128
+ @server_id = server_id
129
+ end
130
+
105
131
  # Checks equality by comparing each attribute.
106
132
  # @param [Object] Object to be compared
107
133
  def ==(o)
@@ -146,61 +172,6 @@ module BmcApi
146
172
  new(transformed_hash)
147
173
  end
148
174
 
149
- # Deserializes the data based on type
150
- # @param string type Data type
151
- # @param string value Value to be deserialized
152
- # @return [Object] Deserialized data
153
- def self._deserialize(type, value)
154
- case type.to_sym
155
- when :Time
156
- Time.parse(value)
157
- when :Date
158
- Date.parse(value)
159
- when :String
160
- value.to_s
161
- when :Integer
162
- value.to_i
163
- when :Float
164
- value.to_f
165
- when :Boolean
166
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
- true
168
- else
169
- false
170
- end
171
- when :Object
172
- # generic object (usually a Hash), return directly
173
- value
174
- when /\AArray<(?<inner_type>.+)>\z/
175
- inner_type = Regexp.last_match[:inner_type]
176
- value.map { |v| _deserialize(inner_type, v) }
177
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
- k_type = Regexp.last_match[:k_type]
179
- v_type = Regexp.last_match[:v_type]
180
- {}.tap do |hash|
181
- value.each do |k, v|
182
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
- end
184
- end
185
- else # model
186
- # models (e.g. Pet) or oneOf
187
- klass = BmcApi.const_get(type)
188
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
189
- end
190
- end
191
-
192
- # Returns the string representation of the object
193
- # @return [String] String presentation of the object
194
- def to_s
195
- to_hash.to_s
196
- end
197
-
198
- # to_body is an alias to to_hash (backward compatibility)
199
- # @return [Hash] Returns the object in the form of hash
200
- def to_body
201
- to_hash
202
- end
203
-
204
175
  # Returns the object in the form of hash
205
176
  # @return [Hash] Returns the object in the form of hash
206
177
  def to_hash
@@ -217,24 +188,6 @@ module BmcApi
217
188
  hash
218
189
  end
219
190
 
220
- # Outputs non-array value in the form of hash
221
- # For object, use to_hash. Otherwise, just return the value
222
- # @param [Object] value Any valid value
223
- # @return [Hash] Returns the value in the form of hash
224
- def _to_hash(value)
225
- if value.is_a?(Array)
226
- value.compact.map { |v| _to_hash(v) }
227
- elsif value.is_a?(Hash)
228
- {}.tap do |hash|
229
- value.each { |k, v| hash[k] = _to_hash(v) }
230
- end
231
- elsif value.respond_to? :to_hash
232
- value.to_hash
233
- else
234
- value
235
- end
236
- end
237
-
238
191
  end
239
192
 
240
193
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module BmcApi
17
17
  # Result of a successful delete action on a SSH key.
18
- class DeleteSshKeyResult
18
+ class DeleteSshKeyResult < ApiModelBase
19
19
  # Resource has been deleted.
20
20
  attr_accessor :result
21
21
 
@@ -30,9 +30,14 @@ module BmcApi
30
30
  }
31
31
  end
32
32
 
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
33
38
  # Returns all the JSON keys this model knows about
34
39
  def self.acceptable_attributes
35
- attribute_map.values
40
+ acceptable_attribute_map.values
36
41
  end
37
42
 
38
43
  # Attribute type mapping.
@@ -57,9 +62,10 @@ module BmcApi
57
62
  end
58
63
 
59
64
  # check to see if the attribute exists and convert string to symbol for hash key
65
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
66
  attributes = attributes.each_with_object({}) { |(k, v), h|
61
- if (!self.class.attribute_map.key?(k.to_sym))
62
- fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::DeleteSshKeyResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ if (!acceptable_attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::DeleteSshKeyResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
69
  end
64
70
  h[k.to_sym] = v
65
71
  }
@@ -102,6 +108,26 @@ module BmcApi
102
108
  true
103
109
  end
104
110
 
111
+ # Custom attribute writer method with validation
112
+ # @param [Object] result Value to be assigned
113
+ def result=(result)
114
+ if result.nil?
115
+ fail ArgumentError, 'result cannot be nil'
116
+ end
117
+
118
+ @result = result
119
+ end
120
+
121
+ # Custom attribute writer method with validation
122
+ # @param [Object] ssh_key_id Value to be assigned
123
+ def ssh_key_id=(ssh_key_id)
124
+ if ssh_key_id.nil?
125
+ fail ArgumentError, 'ssh_key_id cannot be nil'
126
+ end
127
+
128
+ @ssh_key_id = ssh_key_id
129
+ end
130
+
105
131
  # Checks equality by comparing each attribute.
106
132
  # @param [Object] Object to be compared
107
133
  def ==(o)
@@ -146,61 +172,6 @@ module BmcApi
146
172
  new(transformed_hash)
147
173
  end
148
174
 
149
- # Deserializes the data based on type
150
- # @param string type Data type
151
- # @param string value Value to be deserialized
152
- # @return [Object] Deserialized data
153
- def self._deserialize(type, value)
154
- case type.to_sym
155
- when :Time
156
- Time.parse(value)
157
- when :Date
158
- Date.parse(value)
159
- when :String
160
- value.to_s
161
- when :Integer
162
- value.to_i
163
- when :Float
164
- value.to_f
165
- when :Boolean
166
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
- true
168
- else
169
- false
170
- end
171
- when :Object
172
- # generic object (usually a Hash), return directly
173
- value
174
- when /\AArray<(?<inner_type>.+)>\z/
175
- inner_type = Regexp.last_match[:inner_type]
176
- value.map { |v| _deserialize(inner_type, v) }
177
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
- k_type = Regexp.last_match[:k_type]
179
- v_type = Regexp.last_match[:v_type]
180
- {}.tap do |hash|
181
- value.each do |k, v|
182
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
- end
184
- end
185
- else # model
186
- # models (e.g. Pet) or oneOf
187
- klass = BmcApi.const_get(type)
188
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
189
- end
190
- end
191
-
192
- # Returns the string representation of the object
193
- # @return [String] String presentation of the object
194
- def to_s
195
- to_hash.to_s
196
- end
197
-
198
- # to_body is an alias to to_hash (backward compatibility)
199
- # @return [Hash] Returns the object in the form of hash
200
- def to_body
201
- to_hash
202
- end
203
-
204
175
  # Returns the object in the form of hash
205
176
  # @return [Hash] Returns the object in the form of hash
206
177
  def to_hash
@@ -217,24 +188,6 @@ module BmcApi
217
188
  hash
218
189
  end
219
190
 
220
- # Outputs non-array value in the form of hash
221
- # For object, use to_hash. Otherwise, just return the value
222
- # @param [Object] value Any valid value
223
- # @return [Hash] Returns the value in the form of hash
224
- def _to_hash(value)
225
- if value.is_a?(Array)
226
- value.compact.map { |v| _to_hash(v) }
227
- elsif value.is_a?(Hash)
228
- {}.tap do |hash|
229
- value.each { |k, v| hash[k] = _to_hash(v) }
230
- end
231
- elsif value.respond_to? :to_hash
232
- value.to_hash
233
- else
234
- value
235
- end
236
- end
237
-
238
191
  end
239
192
 
240
193
  end