ibm_cloud_power 1.1.1 → 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 (383) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +68 -3
  3. data/docs/CloneTaskReference.md +10 -9
  4. data/docs/CloneTaskStatus.md +14 -13
  5. data/docs/ClonedVolume.md +10 -9
  6. data/docs/ClonedVolumeDetail.md +10 -9
  7. data/docs/CloudConnection.md +32 -31
  8. data/docs/CloudConnectionCreate.md +14 -13
  9. data/docs/CloudConnectionCreateResponse.md +44 -0
  10. data/docs/CloudConnectionEndpointClassic.md +10 -9
  11. data/docs/CloudConnectionEndpointGRE.md +10 -9
  12. data/docs/CloudConnectionEndpointVPC.md +10 -9
  13. data/docs/CloudConnectionGRETunnel.md +12 -11
  14. data/docs/CloudConnectionSpeed.md +4 -5
  15. data/docs/CloudConnectionUpdate.md +18 -17
  16. data/docs/CloudConnectionVPC.md +10 -9
  17. data/docs/CloudConnectionVirtualPrivateClouds.md +8 -7
  18. data/docs/CloudConnectionVirtualPrivateCloudsVirtualPrivateCloudsInner.md +24 -0
  19. data/docs/CloudConnections.md +8 -7
  20. data/docs/CloudInstance.md +28 -27
  21. data/docs/CloudInstanceCreate.md +20 -19
  22. data/docs/CloudInstanceReference.md +22 -21
  23. data/docs/CloudInstanceUpdate.md +16 -15
  24. data/docs/CloudInstanceUsageLimits.md +28 -27
  25. data/docs/CreateCosImageImportJob.md +38 -0
  26. data/docs/CreateDataVolume.md +26 -19
  27. data/docs/CreateImage.md +32 -27
  28. data/docs/DeadPeerDetection.md +22 -0
  29. data/docs/Error.md +10 -9
  30. data/docs/Event.md +24 -23
  31. data/docs/EventUser.md +12 -11
  32. data/docs/Events.md +8 -7
  33. data/docs/ExportImage.md +14 -13
  34. data/docs/IKEPolicies.md +18 -0
  35. data/docs/IKEPolicy.md +30 -0
  36. data/docs/IKEPolicyCreate.md +30 -0
  37. data/docs/IKEPolicyOptions.md +24 -0
  38. data/docs/IKEPolicyRef.md +20 -0
  39. data/docs/IKEPolicyTemplate.md +26 -0
  40. data/docs/IKEPolicyUpdate.md +30 -0
  41. data/docs/IPAddressRange.md +10 -9
  42. data/docs/IPSecPolicies.md +18 -0
  43. data/docs/IPSecPolicy.md +30 -0
  44. data/docs/IPSecPolicyCreate.md +28 -0
  45. data/docs/IPSecPolicyOptions.md +22 -0
  46. data/docs/IPSecPolicyRef.md +20 -0
  47. data/docs/IPSecPolicyTemplate.md +24 -0
  48. data/docs/IPSecPolicyUpdate.md +28 -0
  49. data/docs/Image.md +32 -31
  50. data/docs/ImageReference.md +26 -25
  51. data/docs/ImageSpecifications.md +20 -19
  52. data/docs/ImageVolume.md +14 -13
  53. data/docs/Images.md +8 -7
  54. data/docs/Job.md +24 -0
  55. data/docs/JobReference.md +20 -0
  56. data/docs/Jobs.md +18 -0
  57. data/docs/MaximumStorageAllocation.md +12 -11
  58. data/docs/MinMaxDefault.md +12 -11
  59. data/docs/MultiVolumesCreate.md +28 -21
  60. data/docs/Network.md +28 -27
  61. data/docs/NetworkCreate.md +20 -19
  62. data/docs/NetworkID.md +18 -0
  63. data/docs/NetworkIDs.md +18 -0
  64. data/docs/NetworkIpAddressMetrics.md +14 -13
  65. data/docs/NetworkPort.md +22 -21
  66. data/docs/NetworkPortCreate.md +10 -9
  67. data/docs/NetworkPortPvmInstance.md +10 -9
  68. data/docs/NetworkPortUpdate.md +10 -9
  69. data/docs/NetworkPorts.md +8 -7
  70. data/docs/NetworkReference.md +18 -17
  71. data/docs/NetworkUpdate.md +14 -13
  72. data/docs/Networks.md +8 -7
  73. data/docs/Operation.md +22 -0
  74. data/docs/Operations.md +12 -11
  75. data/docs/Options.md +18 -0
  76. data/docs/PCloudCloudConnectionsApi.md +229 -94
  77. data/docs/PCloudEventsApi.md +60 -27
  78. data/docs/PCloudImagesApi.md +513 -101
  79. data/docs/PCloudInstancesApi.md +83 -33
  80. data/docs/PCloudJobsApi.md +208 -0
  81. data/docs/PCloudNetworksApi.md +287 -118
  82. data/docs/PCloudPVMInstancesApi.md +628 -208
  83. data/docs/PCloudPlacementGroupsApi.md +177 -76
  84. data/docs/PCloudSAPApi.md +86 -36
  85. data/docs/PCloudSnapshotsApi.md +112 -45
  86. data/docs/PCloudStorageCapacityApi.md +112 -45
  87. data/docs/PCloudSystemPoolsApi.md +29 -13
  88. data/docs/PCloudTasksApi.md +55 -22
  89. data/docs/PCloudTenantsApi.md +57 -24
  90. data/docs/PCloudTenantsSSHKeysApi.md +143 -59
  91. data/docs/PCloudVPNConnectionsApi.md +817 -0
  92. data/docs/PCloudVPNPoliciesApi.md +677 -0
  93. data/docs/PCloudVolumesApi.md +629 -256
  94. data/docs/PVMInstance.md +72 -69
  95. data/docs/PVMInstanceAction.md +8 -7
  96. data/docs/PVMInstanceAddNetwork.md +10 -9
  97. data/docs/PVMInstanceCapture.md +20 -19
  98. data/docs/PVMInstanceClone.md +22 -21
  99. data/docs/PVMInstanceConsole.md +8 -7
  100. data/docs/PVMInstanceCreate.md +50 -45
  101. data/docs/PVMInstanceFault.md +14 -13
  102. data/docs/PVMInstanceHealth.md +12 -11
  103. data/docs/PVMInstanceMultiCreate.md +12 -11
  104. data/docs/PVMInstanceNetwork.md +24 -23
  105. data/docs/PVMInstanceNetworks.md +8 -7
  106. data/docs/PVMInstanceOperation.md +10 -9
  107. data/docs/PVMInstanceReference.md +68 -61
  108. data/docs/PVMInstanceRemoveNetwork.md +8 -7
  109. data/docs/PVMInstanceUpdate.md +26 -23
  110. data/docs/PVMInstanceUpdateResponse.md +18 -17
  111. data/docs/PVMInstanceVolumeUpdate.md +8 -7
  112. data/docs/PVMInstances.md +8 -7
  113. data/docs/PeerSubnetUpdate.md +18 -0
  114. data/docs/PeerSubnets.md +18 -0
  115. data/docs/PeeringNetwork.md +12 -11
  116. data/docs/PinPolicy.md +4 -5
  117. data/docs/PlacementGroup.md +14 -13
  118. data/docs/PlacementGroupCreate.md +10 -9
  119. data/docs/PlacementGroupServer.md +8 -7
  120. data/docs/PlacementGroups.md +8 -7
  121. data/docs/SAPCreate.md +30 -23
  122. data/docs/SAPProfile.md +16 -15
  123. data/docs/SAPProfileReference.md +10 -9
  124. data/docs/SAPProfiles.md +8 -7
  125. data/docs/SRC.md +10 -9
  126. data/docs/SSHKey.md +12 -11
  127. data/docs/SSHKeys.md +8 -7
  128. data/docs/Snapshot.md +26 -25
  129. data/docs/SnapshotCreate.md +12 -11
  130. data/docs/SnapshotCreateResponse.md +8 -7
  131. data/docs/SnapshotRestore.md +8 -7
  132. data/docs/SnapshotUpdate.md +10 -9
  133. data/docs/Snapshots.md +8 -7
  134. data/docs/SoftwareLicenses.md +16 -15
  135. data/docs/Status.md +22 -0
  136. data/docs/StockImage.md +12 -11
  137. data/docs/StorageAffinity.md +26 -0
  138. data/docs/StoragePoolCapacity.md +14 -13
  139. data/docs/StoragePoolsCapacity.md +10 -9
  140. data/docs/StorageTypeCapacity.md +12 -11
  141. data/docs/StorageTypesCapacity.md +10 -9
  142. data/docs/System.md +12 -11
  143. data/docs/SystemPool.md +22 -21
  144. data/docs/Task.md +24 -23
  145. data/docs/TaskReference.md +10 -9
  146. data/docs/Tenant.md +20 -19
  147. data/docs/TenantUpdate.md +10 -9
  148. data/docs/UpdateVolume.md +14 -13
  149. data/docs/VPNConnection.md +40 -0
  150. data/docs/VPNConnectionCreate.md +30 -0
  151. data/docs/VPNConnectionCreateResponse.md +42 -0
  152. data/docs/VPNConnectionUpdate.md +24 -0
  153. data/docs/VPNConnections.md +18 -0
  154. data/docs/VPNaaSOptions.md +26 -0
  155. data/docs/VirtualCores.md +12 -11
  156. data/docs/Volume.md +36 -33
  157. data/docs/VolumeInfo.md +10 -9
  158. data/docs/VolumeReference.md +38 -35
  159. data/docs/Volumes.md +8 -7
  160. data/docs/VolumesClone.md +22 -21
  161. data/docs/VolumesCloneAsyncRequest.md +10 -9
  162. data/docs/VolumesCloneCancel.md +8 -7
  163. data/docs/VolumesCloneCreate.md +10 -9
  164. data/docs/VolumesCloneDetail.md +24 -23
  165. data/docs/VolumesCloneExecute.md +10 -9
  166. data/docs/VolumesCloneRequest.md +10 -9
  167. data/docs/VolumesCloneResponse.md +8 -7
  168. data/docs/VolumesClones.md +8 -7
  169. data/git_push.sh +3 -4
  170. data/ibm_cloud_power.gemspec +3 -3
  171. data/lib/ibm_cloud_power/api/p_cloud_cloud_connections_api.rb +43 -29
  172. data/lib/ibm_cloud_power/api/p_cloud_events_api.rb +9 -7
  173. data/lib/ibm_cloud_power/api/p_cloud_images_api.rb +325 -32
  174. data/lib/ibm_cloud_power/api/p_cloud_instances_api.rb +17 -11
  175. data/lib/ibm_cloud_power/api/p_cloud_jobs_api.rb +234 -0
  176. data/lib/ibm_cloud_power/api/p_cloud_networks_api.rb +57 -35
  177. data/lib/ibm_cloud_power/api/p_cloud_placement_groups_api.rb +45 -30
  178. data/lib/ibm_cloud_power/api/p_cloud_pvm_instances_api.rb +256 -64
  179. data/lib/ibm_cloud_power/api/p_cloud_sap_api.rb +17 -11
  180. data/lib/ibm_cloud_power/api/p_cloud_snapshots_api.rb +21 -14
  181. data/lib/ibm_cloud_power/api/p_cloud_storage_capacity_api.rb +17 -13
  182. data/lib/ibm_cloud_power/api/p_cloud_system_pools_api.rb +5 -4
  183. data/lib/ibm_cloud_power/api/p_cloud_tasks_api.rb +9 -7
  184. data/lib/ibm_cloud_power/api/p_cloud_tenants_api.rb +13 -8
  185. data/lib/ibm_cloud_power/api/p_cloud_tenants_ssh_keys_api.rb +29 -18
  186. data/lib/ibm_cloud_power/api/p_cloud_volumes_api.rb +125 -76
  187. data/lib/ibm_cloud_power/api/p_cloud_vpn_connections_api.rb +898 -0
  188. data/lib/ibm_cloud_power/api/p_cloud_vpn_policies_api.rb +732 -0
  189. data/lib/ibm_cloud_power/api_client.rb +56 -52
  190. data/lib/ibm_cloud_power/api_error.rb +1 -1
  191. data/lib/ibm_cloud_power/configuration.rb +43 -12
  192. data/lib/ibm_cloud_power/models/clone_task_reference.rb +19 -8
  193. data/lib/ibm_cloud_power/models/clone_task_status.rb +19 -8
  194. data/lib/ibm_cloud_power/models/cloned_volume.rb +19 -8
  195. data/lib/ibm_cloud_power/models/cloned_volume_detail.rb +19 -8
  196. data/lib/ibm_cloud_power/models/cloud_connection.rb +20 -9
  197. data/lib/ibm_cloud_power/models/cloud_connection_create.rb +53 -8
  198. data/lib/ibm_cloud_power/models/cloud_connection_create_response.rb +406 -0
  199. data/lib/ibm_cloud_power/models/cloud_connection_endpoint_classic.rb +19 -8
  200. data/lib/ibm_cloud_power/models/cloud_connection_endpoint_gre.rb +19 -8
  201. data/lib/ibm_cloud_power/models/cloud_connection_endpoint_vpc.rb +19 -8
  202. data/lib/ibm_cloud_power/models/cloud_connection_gre_tunnel.rb +19 -8
  203. data/lib/ibm_cloud_power/models/cloud_connection_speed.rb +2 -1
  204. data/lib/ibm_cloud_power/models/cloud_connection_update.rb +53 -8
  205. data/lib/ibm_cloud_power/models/cloud_connection_virtual_private_clouds.rb +20 -9
  206. data/lib/ibm_cloud_power/models/cloud_connection_virtual_private_clouds_virtual_private_clouds_inner.rb +270 -0
  207. data/lib/ibm_cloud_power/models/cloud_connection_vpc.rb +19 -8
  208. data/lib/ibm_cloud_power/models/cloud_connections.rb +19 -8
  209. data/lib/ibm_cloud_power/models/cloud_instance.rb +19 -8
  210. data/lib/ibm_cloud_power/models/cloud_instance_create.rb +19 -8
  211. data/lib/ibm_cloud_power/models/cloud_instance_reference.rb +19 -8
  212. data/lib/ibm_cloud_power/models/cloud_instance_update.rb +19 -8
  213. data/lib/ibm_cloud_power/models/cloud_instance_usage_limits.rb +19 -8
  214. data/lib/ibm_cloud_power/models/create_cos_image_import_job.rb +387 -0
  215. data/lib/ibm_cloud_power/models/create_data_volume.rb +59 -14
  216. data/lib/ibm_cloud_power/models/create_image.rb +39 -9
  217. data/lib/ibm_cloud_power/models/dead_peer_detection.rb +350 -0
  218. data/lib/ibm_cloud_power/models/error.rb +32 -21
  219. data/lib/ibm_cloud_power/models/event.rb +20 -9
  220. data/lib/ibm_cloud_power/models/event_user.rb +19 -8
  221. data/lib/ibm_cloud_power/models/events.rb +19 -8
  222. data/lib/ibm_cloud_power/models/export_image.rb +19 -8
  223. data/lib/ibm_cloud_power/models/ike_policies.rb +227 -0
  224. data/lib/ibm_cloud_power/models/ike_policy.rb +414 -0
  225. data/lib/ibm_cloud_power/models/ike_policy_create.rb +414 -0
  226. data/lib/ibm_cloud_power/models/ike_policy_options.rb +274 -0
  227. data/lib/ibm_cloud_power/models/ike_policy_ref.rb +241 -0
  228. data/lib/ibm_cloud_power/models/ike_policy_template.rb +313 -0
  229. data/lib/ibm_cloud_power/models/ike_policy_update.rb +375 -0
  230. data/lib/ibm_cloud_power/models/image.rb +21 -10
  231. data/lib/ibm_cloud_power/models/image_reference.rb +21 -10
  232. data/lib/ibm_cloud_power/models/image_specifications.rb +19 -8
  233. data/lib/ibm_cloud_power/models/image_volume.rb +19 -8
  234. data/lib/ibm_cloud_power/models/images.rb +19 -8
  235. data/lib/ibm_cloud_power/models/ip_address_range.rb +19 -8
  236. data/lib/ibm_cloud_power/models/ip_sec_policies.rb +227 -0
  237. data/lib/ibm_cloud_power/models/ip_sec_policy.rb +402 -0
  238. data/lib/ibm_cloud_power/models/ip_sec_policy_create.rb +387 -0
  239. data/lib/ibm_cloud_power/models/ip_sec_policy_options.rb +258 -0
  240. data/lib/ibm_cloud_power/models/ip_sec_policy_ref.rb +241 -0
  241. data/lib/ibm_cloud_power/models/ip_sec_policy_template.rb +298 -0
  242. data/lib/ibm_cloud_power/models/ip_sec_policy_update.rb +353 -0
  243. data/lib/ibm_cloud_power/models/job.rb +263 -0
  244. data/lib/ibm_cloud_power/models/job_reference.rb +240 -0
  245. data/lib/ibm_cloud_power/models/jobs.rb +227 -0
  246. data/lib/ibm_cloud_power/models/maximum_storage_allocation.rb +20 -9
  247. data/lib/ibm_cloud_power/models/min_max_default.rb +19 -8
  248. data/lib/ibm_cloud_power/models/multi_volumes_create.rb +57 -12
  249. data/lib/ibm_cloud_power/models/network.rb +19 -8
  250. data/lib/ibm_cloud_power/models/network_create.rb +19 -8
  251. data/lib/ibm_cloud_power/models/network_id.rb +225 -0
  252. data/lib/ibm_cloud_power/models/network_ids.rb +222 -0
  253. data/lib/ibm_cloud_power/models/network_ip_address_metrics.rb +19 -8
  254. data/lib/ibm_cloud_power/models/network_port.rb +19 -8
  255. data/lib/ibm_cloud_power/models/network_port_create.rb +19 -8
  256. data/lib/ibm_cloud_power/models/network_port_pvm_instance.rb +19 -8
  257. data/lib/ibm_cloud_power/models/network_port_update.rb +19 -8
  258. data/lib/ibm_cloud_power/models/network_ports.rb +19 -8
  259. data/lib/ibm_cloud_power/models/network_reference.rb +19 -8
  260. data/lib/ibm_cloud_power/models/network_update.rb +19 -8
  261. data/lib/ibm_cloud_power/models/networks.rb +19 -8
  262. data/lib/ibm_cloud_power/models/operation.rb +255 -0
  263. data/lib/ibm_cloud_power/models/operations.rb +19 -8
  264. data/lib/ibm_cloud_power/models/options.rb +224 -0
  265. data/lib/ibm_cloud_power/models/peer_subnet_update.rb +225 -0
  266. data/lib/ibm_cloud_power/models/peer_subnets.rb +222 -0
  267. data/lib/ibm_cloud_power/models/peering_network.rb +19 -8
  268. data/lib/ibm_cloud_power/models/pin_policy.rb +2 -1
  269. data/lib/ibm_cloud_power/models/placement_group.rb +19 -8
  270. data/lib/ibm_cloud_power/models/placement_group_create.rb +19 -8
  271. data/lib/ibm_cloud_power/models/placement_group_server.rb +19 -8
  272. data/lib/ibm_cloud_power/models/placement_groups.rb +19 -8
  273. data/lib/ibm_cloud_power/models/pvm_instance.rb +57 -34
  274. data/lib/ibm_cloud_power/models/pvm_instance_action.rb +19 -8
  275. data/lib/ibm_cloud_power/models/pvm_instance_add_network.rb +19 -8
  276. data/lib/ibm_cloud_power/models/pvm_instance_capture.rb +27 -16
  277. data/lib/ibm_cloud_power/models/pvm_instance_clone.rb +28 -17
  278. data/lib/ibm_cloud_power/models/pvm_instance_console.rb +19 -8
  279. data/lib/ibm_cloud_power/models/pvm_instance_create.rb +54 -24
  280. data/lib/ibm_cloud_power/models/pvm_instance_fault.rb +20 -9
  281. data/lib/ibm_cloud_power/models/pvm_instance_health.rb +19 -8
  282. data/lib/ibm_cloud_power/models/pvm_instance_multi_create.rb +19 -8
  283. data/lib/ibm_cloud_power/models/pvm_instance_network.rb +19 -8
  284. data/lib/ibm_cloud_power/models/pvm_instance_networks.rb +19 -8
  285. data/lib/ibm_cloud_power/models/pvm_instance_operation.rb +19 -8
  286. data/lib/ibm_cloud_power/models/pvm_instance_reference.rb +55 -12
  287. data/lib/ibm_cloud_power/models/pvm_instance_remove_network.rb +19 -8
  288. data/lib/ibm_cloud_power/models/pvm_instance_update.rb +32 -9
  289. data/lib/ibm_cloud_power/models/pvm_instance_update_response.rb +19 -8
  290. data/lib/ibm_cloud_power/models/pvm_instance_volume_update.rb +19 -8
  291. data/lib/ibm_cloud_power/models/pvm_instances.rb +19 -8
  292. data/lib/ibm_cloud_power/models/sap_create.rb +56 -16
  293. data/lib/ibm_cloud_power/models/sap_profile.rb +18 -7
  294. data/lib/ibm_cloud_power/models/sap_profile_reference.rb +19 -8
  295. data/lib/ibm_cloud_power/models/sap_profiles.rb +19 -8
  296. data/lib/ibm_cloud_power/models/snapshot.rb +21 -10
  297. data/lib/ibm_cloud_power/models/snapshot_create.rb +27 -16
  298. data/lib/ibm_cloud_power/models/snapshot_create_response.rb +19 -8
  299. data/lib/ibm_cloud_power/models/snapshot_restore.rb +19 -8
  300. data/lib/ibm_cloud_power/models/snapshot_update.rb +19 -8
  301. data/lib/ibm_cloud_power/models/snapshots.rb +19 -8
  302. data/lib/ibm_cloud_power/models/software_licenses.rb +19 -8
  303. data/lib/ibm_cloud_power/models/src.rb +19 -8
  304. data/lib/ibm_cloud_power/models/ssh_key.rb +20 -9
  305. data/lib/ibm_cloud_power/models/ssh_keys.rb +19 -8
  306. data/lib/ibm_cloud_power/models/status.rb +250 -0
  307. data/lib/ibm_cloud_power/models/stock_image.rb +19 -8
  308. data/lib/ibm_cloud_power/models/storage_affinity.rb +298 -0
  309. data/lib/ibm_cloud_power/models/storage_pool_capacity.rb +20 -9
  310. data/lib/ibm_cloud_power/models/storage_pools_capacity.rb +19 -8
  311. data/lib/ibm_cloud_power/models/storage_type_capacity.rb +19 -8
  312. data/lib/ibm_cloud_power/models/storage_types_capacity.rb +19 -8
  313. data/lib/ibm_cloud_power/models/system.rb +19 -8
  314. data/lib/ibm_cloud_power/models/system_pool.rb +19 -8
  315. data/lib/ibm_cloud_power/models/task.rb +21 -10
  316. data/lib/ibm_cloud_power/models/task_reference.rb +19 -8
  317. data/lib/ibm_cloud_power/models/tenant.rb +20 -9
  318. data/lib/ibm_cloud_power/models/tenant_update.rb +19 -8
  319. data/lib/ibm_cloud_power/models/update_volume.rb +19 -8
  320. data/lib/ibm_cloud_power/models/virtual_cores.rb +19 -8
  321. data/lib/ibm_cloud_power/models/volume.rb +39 -18
  322. data/lib/ibm_cloud_power/models/volume_info.rb +19 -8
  323. data/lib/ibm_cloud_power/models/volume_reference.rb +39 -18
  324. data/lib/ibm_cloud_power/models/volumes.rb +19 -8
  325. data/lib/ibm_cloud_power/models/volumes_clone.rb +21 -10
  326. data/lib/ibm_cloud_power/models/volumes_clone_async_request.rb +30 -19
  327. data/lib/ibm_cloud_power/models/volumes_clone_cancel.rb +19 -8
  328. data/lib/ibm_cloud_power/models/volumes_clone_create.rb +30 -19
  329. data/lib/ibm_cloud_power/models/volumes_clone_detail.rb +21 -10
  330. data/lib/ibm_cloud_power/models/volumes_clone_execute.rb +19 -8
  331. data/lib/ibm_cloud_power/models/volumes_clone_request.rb +30 -19
  332. data/lib/ibm_cloud_power/models/volumes_clone_response.rb +19 -8
  333. data/lib/ibm_cloud_power/models/volumes_clones.rb +19 -8
  334. data/lib/ibm_cloud_power/models/vp_naa_s_options.rb +280 -0
  335. data/lib/ibm_cloud_power/models/vpn_connection.rb +437 -0
  336. data/lib/ibm_cloud_power/models/vpn_connection_create.rb +353 -0
  337. data/lib/ibm_cloud_power/models/vpn_connection_create_response.rb +453 -0
  338. data/lib/ibm_cloud_power/models/vpn_connection_update.rb +251 -0
  339. data/lib/ibm_cloud_power/models/vpn_connections.rb +222 -0
  340. data/lib/ibm_cloud_power/version.rb +2 -2
  341. data/lib/ibm_cloud_power.rb +39 -2
  342. data/spec/api/p_cloud_jobs_api_spec.rb +73 -0
  343. data/spec/api/p_cloud_vpn_connections_api_spec.rb +194 -0
  344. data/spec/api/p_cloud_vpn_policies_api_spec.rb +165 -0
  345. data/spec/api_client_spec.rb +3 -3
  346. data/spec/configuration_spec.rb +1 -1
  347. data/spec/models/cloud_connection_create_response_spec.rb +112 -0
  348. data/spec/models/cloud_connection_virtual_private_clouds_virtual_private_clouds_inner_spec.rb +52 -0
  349. data/spec/models/create_cos_image_import_job_spec.rb +102 -0
  350. data/spec/models/dead_peer_detection_spec.rb +50 -0
  351. data/spec/models/ike_policies_spec.rb +34 -0
  352. data/spec/models/ike_policy_create_spec.rb +86 -0
  353. data/spec/models/ike_policy_options_spec.rb +52 -0
  354. data/spec/models/ike_policy_ref_spec.rb +40 -0
  355. data/spec/models/ike_policy_spec.rb +86 -0
  356. data/spec/models/ike_policy_template_spec.rb +58 -0
  357. data/spec/models/ike_policy_update_spec.rb +86 -0
  358. data/spec/models/ip_sec_policies_spec.rb +34 -0
  359. data/spec/models/ip_sec_policy_create_spec.rb +76 -0
  360. data/spec/models/ip_sec_policy_options_spec.rb +46 -0
  361. data/spec/models/ip_sec_policy_ref_spec.rb +40 -0
  362. data/spec/models/ip_sec_policy_spec.rb +82 -0
  363. data/spec/models/ip_sec_policy_template_spec.rb +52 -0
  364. data/spec/models/ip_sec_policy_update_spec.rb +76 -0
  365. data/spec/models/job_reference_spec.rb +40 -0
  366. data/spec/models/job_spec.rb +52 -0
  367. data/spec/models/jobs_spec.rb +34 -0
  368. data/spec/models/network_id_spec.rb +34 -0
  369. data/spec/models/network_ids_spec.rb +34 -0
  370. data/spec/models/operation_spec.rb +46 -0
  371. data/spec/models/options_spec.rb +34 -0
  372. data/spec/models/peer_subnet_update_spec.rb +34 -0
  373. data/spec/models/peer_subnets_spec.rb +34 -0
  374. data/spec/models/status_spec.rb +46 -0
  375. data/spec/models/storage_affinity_spec.rb +62 -0
  376. data/spec/models/vp_naa_s_options_spec.rb +58 -0
  377. data/spec/models/vpn_connection_create_response_spec.rb +114 -0
  378. data/spec/models/vpn_connection_create_spec.rb +74 -0
  379. data/spec/models/vpn_connection_spec.rb +108 -0
  380. data/spec/models/vpn_connection_update_spec.rb +52 -0
  381. data/spec/models/vpn_connections_spec.rb +34 -0
  382. data/spec/spec_helper.rb +1 -1
  383. metadata +259 -107
