pnap_bmc_api 1.5.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -1
  3. data/VERSION +1 -1
  4. data/docs/DeleteResult.md +1 -1
  5. data/docs/OsConfigurationCloudInit.md +1 -1
  6. data/docs/QuotasApi.md +6 -8
  7. data/docs/SSHKeysApi.md +12 -16
  8. data/docs/Server.md +11 -7
  9. data/docs/ServerCreate.md +3 -3
  10. data/docs/ServerNetworkUpdate.md +2 -2
  11. data/docs/ServerPrivateNetwork.md +3 -3
  12. data/docs/ServerProvision.md +38 -0
  13. data/docs/ServerPublicNetwork.md +2 -2
  14. data/docs/ServersApi.md +173 -111
  15. data/docs/StorageConfigurationRootPartition.md +2 -2
  16. data/lib/pnap_bmc_api/api/quotas_api.rb +11 -7
  17. data/lib/pnap_bmc_api/api/servers_api.rb +200 -75
  18. data/lib/pnap_bmc_api/api/ssh_keys_api.rb +21 -13
  19. data/lib/pnap_bmc_api/api_client.rb +24 -21
  20. data/lib/pnap_bmc_api/api_error.rb +2 -1
  21. data/lib/pnap_bmc_api/configuration.rb +28 -9
  22. data/lib/pnap_bmc_api/models/action_result.rb +16 -19
  23. data/lib/pnap_bmc_api/models/delete_result.rb +18 -19
  24. data/lib/pnap_bmc_api/models/delete_ssh_key_result.rb +18 -19
  25. data/lib/pnap_bmc_api/models/error.rb +16 -19
  26. data/lib/pnap_bmc_api/models/ip_blocks_configuration.rb +19 -20
  27. data/lib/pnap_bmc_api/models/network_configuration.rb +14 -19
  28. data/lib/pnap_bmc_api/models/os_configuration.rb +19 -20
  29. data/lib/pnap_bmc_api/models/os_configuration_cloud_init.rb +15 -20
  30. data/lib/pnap_bmc_api/models/os_configuration_map.rb +14 -19
  31. data/lib/pnap_bmc_api/models/os_configuration_map_esxi.rb +19 -20
  32. data/lib/pnap_bmc_api/models/os_configuration_map_proxmox.rb +19 -20
  33. data/lib/pnap_bmc_api/models/os_configuration_netris_controller.rb +14 -19
  34. data/lib/pnap_bmc_api/models/os_configuration_netris_softgate.rb +25 -22
  35. data/lib/pnap_bmc_api/models/os_configuration_windows.rb +19 -20
  36. data/lib/pnap_bmc_api/models/private_network_configuration.rb +14 -19
  37. data/lib/pnap_bmc_api/models/public_network_configuration.rb +14 -19
  38. data/lib/pnap_bmc_api/models/quota.rb +30 -19
  39. data/lib/pnap_bmc_api/models/quota_edit_limit_request.rb +39 -19
  40. data/lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb +42 -21
  41. data/lib/pnap_bmc_api/models/relinquish_ip_block.rb +14 -19
  42. data/lib/pnap_bmc_api/models/reset_result.rb +16 -19
  43. data/lib/pnap_bmc_api/models/server.rb +79 -33
  44. data/lib/pnap_bmc_api/models/server_create.rb +29 -22
  45. data/lib/pnap_bmc_api/models/server_ip_block.rb +16 -19
  46. data/lib/pnap_bmc_api/models/server_network_update.rb +15 -20
  47. data/lib/pnap_bmc_api/models/server_patch.rb +27 -24
  48. data/lib/pnap_bmc_api/models/server_private_network.rb +23 -22
  49. data/lib/pnap_bmc_api/models/server_provision.rb +395 -0
  50. data/lib/pnap_bmc_api/models/server_public_network.rb +17 -20
  51. data/lib/pnap_bmc_api/models/server_reserve.rb +16 -19
  52. data/lib/pnap_bmc_api/models/server_reset.rb +14 -19
  53. data/lib/pnap_bmc_api/models/ssh_key.rb +28 -19
  54. data/lib/pnap_bmc_api/models/ssh_key_create.rb +52 -19
  55. data/lib/pnap_bmc_api/models/ssh_key_update.rb +29 -19
  56. data/lib/pnap_bmc_api/models/storage_configuration.rb +14 -19
  57. data/lib/pnap_bmc_api/models/storage_configuration_root_partition.rb +14 -19
  58. data/lib/pnap_bmc_api/models/tag_assignment.rb +20 -19
  59. data/lib/pnap_bmc_api/models/tag_assignment_request.rb +16 -19
  60. data/lib/pnap_bmc_api/version.rb +1 -1
  61. data/lib/pnap_bmc_api.rb +2 -2
  62. data/pnap_bmc_api.gemspec +2 -2
  63. data/spec/api/quotas_api_spec.rb +6 -6
  64. data/spec/api/servers_api_spec.rb +109 -36
  65. data/spec/api/ssh_keys_api_spec.rb +9 -9
  66. data/spec/models/action_result_spec.rb +6 -4
  67. data/spec/models/delete_result_spec.rb +7 -5
  68. data/spec/models/delete_ssh_key_result_spec.rb +7 -5
  69. data/spec/models/error_spec.rb +7 -5
  70. data/spec/models/ip_blocks_configuration_spec.rb +7 -5
  71. data/spec/models/network_configuration_spec.rb +19 -5
  72. data/spec/models/os_configuration_cloud_init_spec.rb +5 -3
  73. data/spec/models/os_configuration_map_esxi_spec.rb +8 -6
  74. data/spec/models/os_configuration_map_proxmox_spec.rb +8 -6
  75. data/spec/models/os_configuration_map_spec.rb +8 -6
  76. data/spec/models/os_configuration_netris_controller_spec.rb +7 -5
  77. data/spec/models/os_configuration_netris_softgate_spec.rb +8 -6
  78. data/spec/models/os_configuration_spec.rb +33 -7
  79. data/spec/models/os_configuration_windows_spec.rb +6 -4
  80. data/spec/models/private_network_configuration_spec.rb +8 -6
  81. data/spec/models/public_network_configuration_spec.rb +6 -4
  82. data/spec/models/quota_edit_limit_request_details_spec.rb +8 -6
  83. data/spec/models/quota_edit_limit_request_spec.rb +7 -5
  84. data/spec/models/quota_spec.rb +13 -15
  85. data/spec/models/relinquish_ip_block_spec.rb +6 -4
  86. data/spec/models/reset_result_spec.rb +8 -6
  87. data/spec/models/server_create_spec.rb +25 -17
  88. data/spec/models/server_ip_block_spec.rb +7 -5
  89. data/spec/models/server_network_update_spec.rb +5 -3
  90. data/spec/models/server_patch_spec.rb +7 -5
  91. data/spec/models/server_private_network_spec.rb +9 -7
  92. data/spec/models/server_provision_spec.rb +96 -0
  93. data/spec/models/server_public_network_spec.rb +8 -6
  94. data/spec/models/server_reserve_spec.rb +6 -4
  95. data/spec/models/server_reset_spec.rb +9 -7
  96. data/spec/models/server_spec.rb +47 -27
  97. data/spec/models/ssh_key_create_spec.rb +8 -6
  98. data/spec/models/ssh_key_spec.rb +12 -10
  99. data/spec/models/ssh_key_update_spec.rb +7 -5
  100. data/spec/models/storage_configuration_root_partition_spec.rb +6 -4
  101. data/spec/models/storage_configuration_spec.rb +5 -3
  102. data/spec/models/tag_assignment_request_spec.rb +7 -5
  103. data/spec/models/tag_assignment_spec.rb +10 -8
  104. data/spec/spec_helper.rb +1 -1
  105. metadata +38 -42
  106. data/docs/QuotaEditLimitRequestDetailsAllOf.md +0 -18
  107. data/lib/pnap_bmc_api/models/quota_edit_limit_request_details_all_of.rb +0 -226
  108. data/spec/api_client_spec.rb +0 -226
  109. data/spec/configuration_spec.rb +0 -42
  110. 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
 
