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.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -1
  3. data/VERSION +1 -1
  4. data/docs/DeleteResult.md +1 -1
  5. data/docs/EsxiDatastoreConfiguration.md +18 -0
  6. data/docs/EsxiOsConfiguration.md +18 -0
  7. data/docs/OsConfiguration.md +2 -0
  8. data/docs/OsConfigurationCloudInit.md +1 -1
  9. data/docs/QuotasApi.md +6 -8
  10. data/docs/SSHKeysApi.md +12 -16
  11. data/docs/Server.md +11 -7
  12. data/docs/ServerCreate.md +3 -3
  13. data/docs/ServerNetworkUpdate.md +2 -2
  14. data/docs/ServerPrivateNetwork.md +3 -3
  15. data/docs/ServerProvision.md +38 -0
  16. data/docs/ServerPublicNetwork.md +2 -2
  17. data/docs/ServersApi.md +173 -111
  18. data/docs/StorageConfigurationRootPartition.md +2 -2
  19. data/lib/pnap_bmc_api/api/quotas_api.rb +11 -7
  20. data/lib/pnap_bmc_api/api/servers_api.rb +200 -75
  21. data/lib/pnap_bmc_api/api/ssh_keys_api.rb +21 -13
  22. data/lib/pnap_bmc_api/api_client.rb +26 -23
  23. data/lib/pnap_bmc_api/api_error.rb +2 -1
  24. data/lib/pnap_bmc_api/configuration.rb +28 -9
  25. data/lib/pnap_bmc_api/models/action_result.rb +16 -19
  26. data/lib/pnap_bmc_api/models/delete_result.rb +18 -19
  27. data/lib/pnap_bmc_api/models/delete_ssh_key_result.rb +18 -19
  28. data/lib/pnap_bmc_api/models/error.rb +16 -19
  29. data/lib/pnap_bmc_api/models/esxi_datastore_configuration.rb +262 -0
  30. data/lib/pnap_bmc_api/models/{quota_edit_limit_request_details_all_of.rb → esxi_os_configuration.rb} +25 -36
  31. data/lib/pnap_bmc_api/models/ip_blocks_configuration.rb +19 -20
  32. data/lib/pnap_bmc_api/models/network_configuration.rb +14 -19
  33. data/lib/pnap_bmc_api/models/os_configuration.rb +29 -21
  34. data/lib/pnap_bmc_api/models/os_configuration_cloud_init.rb +15 -20
  35. data/lib/pnap_bmc_api/models/os_configuration_map.rb +14 -19
  36. data/lib/pnap_bmc_api/models/os_configuration_map_esxi.rb +19 -20
  37. data/lib/pnap_bmc_api/models/os_configuration_map_proxmox.rb +19 -20
  38. data/lib/pnap_bmc_api/models/os_configuration_netris_controller.rb +14 -19
  39. data/lib/pnap_bmc_api/models/os_configuration_netris_softgate.rb +25 -22
  40. data/lib/pnap_bmc_api/models/os_configuration_windows.rb +19 -20
  41. data/lib/pnap_bmc_api/models/private_network_configuration.rb +14 -19
  42. data/lib/pnap_bmc_api/models/public_network_configuration.rb +14 -19
  43. data/lib/pnap_bmc_api/models/quota.rb +30 -19
  44. data/lib/pnap_bmc_api/models/quota_edit_limit_request.rb +39 -19
  45. data/lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb +42 -21
  46. data/lib/pnap_bmc_api/models/relinquish_ip_block.rb +14 -19
  47. data/lib/pnap_bmc_api/models/reset_result.rb +16 -19
  48. data/lib/pnap_bmc_api/models/server.rb +79 -33
  49. data/lib/pnap_bmc_api/models/server_create.rb +29 -22
  50. data/lib/pnap_bmc_api/models/server_ip_block.rb +16 -19
  51. data/lib/pnap_bmc_api/models/server_network_update.rb +15 -20
  52. data/lib/pnap_bmc_api/models/server_patch.rb +27 -24
  53. data/lib/pnap_bmc_api/models/server_private_network.rb +23 -22
  54. data/lib/pnap_bmc_api/models/server_provision.rb +395 -0
  55. data/lib/pnap_bmc_api/models/server_public_network.rb +17 -20
  56. data/lib/pnap_bmc_api/models/server_reserve.rb +16 -19
  57. data/lib/pnap_bmc_api/models/server_reset.rb +14 -19
  58. data/lib/pnap_bmc_api/models/ssh_key.rb +28 -19
  59. data/lib/pnap_bmc_api/models/ssh_key_create.rb +52 -19
  60. data/lib/pnap_bmc_api/models/ssh_key_update.rb +29 -19
  61. data/lib/pnap_bmc_api/models/storage_configuration.rb +14 -19
  62. data/lib/pnap_bmc_api/models/storage_configuration_root_partition.rb +14 -19
  63. data/lib/pnap_bmc_api/models/tag_assignment.rb +20 -19
  64. data/lib/pnap_bmc_api/models/tag_assignment_request.rb +16 -19
  65. data/lib/pnap_bmc_api/version.rb +1 -1
  66. data/lib/pnap_bmc_api.rb +4 -2
  67. data/pnap_bmc_api.gemspec +2 -2
  68. data/spec/api/quotas_api_spec.rb +6 -6
  69. data/spec/api/servers_api_spec.rb +109 -36
  70. data/spec/api/ssh_keys_api_spec.rb +9 -9
  71. data/spec/models/action_result_spec.rb +6 -4
  72. data/spec/models/delete_result_spec.rb +7 -5
  73. data/spec/models/delete_ssh_key_result_spec.rb +7 -5
  74. data/spec/models/error_spec.rb +7 -5
  75. data/spec/models/esxi_datastore_configuration_spec.rb +36 -0
  76. data/spec/models/esxi_os_configuration_spec.rb +36 -0
  77. data/spec/models/ip_blocks_configuration_spec.rb +7 -5
  78. data/spec/models/network_configuration_spec.rb +19 -5
  79. data/spec/models/os_configuration_cloud_init_spec.rb +5 -3
  80. data/spec/models/os_configuration_map_esxi_spec.rb +8 -6
  81. data/spec/models/os_configuration_map_proxmox_spec.rb +8 -6
  82. data/spec/models/os_configuration_map_spec.rb +8 -6
  83. data/spec/models/os_configuration_netris_controller_spec.rb +7 -5
  84. data/spec/models/os_configuration_netris_softgate_spec.rb +8 -6
  85. data/spec/models/os_configuration_spec.rb +39 -7
  86. data/spec/models/os_configuration_windows_spec.rb +6 -4
  87. data/spec/models/private_network_configuration_spec.rb +8 -6
  88. data/spec/models/public_network_configuration_spec.rb +6 -4
  89. data/spec/models/quota_edit_limit_request_details_spec.rb +8 -6
  90. data/spec/models/quota_edit_limit_request_spec.rb +7 -5
  91. data/spec/models/quota_spec.rb +13 -15
  92. data/spec/models/relinquish_ip_block_spec.rb +6 -4
  93. data/spec/models/reset_result_spec.rb +8 -6
  94. data/spec/models/server_create_spec.rb +25 -17
  95. data/spec/models/server_ip_block_spec.rb +7 -5
  96. data/spec/models/server_network_update_spec.rb +5 -3
  97. data/spec/models/server_patch_spec.rb +7 -5
  98. data/spec/models/server_private_network_spec.rb +9 -7
  99. data/spec/models/server_provision_spec.rb +96 -0
  100. data/spec/models/server_public_network_spec.rb +8 -6
  101. data/spec/models/server_reserve_spec.rb +6 -4
  102. data/spec/models/server_reset_spec.rb +9 -7
  103. data/spec/models/server_spec.rb +47 -27
  104. data/spec/models/ssh_key_create_spec.rb +8 -6
  105. data/spec/models/ssh_key_spec.rb +12 -10
  106. data/spec/models/ssh_key_update_spec.rb +7 -5
  107. data/spec/models/storage_configuration_root_partition_spec.rb +6 -4
  108. data/spec/models/storage_configuration_spec.rb +5 -3
  109. data/spec/models/tag_assignment_request_spec.rb +7 -5
  110. data/spec/models/tag_assignment_spec.rb +10 -8
  111. data/spec/spec_helper.rb +1 -1
  112. metadata +43 -39
  113. data/docs/QuotaEditLimitRequestDetailsAllOf.md +0 -18
  114. data/spec/api_client_spec.rb +0 -226
  115. data/spec/configuration_spec.rb +0 -42
  116. 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: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -94,6 +94,7 @@ module BmcApi