@@ -6,17 +6,21 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: kylej@us.ibm.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0-beta2
9
+ OpenAPI Generator version: 6.0.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module IbmCloudPower
16
17
  class CreateDataVolume
17
- # Type of disk, required if affinityPolicy is not provided, otherwise ignored
18
+ # Type of disk, required if affinityPolicy is not provided, otherwise ignored.
18
19
  attr_accessor :disk_type
19
20
 
21
+ # Volume pool where the volume will be created; if provided then diskType and affinityPolicy values are ignored.
22
+ attr_accessor :volume_pool
23
+
20
24
  # Volume Name
21
25
  attr_accessor :name
22
26
 
@@ -26,7 +30,7 @@ module IbmCloudPower
26
30
  # Indicates if the volume is shareable between VMs
27
31
  attr_accessor :shareable
28
32
 
29
- # Affinity policy for data volume being created; requires affinityPVMInstance or affinityVolume to be specified;
33
+ # Affinity policy for data volume being created; ignored if volumePool provided. For policy 'affinity'; requires one of affinityPVMInstance or affinityVolume to be specified. For policy 'anti-affinity'; requires one of antiAffinityPVMInstances or antiAffinityVolumes to be specified.
30
34
  attr_accessor :affinity_policy
31
35
 
32
36
  # Volume (ID or Name) to base volume affinity policy against; required if affinityPolicy is provided and affinityPVMInstance is not provided