@@ -19,7 +19,7 @@ module BmcApi
19
19
  # The network identifier.
20
20
  attr_accessor :id
21
21
 
22
- # Configurable/configured IPs on the server.<br> At least 1 IP address is required. All IPs must be within the network's range.<br> Setting the `force` query parameter to `true` allows you to:<ul> <li> Assign no specific IP addresses by designating an empty array of IPs. Note that at least one IP is required for the gateway address to be selected from this network. <li> Assign one or more IP addresses which are already configured on other resource(s) in network.</ul>
22
+ # Configurable/configured IPs on the server.<br> At least 1 IP address is required. Valid IP formats are single IPv4 addresses or IPv4 ranges. All IPs must be within the network's range.<br> Setting the `force` query parameter to `true` allows you to:<ul> <li> Assign no specific IP addresses by designating an empty array of IPs. Note that at least one IP is required for the gateway address to be selected from this network. <li> Assign one or more IP addresses which are already configured on other resource(s) in network.</ul>
23
23
  attr_accessor :ips
24
24
 
25
25
  # (Read-only) The status of the assignment to the network.
@@ -71,6 +71,8 @@ module BmcApi
71
71
 
72
72
  if attributes.key?(:'id')
73
73
  self.id = attributes[:'id']
74
+ else
75
+ self.id = nil
74
76
  end
