Sha256: d7a7e9aa107de1b27e0c5dd2464a03aca124fb7aa669a4438d5dd5c474d47117
Contents?: true
Size: 938 Bytes
Versions: 1
Compression:
Stored size: 938 Bytes
Contents
module Fog module AWS class EC2 def servers Fog::AWS::EC2::Servers.new(:connection => self) end class Servers < Fog::Collection attribute :server_id model Fog::AWS::EC2::Server def initialize(attributes) @server_id ||= [] super end def all(server_id = @server_id) @server_id = server_id if @loaded clear end @loaded = true data = connection.describe_instances(server_id).body data['reservationSet'].each do |reservation| reservation['instancesSet'].each do |instance| self << new(instance) end end self end def get(server_id) if server_id all(server_id).first end rescue Excon::Errors::BadRequest nil end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fog-0.0.40 | lib/fog/aws/models/ec2/servers.rb |