@@ -35,6 +39,12 @@ module IbmCloudPower
35
39
  # PVM Instance (ID or Name) to base volume affinity policy against; required if affinityPolicy is provided and affinityVolume is not provided
36
40
  attr_accessor :affinity_pvm_instance
37
41
 
42
+ # List of volumes to base volume anti-affinity policy against; required if requesting anti-affinity and storageAntiAffinityPVMInstances is not provided
43
+ attr_accessor :anti_affinity_volumes
44
+
45
+ # List of pvmInstances to base volume anti-affinity policy against; required if requesting anti-affinity and antiAffinityVolumes is not provided
46
+ attr_accessor :anti_affinity_pvm_instances
47
+
38
48
  class EnumAttributeValidator
39
49
  attr_reader :datatype
40
50
  attr_reader :allowable_values
@@ -61,25 +71,36 @@ module IbmCloudPower
61
71
  def self.attribute_map
62
72
  {
63
73
  :'disk_type' => :'diskType',
74
+ :'volume_pool' => :'volumePool',
64
75
  :'name' => :'name',
65
76
  :'size' => :'size',
66
77
  :'shareable' => :'shareable',
67
78
  :'affinity_policy' => :'affinityPolicy',
68
79
  :'affinity_volume' => :'affinityVolume',
69
- :'affinity_pvm_instance' => :'affinityPVMInstance'
80
+ :'affinity_pvm_instance' => :'affinityPVMInstance',
81
+ :'anti_affinity_volumes' => :'antiAffinityVolumes',
82
+ :'anti_affinity_pvm_instances' => :'antiAffinityPVMInstances'
70
83
  }