75
77
 
76
78
  if attributes.key?(:'ips')
@@ -87,6 +89,7 @@ module BmcApi
87
89
  # Show invalid properties with the reasons. Usually used together with valid?
88
90
  # @return Array for valid properties with the reasons
89
91
  def list_invalid_properties
92
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
90
93
  invalid_properties = Array.new
91
94
  if @id.nil?
92
95
  invalid_properties.push('invalid value for "id", id cannot be nil.')
@@ -98,6 +101,7 @@ module BmcApi
98
101
  # Check to see if the all the properties in the model are valid
99
102
  # @return true if the model is valid
100
103
  def valid?
104
+ warn '[DEPRECATED] the `valid?` method is obsolete'
101
105
  return false if @id.nil?
102
106
  true
103
107
  end
@@ -128,37 +132,30 @@ module BmcApi
128
132
  # @param [Hash] attributes Model attributes in the form of hash
129
133
  # @return [Object] Returns the model itself
130
134
  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
135
  return nil unless attributes.is_a?(Hash)
139
136
  attributes = attributes.transform_keys(&:to_sym)
140
- self.class.openapi_types.each_pair do |key, type|
141
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
142
- self.send("#{key}=", nil)
137
+ transformed_hash = {}
138
+ openapi_types.each_pair do |key, type|
139
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
140
+ transformed_hash["#{key}"] = nil
143
141
  elsif type =~ /\AArray<(.*)>/i
144
142
  # check to ensure the input is an array given that the attribute
145
143
  # is documented as an array but the input is not
146
- if attributes[self.class.attribute_map[key]].is_a?(Array)
147
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
144
+ if attributes[attribute_map[key]].is_a?(Array)
145
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
148
146
  end
149
- elsif !attributes[self.class.attribute_map[key]].nil?
150
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
147
+ elsif !attributes[attribute_map[key]].nil?
148
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
151
149
  end
152
150
  end
153
-
154
- self
151
+ new(transformed_hash)
155
152
  end
156
153
 
157
154
  # Deserializes the data based on type
158
155
  # @param string type Data type
159
156
  # @param string value Value to be deserialized
160
157
  # @return [Object] Deserialized data
161
- def _deserialize(type, value)
158
+ def self._deserialize(type, value)
162
159
  case type.to_sym
163
160
  when :Time
164
161
  Time.parse(value)
@@ -193,7 +190,7 @@ module BmcApi
193
190
  else # model
194
191
  # models (e.g. Pet) or oneOf
195
192
  klass = BmcApi.const_get(type)
196
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
193
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
197
194
  end
198
195
  end
199
196
 
@@ -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
 
@@ -61,12 +61,15 @@ module BmcApi
61
61
 
62
62
  if attributes.key?(:'pricing_model')
63
63
  self.pricing_model = attributes[:'pricing_model']
64
+ else
65
+ self.pricing_model = nil
64
66
  end
65
67
  end
66
68
 
67
69
  # Show invalid properties with the reasons. Usually used together with valid?
68
70
  # @return Array for valid properties with the reasons
69
71
  def list_invalid_properties
72
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
70
73
  invalid_properties = Array.new
71
74
  if @pricing_model.nil?
72
75
  invalid_properties.push('invalid value for "pricing_model", pricing_model cannot be nil.')
@@ -78,6 +81,7 @@ module BmcApi
78
81
  # Check to see if the all the properties in the model are valid
79
82
  # @return true if the model is valid
