Merge branch 'gscottrw'

This commit is contained in:
geemus 2012-03-19 17:29:19 -05:00
commit 70e0f48fa4
75 changed files with 2963 additions and 0 deletions

View File

@ -6,6 +6,7 @@ module Fog
extend Fog::Provider
service(:auto_scaling, 'aws/auto_scaling', 'AutoScaling')
service(:beanstalk, 'aws/beanstalk', 'ElasticBeanstalk')
service(:cdn, 'aws/cdn', 'CDN')
service(:compute, 'aws/compute', 'Compute')
service(:cloud_formation, 'aws/cloud_formation', 'CloudFormation')

140
lib/fog/aws/beanstalk.rb Normal file
View File

@ -0,0 +1,140 @@
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'aws'))
module Fog
module AWS
class ElasticBeanstalk < Fog::Service
class InvalidParameterError < Fog::Errors::Error; end
requires :aws_access_key_id, :aws_secret_access_key
request_path 'fog/aws/requests/beanstalk'
request :check_dns_availability
request :create_application
request :create_application_version
request :create_configuration_template
request :create_environment
request :create_storage_location
request :delete_application
request :delete_application_version
request :delete_configuration_template
request :delete_environment_configuration
request :describe_applications
request :describe_application_versions
request :describe_configuration_options
request :describe_configuration_settings
request :describe_environment_resources
request :describe_environments
request :describe_events
request :list_available_solution_stacks
request :rebuild_environment
request :request_environment_info
request :restart_app_server
request :retrieve_environment_info
request :swap_environment_cnames
request :terminate_environment
request :update_application
request :update_application_version
request :update_configuration_template
request :update_environment
request :validate_configuration_settings
model_path 'fog/aws/models/beanstalk'
model :application
collection :applications
model :environment
collection :environments
model :event
collection :events
model :template
collection :templates
model :version
collection :versions
class Mock
def initialize(options={})
Fog::Mock.not_implemented
end
end
class Real
def initialize(options={})
require 'fog/core/parser'
require 'multi_json'
@aws_access_key_id = options[:aws_access_key_id]
@aws_secret_access_key = options[:aws_secret_access_key]
@hmac = Fog::HMAC.new('sha256', @aws_secret_access_key)
@connection_options = options[:connection_options] || {}
options[:region] ||= 'us-east-1'
@host = options[:host] || "elasticbeanstalk.#{options[:region]}.amazonaws.com"
@path = options[:path] || '/'
@persistent = options[:persistent] || false
@port = options[:port] || 443
@scheme = options[:scheme] || 'https'
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
end
def reload
@connection.reset
end
# Returns an array of available solutions stack details
def solution_stacks
list_available_solution_stacks.body['ListAvailableSolutionStacksResult']['SolutionStackDetails']
end
private
def request(params)
idempotent = params.delete(:idempotent)
parser = params.delete(:parser)
body = AWS.signed_params(
params,
{
:aws_access_key_id => @aws_access_key_id,
:hmac => @hmac,
:host => @host,
:path => @path,
:port => @port,
:version => '2010-12-01'
}
)
begin
response = @connection.request({
:body => body,
:expects => 200,
:headers => { 'Content-Type' => 'application/x-www-form-urlencoded' },
:idempotent => idempotent,
:host => @host,
:method => 'POST',
:parser => parser
})
rescue Excon::Errors::HTTPStatusError => error
if match = error.response.body.match(/<Code>(.*)<\/Code>[ \t\n]*<Message>(.*)<\/Message>/)
raise case match[1].split('.').last
when 'InvalidParameterValue'
Fog::AWS::ElasticBeanstalk::InvalidParameterError.slurp(error, match[2])
else
Fog::AWS::ElasticBeanstalk::Error.slurp(error, "#{match[1]} => #{match[2]}")
end
else
raise error
end
end
end
end
end
end
end

View File

@ -0,0 +1,62 @@
require 'fog/core/model'
module Fog
module AWS
class ElasticBeanstalk
class Application < Fog::Model
identity :name, :aliases => 'ApplicationName'
attribute :template_names, :aliases => 'ConfigurationTemplates'
attribute :created_at, :aliases => 'DateCreated'
attribute :updated_at, :aliases => 'DateUpdated'
attribute :description, :aliases => 'Description'
attribute :version_names, :aliases => 'Versions'
def initialize(attributes={})
super
end
def environments
requires :name
connection.environments.all({'ApplicationName' => name})
end
def events
requires :name
connection.events.all({'ApplicationName' => name})
end
def templates
requires :name
connection.templates.all({'ApplicationName' => name})
end
def versions
requires :name
connection.versions.all({'ApplicationName' => name})
end
def destroy
requires :name
connection.delete_application(name)
true
end
def save
requires :name
options = {
'ApplicationName' => name
}
options['Description'] = description unless description.nil?
data = connection.create_application(options).body['CreateApplicationResult']['Application']
merge_attributes(data)
true
end
end
end
end
end

View File

@ -0,0 +1,25 @@
require 'fog/core/collection'
require 'fog/aws/models/beanstalk/application'
module Fog
module AWS
class ElasticBeanstalk
class Applications < Fog::Collection
model Fog::AWS::ElasticBeanstalk::Application
def all(application_names=[])
data = connection.describe_applications(application_names).body['DescribeApplicationsResult']['Applications']
load(data) # data is an array of attribute hashes
end
def get(application_name)
if data = connection.describe_applications([application_name]).body['DescribeApplicationsResult']['Applications'].first
new(data)
end
end
end
end
end
end

View File

@ -0,0 +1,129 @@
require 'fog/core/model'
module Fog
module AWS
class ElasticBeanstalk
class Environment < Fog::Model
identity :name, :aliases => 'EnvironmentName'
attribute :id, :aliases => 'EnvironmentId'
attribute :application_name, :aliases => 'ApplicationName'
attribute :cname, :aliases => 'CNAME'
attribute :cname_prefix, :aliases => 'CNAMEPrefix'
attribute :created_at, :aliases => 'DateCreated'
attribute :updated_at, :aliases => 'DateUpdated'
attribute :updated_at, :aliases => 'DateUpdated'
attribute :description, :aliases => 'Description'
attribute :endpoint_url, :aliases => 'EndpointURL'
attribute :health, :aliases => 'Health'
attribute :resources, :aliases => 'Resources'
attribute :solution_stack_name, :aliases => 'SolutionStackName'
attribute :status, :aliases => 'Status'
attribute :template_name, :aliases => 'TemplateName'
attribute :version_label, :aliases => 'VersionLabel'
attribute :option_settings, :aliases => 'OptionSettings'
attribute :options_to_remove, :aliases => 'OptionsToRemove'
def healthy?
health == 'Green'
end
def ready?
status == 'Ready'
end
def terminated?
status == 'Terminated'
end
# Returns the current live resources for this environment
def live_resources
requires :id
data = connection.describe_environment_resources({'EnvironmentId' => id}).body['DescribeEnvironmentResourcesResult']['EnvironmentResources']
data.delete('EnvironmentName') # Delete the environment name from the result, only return actual resources
data
end
# Return events related to this version
def events
requires :id
connection.events.all({'EnvironmentId' => id})
end
# Restarts the app servers in this environment
def restart_app_server
requires :id
connection.restart_app_server({'EnvironmentId' => id})
reload
end
# Rebuilds the environment
def rebuild
requires :id
connection.rebuild_environment({'EnvironmentId' => id})
reload
end
# Return the version object for this environment
def version
requires :application_name, :version_label
connection.versions.get(application_name, version_label)
end
# Update the running version of this environment
def version=(new_version)
requires :id
if new_version.is_a?(String)
new_version_label = new_version
elsif new_version.is_a?(Fog::AWS::ElasticBeanstalk::Version)
new_version_label = new_version.label
else
raise "Unknown type for new_version, must be either String or Fog::AWS::ElasticBeanstalk::Version"
end
if new_version.nil?
raise "Version label not specified."
end
data = connection.update_environment({
'EnvironmentId' => id,
'VersionLabel' => new_version_label
}).body['UpdateEnvironmentResult']
merge_attributes(data)
end
def destroy
requires :id
connection.terminate_environment({'EnvironmentId' => id})
true
end
def save
requires :name, :application_name
requires_one :template_name, :solution_stack_name
options = {
'ApplicationName' => application_name,
'CNAMEPrefix' => cname_prefix,
'Description' => description,
'EnvironmentName' => name,
'OptionSettings' => option_settings,
'OptionsToRemove' => options_to_remove,
'SolutionStackName' => solution_stack_name,
'TemplateName' => template_name,
'VersionLabel' => version_label
}
options.delete_if {|key, value| value.nil?}
data = connection.create_environment(options).body['CreateEnvironmentResult']
merge_attributes(data)
true
end
end
end
end
end