94
94
  # Show invalid properties with the reasons. Usually used together with valid?
95
95
  # @return Array for valid properties with the reasons
96
96
  def list_invalid_properties
97
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
97
98
  invalid_properties = Array.new
98
99
  if !@controller_address.nil? && @controller_address.to_s.length > 253
99
100
  invalid_properties.push('invalid value for "controller_address", the character length must be smaller than or equal to 253.')
@@ -115,6 +116,7 @@ module BmcApi
115
116
  # Check to see if the all the properties in the model are valid
116
117
  # @return true if the model is valid
117
118
  def valid?
119
+ warn '[DEPRECATED] the `valid?` method is obsolete'
118
120
  return false if !@controller_address.nil? && @controller_address.to_s.length > 253
119
121
  return false if !@controller_address.nil? && @controller_address !~ Regexp.new(/^(?!-)[\w\-]{1,63}(?<!-)(\.(?!-)[\w\-]{1,63}(?<!-))*$/)
120
122
  return false if !@controller_auth_key.nil? && @controller_auth_key !~ Regexp.new(/^\S+$/)
@@ -124,12 +126,16 @@ module BmcApi
124
126
  # Custom attribute writer method with validation
125
127
  # @param [Object] controller_address Value to be assigned
126
128
  def controller_address=(controller_address)