71
84
  end
72
85
 
86
+ # Returns all the JSON keys this model knows about
87
+ def self.acceptable_attributes
88
+ attribute_map.values
89
+ end
90
+
73
91
  # Attribute type mapping.
74
92
  def self.openapi_types
75
93
  {
76
94
  :'disk_type' => :'String',
95
+ :'volume_pool' => :'String',
77
96
  :'name' => :'String',
78
97
  :'size' => :'Float',
79
98
  :'shareable' => :'Boolean',
80
99
  :'affinity_policy' => :'String',
81
100
  :'affinity_volume' => :'String',
82
- :'affinity_pvm_instance' => :'String'
101
+ :'affinity_pvm_instance' => :'String',
102
+ :'anti_affinity_volumes' => :'Array<String>',
103
+ :'anti_affinity_pvm_instances' => :'Array<String>'
83
104
  }
84
105
  end
85
106
 
@@ -108,6 +129,10 @@ module IbmCloudPower
108
129
  self.disk_type = attributes[:'disk_type']
109
130
  end
110
131
 
132
+ if attributes.key?(:'volume_pool')
133
+ self.volume_pool = attributes[:'volume_pool']
134
+ end
135
+
111
136
  if attributes.key?(:'name')
112
137
  self.name = attributes[:'name']