View File

@ -0,0 +1,29 @@
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
# Gets an environment given a name.
#
def get(environment_name)
options = { 'EnvironmentNames' => [environment_name] }
if data = connection.describe_environments(options).body['DescribeEnvironmentsResult']['Environments'].first
new(data)
end
end
end
end
end
end

View File

@ -0,0 +1,20 @@
require 'fog/core/model'
module Fog
module AWS
class ElasticBeanstalk
class Event < Fog::Model
attribute :application_name, :aliases => 'ApplicationName'
attribute :environment_name, :aliases => 'EnvironmentName'
attribute :date, :aliases => 'EventDate'
attribute :message, :aliases => 'Message'
attribute :request_id, :aliases => 'RequestId'
attribute :severity, :aliases => 'Severity'
attribute :template_name, :aliases => 'TemplateName'
attribute :version_label, :aliases => 'VersionLabel'
end
end
end
end

View File

@ -0,0 +1,19 @@
require 'fog/core/collection'
require 'fog/aws/models/beanstalk/event'
module Fog
module AWS
class ElasticBeanstalk
class Events < Fog::Collection
model Fog::AWS::ElasticBeanstalk::Event
def all(options={})
data = connection.describe_events(options).body['DescribeEventsResult']['Events']
load(data) # data is an array of attribute hashes
end
end
end
end
end

View File

@ -0,0 +1,62 @@
require 'fog/core/model'
module Fog
module AWS
class ElasticBeanstalk
class Template < Fog::Model
attribute :name, :aliases => 'TemplateName'
attribute :application_name, :aliases => 'ApplicationName'
attribute :created_at, :aliases => 'DateCreated'
attribute :updated_at, :aliases => 'DateUpdated'
attribute :deployment_status, :aliases => 'DeploymentStatus'
attribute :description, :aliases => 'Description'
attribute :environment_id
attribute :environment_name, :aliases => 'EnvironmentName'
attribute :solution_stack_name, :aliases => 'SolutionStackName'
attribute :source_configuration
attribute :option_settings, :aliases => 'OptionSettings'
def initialize(attributes={})
super
end
# Returns an array of options that may be set on this template
def options
requires :name, :application_name
data = connection.describe_configuration_options({
'ApplicationName' => application_name,
'TemplateName' => name
})
data.body['DescribeConfigurationOptionsResult']['Options']
end
def destroy
requires :name, :application_name
connection.delete_configuration_template(application_name, name)
true
end
def save
requires :name, :application_name
options = {
'ApplicationName' => application_name,
'Description' => description,
'EnvironmentId' => environment_id,
'OptionSettings' => option_settings,
'SolutionStackName' => solution_stack_name,
'SourceConfiguration' => source_configuration,
'TemplateName' => name
}
options.delete_if {|key, value| value.nil?}
data = connection.create_configuration_template(options).body['CreateConfigurationTemplateResult']
merge_attributes(data)
true
end
end
end
end
end

View File

@ -0,0 +1,70 @@
require 'fog/core/collection'
require 'fog/aws/models/beanstalk/template'
module Fog
module AWS
class ElasticBeanstalk
class Templates < Fog::Collection
model Fog::AWS::ElasticBeanstalk::Template
# Describes all configuration templates, may optionally pass an ApplicationName filter
#
# Note: This is currently an expensive operation requiring multiple API calls due to a lack of
# a describe configuration templates call in the AWS API.
def all(options={})
application_filter = []
if options.has_key?('ApplicationName')
application_filter << options['ApplicationName']
end
# Initialize with empty array
data = []
applications = connection.describe_applications(application_filter).body['DescribeApplicationsResult']['Applications']
applications.each { |application|
application['ConfigurationTemplates'].each { |template_name|
begin
options = {
'ApplicationName' => application['ApplicationName'],
'TemplateName' => template_name
}
settings = connection.describe_configuration_settings(options).body['DescribeConfigurationSettingsResult']['ConfigurationSettings']
if settings.length == 1
# Add to data
data << settings.first
end
rescue Fog::AWS::ElasticBeanstalk::InvalidParameterError
# Ignore
end
}
}
load(data) # data is an array of attribute hashes
end
def get(application_name, template_name)
options = {
'ApplicationName' => application_name,
'TemplateName' => template_name
}
result = nil
# There is no describe call for templates, so we must use describe_configuration_settings. Unfortunately,
# it throws an exception if template name doesn't exist, which is inconsistent, catch and return nil
begin
data = connection.describe_configuration_settings(options).body['DescribeConfigurationSettingsResult']['ConfigurationSettings']
if data.length == 1
result = new(data.first)
end
rescue Fog::AWS::ElasticBeanstalk::InvalidParameterError
end
result
end
end
end
end
end

View File

@ -0,0 +1,79 @@
require 'fog/core/model'
module Fog
module AWS
class ElasticBeanstalk
class Version < Fog::Model
attribute :label, :aliases => 'VersionLabel'
attribute :application_name, :aliases => 'ApplicationName'
attribute :created_at, :aliases => 'DateCreated'
attribute :updated_at, :aliases => 'DateUpdated'
attribute :description, :aliases => 'Description'
attribute :source_bundle, :aliases => 'SourceBundle'
attribute :auto_create_application # FIXME - should be write only
def initialize(attributes={})
super
end
# Return events related to this version
def events
requires :label, :application_name
connection.events.all({
'ApplicationName' => application_name,
'VersionLabel' => label
})
end
# Returns environments running this version
def environments
requires :label, :application_name
connection.environments.all({
'ApplicationName' => application_name,
'VersionLabel' => label
})
end
def destroy(delete_source_bundle = nil)
requires :label, :application_name
connection.delete_application_version(application_name, label, delete_source_bundle)
true
end
def save
requires :label, :application_name
options = {
'ApplicationName' => application_name,
'AutoCreateApplication' => auto_create_application,
'Description' => description,
'SourceBundle' => source_bundle,
'VersionLabel' => label
}
options.delete_if {|key, value| value.nil?}
data = connection.create_application_version(options).body['CreateApplicationVersionResult']['ApplicationVersion']
merge_attributes(data)
true
end
# Updates the version label with the current property values. Currently only updates description
def update
requires :label, :application_name
options = {
'ApplicationName' => application_name,
'Description' => description,
'VersionLabel' => label
}
options.delete_if {|key, value| value.nil?}
data = connection.update_application_version(options).body['UpdateApplicationVersionResult']['ApplicationVersion']
merge_attributes(data)
end
end
end
end
end