127
- if !controller_address.nil? && controller_address.to_s.length > 253
129
+ if controller_address.nil?
130
+ fail ArgumentError, 'controller_address cannot be nil'
131
+ end
132
+
133
+ if controller_address.to_s.length > 253
128
134
  fail ArgumentError, 'invalid value for "controller_address", the character length must be smaller than or equal to 253.'
129
135
  end
130
136
 
131
137
  pattern = Regexp.new(/^(?!-)[\w\-]{1,63}(?<!-)(\.(?!-)[\w\-]{1,63}(?<!-))*$/)
132
- if !controller_address.nil? && controller_address !~ pattern
138
+ if controller_address !~ pattern
133
139
  fail ArgumentError, "invalid value for \"controller_address\", must conform to the pattern #{pattern}."
134
140
  end
135
141
 
@@ -139,8 +145,12 @@ module BmcApi
139
145
  # Custom attribute writer method with validation
140
146
  # @param [Object] controller_auth_key Value to be assigned
141
147
  def controller_auth_key=(controller_auth_key)
148
+ if controller_auth_key.nil?
149
+ fail ArgumentError, 'controller_auth_key cannot be nil'
150
+ end
151
+
142
152
  pattern = Regexp.new(/^\S+$/)
143
- if !controller_auth_key.nil? && controller_auth_key !~ pattern
153
+ if controller_auth_key !~ pattern
144
154
  fail ArgumentError, "invalid value for \"controller_auth_key\", must conform to the pattern #{pattern}."
145
155
  end
146
156
 
@@ -174,37 +184,30 @@ module BmcApi
174
184
  # @param [Hash] attributes Model attributes in the form of hash
175
185
  # @return [Object] Returns the model itself
176
186
  def self.build_from_hash(attributes)