80
83
  def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
81
85
  return false if @pricing_model.nil?
82
86
  true
83
87
  end
@@ -106,37 +110,30 @@ module BmcApi
106
110
  # @param [Hash] attributes Model attributes in the form of hash
107
111
  # @return [Object] Returns the model itself
108
112
  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
113
  return nil unless attributes.is_a?(Hash)
117
114
  attributes = attributes.transform_keys(&:to_sym)
118
- self.class.openapi_types.each_pair do |key, type|
119
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
120
- self.send("#{key}=", nil)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
121
119
  elsif type =~ /\AArray<(.*)>/i
122
120
  # check to ensure the input is an array given that the attribute
123
121
  # is documented as an array but the input is not
124
- if attributes[self.class.attribute_map[key]].is_a?(Array)
125
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
126
124
  end
127
- elsif !attributes[self.class.attribute_map[key]].nil?
128
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
129
127
  end
130
128
  end
131
-
132
- self
129
+ new(transformed_hash)
133
130
  end
134
131
 
135
132
  # Deserializes the data based on type
136
133
  # @param string type Data type
137
134
  # @param string value Value to be deserialized
138
135
  # @return [Object] Deserialized data
139
- def _deserialize(type, value)
136
+ def self._deserialize(type, value)
140
137
  case type.to_sym
141
138
  when :Time
142
139
  Time.parse(value)
@@ -171,7 +168,7 @@ module BmcApi
171
168
  else # model
172
169
  # models (e.g. Pet) or oneOf
173
170
  klass = BmcApi.const_get(type)
174
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
171
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
175
172
  end
176
173
  end
177
174
 
@@ -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
 
@@ -99,6 +99,7 @@ module BmcApi
99
99
  # Show invalid properties with the reasons. Usually used together with valid?
100
100
  # @return Array for valid properties with the reasons
101
101
  def list_invalid_properties
102
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
102
103
  invalid_properties = Array.new
103
104
  invalid_properties
104
105
  end
@@ -106,6 +107,7 @@ module BmcApi
106
107
  # Check to see if the all the properties in the model are valid
107
108
  # @return true if the model is valid
108
109
  def valid?
110
+ warn '[DEPRECATED] the `valid?` method is obsolete'
109
111
  true
110
112
  end
111
113
 
@@ -136,37 +138,30 @@ module BmcApi
136
138
  # @param [Hash] attributes Model attributes in the form of hash
137
139
  # @return [Object] Returns the model itself
138
140
  def self.build_from_hash(attributes)
139
- new.build_from_hash(attributes)
140
- end
141
-
142
- # Builds the object from hash
143
- # @param [Hash] attributes Model attributes in the form of hash
144
- # @return [Object] Returns the model itself
145
- def build_from_hash(attributes)
146
141
  return nil unless attributes.is_a?(Hash)
147
142
  attributes = attributes.transform_keys(&:to_sym)
148
- self.class.openapi_types.each_pair do |key, type|
149
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
150
- self.send("#{key}=", nil)
143
+ transformed_hash = {}
144
+ openapi_types.each_pair do |key, type|
145
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
146
+ transformed_hash["#{key}"] = nil
151
147
  elsif type =~ /\AArray<(.*)>/i
152
148
  # check to ensure the input is an array given that the attribute
153
149
  # is documented as an array but the input is not
154
- if attributes[self.class.attribute_map[key]].is_a?(Array)
155
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
150
+ if attributes[attribute_map[key]].is_a?(Array)
151
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
156
152
  end
157
- elsif !attributes[self.class.attribute_map[key]].nil?
158
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
153
+ elsif !attributes[attribute_map[key]].nil?
154
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
159
155
  end
160
156
  end
161
-
162
- self
157
+ new(transformed_hash)
163
158
  end
164
159
 
165
160
  # Deserializes the data based on type
166
161
  # @param string type Data type
167
162
  # @param string value Value to be deserialized
168
163
  # @return [Object] Deserialized data
169
- def _deserialize(type, value)
164
+ def self._deserialize(type, value)
170
165
  case type.to_sym
171
166
  when :Time
172
167
  Time.parse(value)
@@ -201,7 +196,7 @@ module BmcApi
201
196
  else # model
202
197
  # models (e.g. Pet) or oneOf
203
198
  klass = BmcApi.const_get(type)
