mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|compute] add support for volume shutdown behavior
This commit is contained in:
parent
9b7fc5d4e5
commit
cd7a6771e1
5 changed files with 16 additions and 9 deletions
|
@ -17,6 +17,7 @@ module Fog
|
|||
attribute :groups
|
||||
attribute :flavor_id, :aliases => 'instanceType'
|
||||
attribute :image_id, :aliases => 'imageId'
|
||||
attr_accessor :instance_initiated_shutdown_behavior
|
||||
attribute :ip_address, :aliases => 'ipAddress'
|
||||
attribute :kernel_id, :aliases => 'kernelId'
|
||||
attribute :key_name, :aliases => 'keyName'
|
||||
|
@ -138,6 +139,7 @@ module Fog
|
|||
options = {
|
||||
'BlockDeviceMapping' => block_device_mapping,
|
||||
'ClientToken' => client_token,
|
||||
'InstanceInitiatedShutdownBehavior' => instance_initiated_shutdown_behavior,
|
||||
'InstanceType' => flavor_id,
|
||||
'KernelId' => kernel_id,
|
||||
'KeyName' => key_name,
|
||||
|
@ -148,6 +150,7 @@ module Fog
|
|||
'SubnetId' => subnet_id,
|
||||
'UserData' => user_data
|
||||
}
|
||||
options.delete_if {|key, value| value.nil?}
|
||||
|
||||
# If subnet is defined we are working on a virtual private cloud.
|
||||
# subnet & security group cannot co-exist. I wish VPC just ignored
|
||||
|
|
|
@ -8,17 +8,18 @@ module Fog
|
|||
extend Fog::Deprecation
|
||||
deprecate(:status, :state)
|
||||
|
||||
identity :id, :aliases => 'volumeId'
|
||||
identity :id, :aliases => 'volumeId'
|
||||
|
||||
attribute :attached_at, :aliases => 'attachTime'
|
||||
attribute :availability_zone, :aliases => 'availabilityZone'
|
||||
attribute :created_at, :aliases => 'createTime'
|
||||
attribute :attached_at, :aliases => 'attachTime'
|
||||
attribute :availability_zone, :aliases => 'availabilityZone'
|
||||
attribute :created_at, :aliases => 'createTime'
|
||||
attribute :delete_on_termination, :aliases => 'deleteOnTermination'
|
||||
attribute :device
|
||||
attribute :server_id, :aliases => 'instanceId'
|
||||
attribute :server_id, :aliases => 'instanceId'
|
||||
attribute :size
|
||||
attribute :snapshot_id, :aliases => 'snapshotId'
|
||||
attribute :state, :aliases => 'status'
|
||||
attribute :tags, :aliases => 'tagSet'
|
||||
attribute :snapshot_id, :aliases => 'snapshotId'
|
||||
attribute :state, :aliases => 'status'
|
||||
attribute :tags, :aliases => 'tagSet'
|
||||
|
||||
def initialize(attributes = {})
|
||||
# assign server first to prevent race condition with new_record?
|
||||
|
|
|
@ -30,6 +30,8 @@ module Fog
|
|||
@in_attachment_set = false
|
||||
when 'attachTime'
|
||||
@attachment[name] = Time.parse(@value)
|
||||
when 'deleteOnTermination'
|
||||
@attachment[name] = @value == 'true'
|
||||
when 'device', 'instanceId', 'status', 'volumeId'
|
||||
@attachment[name] = @value
|
||||
when 'item'
|
||||
|
|
|
@ -22,6 +22,7 @@ module Fog
|
|||
# * 'volumeId'<~String> - Reference to volume
|
||||
# * 'attachmentSet'<~Array>:
|
||||
# * 'attachmentTime'<~Time> - Timestamp for attachment
|
||||
# * 'deleteOnTermination'<~Boolean> - Whether or not to delete volume on instance termination
|
||||
# * 'device'<~String> - How value is exposed to instance
|
||||
# * 'instanceId'<~String> - Reference to attached instance
|
||||
# * 'status'<~String> - Attachment state
|
||||
|
|
|
@ -28,7 +28,7 @@ module Fog
|
|||
# * 'Ebs.DeleteOnTermination'<~String> - specifies whether or not to delete the volume on instance termination
|
||||
# * 'ClientToken'<~String> - unique case-sensitive token for ensuring idempotency
|
||||
# * 'SecurityGroup'<~Array> or <~String> - Name of security group(s) for instances (you must omit this parameter if using Virtual Private Clouds)
|
||||
# * 'InstanceInitiatedShutdownBehaviour'<~String> - specifies whether volumes are stopped or terminated when instance is shutdown
|
||||
# * 'InstanceInitiatedShutdownBehaviour'<~String> - specifies whether volumes are stopped or terminated when instance is shutdown, in [stop, terminate]
|
||||
# * 'InstanceType'<~String> - Type of instance to boot. Valid options
|
||||
# in ['m1.small', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge', 'm2.2xlarge', 'm2.4xlarge']
|
||||
# default is 'm1.small'
|
||||
|
|
Loading…
Reference in a new issue