Class: Knife::Clc::ServerLaunch::Mapper
- Inherits:
-
Object
- Object
- Knife::Clc::ServerLaunch::Mapper
- Defined in:
- lib/knife-clc/server_launch/mapper.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(params) ⇒ Mapper
constructor
A new instance of Mapper.
- #prepare_launch_parameters ⇒ Object
Constructor Details
#initialize(params) ⇒ Mapper
Returns a new instance of Mapper.
7 8 9 |
# File 'lib/knife-clc/server_launch/mapper.rb', line 7 def initialize(params) @config = params.fetch(:config) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/knife-clc/server_launch/mapper.rb', line 5 def config @config end |
Instance Method Details
#prepare_launch_parameters ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/knife-clc/server_launch/mapper.rb', line 11 def prepare_launch_parameters { 'name' => config[:clc_name], 'description' => config[:clc_description], 'groupId' => config[:clc_group], 'sourceServerId' => config[:clc_source_server], 'isManagedOS' => config[:clc_managed], 'isManagedBackup' => config[:clc_managed_backup], 'primaryDns' => config[:clc_primary_dns], 'secondaryDns' => config[:clc_secondary_dns], 'networkId' => config[:clc_network], 'ipAddress' => config[:clc_ip], 'password' => config[:clc_server_password], 'sourceServerPassword' => config[:clc_source_server_password], 'cpu' => config[:clc_cpu].to_i, 'cpuAutoscalePolicyId' => config[:clc_cpu_autoscale_policy], 'memoryGB' => config[:clc_memory].to_i, 'type' => config[:clc_type], 'storageType' => config[:clc_storage_type], 'antiAffinityPolicyId' => config[:clc_anti_affinity_policy], 'customFields' => config[:clc_custom_fields], 'additionalDisks' => config[:clc_disks], 'ttl' => config[:clc_ttl], 'packages' => config[:clc_packages], }.delete_if { |_, value| !value.kind_of?(Integer) && (value.nil? || value.empty?) } end |