204
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
199
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
200
  end
206
201
  end
207
202
 
@@ -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
 
@@ -91,36 +91,51 @@ module BmcApi
91
91
 
92
92
  if attributes.key?(:'id')
93
93
  self.id = attributes[:'id']
94
+ else
95
+ self.id = nil
94
96
  end
95
97
 
96
98
  if attributes.key?(:'default')
97
99
  self.default = attributes[:'default']
100
+ else
101
+ self.default = nil
98
102
  end
99
103
 
100
104
  if attributes.key?(:'name')
101
105
  self.name = attributes[:'name']
106
+ else
107
+ self.name = nil
102
108
  end
103
109
 
104
110
  if attributes.key?(:'key')
105
111
  self.key = attributes[:'key']
112
+ else
113
+ self.key = nil
106
114
  end
107
115
 
108
116
  if attributes.key?(:'fingerprint')
109
117
  self.fingerprint = attributes[:'fingerprint']
118
+ else
119
+ self.fingerprint = nil
110
120
  end
111
121
 
112
122
  if attributes.key?(:'created_on')
113
123
  self.created_on = attributes[:'created_on']
124
+ else
125
+ self.created_on = nil
114
126
  end
115
127
 
116
128
  if attributes.key?(:'last_updated_on')
117
129
  self.last_updated_on = attributes[:'last_updated_on']
130
+ else
131
+ self.last_updated_on = nil
118
132
  end
119
133
  end
120
134
 
121
135
  # Show invalid properties with the reasons. Usually used together with valid?
122
136
  # @return Array for valid properties with the reasons
123
137
  def list_invalid_properties
138
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
124
139
  invalid_properties = Array.new
125
140
  if @id.nil?
126
141
  invalid_properties.push('invalid value for "id", id cannot be nil.')
@@ -156,6 +171,7 @@ module BmcApi
156
171
  # Check to see if the all the properties in the model are valid
157
172
  # @return true if the model is valid
158
173
  def valid?
174
+ warn '[DEPRECATED] the `valid?` method is obsolete'
159
175
  return false if @id.nil?
160
176
  return false if @default.nil?
161
177
  return false if @name.nil?
@@ -196,37 +212,30 @@ module BmcApi
196
212
  # @param [Hash] attributes Model attributes in the form of hash
197
213
  # @return [Object] Returns the model itself
198
214
  def self.build_from_hash(attributes)
199
- new.build_from_hash(attributes)
200
- end
201
-
202
- # Builds the object from hash
203
- # @param [Hash] attributes Model attributes in the form of hash
204
- # @return [Object] Returns the model itself
205
- def build_from_hash(attributes)
206
215
  return nil unless attributes.is_a?(Hash)
207
216
  attributes = attributes.transform_keys(&:to_sym)
208
- self.class.openapi_types.each_pair do |key, type|
209
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
210
- self.send("#{key}=", nil)
217
+ transformed_hash = {}
218
+ openapi_types.each_pair do |key, type|
219
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
220
+ transformed_hash["#{key}"] = nil
211
221
  elsif type =~ /\AArray<(.*)>/i
212
222
  # check to ensure the input is an array given that the attribute
213
223
  # is documented as an array but the input is not
214
- if attributes[self.class.attribute_map[key]].is_a?(Array)
215
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
224
+ if attributes[attribute_map[key]].is_a?(Array)
225
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
216
226
  end
217
- elsif !attributes[self.class.attribute_map[key]].nil?
218
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
227
+ elsif !attributes[attribute_map[key]].nil?
228
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
219
229
  end
220
230
  end
221
-
222
- self
231
+ new(transformed_hash)
223
232
  end
224
233
 
225
234
  # Deserializes the data based on type
226
235
  # @param string type Data type
227
236
  # @param string value Value to be deserialized
228
237
  # @return [Object] Deserialized data
229
- def _deserialize(type, value)
238
+ def self._deserialize(type, value)
230
239
  case type.to_sym
231
240
  when :Time
232
241
  Time.parse(value)
@@ -261,7 +270,7 @@ module BmcApi
261
270
  else # model
262
271
  # models (e.g. Pet) or oneOf
263
272
  klass = BmcApi.const_get(type)
264
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
273
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
265
274
  end
266
275
  end
267
276
 
@@ -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
 