View File

@ -0,0 +1,31 @@
require 'fog/core/collection'
require 'fog/aws/models/beanstalk/version'
module Fog
module AWS
class ElasticBeanstalk
class Versions < Fog::Collection
model Fog::AWS::ElasticBeanstalk::Version
def all(options={})
data = connection.describe_application_versions(options).body['DescribeApplicationVersionsResult']['ApplicationVersions']
load(data) # data is an array of attribute hashes
end
def get(application_name, version_label)
if data = connection.describe_application_versions({
'ApplicationName' => application_name,
'VersionLabels' => [version_label]
}).body['DescribeApplicationVersionsResult']['ApplicationVersions']
if data.length == 1
new(data.first)
end
end
end
end
end
end
end

View File

@ -0,0 +1,19 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class CheckDNSAvailability < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("CheckDNSAvailabilityResult")
tag 'FullyQualifiedCNAME', :string
tag 'Available', :boolean
end
end
end
end
end
end

View File

@ -0,0 +1,24 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class CreateApplication < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("CreateApplicationResult")
tag 'Application', :object
tag 'Versions', :string, :list
tag 'ConfigurationTemplates', :string, :list
tag 'ApplicationName', :string
tag 'Description', :string
tag 'DateCreated', :datetime
tag 'DateUpdated', :datetime
end
end
end
end
end
end

View File

@ -0,0 +1,26 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class CreateApplicationVersion < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("CreateApplicationVersionResult")
tag 'ApplicationVersion', :object
tag 'ApplicationName', :string
tag 'DateCreated', :datetime
tag 'DateUpdated', :datetime
tag 'Description', :string
tag 'SourceBundle', :object
tag 'S3Bucket', :string
tag 'S3Key', :string
tag 'VersionLabel', :string
end
end
end
end
end
end

View File

@ -0,0 +1,29 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class CreateConfigurationTemplate < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("CreateConfigurationTemplateResult")
tag 'ApplicationName', :string
tag 'DateCreated', :datetime
tag 'DateUpdated', :datetime
tag 'DeploymentStatus', :string
tag 'Description', :string
tag 'EnvironmentName', :string
tag 'OptionSettings', :object, :list
tag 'Namespace', :string
tag 'OptionName', :string
tag 'Value', :string
tag 'SolutionStackName', :string
tag 'TemplateName', :string
end
end
end
end
end
end

View File

@ -0,0 +1,37 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class CreateEnvironment < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("CreateEnvironmentResult")
tag 'ApplicationName', :string
tag 'CNAME', :string
tag 'DateCreated', :datetime
tag 'DateUpdated', :datetime
tag 'Description', :string
tag 'EndpointURL', :string
tag 'EnvironmentId', :string
tag 'EnvironmentName', :string
tag 'Health', :string
tag 'Resources', :object
tag 'LoadBalancer', :object
tag 'Domain', :string
tag 'LoadBalancerName', :string
tag 'Listeners', :object, :list
tag 'Port', :integer
tag 'Protocol', :string
tag 'SolutionStackName', :string
tag 'Status', :string
tag 'TemplateName', :string
tag 'VersionLabel', :string
end
end
end
end
end
end

View File

@ -0,0 +1,18 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class CreateStorageLocation < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("CreateStorageLocationResult")
tag 'S3Bucket', :string
end
end
end
end
end
end

View File

@ -0,0 +1,26 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class DescribeApplicationVersions < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("DescribeApplicationVersionsResult")
tag 'ApplicationVersions', :object, :list
tag 'ApplicationName', :string
tag 'DateCreated', :datetime
tag 'DateUpdated', :datetime
tag 'Description', :string
tag 'SourceBundle', :object
tag 'S3Bucket', :string
tag 'S3Key', :string
tag 'VersionLabel', :string
end
end
end
end
end
end

View File

@ -0,0 +1,24 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class DescribeApplications < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("DescribeApplicationsResult")
tag 'Applications', :object, :list
tag 'Versions', :string, :list
tag 'ConfigurationTemplates', :string, :list
tag 'ApplicationName', :string
tag 'Description', :string
tag 'DateCreated', :datetime
tag 'DateUpdated', :datetime
end
end
end
end
end
end

View File

@ -0,0 +1,32 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class DescribeConfigurationOptions < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("DescribeConfigurationOptionsResult")
tag 'SolutionStackName', :string
tag 'Options', :object, :list
tag 'ChangeSeverity', :string
tag 'DefaultValue', :string
tag 'MaxLength', :integer
tag 'MaxValue', :integer
tag 'MinValue', :integer
tag 'Name', :string
tag 'Namespace', :string
tag 'Regex', :object
tag 'Label', :string
tag 'Pattern', :string
tag 'UserDefined', :boolean
tag 'ValueOptions', :string, :list
tag 'ValueType', :string
end
end
end
end
end
end

View File

@ -0,0 +1,30 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class DescribeConfigurationSettings < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("DescribeConfigurationSettingsResult")
tag 'ConfigurationSettings', :object, :list
tag 'ApplicationName', :string
tag 'DateCreated', :datetime
tag 'DateUpdated', :datetime
tag 'DeploymentStatus', :string
tag 'Description', :string
tag 'EnvironmentName', :string
tag 'OptionSettings', :object, :list
tag 'Namespace', :string
tag 'OptionName', :string
tag 'Value', :string
tag 'SolutionStackName', :string
tag 'TemplateName', :string
end
end
end
end
end
end

View File

@ -0,0 +1,26 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class DescribeEnvironmentResources < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("DescribeEnvironmentResourcesResult")
tag 'EnvironmentResources', :object
tag 'AutoScalingGroups', :object, :list
tag 'Name', :string
tag 'EnvironmentName', :string
tag 'Instances', :object, :list
tag 'Id', :string
tag 'LaunchConfigurations', :object, :list
tag 'LoadBalancers', :object, :list
tag 'Triggers', :object, :list
end
end
end
end
end
end

View File

@ -0,0 +1,38 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class DescribeEnvironments < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("DescribeEnvironmentsResult")
tag 'Environments', :object, :list
tag 'ApplicationName', :string
tag 'CNAME', :string
tag 'DateCreated', :datetime
tag 'DateUpdated', :datetime
tag 'Description', :string
tag 'EndpointURL', :string
tag 'EnvironmentId', :string
tag 'EnvironmentName', :string
tag 'Health', :string
tag 'Resources', :object
tag 'LoadBalancer', :object
tag 'Domain', :string
tag 'LoadBalancerName', :string
tag 'Listeners', :object, :list
tag 'Port', :integer
tag 'Protocol', :string
tag 'SolutionStackName', :string
tag 'Status', :string
tag 'TemplateName', :string
tag 'VersionLabel', :string
end
end
end
end
end
end

View File

@ -0,0 +1,27 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class DescribeEvents < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("DescribeEventsResult")
tag 'Events', :object, :list
tag 'ApplicationName', :string
tag 'EnvironmentName', :string
tag 'EventDate', :datetime
tag 'Message', :string
tag 'RequestId', :string
tag 'Severity', :string
tag 'TemplateName', :string
tag 'VersionLabel', :string
tag 'NextToken', :string
end
end
end
end
end
end

View File

@ -0,0 +1,27 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
class Empty < Fog::Parsers::Base
def reset
@response = { 'ResponseMetadata' => {} }
end
def end_element(name)
case name
when 'RequestId'
@response['ResponseMetadata'][name] = value
end
end
end
end
end
end
end