113
138
  end
@@ -131,6 +156,18 @@ module IbmCloudPower
131
156
  if attributes.key?(:'affinity_pvm_instance')
132
157
  self.affinity_pvm_instance = attributes[:'affinity_pvm_instance']
133
158
  end
159
+
160
+ if attributes.key?(:'anti_affinity_volumes')
161
+ if (value = attributes[:'anti_affinity_volumes']).is_a?(Array)
162
+ self.anti_affinity_volumes = value
163
+ end
164
+ end
165
+
166
+ if attributes.key?(:'anti_affinity_pvm_instances')
167
+ if (value = attributes[:'anti_affinity_pvm_instances']).is_a?(Array)
168
+ self.anti_affinity_pvm_instances = value
169
+ end
170
+ end
134
171
  end
135
172
 
136
173
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -174,12 +211,15 @@ module IbmCloudPower
174
211
  return true if self.equal?(o)
175
212
  self.class == o.class &&
176
213
  disk_type == o.disk_type &&
214
+ volume_pool == o.volume_pool &&
177
215
  name == o.name &&
178
216
  size == o.size &&
179
217
  shareable == o.shareable &&
180
218
  affinity_policy == o.affinity_policy &&
181
219
  affinity_volume == o.affinity_volume &&
182
- affinity_pvm_instance == o.affinity_pvm_instance
220
+ affinity_pvm_instance == o.affinity_pvm_instance &&
221
+ anti_affinity_volumes == o.anti_affinity_volumes &&
222
+ anti_affinity_pvm_instances == o.anti_affinity_pvm_instances
183
223
  end