177
- new.build_from_hash(attributes)
178
- end
179
-
180
- # Builds the object from hash
181
- # @param [Hash] attributes Model attributes in the form of hash
182
- # @return [Object] Returns the model itself
183
- def build_from_hash(attributes)
184
187
  return nil unless attributes.is_a?(Hash)
185
188
  attributes = attributes.transform_keys(&:to_sym)
186
- self.class.openapi_types.each_pair do |key, type|
187
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
188
- self.send("#{key}=", nil)
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
189
193
  elsif type =~ /\AArray<(.*)>/i
190
194
  # check to ensure the input is an array given that the attribute
191
195
  # is documented as an array but the input is not
192
- if attributes[self.class.attribute_map[key]].is_a?(Array)
193
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
196
+ if attributes[attribute_map[key]].is_a?(Array)
197
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
194
198
  end
195
- elsif !attributes[self.class.attribute_map[key]].nil?
196
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
199
+ elsif !attributes[attribute_map[key]].nil?
200
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
197
201
  end
198
202
  end
199
-
200
- self
203
+ new(transformed_hash)
201
204
  end
202
205
 
203
206
  # Deserializes the data based on type
204
207
  # @param string type Data type
205
208
  # @param string value Value to be deserialized
206
209
  # @return [Object] Deserialized data
207
- def _deserialize(type, value)
210
+ def self._deserialize(type, value)
208
211
  case type.to_sym
209
212
  when :Time
210
213
  Time.parse(value)
@@ -239,7 +242,7 @@ module BmcApi
239
242
  else # model
240
243
  # models (e.g. Pet) or oneOf
241
244
  klass = BmcApi.const_get(type)
242
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
245
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
243
246
  end
244
247
  end
245
248
 
@@ -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: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -69,6 +69,7 @@ module BmcApi
69
69
  # Show invalid properties with the reasons. Usually used together with valid?
70
70
  # @return Array for valid properties with the reasons
71
71
  def list_invalid_properties
72
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
72
73
  invalid_properties = Array.new
73
74
  if !@rdp_allowed_ips.nil? && @rdp_allowed_ips.length < 1
74
75
  invalid_properties.push('invalid value for "rdp_allowed_ips", number of items must be greater than or equal to 1.')
@@ -80,6 +81,7 @@ module BmcApi
80
81
  # Check to see if the all the properties in the model are valid
81
82
  # @return true if the model is valid
82
83
  def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
83
85
  return false if !@rdp_allowed_ips.nil? && @rdp_allowed_ips.length < 1
84
86
  true
85
87
  end
@@ -87,7 +89,11 @@ module BmcApi
87
89
  # Custom attribute writer method with validation
88
90
  # @param [Object] rdp_allowed_ips Value to be assigned
89
91
  def rdp_allowed_ips=(rdp_allowed_ips)
90
- if !rdp_allowed_ips.nil? && rdp_allowed_ips.length < 1
92
+ if rdp_allowed_ips.nil?
93
+ fail ArgumentError, 'rdp_allowed_ips cannot be nil'
94
+ end
95
+
96
+ if rdp_allowed_ips.length < 1
91
97
  fail ArgumentError, 'invalid value for "rdp_allowed_ips", number of items must be greater than or equal to 1.'
92
98
  end
93
99
 
@@ -118,37 +124,30 @@ module BmcApi
118
124
  # @param [Hash] attributes Model attributes in the form of hash
119
125
  # @return [Object] Returns the model itself
120
126
  def self.build_from_hash(attributes)
121
- new.build_from_hash(attributes)
122
- end
123
-
124
- # Builds the object from hash
125
- # @param [Hash] attributes Model attributes in the form of hash
126
- # @return [Object] Returns the model itself
127
- def build_from_hash(attributes)
128
127
  return nil unless attributes.is_a?(Hash)
129
128
  attributes = attributes.transform_keys(&:to_sym)
