lib/rudy/aws/ec2.rb in rudy-0.2.4 vs lib/rudy/aws/ec2.rb in rudy-0.3.0
- old
+ new
@@ -12,32 +12,77 @@
# :aws_is_public=>false}
def list
@aws.describe_images_by_owner('self') || []
end
+ # +id+ AMI ID to deregister (ami-XXXXXXX)
+ # Returns true when successful. Otherwise throws an exception.
+ def deregister(id)
+ @aws.deregister_image(id)
+ end
+
+ # +path+ the S3 path to the manifest (bucket/file.manifest.xml)
+ # Returns the AMI ID when successful, otherwise throws an exception.
+ def register(path)
+ @aws.register_image(path)
+ end
end
+ class Snapshots
+ include Rudy::AWS::ObjectBase
+
+ def list
+ @aws.describe_snapshots || []
+ end
+
+ def create(vol_id)
+ @aws.create_snapshot(vol_id)
+ end
+
+ def destroy(snap_id)
+ @aws.delete_snapshot(snap_id)
+ end
+
+ def exists?(id)
+ list.each do |v|
+ return true if v[:aws_id] === id
+ end
+ false
+ end
+
+ end
+
class Volumes
include Rudy::AWS::ObjectBase
+
def list
list = @aws.describe_volumes() || []
list.select { |v| v[:aws_status] != "deleting" }
end
def attach(inst_id, vol_id, device)
@aws.attach_volume(vol_id, inst_id, device)
end
+ def detach(vol_id)
+ @aws.detach_volume(vol_id)
+ end
+
def create(zone, size, snapshot=nil)
@aws.create_volume(snapshot, size, zone)
end
+ def destroy(vol_id)
+ @aws.delete_volume(vol_id)
+ end
+
def exists?(id)
list.each do |v|
return true if v[:aws_id] === id
end
false
end
+
end
class Instances
include Rudy::AWS::ObjectBase
\ No newline at end of file