184
224
 
185
225
  # @see the `==` method
@@ -191,7 +231,7 @@ module IbmCloudPower
191
231
  # Calculates hash code according to all attributes.
192
232
  # @return [Integer] Hash code
193
233
  def hash
194
- [disk_type, name, size, shareable, affinity_policy, affinity_volume, affinity_pvm_instance].hash
234
+ [disk_type, volume_pool, name, size, shareable, affinity_policy, affinity_volume, affinity_pvm_instance, anti_affinity_volumes, anti_affinity_pvm_instances].hash
195
235
  end
196
236
 
197
237
  # Builds the object from hash
@@ -206,8 +246,11 @@ module IbmCloudPower
206
246
  # @return [Object] Returns the model itself
207
247
  def build_from_hash(attributes)
208
248
  return nil unless attributes.is_a?(Hash)
249
+ attributes = attributes.transform_keys(&:to_sym)
209
250
  self.class.openapi_types.each_pair do |key, type|
210
- if type =~ /\AArray<(.*)>/i
251
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
252
+ self.send("#{key}=", nil)
253
+ elsif type =~ /\AArray<(.*)>/i
211
254
  # check to ensure the input is an array given that the attribute
212
255
  # is documented as an array but the input is not
213
256
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -215,8 +258,6 @@ module IbmCloudPower
215
258
  end
216
259
  elsif !attributes[self.class.attribute_map[key]].nil?
217
260
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
218
- elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
219
- self.send("#{key}=", nil)
220
261
  end
221
262
  end
222
263
 
@@ -229,8 +270,8 @@ module IbmCloudPower
229
270
  # @return [Object] Deserialized data
230
271
  def _deserialize(type, value)
231
272
  case type.to_sym
232
- when :DateTime
233
- DateTime.parse(value)
273
+ when :Time
274
+ Time.parse(value)
234
275
  when :Date
235
276
  Date.parse(value)
236
277
  when :String
@@ -260,7 +301,9 @@ module IbmCloudPower
260
301
  end
261
302
  end
262
303
  else # model
263
- IbmCloudPower.const_get(type).build_from_hash(value)
304
+ # models (e.g. Pet) or oneOf
305
+ klass = IbmCloudPower.const_get(type)
306
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
264
307
  end
265
308
  end
266
309
 
@@ -286,7 +329,7 @@ module IbmCloudPower
286
329
  is_nullable = self.class.openapi_nullable.include?(attr)
287
330
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
288
331
  end
289
-
332
+
290
333
  hash[param] = _to_hash(value)
291
334
  end
292
335
  hash
@@ -309,5 +352,7 @@ module IbmCloudPower
309
352
  value
310
353
  end
311
354
  end
355
+
312
356
  end
357
+
313
358
  end
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: kylej@us.ibm.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0-beta2
9
+ OpenAPI Generator version: 6.0.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module IbmCloudPower
16
17
  class CreateImage
@@ -44,7 +45,12 @@ module IbmCloudPower
44
45
  # Image OS Type, required if importing a raw image; raw images can only be imported using the command line interface
45
46
  attr_accessor :os_type
46
47
 
47
- # Type of Disk
48
+ attr_accessor :storage_affinity
49
+
50
+ # Storage pool where the image will be loaded; if provided then storageAffinity and diskType will be ignored; Used only when importing an image from cloud storage.
51
+ attr_accessor :storage_pool
52
+
53
+ # Type of Disk; will be ignored if storagePool or affinityPolicy is provided; Used only when importing an image from cloud storage.
48
54
  attr_accessor :disk_type
49
55
 
50
56
  class EnumAttributeValidator
@@ -82,10 +88,17 @@ module IbmCloudPower
82
88
  :'access_key' => :'accessKey',
83
89
  :'secret_key' => :'secretKey',
84
90
  :'os_type' => :'osType',
91
+ :'storage_affinity' => :'storageAffinity',
92
+ :'storage_pool' => :'storagePool',
85
93
  :'disk_type' => :'diskType'
86
94
  }
87
95
  end
88
96
 
97
+ # Returns all the JSON keys this model knows about
98
+ def self.acceptable_attributes
99
+ attribute_map.values
100
+ end
101
+
89
102
  # Attribute type mapping.
90
103
  def self.openapi_types