130
- self.class.openapi_types.each_pair do |key, type|
131
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
132
- self.send("#{key}=", nil)
129
+ transformed_hash = {}
130
+ openapi_types.each_pair do |key, type|
131
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
132
+ transformed_hash["#{key}"] = nil
133
133
  elsif type =~ /\AArray<(.*)>/i
134
134
  # check to ensure the input is an array given that the attribute
135
135
  # is documented as an array but the input is not
136
- if attributes[self.class.attribute_map[key]].is_a?(Array)
137
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
136
+ if attributes[attribute_map[key]].is_a?(Array)
137
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
138
138
  end
139
- elsif !attributes[self.class.attribute_map[key]].nil?
140
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
+ elsif !attributes[attribute_map[key]].nil?
140
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
141
141
  end
142
142
  end
143
-
144
- self
143
+ new(transformed_hash)
145
144
  end
146
145
 
147
146
  # Deserializes the data based on type
148
147
  # @param string type Data type
149
148
  # @param string value Value to be deserialized
150
149
  # @return [Object] Deserialized data
151
- def _deserialize(type, value)
150
+ def self._deserialize(type, value)
152
151
  case type.to_sym
153
152
  when :Time
154
153
  Time.parse(value)
@@ -183,7 +182,7 @@ module BmcApi
183
182
  else # model
184
183
  # models (e.g. Pet) or oneOf
185
184
  klass = BmcApi.const_get(type)
186
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
185
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
186
  end
188
187
  end
189
188
 
@@ -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: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -89,6 +89,7 @@ module BmcApi
89
89
  # Show invalid properties with the reasons. Usually used together with valid?
90
90
  # @return Array for valid properties with the reasons
91
91
  def list_invalid_properties
92
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
92
93
  invalid_properties = Array.new
93
94
  invalid_properties
94
95
  end
@@ -96,6 +97,7 @@ module BmcApi
96
97
  # Check to see if the all the properties in the model are valid
97
98
  # @return true if the model is valid
98
99
  def valid?
100
+ warn '[DEPRECATED] the `valid?` method is obsolete'
99
101
  true
100
102
  end
101
103
 
@@ -125,37 +127,30 @@ module BmcApi
125
127
  # @param [Hash] attributes Model attributes in the form of hash
126
128
  # @return [Object] Returns the model itself
127
129
  def self.build_from_hash(attributes)
128
- new.build_from_hash(attributes)
129
- end
130
-
131
- # Builds the object from hash
132
- # @param [Hash] attributes Model attributes in the form of hash
133
- # @return [Object] Returns the model itself
134
- def build_from_hash(attributes)
135
130
  return nil unless attributes.is_a?(Hash)
136
131
  attributes = attributes.transform_keys(&:to_sym)
137
- self.class.openapi_types.each_pair do |key, type|
138
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
139
- self.send("#{key}=", nil)
132
+ transformed_hash = {}
133
+ openapi_types.each_pair do |key, type|
134
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
135
+ transformed_hash["#{key}"] = nil
140
136
  elsif type =~ /\AArray<(.*)>/i
141
137
  # check to ensure the input is an array given that the attribute
142
138
  # is documented as an array but the input is not
143
- if attributes[self.class.attribute_map[key]].is_a?(Array)
144
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
+ if attributes[attribute_map[key]].is_a?(Array)
140
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
145
141
  end
146
- elsif !attributes[self.class.attribute_map[key]].nil?
147
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
+ elsif !attributes[attribute_map[key]].nil?
143
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
148
144
  end
149
145
  end
150
-
151
- self
146
+ new(transformed_hash)
152
147
  end
153
148
 
154
149
  # Deserializes the data based on type
155
150
  # @param string type Data type
156
151
  # @param string value Value to be deserialized
157
152
  # @return [Object] Deserialized data
158
- def _deserialize(type, value)
153
+ def self._deserialize(type, value)
159
154
  case type.to_sym
160
155
  when :Time
161
156
  Time.parse(value)
@@ -190,7 +185,7 @@ module BmcApi
190
185
  else # model
191
186
  # models (e.g. Pet) or oneOf