@@ -71,20 +71,27 @@ module BmcApi
71
71
 
72
72
  if attributes.key?(:'default')
73
73
  self.default = attributes[:'default']
74
+ else
75
+ self.default = nil
74
76
  end
75
77
 
76
78
  if attributes.key?(:'name')
77
79
  self.name = attributes[:'name']
80
+ else
81
+ self.name = nil
78
82
  end
79
83
 
80
84
  if attributes.key?(:'key')
81
85
  self.key = attributes[:'key']
86
+ else
87
+ self.key = nil
82
88
  end
83
89
  end
84
90
 
85
91
  # Show invalid properties with the reasons. Usually used together with valid?
86
92
  # @return Array for valid properties with the reasons
87
93
  def list_invalid_properties
94
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
88
95
  invalid_properties = Array.new
89
96
  if @default.nil?
90
97
  invalid_properties.push('invalid value for "default", default cannot be nil.')
@@ -102,21 +109,34 @@ module BmcApi
102
109
  invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
103
110
  end
104
111
 
112
+ pattern = Regexp.new(/^(?!\s*$).+/)
113
+ if @name !~ pattern
114
+ invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
115
+ end
116
+
105
117
  if @key.nil?
106
118
  invalid_properties.push('invalid value for "key", key cannot be nil.')
107
119
  end
108
120
 
121
+ pattern = Regexp.new(/^(?!\s*$).+/)
122
+ if @key !~ pattern
123
+ invalid_properties.push("invalid value for \"key\", must conform to the pattern #{pattern}.")
124
+ end
125
+
109
126
  invalid_properties
110
127
  end
111
128
 
112
129
  # Check to see if the all the properties in the model are valid
113
130
  # @return true if the model is valid
114
131
  def valid?
132
+ warn '[DEPRECATED] the `valid?` method is obsolete'
115
133
  return false if @default.nil?
116
134
  return false if @name.nil?
117
135
  return false if @name.to_s.length > 100
118
136
  return false if @name.to_s.length < 1
137
+ return false if @name !~ Regexp.new(/^(?!\s*$).+/)
119
138
  return false if @key.nil?
139
+ return false if @key !~ Regexp.new(/^(?!\s*$).+/)
120
140
  true
121
141
  end
122
142
 
@@ -135,9 +155,29 @@ module BmcApi
135
155
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
136
156
  end
137
157
 
158
+ pattern = Regexp.new(/^(?!\s*$).+/)
159
+ if name !~ pattern
160
+ fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
161
+ end
162
+
138
163
  @name = name
139
164
  end
140
165
 
166
+ # Custom attribute writer method with validation
167
+ # @param [Object] key Value to be assigned
168
+ def key=(key)
169
+ if key.nil?
170
+ fail ArgumentError, 'key cannot be nil'
171
+ end
172
+
173
+ pattern = Regexp.new(/^(?!\s*$).+/)
174
+ if key !~ pattern
175
+ fail ArgumentError, "invalid value for \"key\", must conform to the pattern #{pattern}."
176
+ end
177
+
178
+ @key = key
179
+ end
180
+
141
181
  # Checks equality by comparing each attribute.
142
182
  # @param [Object] Object to be compared
143
183
  def ==(o)
@@ -164,37 +204,30 @@ module BmcApi
164
204
  # @param [Hash] attributes Model attributes in the form of hash
165
205
  # @return [Object] Returns the model itself
166
206
  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
207
  return nil unless attributes.is_a?(Hash)
175
208
  attributes = attributes.transform_keys(&:to_sym)
176
- self.class.openapi_types.each_pair do |key, type|
177
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
178
- self.send("#{key}=", nil)
209
+ transformed_hash = {}
210
+ openapi_types.each_pair do |key, type|
211
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
212
+ transformed_hash["#{key}"] = nil
179
213
  elsif type =~ /\AArray<(.*)>/i
180
214
  # check to ensure the input is an array given that the attribute
181
215
  # is documented as an array but the input is not
182
- if attributes[self.class.attribute_map[key]].is_a?(Array)
183
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
216
+ if attributes[attribute_map[key]].is_a?(Array)
217
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
184
218
  end
185
- elsif !attributes[self.class.attribute_map[key]].nil?
186
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
219
+ elsif !attributes[attribute_map[key]].nil?
220
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
187
221
  end
188
222
  end