91
104
  {
@@ -99,6 +112,8 @@ module IbmCloudPower
99
112
  :'access_key' => :'String',
100
113
  :'secret_key' => :'String',
101
114
  :'os_type' => :'String',
115
+ :'storage_affinity' => :'StorageAffinity',
116
+ :'storage_pool' => :'String',
102
117
  :'disk_type' => :'String'
103
118
  }
104
119
  end
@@ -164,6 +179,14 @@ module IbmCloudPower
164
179
  self.os_type = attributes[:'os_type']
165
180
  end
166
181
 
182
+ if attributes.key?(:'storage_affinity')
183
+ self.storage_affinity = attributes[:'storage_affinity']
184
+ end
185
+
186
+ if attributes.key?(:'storage_pool')
187
+ self.storage_pool = attributes[:'storage_pool']
188
+ end
189
+
167
190
  if attributes.key?(:'disk_type')
168
191
  self.disk_type = attributes[:'disk_type']
169
192
  end
@@ -215,6 +238,8 @@ module IbmCloudPower
215
238
  access_key == o.access_key &&
216
239
  secret_key == o.secret_key &&
217
240
  os_type == o.os_type &&
241
+ storage_affinity == o.storage_affinity &&
242
+ storage_pool == o.storage_pool &&
218
243
  disk_type == o.disk_type
219
244
  end
220
245
 
@@ -227,7 +252,7 @@ module IbmCloudPower
227
252
  # Calculates hash code according to all attributes.
228
253
  # @return [Integer] Hash code
229
254
  def hash
230
- [source, image_id, image_name, image_path, region, image_filename, bucket_name, access_key, secret_key, os_type, disk_type].hash
255
+ [source, image_id, image_name, image_path, region, image_filename, bucket_name, access_key, secret_key, os_type, storage_affinity, storage_pool, disk_type].hash
231
256
  end
232
257
 
233
258
  # Builds the object from hash
@@ -242,8 +267,11 @@ module IbmCloudPower
242
267
  # @return [Object] Returns the model itself
243
268
  def build_from_hash(attributes)
244
269
  return nil unless attributes.is_a?(Hash)
270
+ attributes = attributes.transform_keys(&:to_sym)
245
271
  self.class.openapi_types.each_pair do |key, type|
246
- if type =~ /\AArray<(.*)>/i
272
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
273
+ self.send("#{key}=", nil)
274
+ elsif type =~ /\AArray<(.*)>/i
247
275
  # check to ensure the input is an array given that the attribute
248
276
  # is documented as an array but the input is not
249
277
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -251,8 +279,6 @@ module IbmCloudPower
251
279
  end
252
280
  elsif !attributes[self.class.attribute_map[key]].nil?
253
281
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
254
- elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
255
- self.send("#{key}=", nil)
256
282
  end
257
283
  end
258
284
 
@@ -265,8 +291,8 @@ module IbmCloudPower
265
291
  # @return [Object] Deserialized data
266
292
  def _deserialize(type, value)
267
293
  case type.to_sym
268
- when :DateTime
269
- DateTime.parse(value)
294
+ when :Time
295
+ Time.parse(value)
270
296
  when :Date
271
297
  Date.parse(value)
272
298
  when :String
@@ -296,7 +322,9 @@ module IbmCloudPower
296
322
  end
297
323
  end
298
324
  else # model
299
- IbmCloudPower.const_get(type).build_from_hash(value)
325
+ # models (e.g. Pet) or oneOf
326
+ klass = IbmCloudPower.const_get(type)
327
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
300
328
  end
301
329
  end
302
330
 
@@ -345,5 +373,7 @@ module IbmCloudPower
345
373
  value
346
374
  end
347
375
  end
376
+
348
377
  end
378
+
349
379
  end