View File

@ -0,0 +1,21 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class ListAvailableSolutionStacks < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("ListAvailableSolutionStacksResult")
tag 'SolutionStackDetails', :object, :list
tag 'PermittedFileTypes', :string, :list
tag 'SolutionStackName', :string
tag 'SolutionStacks', :string, :list
end
end
end
end
end
end

View File

@ -0,0 +1,93 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
class BaseParser < Fog::Parsers::Base
def initialize(result_name)
@result_name = result_name # Set before super, since super calls reset
super()
@tags = {}
@list_tags = {}
end
def reset
@response = { @result_name => {}, 'ResponseMetadata' => {} }
# Push root object to top of stack
@parse_stack = [ { :type => :object, :value => @response[@result_name]} ]
end
def tag name, *traits
if traits.delete(:list)
@list_tags[name] = true
end
if traits.length == 1
@tags[name] = traits.last
else
raise "Too many traits specified, only specify :list or a type"
end
end
def start_element(name, attrs = [])
super
if name == 'member'
if @parse_stack.last[:type] == :object
@parse_stack.last[:value] << {} # Push any empty object
end
elsif @list_tags.has_key?(name)
set_value(name, [], :array) # Set an empty array
@parse_stack.push({ :type => @tags[name], :value => get_parent[name] })
elsif @tags[name] == :object
set_value(name, {}, :object)
@parse_stack.push({ :type => @tags[name], :value => get_parent[name] })
end
end
def end_element(name)
case name
when 'member'
if @parse_stack.last[:type] != :object
@parse_stack.last[:value] << value
end
when 'RequestId'
@response['ResponseMetadata'][name] = value
else
if @list_tags.has_key?(name) || @tags[name] == :object
@parse_stack.pop()
elsif @tags.has_key?(name)
set_value(name, value, @tags[name])
end
end
end
def get_parent
parent = @parse_stack.last[:value]
parent.is_a?(Array) ? parent.last : parent
end
def set_value(name, value, type)
case type
when :datetime
get_parent[name] = Time.parse value
when :boolean
get_parent[name] = value == "true" # True only if value is true
when :integer
get_parent[name] = value.to_i
else
get_parent[name] = value
end
end
end
end
end
end
end

View File

@ -0,0 +1,22 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class RetrieveEnvironmentInfo < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("RetrieveEnvironmentInfoResult")
tag 'EnvironmentInfo', :object, :list
tag 'Ec2InstanceId', :string
tag 'InfoType', :string
tag 'Message', :string
tag 'SampleTimestamp', :datetime
end
end
end
end
end
end

View File

@ -0,0 +1,37 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class TerminateEnvironment < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("TerminateEnvironmentResult")
tag 'ApplicationName', :string
tag 'CNAME', :string
tag 'DateCreated', :datetime
tag 'DateUpdated', :datetime
tag 'Description', :string
tag 'EndpointURL', :string
tag 'EnvironmentId', :string
tag 'EnvironmentName', :string
tag 'Health', :string
tag 'Resources', :object
tag 'LoadBalancer', :object
tag 'Domain', :string
tag 'LoadBalancerName', :string
tag 'Listeners', :object, :list
tag 'Port', :integer
tag 'Protocol', :string
tag 'SolutionStackName', :string
tag 'Status', :string
tag 'TemplateName', :string
tag 'VersionLabel', :string
end
end
end
end
end
end

View File

@ -0,0 +1,24 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class UpdateApplication < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("UpdateApplicationResult")
tag 'Application', :object
tag 'Versions', :string, :list
tag 'ConfigurationTemplates', :string, :list
tag 'ApplicationName', :string
tag 'Description', :string
tag 'DateCreated', :datetime
tag 'DateUpdated', :datetime
end
end
end
end
end
end

View File

@ -0,0 +1,26 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class UpdateApplicationVersion < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("UpdateApplicationVersionResult")
tag 'ApplicationVersion', :object
tag 'ApplicationName', :string
tag 'DateCreated', :datetime
tag 'DateUpdated', :datetime
tag 'Description', :string
tag 'SourceBundle', :object
tag 'S3Bucket', :string
tag 'S3Key', :string
tag 'VersionLabel', :string
end
end
end
end
end
end

View File

@ -0,0 +1,29 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class UpdateConfigurationTemplate < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("UpdateConfigurationTemplateResult")
tag 'ApplicationName', :string
tag 'DateCreated', :datetime
tag 'DateUpdated', :datetime
tag 'DeploymentStatus', :string
tag 'Description', :string
tag 'EnvironmentName', :string
tag 'OptionSettings', :object, :list
tag 'Namespace', :string
tag 'OptionName', :string
tag 'Value', :string
tag 'SolutionStackName', :string
tag 'TemplateName', :string
end
end
end
end
end
end

View File

@ -0,0 +1,37 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class UpdateEnvironment < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("UpdateEnvironmentResult")
tag 'ApplicationName', :string
tag 'CNAME', :string
tag 'DateCreated', :datetime
tag 'DateUpdated', :datetime
tag 'Description', :string
tag 'EndpointURL', :string
tag 'EnvironmentId', :string
tag 'EnvironmentName', :string
tag 'Health', :string
tag 'Resources', :object
tag 'LoadBalancer', :object
tag 'Domain', :string
tag 'LoadBalancerName', :string
tag 'Listeners', :object, :list
tag 'Port', :integer
tag 'Protocol', :string
tag 'SolutionStackName', :string
tag 'Status', :string
tag 'TemplateName', :string
tag 'VersionLabel', :string
end
end
end
end
end
end

View File

@ -0,0 +1,22 @@
module Fog
module Parsers
module AWS
module ElasticBeanstalk
require 'fog/aws/parsers/beanstalk/parser'
class ValidateConfigurationSettings < Fog::Parsers::AWS::ElasticBeanstalk::BaseParser
def initialize
super("ValidateConfigurationSettingsResult")
tag 'Messages', :object, :list
tag 'Message', :string
tag 'Namespace', :string
tag 'OptionName', :string
tag 'Severity', :string
end
end
end
end
end
end

View File

