Class: Fog::Compute::Aliyun::Server

Inherits:
Server
  • Object
show all
Defined in:
lib/fog/aliyun/models/compute/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#personalityHash

Note:

This attribute is only used for server creation. This field will be nil on subsequent retrievals.

Returns Hash containing data to inject into the file system of the cloud server instance during server creation.

Examples:

To inject fog.txt into file system

:personality => [{ :path => '/root/fog.txt',
                   :contents => Base64.encode64('Fog was here!')
                }]

Returns:

  • (Hash)

    Hash containing data to inject into the file system of the cloud server instance during server creation.

See Also:



# File 'lib/fog/aliyun/models/compute/server.rb', line 72

Instance Method Details

#imageObject



41
42
43
44
# File 'lib/fog/aliyun/models/compute/server.rb', line 41

def image
  requires :image_id
  Fog::Compute::Aliyun::Image.new(service: service).all(imageId: image_id)[0]
end

#save(options = {}) ⇒ Object



51
52
53
54
55
56
57
58
59
# File 'lib/fog/aliyun/models/compute/server.rb', line 51

def save(options = {})
  requires :image_id, :security_group_ids, :type
  options[:VSwitchId] = vswitch_id if vswitch_id
  options[:KeyPairName] = key_pair_name if key_pair_name
  options[:UserData] = user_data if user_data
  options[:InstanceName] = name if name
  data = Fog::JSON.decode(service.create_server(image_id, security_group_ids, type, options).body)
  merge_attributes(data)
end

#vpcObject



46
47
48
49
# File 'lib/fog/aliyun/models/compute/server.rb', line 46

def vpc
  requires :vpc_id
  $vpc = Fog::Compute::Aliyun::Vpcs.new(service: service).all('vpcId' => vpc_id)[0]
end