192
187
  klass = BmcApi.const_get(type)
193
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
194
189
  end
195
190
  end
196
191
 
@@ -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: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -69,6 +69,7 @@ module BmcApi
69
69
  # Show invalid properties with the reasons. Usually used together with valid?
70
70
  # @return Array for valid properties with the reasons
71
71
  def list_invalid_properties
72
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
72
73
  invalid_properties = Array.new
73
74
  invalid_properties
74
75
  end
@@ -76,6 +77,7 @@ module BmcApi
76
77
  # Check to see if the all the properties in the model are valid
77
78
  # @return true if the model is valid
78
79
  def valid?
80
+ warn '[DEPRECATED] the `valid?` method is obsolete'
79
81
  true
80
82
  end
81
83
 
@@ -103,37 +105,30 @@ module BmcApi
103
105
  # @param [Hash] attributes Model attributes in the form of hash
104
106
  # @return [Object] Returns the model itself
105
107
  def self.build_from_hash(attributes)
106
- new.build_from_hash(attributes)
107
- end
108
-
109
- # Builds the object from hash
110
- # @param [Hash] attributes Model attributes in the form of hash
111
- # @return [Object] Returns the model itself
112
- def build_from_hash(attributes)
113
108
  return nil unless attributes.is_a?(Hash)
114
109
  attributes = attributes.transform_keys(&:to_sym)
115
- self.class.openapi_types.each_pair do |key, type|
116
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
117
- self.send("#{key}=", nil)
110
+ transformed_hash = {}
111
+ openapi_types.each_pair do |key, type|
112
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
113
+ transformed_hash["#{key}"] = nil
118
114
  elsif type =~ /\AArray<(.*)>/i
119
115
  # check to ensure the input is an array given that the attribute
120
116
  # is documented as an array but the input is not
121
- if attributes[self.class.attribute_map[key]].is_a?(Array)
122
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
117
+ if attributes[attribute_map[key]].is_a?(Array)
118
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
123
119
  end
124
- elsif !attributes[self.class.attribute_map[key]].nil?
125
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ elsif !attributes[attribute_map[key]].nil?
121
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
126
122
  end
127
123
  end
128
-
129
- self
124
+ new(transformed_hash)
130
125
  end
131
126
 
132
127
  # Deserializes the data based on type
133
128
  # @param string type Data type
134
129
  # @param string value Value to be deserialized
135
130
  # @return [Object] Deserialized data
136
- def _deserialize(type, value)
131
+ def self._deserialize(type, value)
137
132
  case type.to_sym
138
133
  when :Time
139
134
  Time.parse(value)
@@ -168,7 +163,7 @@ module BmcApi
168
163
  else # model
169
164
  # models (e.g. Pet) or oneOf
170
165
  klass = BmcApi.const_get(type)
171
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
166
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
167
  end
173
168
  end
174
169
 
@@ -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: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -117,42 +117,59 @@ module BmcApi
117
117
 
118
118
  if attributes.key?(:'id')
119
119
  self.id = attributes[:'id']
120
+ else
121
+ self.id = nil
120
122
  end
121
123
 
122
124
  if attributes.key?(:'name')
123
125
  self.name = attributes[:'name']
126
+ else
127
+ self.name = nil
124
128
  end
125
129
 
126
130
  if attributes.key?(:'description')
127
131
  self.description = attributes[:'description']
132
+ else
133
+ self.description = nil
128
134
  end
129
135
 
130
136
  if attributes.key?(:'status')
131
137
  self.status = attributes[:'status']
138
+ else
139
+ self.status = nil
132
140
  end
133
141
 
134
142
  if attributes.key?(:'limit')
135
143
  self.limit = attributes[:'limit']
144
+ else
145
+ self.limit = nil
136
146
  end
137
147
 
138
148
  if attributes.key?(:'unit')
139
149
  self.unit = attributes[:'unit']
150
+ else
151
+ self.unit = nil
140
152
  end
141
153
 
142
154
  if attributes.key?(:'used')
