ibm_cloud_power 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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 MultiVolumesCreate
|
17
|
+
# Base name of the volume(s)
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
# Volume Size (GB)
|
21
|
+
attr_accessor :size
|
22
|
+
|
23
|
+
# Number of volumes to create
|
24
|
+
attr_accessor :count
|
25
|
+
|
26
|
+
# Indicates if the volume is shareable between VMs
|
27
|
+
attr_accessor :shareable
|
28
|
+
|
29
|
+
# Type of Disk, required if affinityPolicy not used
|
30
|
+
attr_accessor :disk_type
|
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
|
+
:'name' => :'name',
|
64
|
+
:'size' => :'size',
|
65
|
+
:'count' => :'count',
|
66
|
+
:'shareable' => :'shareable',
|
67
|
+
:'disk_type' => :'diskType',
|
68
|
+
:'affinity_policy' => :'affinityPolicy',
|
69
|
+
:'affinity_volume' => :'affinityVolume'
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
# Attribute type mapping.
|
74
|
+
def self.openapi_types
|
75
|
+
{
|
76
|
+
:'name' => :'String',
|
77
|
+
:'size' => :'Integer',
|
78
|
+
:'count' => :'Integer',
|
79
|
+
:'shareable' => :'Boolean',
|
80
|
+
:'disk_type' => :'String',
|
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::MultiVolumesCreate` 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::MultiVolumesCreate`. 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?(:'name')
|
108
|
+
self.name = attributes[:'name']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'size')
|
112
|
+
self.size = attributes[:'size']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'count')
|
116
|
+
self.count = attributes[:'count']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'shareable')
|
120
|
+
self.shareable = attributes[:'shareable']
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.key?(:'disk_type')
|
124
|
+
self.disk_type = attributes[:'disk_type']
|
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
|
+
name == o.name &&
|
177
|
+
size == o.size &&
|
178
|
+
count == o.count &&
|
179
|
+
shareable == o.shareable &&
|
180
|
+
disk_type == o.disk_type &&
|
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
|
+
[name, size, count, shareable, disk_type, 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,395 @@
|
|
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 Network
|
17
|
+
# Unique Network ID
|
18
|
+
attr_accessor :network_id
|
19
|
+
|
20
|
+
# Network Name
|
21
|
+
attr_accessor :name
|
22
|
+
|
23
|
+
# Type of Network {pub-vlan, vlan, vxlan}
|
24
|
+
attr_accessor :type
|
25
|
+
|
26
|
+
# VLAN ID
|
27
|
+
attr_accessor :vlan_id
|
28
|
+
|
29
|
+
# Network in CIDR notation (192.168.0.0/24)
|
30
|
+
attr_accessor :cidr
|
31
|
+
|
32
|
+
# Gateway IP Address
|
33
|
+
attr_accessor :gateway
|
34
|
+
|
35
|
+
# DNS Servers
|
36
|
+
attr_accessor :dns_servers
|
37
|
+
|
38
|
+
# IP Address Ranges
|
39
|
+
attr_accessor :ip_address_ranges
|
40
|
+
|
41
|
+
attr_accessor :ip_address_metrics
|
42
|
+
|
43
|
+
# Public IP Address Ranges (for pub-vlan networks)
|
44
|
+
attr_accessor :public_ip_address_ranges
|
45
|
+
|
46
|
+
# MTU Jumbo Network enabled
|
47
|
+
attr_accessor :jumbo
|
48
|
+
|
49
|
+
class EnumAttributeValidator
|
50
|
+
attr_reader :datatype
|
51
|
+
attr_reader :allowable_values
|
52
|
+
|
53
|
+
def initialize(datatype, allowable_values)
|
54
|
+
@allowable_values = allowable_values.map do |value|
|
55
|
+
case datatype.to_s
|
56
|
+
when /Integer/i
|
57
|
+
value.to_i
|
58
|
+
when /Float/i
|
59
|
+
value.to_f
|
60
|
+
else
|
61
|
+
value
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def valid?(value)
|
67
|
+
!value || allowable_values.include?(value)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
72
|
+
def self.attribute_map
|
73
|
+
{
|
74
|
+
:'network_id' => :'networkID',
|
75
|
+
:'name' => :'name',
|
76
|
+
:'type' => :'type',
|
77
|
+
:'vlan_id' => :'vlanID',
|
78
|
+
:'cidr' => :'cidr',
|
79
|
+
:'gateway' => :'gateway',
|
80
|
+
:'dns_servers' => :'dnsServers',
|
81
|
+
:'ip_address_ranges' => :'ipAddressRanges',
|
82
|
+
:'ip_address_metrics' => :'ipAddressMetrics',
|
83
|
+
:'public_ip_address_ranges' => :'publicIPAddressRanges',
|
84
|
+
:'jumbo' => :'jumbo'
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
# Attribute type mapping.
|
89
|
+
def self.openapi_types
|
90
|
+
{
|
91
|
+
:'network_id' => :'String',
|
92
|
+
:'name' => :'String',
|
93
|
+
:'type' => :'String',
|
94
|
+
:'vlan_id' => :'Float',
|
95
|
+
:'cidr' => :'String',
|
96
|
+
:'gateway' => :'String',
|
97
|
+
:'dns_servers' => :'Array<String>',
|
98
|
+
:'ip_address_ranges' => :'Array<IPAddressRange>',
|
99
|
+
:'ip_address_metrics' => :'NetworkIpAddressMetrics',
|
100
|
+
:'public_ip_address_ranges' => :'Array<IPAddressRange>',
|
101
|
+
:'jumbo' => :'Boolean'
|
102
|
+
}
|
103
|
+
end
|
104
|
+
|
105
|
+
# List of attributes with nullable: true
|
106
|
+
def self.openapi_nullable
|
107
|
+
Set.new([
|
108
|
+
])
|
109
|
+
end
|
110
|
+
|
111
|
+
# Initializes the object
|
112
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
113
|
+
def initialize(attributes = {})
|
114
|
+
if (!attributes.is_a?(Hash))
|
115
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudPower::Network` initialize method"
|
116
|
+
end
|
117
|
+
|
118
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
119
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
120
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
121
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudPower::Network`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
122
|
+
end
|
123
|
+
h[k.to_sym] = v
|
124
|
+
}
|
125
|
+
|
126
|
+
if attributes.key?(:'network_id')
|
127
|
+
self.network_id = attributes[:'network_id']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:'name')
|
131
|
+
self.name = attributes[:'name']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes.key?(:'type')
|
135
|
+
self.type = attributes[:'type']
|
136
|
+
else
|
137
|
+
self.type = 'vlan'
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.key?(:'vlan_id')
|
141
|
+
self.vlan_id = attributes[:'vlan_id']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.key?(:'cidr')
|
145
|
+
self.cidr = attributes[:'cidr']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.key?(:'gateway')
|
149
|
+
self.gateway = attributes[:'gateway']
|
150
|
+
end
|
151
|
+
|
152
|
+
if attributes.key?(:'dns_servers')
|
153
|
+
if (value = attributes[:'dns_servers']).is_a?(Array)
|
154
|
+
self.dns_servers = value
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
if attributes.key?(:'ip_address_ranges')
|
159
|
+
if (value = attributes[:'ip_address_ranges']).is_a?(Array)
|
160
|
+
self.ip_address_ranges = value
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
if attributes.key?(:'ip_address_metrics')
|
165
|
+
self.ip_address_metrics = attributes[:'ip_address_metrics']
|
166
|
+
end
|
167
|
+
|
168
|
+
if attributes.key?(:'public_ip_address_ranges')
|
169
|
+
if (value = attributes[:'public_ip_address_ranges']).is_a?(Array)
|
170
|
+
self.public_ip_address_ranges = value
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
if attributes.key?(:'jumbo')
|
175
|
+
self.jumbo = attributes[:'jumbo']
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
180
|
+
# @return Array for valid properties with the reasons
|
181
|
+
def list_invalid_properties
|
182
|
+
invalid_properties = Array.new
|
183
|
+
if @network_id.nil?
|
184
|
+
invalid_properties.push('invalid value for "network_id", network_id cannot be nil.')
|
185
|
+
end
|
186
|
+
|
187
|
+
if @name.nil?
|
188
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
189
|
+
end
|
190
|
+
|
191
|
+
if @type.nil?
|
192
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
193
|
+
end
|
194
|
+
|
195
|
+
if @vlan_id.nil?
|
196
|
+
invalid_properties.push('invalid value for "vlan_id", vlan_id cannot be nil.')
|
197
|
+
end
|
198
|
+
|
199
|
+
if @cidr.nil?
|
200
|
+
invalid_properties.push('invalid value for "cidr", cidr cannot be nil.')
|
201
|
+
end
|
202
|
+
|
203
|
+
if @dns_servers.nil?
|
204
|
+
invalid_properties.push('invalid value for "dns_servers", dns_servers cannot be nil.')
|
205
|
+
end
|
206
|
+
|
207
|
+
if @ip_address_ranges.nil?
|
208
|
+
invalid_properties.push('invalid value for "ip_address_ranges", ip_address_ranges cannot be nil.')
|
209
|
+
end
|
210
|
+
|
211
|
+
if @ip_address_metrics.nil?
|
212
|
+
invalid_properties.push('invalid value for "ip_address_metrics", ip_address_metrics cannot be nil.')
|
213
|
+
end
|
214
|
+
|
215
|
+
if @jumbo.nil?
|
216
|
+
invalid_properties.push('invalid value for "jumbo", jumbo cannot be nil.')
|
217
|
+
end
|
218
|
+
|
219
|
+
invalid_properties
|
220
|
+
end
|
221
|
+
|
222
|
+
# Check to see if the all the properties in the model are valid
|
223
|
+
# @return true if the model is valid
|
224
|
+
def valid?
|
225
|
+
return false if @network_id.nil?
|
226
|
+
return false if @name.nil?
|
227
|
+
return false if @type.nil?
|
228
|
+
type_validator = EnumAttributeValidator.new('String', ["pub-vlan", "vlan", "vxlan"])
|
229
|
+
return false unless type_validator.valid?(@type)
|
230
|
+
return false if @vlan_id.nil?
|
231
|
+
return false if @cidr.nil?
|
232
|
+
return false if @dns_servers.nil?
|
233
|
+
return false if @ip_address_ranges.nil?
|
234
|
+
return false if @ip_address_metrics.nil?
|
235
|
+
return false if @jumbo.nil?
|
236
|
+
true
|
237
|
+
end
|
238
|
+
|
239
|
+
# Custom attribute writer method checking allowed values (enum).
|
240
|
+
# @param [Object] type Object to be assigned
|
241
|
+
def type=(type)
|
242
|
+
validator = EnumAttributeValidator.new('String', ["pub-vlan", "vlan", "vxlan"])
|
243
|
+
unless validator.valid?(type)
|
244
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
245
|
+
end
|
246
|
+
@type = type
|
247
|
+
end
|
248
|
+
|
249
|
+
# Checks equality by comparing each attribute.
|
250
|
+
# @param [Object] Object to be compared
|
251
|
+
def ==(o)
|
252
|
+
return true if self.equal?(o)
|
253
|
+
self.class == o.class &&
|
254
|
+
network_id == o.network_id &&
|
255
|
+
name == o.name &&
|
256
|
+
type == o.type &&
|
257
|
+
vlan_id == o.vlan_id &&
|
258
|
+
cidr == o.cidr &&
|
259
|
+
gateway == o.gateway &&
|
260
|
+
dns_servers == o.dns_servers &&
|
261
|
+
ip_address_ranges == o.ip_address_ranges &&
|
262
|
+
ip_address_metrics == o.ip_address_metrics &&
|
263
|
+
public_ip_address_ranges == o.public_ip_address_ranges &&
|
264
|
+
jumbo == o.jumbo
|
265
|
+
end
|
266
|
+
|
267
|
+
# @see the `==` method
|
268
|
+
# @param [Object] Object to be compared
|
269
|
+
def eql?(o)
|
270
|
+
self == o
|
271
|
+
end
|
272
|
+
|
273
|
+
# Calculates hash code according to all attributes.
|
274
|
+
# @return [Integer] Hash code
|
275
|
+
def hash
|
276
|
+
[network_id, name, type, vlan_id, cidr, gateway, dns_servers, ip_address_ranges, ip_address_metrics, public_ip_address_ranges, jumbo].hash
|
277
|
+
end
|
278
|
+
|
279
|
+
# Builds the object from hash
|
280
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
281
|
+
# @return [Object] Returns the model itself
|
282
|
+
def self.build_from_hash(attributes)
|
283
|
+
new.build_from_hash(attributes)
|
284
|
+
end
|
285
|
+
|
286
|
+
# Builds the object from hash
|
287
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
288
|
+
# @return [Object] Returns the model itself
|
289
|
+
def build_from_hash(attributes)
|
290
|
+
return nil unless attributes.is_a?(Hash)
|
291
|
+
self.class.openapi_types.each_pair do |key, type|
|
292
|
+
if type =~ /\AArray<(.*)>/i
|
293
|
+
# check to ensure the input is an array given that the attribute
|
294
|
+
# is documented as an array but the input is not
|
295
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
296
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
297
|
+
end
|
298
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
299
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
300
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
301
|
+
self.send("#{key}=", nil)
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
self
|
306
|
+
end
|
307
|
+
|
308
|
+
# Deserializes the data based on type
|
309
|
+
# @param string type Data type
|
310
|
+
# @param string value Value to be deserialized
|
311
|
+
# @return [Object] Deserialized data
|
312
|
+
def _deserialize(type, value)
|
313
|
+
case type.to_sym
|
314
|
+
when :DateTime
|
315
|
+
DateTime.parse(value)
|
316
|
+
when :Date
|
317
|
+
Date.parse(value)
|
318
|
+
when :String
|
319
|
+
value.to_s
|
320
|
+
when :Integer
|
321
|
+
value.to_i
|
322
|
+
when :Float
|
323
|
+
value.to_f
|
324
|
+
when :Boolean
|
325
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
326
|
+
true
|
327
|
+
else
|
328
|
+
false
|
329
|
+
end
|
330
|
+
when :Object
|
331
|
+
# generic object (usually a Hash), return directly
|
332
|
+
value
|
333
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
334
|
+
inner_type = Regexp.last_match[:inner_type]
|
335
|
+
value.map { |v| _deserialize(inner_type, v) }
|
336
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
337
|
+
k_type = Regexp.last_match[:k_type]
|
338
|
+
v_type = Regexp.last_match[:v_type]
|
339
|
+
{}.tap do |hash|
|
340
|
+
value.each do |k, v|
|
341
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
342
|
+
end
|
343
|
+
end
|
344
|
+
else # model
|
345
|
+
IbmCloudPower.const_get(type).build_from_hash(value)
|
346
|
+
end
|
347
|
+
end
|
348
|
+
|
349
|
+
# Returns the string representation of the object
|
350
|
+
# @return [String] String presentation of the object
|
351
|
+
def to_s
|
352
|
+
to_hash.to_s
|
353
|
+
end
|
354
|
+
|
355
|
+
# to_body is an alias to to_hash (backward compatibility)
|
356
|
+
# @return [Hash] Returns the object in the form of hash
|
357
|
+
def to_body
|
358
|
+
to_hash
|
359
|
+
end
|
360
|
+
|
361
|
+
# Returns the object in the form of hash
|
362
|
+
# @return [Hash] Returns the object in the form of hash
|
363
|
+
def to_hash
|
364
|
+
hash = {}
|
365
|
+
self.class.attribute_map.each_pair do |attr, param|
|
366
|
+
value = self.send(attr)
|
367
|
+
if value.nil?
|
368
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
369
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
370
|
+
end
|
371
|
+
|
372
|
+
hash[param] = _to_hash(value)
|
373
|
+
end
|
374
|
+
hash
|
375
|
+
end
|
376
|
+
|
377
|
+
# Outputs non-array value in the form of hash
|
378
|
+
# For object, use to_hash. Otherwise, just return the value
|
379
|
+
# @param [Object] value Any valid value
|
380
|
+
# @return [Hash] Returns the value in the form of hash
|
381
|
+
def _to_hash(value)
|
382
|
+
if value.is_a?(Array)
|
383
|
+
value.compact.map { |v| _to_hash(v) }
|
384
|
+
elsif value.is_a?(Hash)
|
385
|
+
{}.tap do |hash|
|
386
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
387
|
+
end
|
388
|
+
elsif value.respond_to? :to_hash
|
389
|
+
value.to_hash
|
390
|
+
else
|
391
|
+
value
|
392
|
+
end
|
393
|
+
end
|
394
|
+
end
|
395
|
+
end
|