189
-
190
- self
223
+ new(transformed_hash)
191
224
  end
192
225
 
193
226
  # Deserializes the data based on type
194
227
  # @param string type Data type
195
228
  # @param string value Value to be deserialized
196
229
  # @return [Object] Deserialized data
197
- def _deserialize(type, value)
230
+ def self._deserialize(type, value)
198
231
  case type.to_sym
199
232
  when :Time
200
233
  Time.parse(value)
@@ -229,7 +262,7 @@ module BmcApi
229
262
  else # model
230
263
  # models (e.g. Pet) or oneOf
231
264
  klass = BmcApi.const_get(type)
232
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
265
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
233
266
  end
234
267
  end
235
268
 
@@ -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?(:'default')
68
68
  self.default = attributes[:'default']
69
+ else
70
+ self.default = nil
69
71
  end
70
72
 
71
73
  if attributes.key?(:'name')
72
74
  self.name = attributes[:'name']
75
+ else
76
+ self.name = 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 @default.nil?
81
86
  invalid_properties.push('invalid value for "default", default cannot be nil.')
@@ -93,16 +98,23 @@ module BmcApi
93
98
  invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
94
99
  end
95
100
 
101
+ pattern = Regexp.new(/^(?!\s*$).+/)
102
+ if @name !~ pattern
103
+ invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
104
+ end
105
+
96
106
  invalid_properties
97
107
  end
98
108
 
99
109
  # Check to see if the all the properties in the model are valid
100
110
  # @return true if the model is valid
101
111
  def valid?
112
+ warn '[DEPRECATED] the `valid?` method is obsolete'
102
113
  return false if @default.nil?
103
114
  return false if @name.nil?
104
115
  return false if @name.to_s.length > 100
105
116
  return false if @name.to_s.length < 1
117
+ return false if @name !~ Regexp.new(/^(?!\s*$).+/)
106
118
  true
107
119
  end
108
120
 
@@ -121,6 +133,11 @@ module BmcApi
121
133
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
122
134
  end
123
135
 
136
+ pattern = Regexp.new(/^(?!\s*$).+/)
137
+ if name !~ pattern
138
+ fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
139
+ end
140
+
124
141
  @name = name
125
142
  end
126
143
 
@@ -149,37 +166,30 @@ module BmcApi
149
166
  # @param [Hash] attributes Model attributes in the form of hash
150
167
  # @return [Object] Returns the model itself
151
168
  def self.build_from_hash(attributes)
152
- new.build_from_hash(attributes)
153
- end
154
-
155
- # Builds the object from hash
156
- # @param [Hash] attributes Model attributes in the form of hash
157
- # @return [Object] Returns the model itself
158
- def build_from_hash(attributes)
159
169
  return nil unless attributes.is_a?(Hash)
160
170
  attributes = attributes.transform_keys(&:to_sym)
161
- self.class.openapi_types.each_pair do |key, type|
162
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
163
- self.send("#{key}=", nil)
171
+ transformed_hash = {}
172
+ openapi_types.each_pair do |key, type|
173
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
174
+ transformed_hash["#{key}"] = nil
164
175
  elsif type =~ /\AArray<(.*)>/i
165
176
  # check to ensure the input is an array given that the attribute
166
177
  # is documented as an array but the input is not
167
- if attributes[self.class.attribute_map[key]].is_a?(Array)
168
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
178
+ if attributes[attribute_map[key]].is_a?(Array)
179
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
169
180
  end
170
- elsif !attributes[self.class.attribute_map[key]].nil?
171
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
181
+ elsif !attributes[attribute_map[key]].nil?
182
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
172
183
  end
173
184
  end
174
-
175
- self
185
+ new(transformed_hash)
176
186
  end
177
187
 
178
188
  # Deserializes the data based on type
179
189
  # @param string type Data type
180
190
  # @param string value Value to be deserialized
181
191
  # @return [Object] Deserialized data
182
- def _deserialize(type, value)
192
+ def self._deserialize(type, value)
183
193
  case type.to_sym
184
194
  when :Time
185
195
  Time.parse(value)
@@ -214,7 +224,7 @@ module BmcApi
214
224
  else # model
215
225
  # models (e.g. Pet) or oneOf
216
226
  klass = BmcApi.const_get(type)
217
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
227
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
218
228
  end
219
229
  end
220
230