143
155
  self.used = attributes[:'used']
156
+ else
157
+ self.used = nil
144
158
  end
145
159
 
146
160
  if attributes.key?(:'quota_edit_limit_request_details')
147
161
  if (value = attributes[:'quota_edit_limit_request_details']).is_a?(Array)
148
162
  self.quota_edit_limit_request_details = value
149
163
  end
164
+ else
165
+ self.quota_edit_limit_request_details = nil
150
166
  end
151
167
  end
152
168
 
153
169
  # Show invalid properties with the reasons. Usually used together with valid?
154
170
  # @return Array for valid properties with the reasons
155
171
  def list_invalid_properties
172
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
156
173
  invalid_properties = Array.new
157
174
  if @id.nil?
158
175
  invalid_properties.push('invalid value for "id", id cannot be nil.')
@@ -200,6 +217,7 @@ module BmcApi
200
217
  # Check to see if the all the properties in the model are valid
201
218
  # @return true if the model is valid
202
219
  def valid?
220
+ warn '[DEPRECATED] the `valid?` method is obsolete'
203
221
  return false if @id.nil?
204
222
  return false if @name.nil?
205
223
  return false if @description.nil?
@@ -284,37 +302,30 @@ module BmcApi
284
302
  # @param [Hash] attributes Model attributes in the form of hash
285
303
  # @return [Object] Returns the model itself
286
304
  def self.build_from_hash(attributes)
287
- new.build_from_hash(attributes)
288
- end
289
-
290
- # Builds the object from hash
291
- # @param [Hash] attributes Model attributes in the form of hash
292
- # @return [Object] Returns the model itself
293
- def build_from_hash(attributes)
294
305
  return nil unless attributes.is_a?(Hash)
295
306
  attributes = attributes.transform_keys(&:to_sym)
296
- self.class.openapi_types.each_pair do |key, type|
297
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
298
- self.send("#{key}=", nil)
307
+ transformed_hash = {}
308
+ openapi_types.each_pair do |key, type|
309
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
310
+ transformed_hash["#{key}"] = nil
299
311
  elsif type =~ /\AArray<(.*)>/i
300
312
  # check to ensure the input is an array given that the attribute
301
313
  # is documented as an array but the input is not
302
- if attributes[self.class.attribute_map[key]].is_a?(Array)
303
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
314
+ if attributes[attribute_map[key]].is_a?(Array)
315
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
304
316
  end
305
- elsif !attributes[self.class.attribute_map[key]].nil?
306
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
317
+ elsif !attributes[attribute_map[key]].nil?
318
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
307
319
  end
308
320
  end
309
-
310
- self
321
+ new(transformed_hash)
311
322
  end
312
323
 
313
324
  # Deserializes the data based on type
314
325
  # @param string type Data type
315
326
  # @param string value Value to be deserialized
316
327
  # @return [Object] Deserialized data
317
- def _deserialize(type, value)
328
+ def self._deserialize(type, value)
318
329
  case type.to_sym
319
330
  when :Time
320
331
  Time.parse(value)
@@ -349,7 +360,7 @@ module BmcApi
349
360
  else # model
350
361
  # models (e.g. Pet) or oneOf
351
362
  klass = BmcApi.const_get(type)
352
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
363
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
353
364
  end
354
365
  end
355
366
 
@@ -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: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -66,16 +66,21 @@ module BmcApi
66
66
 
67
67
  if attributes.key?(:'limit')
68
68
  self.limit = attributes[:'limit']
69
+ else
70
+ self.limit = nil
69
71
  end
70
72
 
71
73
  if attributes.key?(:'reason')
72
74
  self.reason = attributes[:'reason']
75
+ else
76
+ self.reason = nil
73
77
  end
74
78
  end
75
79
 
76
80
  # Show invalid properties with the reasons. Usually used together with valid?
77
81
  # @return Array for valid properties with the reasons
78
82
  def list_invalid_properties
83
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
79
84
  invalid_properties = Array.new