@ -0,0 +1,27 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/check_dns_availability'
# Checks if the specified CNAME is available.
#
# ==== Options
# * CNAMEPrefix<~String>: The prefix used when this CNAME is reserved
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_CheckDNSAvailability.html
#
def check_dns_availability(options)
request({
'Operation' => 'CheckDNSAvailability',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::CheckDNSAvailability.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,29 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/create_application'
# Creates an application that has one configuration template named default and no application versions.
#
# ==== Options
# * ApplicationName<~String>: The name of the application.
# * Description<~String>: Describes the application.
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_CreateApplication.html
#
def create_application(options={})
request({
'Operation' => 'CreateApplication',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::CreateApplication.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,41 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/create_application_version'
# Creates an application version for the specified application.
#
# ==== Options
# * ApplicationName<~String>: The name of the application. If no application is found with this name,
# and AutoCreateApplication is false, returns an InvalidParameterValue error.
# * AutoCreateApplication<~Boolean>: If true, create the application if it doesn't exist.
# * Description<~String>: Describes this version.
# * SourceBundle<~Hash>: The Amazon S3 bucket and key that identify the location of the source bundle
# for this version. Use keys 'S3Bucket' and 'S3Key' to describe location.
# * VersionLabel<~String>: A label identifying this version.
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_CreateApplicationVersion.html
#
def create_application_version(options={})
if source_bundle = options.delete('SourceBundle')
# flatten hash
options.merge!({
'SourceBundle.S3Bucket' => source_bundle['S3Bucket'],
'SourceBundle.S3Key' => source_bundle['S3Key']
})
end
request({
'Operation' => 'CreateApplicationVersion',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::CreateApplicationVersion.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,44 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/create_configuration_template'
# Creates a configuration template. Templates are associated with a specific application and are used to
# deploy different versions of the application with the same configuration settings.
#
# ==== Options
# * ApplicationName<~String>: The name of the application to associate with this configuration template.
# If no application is found with this name, AWS Elastic Beanstalk returns an InvalidParameterValue error.
# * Description<~String>: Describes this configuration.
# * EnvironmentId<~String>: The ID of the environment used with this configuration template.
# * OptionSettings<~Hash>: If specified, AWS Elastic Beanstalk sets the specified configuration option
# to the requested value. The new value overrides the value obtained from the solution stack or the
# source configuration template.
# * SolutionStackName<~String>: The name of the solution stack used by this configuration. The solution
# stack specifies the operating system, architecture, and application server for a configuration template.
# It determines the set of configuration options as well as the possible and default values.
# * SourceConfiguration<~String>: If specified, AWS Elastic Beanstalk uses the configuration values from the
# specified configuration template to create a new configuration.
# * TemplateName<~String>: The name of the configuration template.
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_CreateConfigurationTemplate.html
#
def create_configuration_template(options={})
if option_settings = options.delete('OptionSettings')
options.merge!(AWS.indexed_param('OptionSettings.member.%d', [*option_settings]))
end
request({
'Operation' => 'CreateConfigurationTemplate',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::CreateConfigurationTemplate.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,50 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/create_environment'
# Launches an environment for the specified application using the specified configuration.
#
# ==== Options
# * ApplicationName<~String>: If specified, AWS Elastic Beanstalk restricts the returned descriptions
# to include only those that are associated with this application.
# * CNAMEPrefix<~String>: If specified, the environment attempts to use this value as the prefix for the CNAME.
# If not specified, the environment uses the environment name.
# * Description<~String>: Describes this environment.
# * EnvironmentName<~String>: A unique name for the deployment environment. Used in the application URL.
# * OptionSettings<~Array>: If specified, AWS Elastic Beanstalk sets the specified configuration options to
# the requested value in the configuration set for the new environment. These override the values obtained
# from the solution stack or the configuration template.
# * OptionsToRemove<~Array>: A list of custom user-defined configuration options to remove from the
# configuration set for this new environment.
# * SolutionStackName<~String>: This is an alternative to specifying a configuration name. If specified,
# AWS Elastic Beanstalk sets the configuration values to the default values associated with the
# specified solution stack.
# * TemplateName<~String>: The name of the configuration template to use in deployment. If no configuration
# template is found with this name, AWS Elastic Beanstalk returns an InvalidParameterValue error.
# * VersionLabel<~String>: The name of the application version to deploy.
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_CreateEnvironment.html
#
def create_environment(options={})
if option_settings = options.delete('OptionSettings')
options.merge!(AWS.indexed_param('OptionSettings.member.%d', [*option_settings]))
end
if options_to_remove = options.delete('OptionsToRemove')
options.merge!(AWS.indexed_param('OptionsToRemove.member.%d', [*options_to_remove]))
end
request({
'Operation' => 'CreateEnvironment',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::CreateEnvironment.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,27 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/create_storage_location'
# Creates the Amazon S3 storage location for the account.
#
# ==== Options
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_CreateStorageLocation.html
#
def create_storage_location()
request({
'Operation' => 'CreateStorageLocation',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::CreateStorageLocation.new
})
end
end
end
end
end

View File

@ -0,0 +1,29 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/empty'
# Deletes the specified application along with all associated versions and configurations.
#
# ==== Options
# * application_name<~String>: The name of the application to delete.
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_DeleteApplication.html
#
def delete_application(application_name)
options = { 'ApplicationName' => application_name }
request({
'Operation' => 'DeleteApplication',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::Empty.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,36 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/empty'
# Deletes the specified version from the specified application.
#
# ==== Options
# * application_name<~String>: The name of the application to delete releases from.
# * version_label<~String>: The label of the version to delete.
# * delete_source_bundle<~Boolean>: Indicates whether to delete the associated source bundle from Amazon S3.
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_DeleteApplication.html
#
def delete_application_version(application_name, version_label, delete_source_bundle = nil)
options = {
'ApplicationName' => application_name,
'VersionLabel' => version_label
}
options['DeleteSourceBundle'] = delete_source_bundle unless delete_source_bundle.nil?
request({
'Operation' => 'DeleteApplicationVersion',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::Empty.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,34 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/empty'
# Deletes the specified configuration template.
#
# ==== Options
# * application_name<~String>: The name of the application to delete the configuration template from.
# * template_name<~String>: The name of the configuration template to delete.
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_DeleteConfigurationTemplate.html
#
def delete_configuration_template(application_name, template_name)
options = {
'ApplicationName' => application_name,
'TemplateName' => template_name
}
request({
'Operation' => 'DeleteConfigurationTemplate',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::Empty.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,34 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/empty'
# Deletes the draft configuration associated with the running environment.
#
# ==== Options
# * application_name<~String>: The name of the application the environment is associated with.
# * environment_name<~String>: The name of the environment to delete the draft configuration from.
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_DeleteConfigurationTemplate.html
#
def delete_environment_configuration(application_name, environment_name)
options = {
'ApplicationName' => application_name,
'EnvironmentName' => environment_name
}
request({
'Operation' => 'DeleteEnvironmentConfiguration',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::Empty.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,34 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/describe_application_versions'
# Returns descriptions for existing application versions.
#
# ==== Options
# * ApplicationName<~String>: If specified, AWS Elastic Beanstalk restricts the returned descriptions to
# only include ones that are associated with the specified application.
# * VersionLabels<~Array>: If specified, restricts the returned descriptions to only include ones that have
# the specified version labels.
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_DescribeApplicationVersions.html
#
def describe_application_versions(options={})
if version_labels = options.delete('VersionLabels')
options.merge!(AWS.indexed_param('VersionLabels.member.%d', [*version_labels]))
end
request({
'Operation' => 'DescribeApplicationVersions',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::DescribeApplicationVersions.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,30 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/describe_applications'
# Returns the descriptions of existing applications.
#
# ==== Options
# * application_names<~Array>: If specified, AWS Elastic Beanstalk restricts the returned descriptions
# to only include those with the specified names.
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_DescribeApplications.html
#
def describe_applications(application_names=[])
options = {}
options.merge!(AWS.indexed_param('ApplicationNames.member.%d', [*application_names]))
request({
'Operation' => 'DescribeApplications',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::DescribeApplications.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,40 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/describe_configuration_options'
# Describes the configuration options that are used in a particular configuration template or environment,
# or that a specified solution stack defines. The description includes the values the options,
# their default values, and an indication of the required action on a running environment
# if an option value is changed.
#
# ==== Options
# * ApplicationName<~String>: The name of the application associated with the configuration template or
# environment. Only needed if you want to describe the configuration options associated with either the
# configuration template or environment.
# * EnvironmentName<~String>: The name of the environment whose configuration options you want to describe.
# * Options<~Array>: If specified, restricts the descriptions to only the specified options.
# * SolutionStackName<~String>: The name of the solution stack whose configuration options you want to describe.
# * TemplateName<~String>: The name of the configuration template whose configuration options you want to describe.
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_DescribeConfigurationOptions.html
#
def describe_configuration_options(options={})
if option_filters = options.delete('Options')
options.merge!(AWS.indexed_param('Options.member.%d', [*option_filters]))
end
request({
'Operation' => 'DescribeConfigurationOptions',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::DescribeConfigurationOptions.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,31 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/describe_configuration_settings'
# Returns a description of the settings for the specified configuration set, that is, either a configuration
# template or the configuration set associated with a running environment.
#
# ==== Options
# * ApplicationName<~String>: The application for the environment or configuration template.
# * EnvironmentName<~String>: The name of the environment to describe.
# * TemplateName<~String>: The name of the configuration template to describe.
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_DescribeConfigurationSettings.html
#
def describe_configuration_settings(options={})
request({
'Operation' => 'DescribeConfigurationSettings',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::DescribeConfigurationSettings.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,29 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/describe_environment_resources'
# Returns AWS resources for this environment.
#
# ==== Options
# * EnvironmentId
# * EnvironmentName
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_DescribeEnvironmentResources.html
#
def describe_environment_resources(options={})
request({
'Operation' => 'DescribeEnvironmentResources',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::DescribeEnvironmentResources.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,40 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/describe_environments'
# Returns descriptions for existing environments.
#
# ==== Options
# * ApplicationName<~String>: If specified, AWS Elastic Beanstalk restricts the returned descriptions
# to include only those that are associated with this application.
# * EnvironmentIds
# * EnvironmentNames
# * IncludeDeleted
# * IncludedDeletedBackTo
# * VersionLabel<~String>:
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_DescribeEnvironments.html
#
def describe_environments(options={})
if environment_ids = options.delete('EnvironmentIds')
options.merge!(AWS.indexed_param('EnvironmentIds.member.%d', [*environment_ids]))
end
if environment_names = options.delete('EnvironmentNames')
options.merge!(AWS.indexed_param('EnvironmentNames.member.%d', [*environment_names]))
end
request({
'Operation' => 'DescribeEnvironments',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::DescribeEnvironments.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,29 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/describe_events'
# Returns list of event descriptions matching criteria up to the last 6 weeks.
#
# ==== Options
# * ApplicationName<~String>: If specified, AWS Elastic Beanstalk restricts the returned descriptions
# to include only those that are associated with this application.
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_DescribeEnvironments.html
#
def describe_events(options={})
request({
'Operation' => 'DescribeEvents',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::DescribeEvents.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,27 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/list_available_solution_stacks'
# Checks if the specified CNAME is available.
#
# ==== Options
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_CheckDNSAvailability.html
#
def list_available_solution_stacks()
request({
'Operation' => 'ListAvailableSolutionStacks',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::ListAvailableSolutionStacks.new
})
end
end
end
end
end

View File

@ -0,0 +1,30 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/empty'
# Deletes and recreates all of the AWS resources (for example: the Auto Scaling group, load balancer, etc.)
# for a specified environment and forces a restart.
#
# ==== Options
# * EnvironmentId
# * EnvironmentName
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_RebuildEnvironment.html
#
def rebuild_environment(options={})
request({
'Operation' => 'RebuildEnvironment',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::Empty.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,29 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/empty'
# Returns AWS resources for this environment.
#
# ==== Options
# * EnvironmentId
# * EnvironmentName
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_RequestEnvironmentInfo.html
#
def request_environment_info(options={})
request({
'Operation' => 'RequestEnvironmentInfo',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::Empty.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,29 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/empty'
# Returns AWS resources for this environment.
#
# ==== Options
# * EnvironmentId
# * EnvironmentName
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_RestartAppServer.html
#
def restart_app_server(options={})
request({
'Operation' => 'RestartAppServer',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::Empty.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,29 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/retrieve_environment_info'
# Returns AWS resources for this environment.
#
# ==== Options
# * EnvironmentId
# * EnvironmentName
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_RetrieveEnvironmentInfo.html
#
def retrieve_environment_info(options={})
request({
'Operation' => 'RetrieveEnvironmentInfo',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::RetrieveEnvironmentInfo.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,29 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/empty'
# Swaps the CNAMEs of two environments.
#
# ==== Options
# * EnvironmentId
# * EnvironmentName
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_SwapEnvironmentCNAMEs.html
#
def swap_environment_cnames(options={})
request({
'Operation' => 'SwapEnvironmentCNAMEs',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::Empty.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,31 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/terminate_environment'
# Terminates the specified environment.
#
# ==== Options
# * EnvironmentId<~String>: The ID of the environment to terminate.
# * EnvironmentName<~String>: The name of the environment to terminate.
# * TerminateResources<~Boolean>: Indicates whether the associated AWS resources should shut down when the
# environment is terminated
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_TerminateEnvironment.html
#
def terminate_environment(options={})
request({
'Operation' => 'TerminateEnvironment',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::TerminateEnvironment.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,30 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/update_application'
# Updates the specified application to have the specified properties.
#
# ==== Options
# * ApplicationName<~String>: The name of the application to update. If no such application is found,
# UpdateApplication returns an InvalidParameterValue error.
# * Description<~String>: A new description for the application.
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_UpdateApplication.html
#
def update_application(options)
request({
'Operation' => 'UpdateApplication',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::UpdateApplication.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,30 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/update_application_version'
# Updates the specified application version to have the specified properties.
#
# ==== Options
# * ApplicationName<~String>: The name of the application associated with this version.
# * VersionLabel<~String>: The name of the version to update.
# * Description<~String>: A new description for this release.
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_UpdateApplicationVersion.html
#
def update_application_version(options)
request({
'Operation' => 'UpdateApplicationVersion',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::UpdateApplicationVersion.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,36 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/update_configuration_template'
# Updates the specified configuration template to have the specified properties or configuration option values.
#
# ==== Options
# * ApplicationName<~String>: If specified, AWS Elastic Beanstalk restricts the returned descriptions
# to include only those that are associated with this application.
# * VersionLabel<~String>:
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_CreateConfigurationTemplate.html
#
def update_configuration_template(options={})
if option_settings = options.delete('OptionSettings')
options.merge!(AWS.indexed_param('OptionSettings.member.%d', [*option_settings]))
end
if options_to_remove = options.delete('OptionsToRemove')
options.merge!(AWS.indexed_param('OptionsToRemove.member.%d', [*options_to_remove]))
end
request({
'Operation' => 'UpdateConfigurationTemplate',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::UpdateConfigurationTemplate.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,42 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/update_environment'
# Updates the environment description, deploys a new application version, updates the configuration settings
# to an entirely new configuration template, or updates select configuration option values in
# the running environment.
#
# ==== Options
# * ApplicationName<~String>: If specified, AWS Elastic Beanstalk restricts the returned descriptions
# to include only those that are associated with this application.
# * EnvironmentIds
# * EnvironmentNames
# * IncludeDeleted
# * IncludedDeletedBackTo
# * VersionLabel<~String>:
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_CreateEnvironment.html
#
def update_environment(options={})
if option_settings = options.delete('OptionSettings')
options.merge!(AWS.indexed_param('OptionSettings.member.%d', [*option_settings]))
end
if options_to_remove = options.delete('OptionsToRemove')
options.merge!(AWS.indexed_param('OptionsToRemove.member.%d', [*options_to_remove]))
end
request({
'Operation' => 'UpdateEnvironment',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::UpdateEnvironment.new
}.merge(options))
end
end
end
end
end

View File

@ -0,0 +1,33 @@
module Fog
module AWS
class ElasticBeanstalk
class Real
require 'fog/aws/parsers/beanstalk/validate_configuration_settings'
# Updates the specified configuration template to have the specified properties or configuration option values.
#
# ==== Options
# * ApplicationName<~String>: If specified, AWS Elastic Beanstalk restricts the returned descriptions
# to include only those that are associated with this application.
# * VersionLabel<~String>:
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/API_CreateConfigurationTemplate.html
#
def validate_configuration_settings(options={})
if option_settings = options.delete('OptionSettings')
options.merge!(AWS.indexed_param('OptionSettings.member.%d', [*option_settings]))
end
request({
'Operation' => 'ValidateConfigurationSettings',
:parser => Fog::Parsers::AWS::ElasticBeanstalk::ValidateConfigurationSettings.new
}.merge(options))
end
end
end
end
end

View File

@ -5,6 +5,8 @@ class AWS < Fog::Bin
case key
when :auto_scaling
Fog::AWS::AutoScaling
when :beanstalk
Fog::AWS::ElasticBeanstalk
when :cdn
Fog::CDN::AWS
when :cloud_formation

View File

@ -0,0 +1,70 @@
Shindo.tests("Fog::AWS[:beanstalk] | application", ['aws', 'beanstalk']) do
pending if Fog.mocking?
@application_opts = {
:name => uniq_id('fog-test-app'),
:description => 'A nice description.'
}
model_tests(Fog::AWS[:beanstalk].applications, @application_opts, false) do
test("#attributes") do
@instance.name == @application_opts[:name] &&
@instance.description == @application_opts[:description]
end
test("#events") do
# There should be some events now.
@instance.events.length > 0
end
version_name = uniq_id('fog-test-ver')
@instance.versions.create(
:application_name => @instance.name,
:label => version_name
)
test("#versions") do
# We should have one version.
@instance.versions.length == 1
end
template_name = uniq_id('fog-test-template')
@instance.templates.create(
:application_name => @instance.name,
:name => template_name,
:solution_stack_name => '32bit Amazon Linux running Tomcat 7'
)
test('#templates') do
# We should have one template now.
@instance.templates.length == 1
end
environment_name = uniq_id('fog-test-env')
environment = @instance.environments.create(
:application_name => @instance.name,
:name => environment_name,
:version_label => version_name,
:solution_stack_name => '32bit Amazon Linux running Tomcat 7'
)
# Go ahead an terminate immediately.
environment.destroy
# Create an environment
test("#environments") do
# We should have one environment now.
@instance.environments.length == 1
end
# Must wait for termination before destroying application
tests("waiting for test environment to terminate").succeeds do
environment.wait_for { terminated? }
end
end
end

View File

@ -0,0 +1,7 @@
Shindo.tests("Fog::AWS[:beanstalk] | applications", ['aws', 'beanstalk']) do
pending if Fog.mocking?
collection_tests(Fog::AWS[:beanstalk].applications, {:name => uniq_id('fog-test-app')}, false)
end

View File

@ -0,0 +1,132 @@
Shindo.tests("Fog::AWS[:beanstalk] | environment", ['aws', 'beanstalk']) do
pending if Fog.mocking?
@beanstalk = Fog::AWS[:beanstalk]
@application_name = uniq_id('fog-test-app')
@environment_name = uniq_id('fog-test-env')
@version_names = []
# Create two unique version names
2.times {
@version_names << uniq_id('fog-test-version')
}
@application = @beanstalk.applications.create({:name => @application_name})
@versions = []
@version_names.each { |name|
@versions << @beanstalk.versions.create({
:label => name,
:application_name => @application_name,
})
}
@environment_opts = {
:application_name => @application_name,
:name => @environment_name,
:version_label => @version_names[0],
:solution_stack_name => '32bit Amazon Linux running Tomcat 7'
}
# Note: These model tests can take quite a bit of time to run, about 10 minutes typically.
model_tests(@beanstalk.environments, @environment_opts, false) do
# Wait for initial ready before next tests.
tests("#ready?").succeeds do
@instance.wait_for { ready? }
end
tests("#healthy?").succeeds do
@instance.wait_for { healthy? }
end
test("#events") do
# There should be some events now.
@instance.events.length > 0
end
test("#version") do
@instance.version.label == @version_names[0]
end
test("#version= string") do
# Set to version 2
@instance.version = @version_names[1]
count = 0
if @instance.version.label == @version_names[1]
@instance.events.each { |event|
if event.message == "Environment update is starting."
count = count + 1
end
}
end
count == 1
end
tests("#ready? after version= string").succeeds do
@instance.wait_for { ready? }
end
test("#version= version object") do
# reset back to first version using version object
@instance.version = @versions[0]
count = 0
if @instance.version.label == @version_names[0]
@instance.events.each { |event|
if event.message == "Environment update is starting."
count = count + 1
end
}
end
# Pass if we have two environment updating events
count == 2
end
tests("#ready? after version= version object").succeeds do
@instance.wait_for { ready? }
end
test('#restart_app_server') do
@instance.restart_app_server
passed = false
@instance.events.each { |event|
if event.message == "restartAppServer is starting."
passed = true
end
}
passed
end
test('#rebuild') do
@instance.rebuild
passed = false
@instance.events.each { |event|
if event.message == "rebuildEnvironment is starting."
passed = true
end
}
passed
end
# Wait for ready or next tests may fail
tests("#ready? after rebuild").succeeds do
@instance.wait_for { ready? }
end
end
# Wait for instance to terminate before deleting application
tests('#terminated?').succeeds do
@instance.wait_for { terminated? }
end
# delete application
@application.destroy
end

View File

@ -0,0 +1,34 @@
Shindo.tests("Fog::AWS[:beanstalk] | environments", ['aws', 'beanstalk']) do
pending if Fog.mocking?
@beanstalk = Fog::AWS[:beanstalk]
@application_name = uniq_id('fog-test-app')
@environment_name = uniq_id('fog-test-env')
@version_name = uniq_id('fog-test-version')
# Create an application/version to use for testing.
@version = @beanstalk.versions.create({
:label => @version_name,
:application_name => @application_name,
:auto_create_application => true
})
@application = @beanstalk.applications.get(@application_name)
@environment_opts = {
:application_name => @application_name,
:name => @environment_name,
:version_label => @version_name,
:solution_stack_name => '32bit Amazon Linux running Tomcat 7'
}
collection_tests(@beanstalk.environments, @environment_opts, false)
# Wait for instance to terminate before deleting application
@instance.wait_for { terminated? }
# delete application
@application.destroy
end

View File

@ -0,0 +1,47 @@
Shindo.tests("Fog::AWS[:beanstalk] | template", ['aws', 'beanstalk']) do
pending if Fog.mocking?
@beanstalk = Fog::AWS[:beanstalk]
@application_name = uniq_id('fog-test-app')
@template_name = uniq_id('fog-test-template')
@template_description = 'A nice description'
@application = @beanstalk.applications.create({:name => @application_name})
@template_opts = {
:application_name => @application_name,
:name => @template_name,
:description => @template_description,
:solution_stack_name => '32bit Amazon Linux running Tomcat 7'
}
model_tests(@beanstalk .templates, @template_opts, false) do
test("#attributes") do
@instance.name == @template_name &&
@instance.description == @template_description &&
@instance.application_name == @application_name &&
@instance.solution_stack_name == @template_opts[:solution_stack_name]
end
test("#options") do
options = @instance.options
passed = false
if options.each { |option|
# See if we recognize at least one option
if option["Name"] == 'LoadBalancerHTTPPort' && option["Namespace"] == 'aws:elb:loadbalancer'
passed = true
end
}
end
passed
end
end
# delete application
@application.destroy
end

View File

@ -0,0 +1,62 @@
Shindo.tests("Fog::AWS[:beanstalk] | templates", ['aws', 'beanstalk']) do
pending if Fog.mocking?
@beanstalk = Fog::AWS[:beanstalk]
@application_name = uniq_id('fog-test-app')
@template_name = uniq_id('fog-test-template')
@template_description = 'A nice description'
@application = @beanstalk.applications.create({:name => @application_name})
params = {
:application_name => @application_name,
:name => @template_name,
:description => @template_description,
:solution_stack_name => '32bit Amazon Linux running Tomcat 7'
}
collection = @beanstalk.templates
tests('success') do
tests("#new(#{params.inspect})").succeeds do
pending if Fog.mocking?
collection.new(params)
end
tests("#create(#{params.inspect})").succeeds do
pending if Fog.mocking?
@instance = collection.create(params)
end
tests("#all").succeeds do
pending if Fog.mocking?
collection.all
end
tests("#get(#{@application_name}, #{@template_name})").succeeds do
pending if Fog.mocking?
collection.get(@application_name, @template_name)
end
if !Fog.mocking?
@instance.destroy
end
end
tests('failure') do
tests("#get(#{@application_name}, #{@template_name})").returns(nil) do
pending if Fog.mocking?
collection.get(@application_name, @template_name)
end
end
# delete application
@application.destroy
end

View File

@ -0,0 +1,66 @@
Shindo.tests("Fog::AWS[:beanstalk] | version", ['aws', 'beanstalk']) do
pending if Fog.mocking?
@beanstalk = Fog::AWS[:beanstalk]
@application_name = uniq_id('fog-test-app')
@version_name = uniq_id('fog-test-version')
@version_description = 'A nice description'
@application = @beanstalk.applications.create({:name => @application_name})
@version_opts = {
:application_name => @application_name,
:label => @version_name,
:description => @version_description
}
model_tests(@beanstalk.versions, @version_opts, false) do
test("attributes") do
@instance.label == @version_name &&
@instance.description == @version_description &&
@instance.application_name == @application_name
end
test("#events") do
# There should be some events now.
@instance.events.length > 0
end
test("#update description") do
new_description = "A completely new description."
@instance.description = new_description
@instance.update
passed = false
if @instance.description == new_description
# reload version from AWS to verify save is committed to server, not just on local object
if @beanstalk.versions.get(@application_name, @version_name).description == new_description
passed = true
end
end
passed
end
test("#update description empty") do
@instance.description = '' # Set to empty to nil out
@instance.update
passed = false
if @instance.description == nil
# reload version from AWS to verify save is committed to server, not just on local object
if @beanstalk.versions.get(@application_name, @version_name).description == nil
passed = true
end
end
passed
end
end
# delete application
@application.destroy
end

View File

@ -0,0 +1,61 @@
Shindo.tests("Fog::AWS[:beanstalk] | versions", ['aws', 'beanstalk']) do
pending if Fog.mocking?
@beanstalk = Fog::AWS[:beanstalk]
@application_name = uniq_id('fog-test-app')
@version_name = uniq_id('fog-test-version')
@version_description = 'A nice description'
@application = @beanstalk.applications.create({:name => @application_name})
params = {
:application_name => @application_name,
:label => @version_name,
:description => @version_description
}
collection = @beanstalk.versions
tests('success') do
tests("#new(#{params.inspect})").succeeds do
pending if Fog.mocking?
collection.new(params)
end
tests("#create(#{params.inspect})").succeeds do
pending if Fog.mocking?
@instance = collection.create(params)
end
tests("#all").succeeds do
pending if Fog.mocking?
collection.all
end
tests("#get(#{@application_name}, #{@version_name})").succeeds do
pending if Fog.mocking?
collection.get(@application_name, @version_name)
end
if !Fog.mocking?
@instance.destroy
end
end
tests('failure') do
tests("#get(#{@application_name}, #{@version_name})").returns(nil) do
pending if Fog.mocking?
collection.get(@application_name, @version_name)
end
end
# delete application
@application.destroy
end

View File

@ -0,0 +1,140 @@
Shindo.tests('AWS::ElasticBeanstalk | application_tests', ['aws', 'beanstalk']) do
def unique_name(prefix)
#get time (with 1/100th of sec accuracy)
#want unique domain name and if provider is fast, this can be called more than once per second
time = Time.now.to_i.to_s
prefix + time
end
unless Fog.mocking?
@beanstalk = Fog::AWS[:beanstalk]
end
@test_description = "A unique description."
@test_app_name = unique_name("fog-test-app-")
tests('success') do
pending if Fog.mocking?
@describe_applications_format = {
'DescribeApplicationsResult' => {
'Applications' => [
'ApplicationName' => String,
'ConfigurationTemplates' => [String],
'Description' => Fog::Nullable::String,
'DateCreated' => Time,
'DateUpdated' => Time,
'Versions' => [String]
]},
'ResponseMetadata' => {'RequestId'=> String},
}
tests("#describe_applications format").formats(@describe_applications_format) do
result = @beanstalk.describe_applications.body
end
test("#create_application") {
response = @beanstalk.create_application({
'ApplicationName' => @test_app_name,
'Description' => @test_description
})
result = false
if response.status == 200
app_info = response.body['CreateApplicationResult']['Application']
if app_info
if app_info['ApplicationName'] == @test_app_name &&
app_info['Description'] == @test_description &&
app_info['ConfigurationTemplates'].empty? &&
app_info['Versions'].empty?
result = true
end
end
end
result
}
test("#describe_applications all") {
response = @beanstalk.describe_applications
result = false
if response.status == 200
apps = response.body['DescribeApplicationsResult']['Applications']
apps.each { |app_info|
if app_info
if app_info['ApplicationName'] == @test_app_name &&
app_info['Description'] == @test_description &&
app_info['ConfigurationTemplates'].empty? &&
app_info['Versions'].empty?
result = true
end
end
}
end
result
}
test("#create_application filter") {
# Test for a specific app
response = @beanstalk.describe_applications([@test_app_name])
result = false
if response.status == 200
apps = response.body['DescribeApplicationsResult']['Applications']
if apps && apps.length == 1
app_info = apps.first
if app_info['ApplicationName'] == @test_app_name &&
app_info['Description'] == @test_description &&
app_info['ConfigurationTemplates'].empty? &&
app_info['Versions'].empty?
result = true
end
end
end
result
}
test("#update_application description") {
@test_description = "A completely new description."
response = @beanstalk.update_application({
'ApplicationName' => @test_app_name,
'Description' => @test_description
})
result = false
if response.status == 200
app_info = response.body['UpdateApplicationResult']['Application']
if app_info
if app_info['ApplicationName'] == @test_app_name &&
app_info['Description'] == @test_description &&
app_info['ConfigurationTemplates'].empty? &&
app_info['Versions'].empty?
result = true
end
end
end
result
}
test("#delete_application") {
response = @beanstalk.delete_application(@test_app_name)
result = false
if response.status == 200
result = true
end
result
}
end
end

View File

@ -0,0 +1,22 @@
Shindo.tests('AWS::ElasticBeanstalk | solution_stack_tests', ['aws', 'beanstalk']) do
tests('success') do
pending if Fog.mocking?
@solution_stack_result_format = {
'ListAvailableSolutionStacksResult' => {
'SolutionStackDetails' => [
'SolutionStackName' => String,
'PermittedFileTypes' => [String]
],
'SolutionStacks' => [String]
},
'ResponseMetadata' => {'RequestId'=> String},
}
tests("#list_available_solution_stacks").formats(@solution_stack_result_format) do
Fog::AWS[:beanstalk].list_available_solution_stacks.body
end
end
end