ibm_cloud_power 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +255 -0
- data/Rakefile +10 -0
- data/docs/CloneTaskReference.md +19 -0
- data/docs/CloneTaskStatus.md +23 -0
- data/docs/ClonedVolume.md +19 -0
- data/docs/ClonedVolumeDetail.md +19 -0
- data/docs/CloudInstance.md +37 -0
- data/docs/CloudInstanceCreate.md +29 -0
- data/docs/CloudInstanceReference.md +31 -0
- data/docs/CloudInstanceUpdate.md +25 -0
- data/docs/CloudInstanceUsageLimits.md +37 -0
- data/docs/CreateDataVolume.md +29 -0
- data/docs/CreateImage.md +37 -0
- data/docs/Error.md +19 -0
- data/docs/Event.md +33 -0
- data/docs/EventUser.md +21 -0
- data/docs/Events.md +17 -0
- data/docs/ExportImage.md +23 -0
- data/docs/IPAddressRange.md +19 -0
- data/docs/Image.md +39 -0
- data/docs/ImageReference.md +33 -0
- data/docs/ImageSpecifications.md +29 -0
- data/docs/ImageVolume.md +23 -0
- data/docs/Images.md +17 -0
- data/docs/MinMaxDefault.md +21 -0
- data/docs/MultiVolumesCreate.md +29 -0
- data/docs/Network.md +37 -0
- data/docs/NetworkCreate.md +29 -0
- data/docs/NetworkIpAddressMetrics.md +23 -0
- data/docs/NetworkPort.md +29 -0
- data/docs/NetworkPortCreate.md +19 -0
- data/docs/NetworkPortPvmInstance.md +19 -0
- data/docs/NetworkPortUpdate.md +19 -0
- data/docs/NetworkPorts.md +17 -0
- data/docs/NetworkReference.md +27 -0
- data/docs/NetworkUpdate.md +23 -0
- data/docs/Networks.md +17 -0
- data/docs/Operations.md +21 -0
- data/docs/PCloudEventsApi.md +114 -0
- data/docs/PCloudImagesApi.md +342 -0
- data/docs/PCloudInstancesApi.md +148 -0
- data/docs/PCloudNetworksApi.md +504 -0
- data/docs/PCloudPVMInstancesApi.md +809 -0
- data/docs/PCloudSAPApi.md +150 -0
- data/docs/PCloudSnapshotsApi.md +200 -0
- data/docs/PCloudSystemPoolsApi.md +54 -0
- data/docs/PCloudTasksApi.md +100 -0
- data/docs/PCloudTenantsApi.md +102 -0
- data/docs/PCloudTenantsSSHKeysApi.md +248 -0
- data/docs/PCloudVolumesApi.md +746 -0
- data/docs/PVMInstance.md +77 -0
- data/docs/PVMInstanceAction.md +17 -0
- data/docs/PVMInstanceAddNetwork.md +19 -0
- data/docs/PVMInstanceCapture.md +29 -0
- data/docs/PVMInstanceClone.md +31 -0
- data/docs/PVMInstanceConsole.md +17 -0
- data/docs/PVMInstanceCreate.md +53 -0
- data/docs/PVMInstanceFault.md +23 -0
- data/docs/PVMInstanceHealth.md +21 -0
- data/docs/PVMInstanceMultiCreate.md +21 -0
- data/docs/PVMInstanceNetwork.md +33 -0
- data/docs/PVMInstanceNetworks.md +17 -0
- data/docs/PVMInstanceOperation.md +19 -0
- data/docs/PVMInstanceReference.md +71 -0
- data/docs/PVMInstanceRemoveNetwork.md +17 -0
- data/docs/PVMInstanceUpdate.md +33 -0
- data/docs/PVMInstanceUpdateResponse.md +27 -0
- data/docs/PVMInstanceVolumeUpdate.md +17 -0
- data/docs/PVMInstances.md +17 -0
- data/docs/PeeringNetwork.md +21 -0
- data/docs/PinPolicy.md +16 -0
- data/docs/SAPCreate.md +33 -0
- data/docs/SAPProfile.md +25 -0
- data/docs/SAPProfileReference.md +19 -0
- data/docs/SAPProfiles.md +17 -0
- data/docs/SRC.md +19 -0
- data/docs/SSHKey.md +21 -0
- data/docs/SSHKeys.md +17 -0
- data/docs/Snapshot.md +35 -0
- data/docs/SnapshotCreate.md +21 -0
- data/docs/SnapshotCreateResponse.md +17 -0
- data/docs/SnapshotRestore.md +17 -0
- data/docs/SnapshotUpdate.md +19 -0
- data/docs/Snapshots.md +17 -0
- data/docs/SoftwareLicenses.md +25 -0
- data/docs/StockImage.md +21 -0
- data/docs/System.md +21 -0
- data/docs/SystemPool.md +31 -0
- data/docs/Task.md +33 -0
- data/docs/TaskReference.md +19 -0
- data/docs/Tenant.md +29 -0
- data/docs/TenantUpdate.md +19 -0
- data/docs/UpdateVolume.md +23 -0
- data/docs/VirtualCores.md +21 -0
- data/docs/Volume.md +41 -0
- data/docs/VolumeInfo.md +19 -0
- data/docs/VolumeReference.md +43 -0
- data/docs/Volumes.md +17 -0
- data/docs/VolumesClone.md +31 -0
- data/docs/VolumesCloneAsyncRequest.md +19 -0
- data/docs/VolumesCloneCancel.md +17 -0
- data/docs/VolumesCloneCreate.md +19 -0
- data/docs/VolumesCloneDetail.md +33 -0
- data/docs/VolumesCloneExecute.md +19 -0
- data/docs/VolumesCloneRequest.md +19 -0
- data/docs/VolumesCloneResponse.md +17 -0
- data/docs/VolumesClones.md +17 -0
- data/git_push.sh +58 -0
- data/ibm_cloud_power.gemspec +38 -0
- data/lib/ibm_cloud_power.rb +144 -0
- data/lib/ibm_cloud_power/api/p_cloud_events_api.rb +163 -0
- data/lib/ibm_cloud_power/api/p_cloud_images_api.rb +473 -0
- data/lib/ibm_cloud_power/api/p_cloud_instances_api.rb +210 -0
- data/lib/ibm_cloud_power/api/p_cloud_networks_api.rb +719 -0
- data/lib/ibm_cloud_power/api/p_cloud_pvm_instances_api.rb +1166 -0
- data/lib/ibm_cloud_power/api/p_cloud_sap_api.rb +216 -0
- data/lib/ibm_cloud_power/api/p_cloud_snapshots_api.rb +288 -0
- data/lib/ibm_cloud_power/api/p_cloud_system_pools_api.rb +82 -0
- data/lib/ibm_cloud_power/api/p_cloud_tasks_api.rb +142 -0
- data/lib/ibm_cloud_power/api/p_cloud_tenants_api.rb +150 -0
- data/lib/ibm_cloud_power/api/p_cloud_tenants_ssh_keys_api.rb +356 -0
- data/lib/ibm_cloud_power/api/p_cloud_volumes_api.rb +1065 -0
- data/lib/ibm_cloud_power/api_client.rb +387 -0
- data/lib/ibm_cloud_power/api_error.rb +57 -0
- data/lib/ibm_cloud_power/configuration.rb +241 -0
- data/lib/ibm_cloud_power/models/clone_task_reference.rb +229 -0
- data/lib/ibm_cloud_power/models/clone_task_status.rb +285 -0
- data/lib/ibm_cloud_power/models/cloned_volume.rb +219 -0
- data/lib/ibm_cloud_power/models/cloned_volume_detail.rb +227 -0
- data/lib/ibm_cloud_power/models/cloud_instance.rb +361 -0
- data/lib/ibm_cloud_power/models/cloud_instance_create.rb +294 -0
- data/lib/ibm_cloud_power/models/cloud_instance_reference.rb +315 -0
- data/lib/ibm_cloud_power/models/cloud_instance_update.rb +249 -0
- data/lib/ibm_cloud_power/models/cloud_instance_usage_limits.rb +334 -0
- data/lib/ibm_cloud_power/models/create_data_volume.rb +313 -0
- data/lib/ibm_cloud_power/models/create_image.rb +360 -0
- data/lib/ibm_cloud_power/models/error.rb +217 -0
- data/lib/ibm_cloud_power/models/event.rb +357 -0
- data/lib/ibm_cloud_power/models/event_user.rb +234 -0
- data/lib/ibm_cloud_power/models/events.rb +216 -0
- data/lib/ibm_cloud_power/models/export_image.rb +249 -0
- data/lib/ibm_cloud_power/models/image.rb +351 -0
- data/lib/ibm_cloud_power/models/image_reference.rb +333 -0
- data/lib/ibm_cloud_power/models/image_specifications.rb +269 -0
- data/lib/ibm_cloud_power/models/image_volume.rb +259 -0
- data/lib/ibm_cloud_power/models/images.rb +216 -0
- data/lib/ibm_cloud_power/models/ip_address_range.rb +229 -0
- data/lib/ibm_cloud_power/models/min_max_default.rb +244 -0
- data/lib/ibm_cloud_power/models/multi_volumes_create.rb +313 -0
- data/lib/ibm_cloud_power/models/network.rb +395 -0
- data/lib/ibm_cloud_power/models/network_create.rb +314 -0
- data/lib/ibm_cloud_power/models/network_ip_address_metrics.rb +260 -0
- data/lib/ibm_cloud_power/models/network_port.rb +293 -0
- data/lib/ibm_cloud_power/models/network_port_create.rb +219 -0
- data/lib/ibm_cloud_power/models/network_port_pvm_instance.rb +220 -0
- data/lib/ibm_cloud_power/models/network_port_update.rb +219 -0
- data/lib/ibm_cloud_power/models/network_ports.rb +216 -0
- data/lib/ibm_cloud_power/models/network_reference.rb +325 -0
- data/lib/ibm_cloud_power/models/network_update.rb +243 -0
- data/lib/ibm_cloud_power/models/networks.rb +216 -0
- data/lib/ibm_cloud_power/models/operations.rb +287 -0
- data/lib/ibm_cloud_power/models/peering_network.rb +241 -0
- data/lib/ibm_cloud_power/models/pin_policy.rb +37 -0
- data/lib/ibm_cloud_power/models/pvm_instance.rb +612 -0
- data/lib/ibm_cloud_power/models/pvm_instance_action.rb +248 -0
- data/lib/ibm_cloud_power/models/pvm_instance_add_network.rb +224 -0
- data/lib/ibm_cloud_power/models/pvm_instance_capture.rb +317 -0
- data/lib/ibm_cloud_power/models/pvm_instance_clone.rb +328 -0
- data/lib/ibm_cloud_power/models/pvm_instance_console.rb +214 -0
- data/lib/ibm_cloud_power/models/pvm_instance_create.rb +483 -0
- data/lib/ibm_cloud_power/models/pvm_instance_fault.rb +240 -0
- data/lib/ibm_cloud_power/models/pvm_instance_health.rb +230 -0
- data/lib/ibm_cloud_power/models/pvm_instance_multi_create.rb +279 -0
- data/lib/ibm_cloud_power/models/pvm_instance_network.rb +290 -0
- data/lib/ibm_cloud_power/models/pvm_instance_networks.rb +216 -0
- data/lib/ibm_cloud_power/models/pvm_instance_operation.rb +262 -0
- data/lib/ibm_cloud_power/models/pvm_instance_reference.rb +566 -0
- data/lib/ibm_cloud_power/models/pvm_instance_remove_network.rb +209 -0
- data/lib/ibm_cloud_power/models/pvm_instance_update.rb +322 -0
- data/lib/ibm_cloud_power/models/pvm_instance_update_response.rb +292 -0
- data/lib/ibm_cloud_power/models/pvm_instance_volume_update.rb +214 -0
- data/lib/ibm_cloud_power/models/pvm_instances.rb +216 -0
- data/lib/ibm_cloud_power/models/sap_create.rb +311 -0
- data/lib/ibm_cloud_power/models/sap_profile.rb +310 -0
- data/lib/ibm_cloud_power/models/sap_profile_reference.rb +229 -0
- data/lib/ibm_cloud_power/models/sap_profiles.rb +216 -0
- data/lib/ibm_cloud_power/models/snapshot.rb +321 -0
- data/lib/ibm_cloud_power/models/snapshot_create.rb +236 -0
- data/lib/ibm_cloud_power/models/snapshot_create_response.rb +214 -0
- data/lib/ibm_cloud_power/models/snapshot_restore.rb +211 -0
- data/lib/ibm_cloud_power/models/snapshot_update.rb +219 -0
- data/lib/ibm_cloud_power/models/snapshots.rb +216 -0
- data/lib/ibm_cloud_power/models/software_licenses.rb +257 -0
- data/lib/ibm_cloud_power/models/src.rb +219 -0
- data/lib/ibm_cloud_power/models/ssh_key.rb +239 -0
- data/lib/ibm_cloud_power/models/ssh_keys.rb +216 -0
- data/lib/ibm_cloud_power/models/stock_image.rb +230 -0
- data/lib/ibm_cloud_power/models/system.rb +239 -0
- data/lib/ibm_cloud_power/models/system_pool.rb +277 -0
- data/lib/ibm_cloud_power/models/task.rb +334 -0
- data/lib/ibm_cloud_power/models/task_reference.rb +229 -0
- data/lib/ibm_cloud_power/models/tenant.rb +295 -0
- data/lib/ibm_cloud_power/models/tenant_update.rb +221 -0
- data/lib/ibm_cloud_power/models/update_volume.rb +239 -0
- data/lib/ibm_cloud_power/models/virtual_cores.rb +253 -0
- data/lib/ibm_cloud_power/models/volume.rb +356 -0
- data/lib/ibm_cloud_power/models/volume_info.rb +219 -0
- data/lib/ibm_cloud_power/models/volume_reference.rb +396 -0
- data/lib/ibm_cloud_power/models/volumes.rb +216 -0
- data/lib/ibm_cloud_power/models/volumes_clone.rb +284 -0
- data/lib/ibm_cloud_power/models/volumes_clone_async_request.rb +231 -0
- data/lib/ibm_cloud_power/models/volumes_clone_cancel.rb +209 -0
- data/lib/ibm_cloud_power/models/volumes_clone_create.rb +231 -0
- data/lib/ibm_cloud_power/models/volumes_clone_detail.rb +296 -0
- data/lib/ibm_cloud_power/models/volumes_clone_execute.rb +224 -0
- data/lib/ibm_cloud_power/models/volumes_clone_request.rb +231 -0
- data/lib/ibm_cloud_power/models/volumes_clone_response.rb +211 -0
- data/lib/ibm_cloud_power/models/volumes_clones.rb +211 -0
- data/lib/ibm_cloud_power/version.rb +15 -0
- data/spec/api/p_cloud_events_api_spec.rb +62 -0
- data/spec/api/p_cloud_images_api_spec.rb +117 -0
- data/spec/api/p_cloud_instances_api_spec.rb +69 -0
- data/spec/api/p_cloud_networks_api_spec.rb +161 -0
- data/spec/api/p_cloud_pvm_instances_api_spec.rb +240 -0
- data/spec/api/p_cloud_sap_api_spec.rb +70 -0
- data/spec/api/p_cloud_snapshots_api_spec.rb +83 -0
- data/spec/api/p_cloud_system_pools_api_spec.rb +46 -0
- data/spec/api/p_cloud_tasks_api_spec.rb +57 -0
- data/spec/api/p_cloud_tenants_api_spec.rb +58 -0
- data/spec/api/p_cloud_tenants_ssh_keys_api_spec.rb +95 -0
- data/spec/api/p_cloud_volumes_api_spec.rb +223 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/clone_task_reference_spec.rb +47 -0
- data/spec/models/clone_task_status_spec.rb +63 -0
- data/spec/models/cloned_volume_detail_spec.rb +47 -0
- data/spec/models/cloned_volume_spec.rb +47 -0
- data/spec/models/cloud_instance_create_spec.rb +77 -0
- data/spec/models/cloud_instance_reference_spec.rb +83 -0
- data/spec/models/cloud_instance_spec.rb +101 -0
- data/spec/models/cloud_instance_update_spec.rb +65 -0
- data/spec/models/cloud_instance_usage_limits_spec.rb +101 -0
- data/spec/models/create_data_volume_spec.rb +81 -0
- data/spec/models/create_image_spec.rb +109 -0
- data/spec/models/error_spec.rb +47 -0
- data/spec/models/event_spec.rb +93 -0
- data/spec/models/event_user_spec.rb +53 -0
- data/spec/models/events_spec.rb +41 -0
- data/spec/models/export_image_spec.rb +59 -0
- data/spec/models/image_reference_spec.rb +89 -0
- data/spec/models/image_spec.rb +107 -0
- data/spec/models/image_specifications_spec.rb +77 -0
- data/spec/models/image_volume_spec.rb +59 -0
- data/spec/models/images_spec.rb +41 -0
- data/spec/models/ip_address_range_spec.rb +47 -0
- data/spec/models/min_max_default_spec.rb +53 -0
- data/spec/models/multi_volumes_create_spec.rb +81 -0
- data/spec/models/network_create_spec.rb +81 -0
- data/spec/models/network_ip_address_metrics_spec.rb +59 -0
- data/spec/models/network_port_create_spec.rb +47 -0
- data/spec/models/network_port_pvm_instance_spec.rb +47 -0
- data/spec/models/network_port_spec.rb +77 -0
- data/spec/models/network_port_update_spec.rb +47 -0
- data/spec/models/network_ports_spec.rb +41 -0
- data/spec/models/network_reference_spec.rb +75 -0
- data/spec/models/network_spec.rb +105 -0
- data/spec/models/network_update_spec.rb +59 -0
- data/spec/models/networks_spec.rb +41 -0
- data/spec/models/operations_spec.rb +65 -0
- data/spec/models/peering_network_spec.rb +53 -0
- data/spec/models/pin_policy_spec.rb +35 -0
- data/spec/models/pvm_instance_action_spec.rb +45 -0
- data/spec/models/pvm_instance_add_network_spec.rb +47 -0
- data/spec/models/pvm_instance_capture_spec.rb +81 -0
- data/spec/models/pvm_instance_clone_spec.rb +87 -0
- data/spec/models/pvm_instance_console_spec.rb +41 -0
- data/spec/models/pvm_instance_create_spec.rb +161 -0
- data/spec/models/pvm_instance_fault_spec.rb +59 -0
- data/spec/models/pvm_instance_health_spec.rb +53 -0
- data/spec/models/pvm_instance_multi_create_spec.rb +61 -0
- data/spec/models/pvm_instance_network_spec.rb +89 -0
- data/spec/models/pvm_instance_networks_spec.rb +41 -0
- data/spec/models/pvm_instance_operation_spec.rb +51 -0
- data/spec/models/pvm_instance_reference_spec.rb +207 -0
- data/spec/models/pvm_instance_remove_network_spec.rb +41 -0
- data/spec/models/pvm_instance_spec.rb +225 -0
- data/spec/models/pvm_instance_update_response_spec.rb +75 -0
- data/spec/models/pvm_instance_update_spec.rb +93 -0
- data/spec/models/pvm_instance_volume_update_spec.rb +41 -0
- data/spec/models/pvm_instances_spec.rb +41 -0
- data/spec/models/sap_create_spec.rb +89 -0
- data/spec/models/sap_profile_reference_spec.rb +47 -0
- data/spec/models/sap_profile_spec.rb +69 -0
- data/spec/models/sap_profiles_spec.rb +41 -0
- data/spec/models/snapshot_create_response_spec.rb +41 -0
- data/spec/models/snapshot_create_spec.rb +53 -0
- data/spec/models/snapshot_restore_spec.rb +41 -0
- data/spec/models/snapshot_spec.rb +95 -0
- data/spec/models/snapshot_update_spec.rb +47 -0
- data/spec/models/snapshots_spec.rb +41 -0
- data/spec/models/software_licenses_spec.rb +65 -0
- data/spec/models/src_spec.rb +47 -0
- data/spec/models/ssh_key_spec.rb +53 -0
- data/spec/models/ssh_keys_spec.rb +41 -0
- data/spec/models/stock_image_spec.rb +53 -0
- data/spec/models/system_pool_spec.rb +83 -0
- data/spec/models/system_spec.rb +53 -0
- data/spec/models/task_reference_spec.rb +47 -0
- data/spec/models/task_spec.rb +89 -0
- data/spec/models/tenant_spec.rb +77 -0
- data/spec/models/tenant_update_spec.rb +47 -0
- data/spec/models/update_volume_spec.rb +59 -0
- data/spec/models/virtual_cores_spec.rb +53 -0
- data/spec/models/volume_info_spec.rb +47 -0
- data/spec/models/volume_reference_spec.rb +119 -0
- data/spec/models/volume_spec.rb +113 -0
- data/spec/models/volumes_clone_async_request_spec.rb +47 -0
- data/spec/models/volumes_clone_cancel_spec.rb +41 -0
- data/spec/models/volumes_clone_create_spec.rb +47 -0
- data/spec/models/volumes_clone_detail_spec.rb +89 -0
- data/spec/models/volumes_clone_execute_spec.rb +47 -0
- data/spec/models/volumes_clone_request_spec.rb +47 -0
- data/spec/models/volumes_clone_response_spec.rb +47 -0
- data/spec/models/volumes_clone_spec.rb +83 -0
- data/spec/models/volumes_clones_spec.rb +41 -0
- data/spec/models/volumes_spec.rb +41 -0
- data/spec/spec_helper.rb +111 -0
- metadata +519 -0
|
@@ -0,0 +1,317 @@
|
|
|
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: 5.0.0-beta2
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
|
|
15
|
+
module IbmCloudPower
|
|
16
|
+
class PVMInstanceCapture
|
|
17
|
+
# Name of the deployable image created for the captured PVMInstance
|
|
18
|
+
attr_accessor :capture_name
|
|
19
|
+
|
|
20
|
+
# List of Data volume IDs to include in the captured PVMInstance
|
|
21
|
+
attr_accessor :capture_volume_i_ds
|
|
22
|
+
|
|
23
|
+
# Destination for the deployable image
|
|
24
|
+
attr_accessor :capture_destination
|
|
25
|
+
|
|
26
|
+
# Cloud Storage Image Path (bucket-name [/folder/../..])
|
|
27
|
+
attr_accessor :cloud_storage_image_path
|
|
28
|
+
|
|
29
|
+
# Cloud Storage Region
|
|
30
|
+
attr_accessor :cloud_storage_region
|
|
31
|
+
|
|
32
|
+
# Cloud Storage Access key
|
|
33
|
+
attr_accessor :cloud_storage_access_key
|
|
34
|
+
|
|
35
|
+
# Cloud Storage Secret key
|
|
36
|
+
attr_accessor :cloud_storage_secret_key
|
|
37
|
+
|
|
38
|
+
class EnumAttributeValidator
|
|
39
|
+
attr_reader :datatype
|
|
40
|
+
attr_reader :allowable_values
|
|
41
|
+
|
|
42
|
+
def initialize(datatype, allowable_values)
|
|
43
|
+
@allowable_values = allowable_values.map do |value|
|
|
44
|
+
case datatype.to_s
|
|
45
|
+
when /Integer/i
|
|
46
|
+
value.to_i
|
|
47
|
+
when /Float/i
|
|
48
|
+
value.to_f
|
|
49
|
+
else
|
|
50
|
+
value
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def valid?(value)
|
|
56
|
+
!value || allowable_values.include?(value)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
61
|
+
def self.attribute_map
|
|
62
|
+
{
|
|
63
|
+
:'capture_name' => :'captureName',
|
|
64
|
+
:'capture_volume_i_ds' => :'captureVolumeIDs',
|
|
65
|
+
:'capture_destination' => :'captureDestination',
|
|
66
|
+
:'cloud_storage_image_path' => :'cloudStorageImagePath',
|
|
67
|
+
:'cloud_storage_region' => :'cloudStorageRegion',
|
|
68
|
+
:'cloud_storage_access_key' => :'cloudStorageAccessKey',
|
|
69
|
+
:'cloud_storage_secret_key' => :'cloudStorageSecretKey'
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Attribute type mapping.
|
|
74
|
+
def self.openapi_types
|
|
75
|
+
{
|
|
76
|
+
:'capture_name' => :'String',
|
|
77
|
+
:'capture_volume_i_ds' => :'Array<String>',
|
|
78
|
+
:'capture_destination' => :'String',
|
|
79
|
+
:'cloud_storage_image_path' => :'String',
|
|
80
|
+
:'cloud_storage_region' => :'String',
|
|
81
|
+
:'cloud_storage_access_key' => :'String',
|
|
82
|
+
:'cloud_storage_secret_key' => :'String'
|
|
83
|
+
}
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# List of attributes with nullable: true
|
|
87
|
+
def self.openapi_nullable
|
|
88
|
+
Set.new([
|
|
89
|
+
])
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Initializes the object
|
|
93
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
94
|
+
def initialize(attributes = {})
|
|
95
|
+
if (!attributes.is_a?(Hash))
|
|
96
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudPower::PVMInstanceCapture` initialize method"
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
100
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
101
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
102
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudPower::PVMInstanceCapture`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
103
|
+
end
|
|
104
|
+
h[k.to_sym] = v
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if attributes.key?(:'capture_name')
|
|
108
|
+
self.capture_name = attributes[:'capture_name']
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
if attributes.key?(:'capture_volume_i_ds')
|
|
112
|
+
if (value = attributes[:'capture_volume_i_ds']).is_a?(Array)
|
|
113
|
+
self.capture_volume_i_ds = value
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if attributes.key?(:'capture_destination')
|
|
118
|
+
self.capture_destination = attributes[:'capture_destination']
|
|
119
|
+
else
|
|
120
|
+
self.capture_destination = 'cloud-storage'
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
if attributes.key?(:'cloud_storage_image_path')
|
|
124
|
+
self.cloud_storage_image_path = attributes[:'cloud_storage_image_path']
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
if attributes.key?(:'cloud_storage_region')
|
|
128
|
+
self.cloud_storage_region = attributes[:'cloud_storage_region']
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if attributes.key?(:'cloud_storage_access_key')
|
|
132
|
+
self.cloud_storage_access_key = attributes[:'cloud_storage_access_key']
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
if attributes.key?(:'cloud_storage_secret_key')
|
|
136
|
+
self.cloud_storage_secret_key = attributes[:'cloud_storage_secret_key']
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
141
|
+
# @return Array for valid properties with the reasons
|
|
142
|
+
def list_invalid_properties
|
|
143
|
+
invalid_properties = Array.new
|
|
144
|
+
if @capture_name.nil?
|
|
145
|
+
invalid_properties.push('invalid value for "capture_name", capture_name cannot be nil.')
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
if @capture_destination.nil?
|
|
149
|
+
invalid_properties.push('invalid value for "capture_destination", capture_destination cannot be nil.')
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
invalid_properties
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Check to see if the all the properties in the model are valid
|
|
156
|
+
# @return true if the model is valid
|
|
157
|
+
def valid?
|
|
158
|
+
return false if @capture_name.nil?
|
|
159
|
+
return false if @capture_destination.nil?
|
|
160
|
+
capture_destination_validator = EnumAttributeValidator.new('String', ["image-catalog", "cloud-storage", "both"])
|
|
161
|
+
return false unless capture_destination_validator.valid?(@capture_destination)
|
|
162
|
+
true
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
166
|
+
# @param [Object] capture_destination Object to be assigned
|
|
167
|
+
def capture_destination=(capture_destination)
|
|
168
|
+
validator = EnumAttributeValidator.new('String', ["image-catalog", "cloud-storage", "both"])
|
|
169
|
+
unless validator.valid?(capture_destination)
|
|
170
|
+
fail ArgumentError, "invalid value for \"capture_destination\", must be one of #{validator.allowable_values}."
|
|
171
|
+
end
|
|
172
|
+
@capture_destination = capture_destination
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Checks equality by comparing each attribute.
|
|
176
|
+
# @param [Object] Object to be compared
|
|
177
|
+
def ==(o)
|
|
178
|
+
return true if self.equal?(o)
|
|
179
|
+
self.class == o.class &&
|
|
180
|
+
capture_name == o.capture_name &&
|
|
181
|
+
capture_volume_i_ds == o.capture_volume_i_ds &&
|
|
182
|
+
capture_destination == o.capture_destination &&
|
|
183
|
+
cloud_storage_image_path == o.cloud_storage_image_path &&
|
|
184
|
+
cloud_storage_region == o.cloud_storage_region &&
|
|
185
|
+
cloud_storage_access_key == o.cloud_storage_access_key &&
|
|
186
|
+
cloud_storage_secret_key == o.cloud_storage_secret_key
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# @see the `==` method
|
|
190
|
+
# @param [Object] Object to be compared
|
|
191
|
+
def eql?(o)
|
|
192
|
+
self == o
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Calculates hash code according to all attributes.
|
|
196
|
+
# @return [Integer] Hash code
|
|
197
|
+
def hash
|
|
198
|
+
[capture_name, capture_volume_i_ds, capture_destination, cloud_storage_image_path, cloud_storage_region, cloud_storage_access_key, cloud_storage_secret_key].hash
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Builds the object from hash
|
|
202
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
203
|
+
# @return [Object] Returns the model itself
|
|
204
|
+
def self.build_from_hash(attributes)
|
|
205
|
+
new.build_from_hash(attributes)
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Builds the object from hash
|
|
209
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
210
|
+
# @return [Object] Returns the model itself
|
|
211
|
+
def build_from_hash(attributes)
|
|
212
|
+
return nil unless attributes.is_a?(Hash)
|
|
213
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
214
|
+
if type =~ /\AArray<(.*)>/i
|
|
215
|
+
# check to ensure the input is an array given that the attribute
|
|
216
|
+
# is documented as an array but the input is not
|
|
217
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
218
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
219
|
+
end
|
|
220
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
221
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
222
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
223
|
+
self.send("#{key}=", nil)
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
self
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Deserializes the data based on type
|
|
231
|
+
# @param string type Data type
|
|
232
|
+
# @param string value Value to be deserialized
|
|
233
|
+
# @return [Object] Deserialized data
|
|
234
|
+
def _deserialize(type, value)
|
|
235
|
+
case type.to_sym
|
|
236
|
+
when :DateTime
|
|
237
|
+
DateTime.parse(value)
|
|
238
|
+
when :Date
|
|
239
|
+
Date.parse(value)
|
|
240
|
+
when :String
|
|
241
|
+
value.to_s
|
|
242
|
+
when :Integer
|
|
243
|
+
value.to_i
|
|
244
|
+
when :Float
|
|
245
|
+
value.to_f
|
|
246
|
+
when :Boolean
|
|
247
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
248
|
+
true
|
|
249
|
+
else
|
|
250
|
+
false
|
|
251
|
+
end
|
|
252
|
+
when :Object
|
|
253
|
+
# generic object (usually a Hash), return directly
|
|
254
|
+
value
|
|
255
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
256
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
257
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
258
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
259
|
+
k_type = Regexp.last_match[:k_type]
|
|
260
|
+
v_type = Regexp.last_match[:v_type]
|
|
261
|
+
{}.tap do |hash|
|
|
262
|
+
value.each do |k, v|
|
|
263
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
else # model
|
|
267
|
+
IbmCloudPower.const_get(type).build_from_hash(value)
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# Returns the string representation of the object
|
|
272
|
+
# @return [String] String presentation of the object
|
|
273
|
+
def to_s
|
|
274
|
+
to_hash.to_s
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
278
|
+
# @return [Hash] Returns the object in the form of hash
|
|
279
|
+
def to_body
|
|
280
|
+
to_hash
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
# Returns the object in the form of hash
|
|
284
|
+
# @return [Hash] Returns the object in the form of hash
|
|
285
|
+
def to_hash
|
|
286
|
+
hash = {}
|
|
287
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
288
|
+
value = self.send(attr)
|
|
289
|
+
if value.nil?
|
|
290
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
291
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
hash[param] = _to_hash(value)
|
|
295
|
+
end
|
|
296
|
+
hash
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# Outputs non-array value in the form of hash
|
|
300
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
301
|
+
# @param [Object] value Any valid value
|
|
302
|
+
# @return [Hash] Returns the value in the form of hash
|
|
303
|
+
def _to_hash(value)
|
|
304
|
+
if value.is_a?(Array)
|
|
305
|
+
value.compact.map { |v| _to_hash(v) }
|
|
306
|
+
elsif value.is_a?(Hash)
|
|
307
|
+
{}.tap do |hash|
|
|
308
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
309
|
+
end
|
|
310
|
+
elsif value.respond_to? :to_hash
|
|
311
|
+
value.to_hash
|
|
312
|
+
else
|
|
313
|
+
value
|
|
314
|
+
end
|
|
315
|
+
end
|
|
316
|
+
end
|
|
317
|
+
end
|
|
@@ -0,0 +1,328 @@
|
|
|
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: 5.0.0-beta2
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
|
|
15
|
+
module IbmCloudPower
|
|
16
|
+
class PVMInstanceClone
|
|
17
|
+
# Name of the server to create
|
|
18
|
+
attr_accessor :name
|
|
19
|
+
|
|
20
|
+
# Number of processors allocated
|
|
21
|
+
attr_accessor :processors
|
|
22
|
+
|
|
23
|
+
# Processor type (dedicated, shared, capped)
|
|
24
|
+
attr_accessor :proc_type
|
|
25
|
+
|
|
26
|
+
# Amount of memory allocated (in GB)
|
|
27
|
+
attr_accessor :memory
|
|
28
|
+
|
|
29
|
+
# The pvm instance networks information
|
|
30
|
+
attr_accessor :networks
|
|
31
|
+
|
|
32
|
+
# List of volume IDs
|
|
33
|
+
attr_accessor :volume_i_ds
|
|
34
|
+
|
|
35
|
+
# The name of the SSH key pair provided to the server for authenticating users (looked up in the tenant's list of keys)
|
|
36
|
+
attr_accessor :key_pair_name
|
|
37
|
+
|
|
38
|
+
attr_accessor :software_licenses
|
|
39
|
+
|
|
40
|
+
class EnumAttributeValidator
|
|
41
|
+
attr_reader :datatype
|
|
42
|
+
attr_reader :allowable_values
|
|
43
|
+
|
|
44
|
+
def initialize(datatype, allowable_values)
|
|
45
|
+
@allowable_values = allowable_values.map do |value|
|
|
46
|
+
case datatype.to_s
|
|
47
|
+
when /Integer/i
|
|
48
|
+
value.to_i
|
|
49
|
+
when /Float/i
|
|
50
|
+
value.to_f
|
|
51
|
+
else
|
|
52
|
+
value
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def valid?(value)
|
|
58
|
+
!value || allowable_values.include?(value)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
63
|
+
def self.attribute_map
|
|
64
|
+
{
|
|
65
|
+
:'name' => :'name',
|
|
66
|
+
:'processors' => :'processors',
|
|
67
|
+
:'proc_type' => :'procType',
|
|
68
|
+
:'memory' => :'memory',
|
|
69
|
+
:'networks' => :'networks',
|
|
70
|
+
:'volume_i_ds' => :'volumeIDs',
|
|
71
|
+
:'key_pair_name' => :'keyPairName',
|
|
72
|
+
:'software_licenses' => :'softwareLicenses'
|
|
73
|
+
}
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Attribute type mapping.
|
|
77
|
+
def self.openapi_types
|
|
78
|
+
{
|
|
79
|
+
:'name' => :'String',
|
|
80
|
+
:'processors' => :'Float',
|
|
81
|
+
:'proc_type' => :'String',
|
|
82
|
+
:'memory' => :'Float',
|
|
83
|
+
:'networks' => :'Array<PVMInstanceAddNetwork>',
|
|
84
|
+
:'volume_i_ds' => :'Array<String>',
|
|
85
|
+
:'key_pair_name' => :'String',
|
|
86
|
+
:'software_licenses' => :'SoftwareLicenses'
|
|
87
|
+
}
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# List of attributes with nullable: true
|
|
91
|
+
def self.openapi_nullable
|
|
92
|
+
Set.new([
|
|
93
|
+
])
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Initializes the object
|
|
97
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
98
|
+
def initialize(attributes = {})
|
|
99
|
+
if (!attributes.is_a?(Hash))
|
|
100
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudPower::PVMInstanceClone` initialize method"
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
104
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
105
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
106
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudPower::PVMInstanceClone`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
107
|
+
end
|
|
108
|
+
h[k.to_sym] = v
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if attributes.key?(:'name')
|
|
112
|
+
self.name = attributes[:'name']
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
if attributes.key?(:'processors')
|
|
116
|
+
self.processors = attributes[:'processors']
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
if attributes.key?(:'proc_type')
|
|
120
|
+
self.proc_type = attributes[:'proc_type']
|
|
121
|
+
else
|
|
122
|
+
self.proc_type = 'dedicated'
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if attributes.key?(:'memory')
|
|
126
|
+
self.memory = attributes[:'memory']
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if attributes.key?(:'networks')
|
|
130
|
+
if (value = attributes[:'networks']).is_a?(Array)
|
|
131
|
+
self.networks = value
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
if attributes.key?(:'volume_i_ds')
|
|
136
|
+
if (value = attributes[:'volume_i_ds']).is_a?(Array)
|
|
137
|
+
self.volume_i_ds = value
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if attributes.key?(:'key_pair_name')
|
|
142
|
+
self.key_pair_name = attributes[:'key_pair_name']
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if attributes.key?(:'software_licenses')
|
|
146
|
+
self.software_licenses = attributes[:'software_licenses']
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
151
|
+
# @return Array for valid properties with the reasons
|
|
152
|
+
def list_invalid_properties
|
|
153
|
+
invalid_properties = Array.new
|
|
154
|
+
if @name.nil?
|
|
155
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if @networks.nil?
|
|
159
|
+
invalid_properties.push('invalid value for "networks", networks cannot be nil.')
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
invalid_properties
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Check to see if the all the properties in the model are valid
|
|
166
|
+
# @return true if the model is valid
|
|
167
|
+
def valid?
|
|
168
|
+
return false if @name.nil?
|
|
169
|
+
proc_type_validator = EnumAttributeValidator.new('String', ["dedicated", "shared", "capped"])
|
|
170
|
+
return false unless proc_type_validator.valid?(@proc_type)
|
|
171
|
+
return false if @networks.nil?
|
|
172
|
+
true
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
176
|
+
# @param [Object] proc_type Object to be assigned
|
|
177
|
+
def proc_type=(proc_type)
|
|
178
|
+
validator = EnumAttributeValidator.new('String', ["dedicated", "shared", "capped"])
|
|
179
|
+
unless validator.valid?(proc_type)
|
|
180
|
+
fail ArgumentError, "invalid value for \"proc_type\", must be one of #{validator.allowable_values}."
|
|
181
|
+
end
|
|
182
|
+
@proc_type = proc_type
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Checks equality by comparing each attribute.
|
|
186
|
+
# @param [Object] Object to be compared
|
|
187
|
+
def ==(o)
|
|
188
|
+
return true if self.equal?(o)
|
|
189
|
+
self.class == o.class &&
|
|
190
|
+
name == o.name &&
|
|
191
|
+
processors == o.processors &&
|
|
192
|
+
proc_type == o.proc_type &&
|
|
193
|
+
memory == o.memory &&
|
|
194
|
+
networks == o.networks &&
|
|
195
|
+
volume_i_ds == o.volume_i_ds &&
|
|
196
|
+
key_pair_name == o.key_pair_name &&
|
|
197
|
+
software_licenses == o.software_licenses
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# @see the `==` method
|
|
201
|
+
# @param [Object] Object to be compared
|
|
202
|
+
def eql?(o)
|
|
203
|
+
self == o
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Calculates hash code according to all attributes.
|
|
207
|
+
# @return [Integer] Hash code
|
|
208
|
+
def hash
|
|
209
|
+
[name, processors, proc_type, memory, networks, volume_i_ds, key_pair_name, software_licenses].hash
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Builds the object from hash
|
|
213
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
214
|
+
# @return [Object] Returns the model itself
|
|
215
|
+
def self.build_from_hash(attributes)
|
|
216
|
+
new.build_from_hash(attributes)
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Builds the object from hash
|
|
220
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
221
|
+
# @return [Object] Returns the model itself
|
|
222
|
+
def build_from_hash(attributes)
|
|
223
|
+
return nil unless attributes.is_a?(Hash)
|
|
224
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
225
|
+
if type =~ /\AArray<(.*)>/i
|
|
226
|
+
# check to ensure the input is an array given that the attribute
|
|
227
|
+
# is documented as an array but the input is not
|
|
228
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
229
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
230
|
+
end
|
|
231
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
232
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
233
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
234
|
+
self.send("#{key}=", nil)
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
self
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Deserializes the data based on type
|
|
242
|
+
# @param string type Data type
|
|
243
|
+
# @param string value Value to be deserialized
|
|
244
|
+
# @return [Object] Deserialized data
|
|
245
|
+
def _deserialize(type, value)
|
|
246
|
+
case type.to_sym
|
|
247
|
+
when :DateTime
|
|
248
|
+
DateTime.parse(value)
|
|
249
|
+
when :Date
|
|
250
|
+
Date.parse(value)
|
|
251
|
+
when :String
|
|
252
|
+
value.to_s
|
|
253
|
+
when :Integer
|
|
254
|
+
value.to_i
|
|
255
|
+
when :Float
|
|
256
|
+
value.to_f
|
|
257
|
+
when :Boolean
|
|
258
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
259
|
+
true
|
|
260
|
+
else
|
|
261
|
+
false
|
|
262
|
+
end
|
|
263
|
+
when :Object
|
|
264
|
+
# generic object (usually a Hash), return directly
|
|
265
|
+
value
|
|
266
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
267
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
268
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
269
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
270
|
+
k_type = Regexp.last_match[:k_type]
|
|
271
|
+
v_type = Regexp.last_match[:v_type]
|
|
272
|
+
{}.tap do |hash|
|
|
273
|
+
value.each do |k, v|
|
|
274
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
275
|
+
end
|
|
276
|
+
end
|
|
277
|
+
else # model
|
|
278
|
+
IbmCloudPower.const_get(type).build_from_hash(value)
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# Returns the string representation of the object
|
|
283
|
+
# @return [String] String presentation of the object
|
|
284
|
+
def to_s
|
|
285
|
+
to_hash.to_s
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
289
|
+
# @return [Hash] Returns the object in the form of hash
|
|
290
|
+
def to_body
|
|
291
|
+
to_hash
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
# Returns the object in the form of hash
|
|
295
|
+
# @return [Hash] Returns the object in the form of hash
|
|
296
|
+
def to_hash
|
|
297
|
+
hash = {}
|
|
298
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
299
|
+
value = self.send(attr)
|
|
300
|
+
if value.nil?
|
|
301
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
302
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
hash[param] = _to_hash(value)
|
|
306
|
+
end
|
|
307
|
+
hash
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
# Outputs non-array value in the form of hash
|
|
311
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
312
|
+
# @param [Object] value Any valid value
|
|
313
|
+
# @return [Hash] Returns the value in the form of hash
|
|
314
|
+
def _to_hash(value)
|
|
315
|
+
if value.is_a?(Array)
|
|
316
|
+
value.compact.map { |v| _to_hash(v) }
|
|
317
|
+
elsif value.is_a?(Hash)
|
|
318
|
+
{}.tap do |hash|
|
|
319
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
320
|
+
end
|
|
321
|
+
elsif value.respond_to? :to_hash
|
|
322
|
+
value.to_hash
|
|
323
|
+
else
|
|
324
|
+
value
|
|
325
|
+
end
|
|
326
|
+
end
|
|
327
|
+
end
|
|
328
|
+
end
|