80
85
  if @limit.nil?
81
86
  invalid_properties.push('invalid value for "limit", limit cannot be nil.')
@@ -89,15 +94,22 @@ module BmcApi
89
94
  invalid_properties.push('invalid value for "reason", reason cannot be nil.')
90
95
  end
91
96
 
97
+ pattern = Regexp.new(/^(?!\s*$).+/)
98
+ if @reason !~ pattern
99
+ invalid_properties.push("invalid value for \"reason\", must conform to the pattern #{pattern}.")
100
+ end
101
+
92
102
  invalid_properties
93
103
  end
94
104
 
95
105
  # Check to see if the all the properties in the model are valid
96
106
  # @return true if the model is valid
97
107
  def valid?
108
+ warn '[DEPRECATED] the `valid?` method is obsolete'
98
109
  return false if @limit.nil?
99
110
  return false if @limit < 0
100
111
  return false if @reason.nil?
112
+ return false if @reason !~ Regexp.new(/^(?!\s*$).+/)
101
113
  true
102
114
  end
103
115
 
@@ -115,6 +127,21 @@ module BmcApi
115
127
  @limit = limit
116
128
  end
117
129
 
130
+ # Custom attribute writer method with validation
131
+ # @param [Object] reason Value to be assigned
132
+ def reason=(reason)
133
+ if reason.nil?
134
+ fail ArgumentError, 'reason cannot be nil'
135
+ end
136
+
137
+ pattern = Regexp.new(/^(?!\s*$).+/)
138
+ if reason !~ pattern
139
+ fail ArgumentError, "invalid value for \"reason\", must conform to the pattern #{pattern}."
140
+ end
141
+
142
+ @reason = reason
143
+ end
144
+
118
145
  # Checks equality by comparing each attribute.
119
146
  # @param [Object] Object to be compared
120
147
  def ==(o)
@@ -140,37 +167,30 @@ module BmcApi
140
167
  # @param [Hash] attributes Model attributes in the form of hash
141
168
  # @return [Object] Returns the model itself
142
169
  def self.build_from_hash(attributes)
143
- new.build_from_hash(attributes)
144
- end
145
-
146
- # Builds the object from hash
147
- # @param [Hash] attributes Model attributes in the form of hash
148
- # @return [Object] Returns the model itself
149
- def build_from_hash(attributes)
150
170
  return nil unless attributes.is_a?(Hash)
151
171
  attributes = attributes.transform_keys(&:to_sym)
152
- self.class.openapi_types.each_pair do |key, type|
153
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
154
- self.send("#{key}=", nil)
172
+ transformed_hash = {}
173
+ openapi_types.each_pair do |key, type|
174
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
175
+ transformed_hash["#{key}"] = nil
155
176
  elsif type =~ /\AArray<(.*)>/i
156
177
  # check to ensure the input is an array given that the attribute
157
178
  # is documented as an array but the input is not
158
- if attributes[self.class.attribute_map[key]].is_a?(Array)
159
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
179
+ if attributes[attribute_map[key]].is_a?(Array)
180
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
160
181
  end
161
- elsif !attributes[self.class.attribute_map[key]].nil?
162
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
182
+ elsif !attributes[attribute_map[key]].nil?
183
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
163
184
  end
164
185
  end
165
-
166
- self
186
+ new(transformed_hash)
167
187
  end
168
188
 
169
189
  # Deserializes the data based on type
170
190
  # @param string type Data type
171
191
  # @param string value Value to be deserialized
172
192
  # @return [Object] Deserialized data
173
- def _deserialize(type, value)
193
+ def self._deserialize(type, value)
174
194
  case type.to_sym
175
195
  when :Time
176
196
  Time.parse(value)
@@ -205,7 +225,7 @@ module BmcApi
205
225
  else # model
206
226
  # models (e.g. Pet) or oneOf
207
227
  klass = BmcApi.const_get(type)
208
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
228
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
209
229
  end
210
230
  end
211
231