2012-03-15 17:12:30 -07:00
|
|
|
require 'fog/core/collection'
|
|
|
|
require 'fog/aws/models/beanstalk/environment'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class ElasticBeanstalk
|
|
|
|
|
|
|
|
class Environments < Fog::Collection
|
|
|
|
model Fog::AWS::ElasticBeanstalk::Environment
|
|
|
|
|
|
|
|
def all(options={})
|
|
|
|
data = connection.describe_environments(options).body['DescribeEnvironmentsResult']['Environments']
|
|
|
|
load(data) # data is an array of attribute hashes
|
|
|
|
end
|
|
|
|
|
2012-03-16 11:56:28 -07:00
|
|
|
# Gets an environment given a name.
|
2012-03-15 17:12:30 -07:00
|
|
|
#
|
2012-03-16 11:56:28 -07:00
|
|
|
def get(environment_name)
|
|
|
|
options = { 'EnvironmentNames' => [environment_name] }
|
2012-03-15 17:12:30 -07:00
|
|
|
|
|
|
|
if data = connection.describe_environments(options).body['DescribeEnvironmentsResult']['Environments'].first
|
|
|
|
new(data)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|