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,313 @@
|
|
|
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 CreateDataVolume
|
|
17
|
+
# Type of Disk, required if affinityPolicy not used
|
|
18
|
+
attr_accessor :disk_type
|
|
19
|
+
|
|
20
|
+
# Volume pool where the volume will be located
|
|
21
|
+
attr_accessor :volume_pool
|
|
22
|
+
|
|
23
|
+
# Volume Name
|
|
24
|
+
attr_accessor :name
|
|
25
|
+
|
|
26
|
+
# Volume Size (GB)
|
|
27
|
+
attr_accessor :size
|
|
28
|
+
|
|
29
|
+
# Indicates if the volume is shareable between VMs
|
|
30
|
+
attr_accessor :shareable
|
|
31
|
+
|
|
32
|
+
# Affinity policy for data volume being created; requires affinityVolume to be specified
|
|
33
|
+
attr_accessor :affinity_policy
|
|
34
|
+
|
|
35
|
+
# Volume (ID or Name)to base volume affinity policy against; required if affinityPolicy provided
|
|
36
|
+
attr_accessor :affinity_volume
|
|
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
|
+
:'disk_type' => :'diskType',
|
|
64
|
+
:'volume_pool' => :'volumePool',
|
|
65
|
+
:'name' => :'name',
|
|
66
|
+
:'size' => :'size',
|
|
67
|
+
:'shareable' => :'shareable',
|
|
68
|
+
:'affinity_policy' => :'affinityPolicy',
|
|
69
|
+
:'affinity_volume' => :'affinityVolume'
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Attribute type mapping.
|
|
74
|
+
def self.openapi_types
|
|
75
|
+
{
|
|
76
|
+
:'disk_type' => :'String',
|
|
77
|
+
:'volume_pool' => :'String',
|
|
78
|
+
:'name' => :'String',
|
|
79
|
+
:'size' => :'Float',
|
|
80
|
+
:'shareable' => :'Boolean',
|
|
81
|
+
:'affinity_policy' => :'String',
|
|
82
|
+
:'affinity_volume' => :'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::CreateDataVolume` 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::CreateDataVolume`. 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?(:'disk_type')
|
|
108
|
+
self.disk_type = attributes[:'disk_type']
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
if attributes.key?(:'volume_pool')
|
|
112
|
+
self.volume_pool = attributes[:'volume_pool']
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
if attributes.key?(:'name')
|
|
116
|
+
self.name = attributes[:'name']
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
if attributes.key?(:'size')
|
|
120
|
+
self.size = attributes[:'size']
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
if attributes.key?(:'shareable')
|
|
124
|
+
self.shareable = attributes[:'shareable']
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
if attributes.key?(:'affinity_policy')
|
|
128
|
+
self.affinity_policy = attributes[:'affinity_policy']
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if attributes.key?(:'affinity_volume')
|
|
132
|
+
self.affinity_volume = attributes[:'affinity_volume']
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
137
|
+
# @return Array for valid properties with the reasons
|
|
138
|
+
def list_invalid_properties
|
|
139
|
+
invalid_properties = Array.new
|
|
140
|
+
if @name.nil?
|
|
141
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
if @size.nil?
|
|
145
|
+
invalid_properties.push('invalid value for "size", size cannot be nil.')
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
invalid_properties
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Check to see if the all the properties in the model are valid
|
|
152
|
+
# @return true if the model is valid
|
|
153
|
+
def valid?
|
|
154
|
+
return false if @name.nil?
|
|
155
|
+
return false if @size.nil?
|
|
156
|
+
affinity_policy_validator = EnumAttributeValidator.new('String', ["affinity", "anti-affinity"])
|
|
157
|
+
return false unless affinity_policy_validator.valid?(@affinity_policy)
|
|
158
|
+
true
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
162
|
+
# @param [Object] affinity_policy Object to be assigned
|
|
163
|
+
def affinity_policy=(affinity_policy)
|
|
164
|
+
validator = EnumAttributeValidator.new('String', ["affinity", "anti-affinity"])
|
|
165
|
+
unless validator.valid?(affinity_policy)
|
|
166
|
+
fail ArgumentError, "invalid value for \"affinity_policy\", must be one of #{validator.allowable_values}."
|
|
167
|
+
end
|
|
168
|
+
@affinity_policy = affinity_policy
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# Checks equality by comparing each attribute.
|
|
172
|
+
# @param [Object] Object to be compared
|
|
173
|
+
def ==(o)
|
|
174
|
+
return true if self.equal?(o)
|
|
175
|
+
self.class == o.class &&
|
|
176
|
+
disk_type == o.disk_type &&
|
|
177
|
+
volume_pool == o.volume_pool &&
|
|
178
|
+
name == o.name &&
|
|
179
|
+
size == o.size &&
|
|
180
|
+
shareable == o.shareable &&
|
|
181
|
+
affinity_policy == o.affinity_policy &&
|
|
182
|
+
affinity_volume == o.affinity_volume
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# @see the `==` method
|
|
186
|
+
# @param [Object] Object to be compared
|
|
187
|
+
def eql?(o)
|
|
188
|
+
self == o
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Calculates hash code according to all attributes.
|
|
192
|
+
# @return [Integer] Hash code
|
|
193
|
+
def hash
|
|
194
|
+
[disk_type, volume_pool, name, size, shareable, affinity_policy, affinity_volume].hash
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Builds the object from hash
|
|
198
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
199
|
+
# @return [Object] Returns the model itself
|
|
200
|
+
def self.build_from_hash(attributes)
|
|
201
|
+
new.build_from_hash(attributes)
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Builds the object from hash
|
|
205
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
206
|
+
# @return [Object] Returns the model itself
|
|
207
|
+
def build_from_hash(attributes)
|
|
208
|
+
return nil unless attributes.is_a?(Hash)
|
|
209
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
210
|
+
if type =~ /\AArray<(.*)>/i
|
|
211
|
+
# check to ensure the input is an array given that the attribute
|
|
212
|
+
# is documented as an array but the input is not
|
|
213
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
214
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
215
|
+
end
|
|
216
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
217
|
+
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
|
+
end
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
self
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Deserializes the data based on type
|
|
227
|
+
# @param string type Data type
|
|
228
|
+
# @param string value Value to be deserialized
|
|
229
|
+
# @return [Object] Deserialized data
|
|
230
|
+
def _deserialize(type, value)
|
|
231
|
+
case type.to_sym
|
|
232
|
+
when :DateTime
|
|
233
|
+
DateTime.parse(value)
|
|
234
|
+
when :Date
|
|
235
|
+
Date.parse(value)
|
|
236
|
+
when :String
|
|
237
|
+
value.to_s
|
|
238
|
+
when :Integer
|
|
239
|
+
value.to_i
|
|
240
|
+
when :Float
|
|
241
|
+
value.to_f
|
|
242
|
+
when :Boolean
|
|
243
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
244
|
+
true
|
|
245
|
+
else
|
|
246
|
+
false
|
|
247
|
+
end
|
|
248
|
+
when :Object
|
|
249
|
+
# generic object (usually a Hash), return directly
|
|
250
|
+
value
|
|
251
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
252
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
253
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
254
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
255
|
+
k_type = Regexp.last_match[:k_type]
|
|
256
|
+
v_type = Regexp.last_match[:v_type]
|
|
257
|
+
{}.tap do |hash|
|
|
258
|
+
value.each do |k, v|
|
|
259
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
else # model
|
|
263
|
+
IbmCloudPower.const_get(type).build_from_hash(value)
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
# Returns the string representation of the object
|
|
268
|
+
# @return [String] String presentation of the object
|
|
269
|
+
def to_s
|
|
270
|
+
to_hash.to_s
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
274
|
+
# @return [Hash] Returns the object in the form of hash
|
|
275
|
+
def to_body
|
|
276
|
+
to_hash
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# Returns the object in the form of hash
|
|
280
|
+
# @return [Hash] Returns the object in the form of hash
|
|
281
|
+
def to_hash
|
|
282
|
+
hash = {}
|
|
283
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
284
|
+
value = self.send(attr)
|
|
285
|
+
if value.nil?
|
|
286
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
287
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
hash[param] = _to_hash(value)
|
|
291
|
+
end
|
|
292
|
+
hash
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
# Outputs non-array value in the form of hash
|
|
296
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
297
|
+
# @param [Object] value Any valid value
|
|
298
|
+
# @return [Hash] Returns the value in the form of hash
|
|
299
|
+
def _to_hash(value)
|
|
300
|
+
if value.is_a?(Array)
|
|
301
|
+
value.compact.map { |v| _to_hash(v) }
|
|
302
|
+
elsif value.is_a?(Hash)
|
|
303
|
+
{}.tap do |hash|
|
|
304
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
305
|
+
end
|
|
306
|
+
elsif value.respond_to? :to_hash
|
|
307
|
+
value.to_hash
|
|
308
|
+
else
|
|
309
|
+
value
|
|
310
|
+
end
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
end
|
|
@@ -0,0 +1,360 @@
|
|
|
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 CreateImage
|
|
17
|
+
# Source of the image
|
|
18
|
+
attr_accessor :source
|
|
19
|
+
|
|
20
|
+
# Image ID of existing source image; required for copy image
|
|
21
|
+
attr_accessor :image_id
|
|
22
|
+
|
|
23
|
+
# Name to give created image; required for import image
|
|
24
|
+
attr_accessor :image_name
|
|
25
|
+
|
|
26
|
+
# (deprecated - replaced by region, imageFilename and bucketName) Path to image starting with service endpoint and ending with image filename
|
|
27
|
+
attr_accessor :image_path
|
|
28
|
+
|
|
29
|
+
# Cloud Storage Region; only required to access IBM Cloud Storage
|
|
30
|
+
attr_accessor :region
|
|
31
|
+
|
|
32
|
+
# Cloud Storage image filename; required for import image
|
|
33
|
+
attr_accessor :image_filename
|
|
34
|
+
|
|
35
|
+
# Cloud Storage bucket name; bucket-name[/optional/folder]; required for import image
|
|
36
|
+
attr_accessor :bucket_name
|
|
37
|
+
|
|
38
|
+
# Cloud Storage access key; required for import image
|
|
39
|
+
attr_accessor :access_key
|
|
40
|
+
|
|
41
|
+
# Cloud Storage secret key; required for import image
|
|
42
|
+
attr_accessor :secret_key
|
|
43
|
+
|
|
44
|
+
# Image OS Type, required if importing a raw image; raw images can only be imported using the command line interface
|
|
45
|
+
attr_accessor :os_type
|
|
46
|
+
|
|
47
|
+
# Type of Disk
|
|
48
|
+
attr_accessor :disk_type
|
|
49
|
+
|
|
50
|
+
class EnumAttributeValidator
|
|
51
|
+
attr_reader :datatype
|
|
52
|
+
attr_reader :allowable_values
|
|
53
|
+
|
|
54
|
+
def initialize(datatype, allowable_values)
|
|
55
|
+
@allowable_values = allowable_values.map do |value|
|
|
56
|
+
case datatype.to_s
|
|
57
|
+
when /Integer/i
|
|
58
|
+
value.to_i
|
|
59
|
+
when /Float/i
|
|
60
|
+
value.to_f
|
|
61
|
+
else
|
|
62
|
+
value
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def valid?(value)
|
|
68
|
+
!value || allowable_values.include?(value)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
73
|
+
def self.attribute_map
|
|
74
|
+
{
|
|
75
|
+
:'source' => :'source',
|
|
76
|
+
:'image_id' => :'imageID',
|
|
77
|
+
:'image_name' => :'imageName',
|
|
78
|
+
:'image_path' => :'imagePath',
|
|
79
|
+
:'region' => :'region',
|
|
80
|
+
:'image_filename' => :'imageFilename',
|
|
81
|
+
:'bucket_name' => :'bucketName',
|
|
82
|
+
:'access_key' => :'accessKey',
|
|
83
|
+
:'secret_key' => :'secretKey',
|
|
84
|
+
:'os_type' => :'osType',
|
|
85
|
+
:'disk_type' => :'diskType'
|
|
86
|
+
}
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Attribute type mapping.
|
|
90
|
+
def self.openapi_types
|
|
91
|
+
{
|
|
92
|
+
:'source' => :'String',
|
|
93
|
+
:'image_id' => :'String',
|
|
94
|
+
:'image_name' => :'String',
|
|
95
|
+
:'image_path' => :'String',
|
|
96
|
+
:'region' => :'String',
|
|
97
|
+
:'image_filename' => :'String',
|
|
98
|
+
:'bucket_name' => :'String',
|
|
99
|
+
:'access_key' => :'String',
|
|
100
|
+
:'secret_key' => :'String',
|
|
101
|
+
:'os_type' => :'String',
|
|
102
|
+
:'disk_type' => :'String'
|
|
103
|
+
}
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# List of attributes with nullable: true
|
|
107
|
+
def self.openapi_nullable
|
|
108
|
+
Set.new([
|
|
109
|
+
])
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Initializes the object
|
|
113
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
114
|
+
def initialize(attributes = {})
|
|
115
|
+
if (!attributes.is_a?(Hash))
|
|
116
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudPower::CreateImage` initialize method"
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
120
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
121
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
122
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudPower::CreateImage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
123
|
+
end
|
|
124
|
+
h[k.to_sym] = v
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if attributes.key?(:'source')
|
|
128
|
+
self.source = attributes[:'source']
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if attributes.key?(:'image_id')
|
|
132
|
+
self.image_id = attributes[:'image_id']
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
if attributes.key?(:'image_name')
|
|
136
|
+
self.image_name = attributes[:'image_name']
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
if attributes.key?(:'image_path')
|
|
140
|
+
self.image_path = attributes[:'image_path']
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
if attributes.key?(:'region')
|
|
144
|
+
self.region = attributes[:'region']
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
if attributes.key?(:'image_filename')
|
|
148
|
+
self.image_filename = attributes[:'image_filename']
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
if attributes.key?(:'bucket_name')
|
|
152
|
+
self.bucket_name = attributes[:'bucket_name']
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
if attributes.key?(:'access_key')
|
|
156
|
+
self.access_key = attributes[:'access_key']
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
if attributes.key?(:'secret_key')
|
|
160
|
+
self.secret_key = attributes[:'secret_key']
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
if attributes.key?(:'os_type')
|
|
164
|
+
self.os_type = attributes[:'os_type']
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
if attributes.key?(:'disk_type')
|
|
168
|
+
self.disk_type = attributes[:'disk_type']
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
173
|
+
# @return Array for valid properties with the reasons
|
|
174
|
+
def list_invalid_properties
|
|
175
|
+
invalid_properties = Array.new
|
|
176
|
+
if @source.nil?
|
|
177
|
+
invalid_properties.push('invalid value for "source", source cannot be nil.')
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
invalid_properties
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Check to see if the all the properties in the model are valid
|
|
184
|
+
# @return true if the model is valid
|
|
185
|
+
def valid?
|
|
186
|
+
return false if @source.nil?
|
|
187
|
+
source_validator = EnumAttributeValidator.new('String', ["root-project", "url"])
|
|
188
|
+
return false unless source_validator.valid?(@source)
|
|
189
|
+
os_type_validator = EnumAttributeValidator.new('String', ["aix", "ibmi", "redhat", "sles"])
|
|
190
|
+
return false unless os_type_validator.valid?(@os_type)
|
|
191
|
+
true
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
195
|
+
# @param [Object] source Object to be assigned
|
|
196
|
+
def source=(source)
|
|
197
|
+
validator = EnumAttributeValidator.new('String', ["root-project", "url"])
|
|
198
|
+
unless validator.valid?(source)
|
|
199
|
+
fail ArgumentError, "invalid value for \"source\", must be one of #{validator.allowable_values}."
|
|
200
|
+
end
|
|
201
|
+
@source = source
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
205
|
+
# @param [Object] os_type Object to be assigned
|
|
206
|
+
def os_type=(os_type)
|
|
207
|
+
validator = EnumAttributeValidator.new('String', ["aix", "ibmi", "redhat", "sles"])
|
|
208
|
+
unless validator.valid?(os_type)
|
|
209
|
+
fail ArgumentError, "invalid value for \"os_type\", must be one of #{validator.allowable_values}."
|
|
210
|
+
end
|
|
211
|
+
@os_type = os_type
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Checks equality by comparing each attribute.
|
|
215
|
+
# @param [Object] Object to be compared
|
|
216
|
+
def ==(o)
|
|
217
|
+
return true if self.equal?(o)
|
|
218
|
+
self.class == o.class &&
|
|
219
|
+
source == o.source &&
|
|
220
|
+
image_id == o.image_id &&
|
|
221
|
+
image_name == o.image_name &&
|
|
222
|
+
image_path == o.image_path &&
|
|
223
|
+
region == o.region &&
|
|
224
|
+
image_filename == o.image_filename &&
|
|
225
|
+
bucket_name == o.bucket_name &&
|
|
226
|
+
access_key == o.access_key &&
|
|
227
|
+
secret_key == o.secret_key &&
|
|
228
|
+
os_type == o.os_type &&
|
|
229
|
+
disk_type == o.disk_type
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
# @see the `==` method
|
|
233
|
+
# @param [Object] Object to be compared
|
|
234
|
+
def eql?(o)
|
|
235
|
+
self == o
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# Calculates hash code according to all attributes.
|
|
239
|
+
# @return [Integer] Hash code
|
|
240
|
+
def hash
|
|
241
|
+
[source, image_id, image_name, image_path, region, image_filename, bucket_name, access_key, secret_key, os_type, disk_type].hash
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Builds the object from hash
|
|
245
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
246
|
+
# @return [Object] Returns the model itself
|
|
247
|
+
def self.build_from_hash(attributes)
|
|
248
|
+
new.build_from_hash(attributes)
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Builds the object from hash
|
|
252
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
253
|
+
# @return [Object] Returns the model itself
|
|
254
|
+
def build_from_hash(attributes)
|
|
255
|
+
return nil unless attributes.is_a?(Hash)
|
|
256
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
257
|
+
if type =~ /\AArray<(.*)>/i
|
|
258
|
+
# check to ensure the input is an array given that the attribute
|
|
259
|
+
# is documented as an array but the input is not
|
|
260
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
261
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
262
|
+
end
|
|
263
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
264
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
265
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
266
|
+
self.send("#{key}=", nil)
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
self
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
# Deserializes the data based on type
|
|
274
|
+
# @param string type Data type
|
|
275
|
+
# @param string value Value to be deserialized
|
|
276
|
+
# @return [Object] Deserialized data
|
|
277
|
+
def _deserialize(type, value)
|
|
278
|
+
case type.to_sym
|
|
279
|
+
when :DateTime
|
|
280
|
+
DateTime.parse(value)
|
|
281
|
+
when :Date
|
|
282
|
+
Date.parse(value)
|
|
283
|
+
when :String
|
|
284
|
+
value.to_s
|
|
285
|
+
when :Integer
|
|
286
|
+
value.to_i
|
|
287
|
+
when :Float
|
|
288
|
+
value.to_f
|
|
289
|
+
when :Boolean
|
|
290
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
291
|
+
true
|
|
292
|
+
else
|
|
293
|
+
false
|
|
294
|
+
end
|
|
295
|
+
when :Object
|
|
296
|
+
# generic object (usually a Hash), return directly
|
|
297
|
+
value
|
|
298
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
299
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
300
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
301
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
302
|
+
k_type = Regexp.last_match[:k_type]
|
|
303
|
+
v_type = Regexp.last_match[:v_type]
|
|
304
|
+
{}.tap do |hash|
|
|
305
|
+
value.each do |k, v|
|
|
306
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
else # model
|
|
310
|
+
IbmCloudPower.const_get(type).build_from_hash(value)
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
# Returns the string representation of the object
|
|
315
|
+
# @return [String] String presentation of the object
|
|
316
|
+
def to_s
|
|
317
|
+
to_hash.to_s
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
321
|
+
# @return [Hash] Returns the object in the form of hash
|
|
322
|
+
def to_body
|
|
323
|
+
to_hash
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
# Returns the object in the form of hash
|
|
327
|
+
# @return [Hash] Returns the object in the form of hash
|
|
328
|
+
def to_hash
|
|
329
|
+
hash = {}
|
|
330
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
331
|
+
value = self.send(attr)
|
|
332
|
+
if value.nil?
|
|
333
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
334
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
hash[param] = _to_hash(value)
|
|
338
|
+
end
|
|
339
|
+
hash
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
# Outputs non-array value in the form of hash
|
|
343
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
344
|
+
# @param [Object] value Any valid value
|
|
345
|
+
# @return [Hash] Returns the value in the form of hash
|
|
346
|
+
def _to_hash(value)
|
|
347
|
+
if value.is_a?(Array)
|
|
348
|
+
value.compact.map { |v| _to_hash(v) }
|
|
349
|
+
elsif value.is_a?(Hash)
|
|
350
|
+
{}.tap do |hash|
|
|
351
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
352
|
+
end
|
|
353
|
+
elsif value.respond_to? :to_hash
|
|
354
|
+
value.to_hash
|
|
355
|
+
else
|
|
356
|
+
value
|
|
357
|
+
end
|
|
358
|
+
end
|
|
359
|
+
end
|
|
360
|
+
end
|