@@ -0,0 +1,350 @@
1
+ =begin
2
+ #Power Cloud API
3
+
4
+ #IBM Power Cloud API for Power Hardware / Infrastructure
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: kylej@us.ibm.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module IbmCloudPower
17
+ # Dead Peer Detection of the VPN Connection
18
+ class DeadPeerDetection
19
+ # Action to take when a Peer Gateway stops responding
20
+ attr_accessor :action
21
+
22
+ # How often to test that the Peer Gateway is responsive
23
+ attr_accessor :interval
24
+
25
+ # The number of attempts to connect before tearing down the connection
26
+ attr_accessor :threshold
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'action' => :'action',
54
+ :'interval' => :'interval',
55
+ :'threshold' => :'threshold'
56
+ }
57
+ end
58
+
59
+ # Returns all the JSON keys this model knows about
60
+ def self.acceptable_attributes
61
+ attribute_map.values
62
+ end
63
+
64
+ # Attribute type mapping.
65
+ def self.openapi_types
66
+ {
67
+ :'action' => :'String',
68
+ :'interval' => :'Integer',
69
+ :'threshold' => :'Integer'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudPower::DeadPeerDetection` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudPower::DeadPeerDetection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'action')
95
+ self.action = attributes[:'action']
96
+ end
97
+
98
+ if attributes.key?(:'interval')
99
+ self.interval = attributes[:'interval']
100
+ else
101
+ self.interval = 10
102
+ end
103
+
104
+ if attributes.key?(:'threshold')
105
+ self.threshold = attributes[:'threshold']
106
+ else
107
+ self.threshold = 5
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ invalid_properties = Array.new
115
+ if @action.nil?
116
+ invalid_properties.push('invalid value for "action", action cannot be nil.')
117
+ end
118
+
119
+ if @interval.nil?
120
+ invalid_properties.push('invalid value for "interval", interval cannot be nil.')
121
+ end
122
+
123
+ if @interval > 60
124
+ invalid_properties.push('invalid value for "interval", must be smaller than or equal to 60.')
125
+ end
126
+
127
+ if @interval < 2
128
+ invalid_properties.push('invalid value for "interval", must be greater than or equal to 2.')
129
+ end
130
+
131
+ if @threshold.nil?
132
+ invalid_properties.push('invalid value for "threshold", threshold cannot be nil.')
133
+ end
134
+
135
+ if @threshold > 5
136
+ invalid_properties.push('invalid value for "threshold", must be smaller than or equal to 5.')
137
+ end
138
+
139
+ if @threshold < 1
140
+ invalid_properties.push('invalid value for "threshold", must be greater than or equal to 1.')
141
+ end
142
+
143
+ invalid_properties
144
+ end
145
+
146
+ # Check to see if the all the properties in the model are valid
147
+ # @return true if the model is valid
148
+ def valid?
149
+ return false if @action.nil?
150
+ action_validator = EnumAttributeValidator.new('String', ["restart"])
151
+ return false unless action_validator.valid?(@action)
152
+ return false if @interval.nil?
153
+ return false if @interval > 60
154
+ return false if @interval < 2
155
+ return false if @threshold.nil?
156
+ return false if @threshold > 5
157
+ return false if @threshold < 1
158
+ true
159
+ end
160
+
161
+ # Custom attribute writer method checking allowed values (enum).
162
+ # @param [Object] action Object to be assigned
163
+ def action=(action)
164
+ validator = EnumAttributeValidator.new('String', ["restart"])
165
+ unless validator.valid?(action)
166
+ fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}."
167
+ end
168
+ @action = action
169
+ end
170
+
171
+ # Custom attribute writer method with validation
172
+ # @param [Object] interval Value to be assigned
173
+ def interval=(interval)
174
+ if interval.nil?
175
+ fail ArgumentError, 'interval cannot be nil'
176
+ end
177
+
178
+ if interval > 60
179
+ fail ArgumentError, 'invalid value for "interval", must be smaller than or equal to 60.'
180
+ end
181
+
182
+ if interval < 2
183
+ fail ArgumentError, 'invalid value for "interval", must be greater than or equal to 2.'
184
+ end
185
+
186
+ @interval = interval
187
+ end
188
+
189
+ # Custom attribute writer method with validation
190
+ # @param [Object] threshold Value to be assigned
191
+ def threshold=(threshold)
192
+ if threshold.nil?
193
+ fail ArgumentError, 'threshold cannot be nil'
194
+ end
195
+
196
+ if threshold > 5
197
+ fail ArgumentError, 'invalid value for "threshold", must be smaller than or equal to 5.'
198
+ end
199
+
200
+ if threshold < 1
201
+ fail ArgumentError, 'invalid value for "threshold", must be greater than or equal to 1.'
202
+ end
203
+
204
+ @threshold = threshold
205
+ end
206
+
207
+ # Checks equality by comparing each attribute.
208
+ # @param [Object] Object to be compared
209
+ def ==(o)
210
+ return true if self.equal?(o)
211
+ self.class == o.class &&
212
+ action == o.action &&
213
+ interval == o.interval &&
214
+ threshold == o.threshold
215
+ end
216
+
217
+ # @see the `==` method
218
+ # @param [Object] Object to be compared
219
+ def eql?(o)
220
+ self == o
221
+ end
222
+
223
+ # Calculates hash code according to all attributes.
224
+ # @return [Integer] Hash code
225
+ def hash
226
+ [action, interval, threshold].hash
227
+ end
228
+
229
+ # Builds the object from hash
230
+ # @param [Hash] attributes Model attributes in the form of hash
231
+ # @return [Object] Returns the model itself
232
+ def self.build_from_hash(attributes)
233
+ new.build_from_hash(attributes)
234
+ end
235
+
236
+ # Builds the object from hash
237
+ # @param [Hash] attributes Model attributes in the form of hash
238
+ # @return [Object] Returns the model itself
239
+ def build_from_hash(attributes)
240
+ return nil unless attributes.is_a?(Hash)
241
+ attributes = attributes.transform_keys(&:to_sym)
242
+ self.class.openapi_types.each_pair do |key, type|
243
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
244
+ self.send("#{key}=", nil)
245
+ elsif type =~ /\AArray<(.*)>/i
246
+ # check to ensure the input is an array given that the attribute
247
+ # is documented as an array but the input is not
248
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
249
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
250
+ end
251
+ elsif !attributes[self.class.attribute_map[key]].nil?
252
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
253
+ end
254
+ end
255
+
256
+ self
257
+ end
258
+
259
+ # Deserializes the data based on type
260
+ # @param string type Data type
261
+ # @param string value Value to be deserialized
262
+ # @return [Object] Deserialized data
263
+ def _deserialize(type, value)
264
+ case type.to_sym
265
+ when :Time
266
+ Time.parse(value)
267
+ when :Date
268
+ Date.parse(value)
269
+ when :String
270
+ value.to_s
271
+ when :Integer
272
+ value.to_i
273
+ when :Float
274
+ value.to_f
275
+ when :Boolean
276
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
277
+ true
278
+ else
279
+ false
280
+ end
281
+ when :Object
282
+ # generic object (usually a Hash), return directly
283
+ value
284
+ when /\AArray<(?<inner_type>.+)>\z/
285
+ inner_type = Regexp.last_match[:inner_type]
286
+ value.map { |v| _deserialize(inner_type, v) }
287
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
288
+ k_type = Regexp.last_match[:k_type]
289
+ v_type = Regexp.last_match[:v_type]
290
+ {}.tap do |hash|
291
+ value.each do |k, v|
292
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
293
+ end
294
+ end
295
+ else # model
296
+ # models (e.g. Pet) or oneOf
297
+ klass = IbmCloudPower.const_get(type)
298
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
299
+ end
300
+ end
301
+
302
+ # Returns the string representation of the object
303
+ # @return [String] String presentation of the object
304
+ def to_s
305
+ to_hash.to_s
306
+ end
307
+
308
+ # to_body is an alias to to_hash (backward compatibility)
309
+ # @return [Hash] Returns the object in the form of hash
310
+ def to_body
311
+ to_hash
312
+ end
313
+
314
+ # Returns the object in the form of hash
315
+ # @return [Hash] Returns the object in the form of hash
316
+ def to_hash
317
+ hash = {}
318
+ self.class.attribute_map.each_pair do |attr, param|
319
+ value = self.send(attr)
320
+ if value.nil?
321
+ is_nullable = self.class.openapi_nullable.include?(attr)
322
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
323
+ end
324
+
325
+ hash[param] = _to_hash(value)
326
+ end
327
+ hash
328
+ end
329
+
330
+ # Outputs non-array value in the form of hash
331
+ # For object, use to_hash. Otherwise, just return the value
332
+ # @param [Object] value Any valid value
333
+ # @return [Hash] Returns the value in the form of hash
334
+ def _to_hash(value)
335
+ if value.is_a?(Array)
336
+ value.compact.map { |v| _to_hash(v) }
337
+ elsif value.is_a?(Hash)
338
+ {}.tap do |hash|
339
+ value.each { |k, v| hash[k] = _to_hash(v) }
340
+ end
341
+ elsif value.respond_to? :to_hash
342
+ value.to_hash
343
+ else
344
+ value
345
+ end
346
+ end
347
+
348
+ end
349
+
350
+ end