2012-03-15 20:12:30 -04: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={})
|
2012-12-22 18:32:13 -05:00
|
|
|
data = service.describe_environments(options).body['DescribeEnvironmentsResult']['Environments']
|
2012-03-15 20:12:30 -04:00
|
|
|
load(data) # data is an array of attribute hashes
|
|
|
|
end
|
|
|
|
|
2012-03-16 14:56:28 -04:00
|
|
|
# Gets an environment given a name.
|
2012-03-15 20:12:30 -04:00
|
|
|
#
|
2012-03-16 14:56:28 -04:00
|
|
|
def get(environment_name)
|
|
|
|
options = { 'EnvironmentNames' => [environment_name] }
|
2012-03-15 20:12:30 -04:00
|
|
|
|
2012-12-22 18:32:13 -05:00
|
|
|
if data = service.describe_environments(options).body['DescribeEnvironmentsResult']['Environments'].first
|
2012-03-15 20:12:30 -04:00
|
|
|
new(data)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|