1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[aws|beanstalk] Updates reference to service

This commit is contained in:
Paul Thornthwaite 2012-12-22 23:32:13 +00:00
parent e8108fdce0
commit 017a1b67f9
9 changed files with 38 additions and 38 deletions

View file

@ -18,27 +18,27 @@ module Fog
def environments def environments
requires :name requires :name
connection.environments.all({'ApplicationName' => name}) service.environments.all({'ApplicationName' => name})
end end
def events def events
requires :name requires :name
connection.events.all({'ApplicationName' => name}) service.events.all({'ApplicationName' => name})
end end
def templates def templates
requires :name requires :name
connection.templates.all({'ApplicationName' => name}) service.templates.all({'ApplicationName' => name})
end end
def versions def versions
requires :name requires :name
connection.versions.all({'ApplicationName' => name}) service.versions.all({'ApplicationName' => name})
end end
def destroy def destroy
requires :name requires :name
connection.delete_application(name) service.delete_application(name)
true true
end end
@ -50,7 +50,7 @@ module Fog
} }
options['Description'] = description unless description.nil? options['Description'] = description unless description.nil?
data = connection.create_application(options).body['CreateApplicationResult']['Application'] data = service.create_application(options).body['CreateApplicationResult']['Application']
merge_attributes(data) merge_attributes(data)
true true
end end
@ -59,4 +59,4 @@ module Fog
end end
end end
end end

View file

@ -9,12 +9,12 @@ module Fog
model Fog::AWS::ElasticBeanstalk::Application model Fog::AWS::ElasticBeanstalk::Application
def all(application_names=[]) def all(application_names=[])
data = connection.describe_applications(application_names).body['DescribeApplicationsResult']['Applications'] data = service.describe_applications(application_names).body['DescribeApplicationsResult']['Applications']
load(data) # data is an array of attribute hashes load(data) # data is an array of attribute hashes
end end
def get(application_name) def get(application_name)
if data = connection.describe_applications([application_name]).body['DescribeApplicationsResult']['Applications'].first if data = service.describe_applications([application_name]).body['DescribeApplicationsResult']['Applications'].first
new(data) new(data)
end end
end end

View file

@ -40,7 +40,7 @@ module Fog
# Returns the current live resources for this environment # Returns the current live resources for this environment
def live_resources def live_resources
requires :id requires :id
data = connection.describe_environment_resources({'EnvironmentId' => id}).body['DescribeEnvironmentResourcesResult']['EnvironmentResources'] data = service.describe_environment_resources({'EnvironmentId' => id}).body['DescribeEnvironmentResourcesResult']['EnvironmentResources']
data.delete('EnvironmentName') # Delete the environment name from the result, only return actual resources data.delete('EnvironmentName') # Delete the environment name from the result, only return actual resources
data data
end end
@ -54,26 +54,26 @@ module Fog
# Return events related to this version # Return events related to this version
def events def events
requires :id requires :id
connection.events.all({'EnvironmentId' => id}) service.events.all({'EnvironmentId' => id})
end end
# Restarts the app servers in this environment # Restarts the app servers in this environment
def restart_app_server def restart_app_server
requires :id requires :id
connection.restart_app_server({'EnvironmentId' => id}) service.restart_app_server({'EnvironmentId' => id})
reload reload
end end
# Rebuilds the environment # Rebuilds the environment
def rebuild def rebuild
requires :id requires :id
connection.rebuild_environment({'EnvironmentId' => id}) service.rebuild_environment({'EnvironmentId' => id})
reload reload
end end
def swap_cnames(source) def swap_cnames(source)
requires :name requires :name
connection.swap_environment_cnames({ service.swap_environment_cnames({
'SourceEnvironmentName' => source.name, 'SourceEnvironmentName' => source.name,
'DestinationEnvironmentName' => name 'DestinationEnvironmentName' => name
}) })
@ -84,7 +84,7 @@ module Fog
# Return the version object for this environment # Return the version object for this environment
def version def version
requires :application_name, :version_label requires :application_name, :version_label
connection.versions.get(application_name, version_label) service.versions.get(application_name, version_label)
end end
# Update the running version of this environment # Update the running version of this environment
@ -102,7 +102,7 @@ module Fog
raise "Version label not specified." raise "Version label not specified."
end end
data = connection.update_environment({ data = service.update_environment({
'EnvironmentId' => id, 'EnvironmentId' => id,
'VersionLabel' => new_version_label 'VersionLabel' => new_version_label
}).body['UpdateEnvironmentResult'] }).body['UpdateEnvironmentResult']
@ -112,7 +112,7 @@ module Fog
def destroy def destroy
requires :id requires :id
connection.terminate_environment({'EnvironmentId' => id}) service.terminate_environment({'EnvironmentId' => id})
true true
end end
@ -133,7 +133,7 @@ module Fog
} }
options.delete_if {|key, value| value.nil?} options.delete_if {|key, value| value.nil?}
data = connection.create_environment(options).body['CreateEnvironmentResult'] data = service.create_environment(options).body['CreateEnvironmentResult']
merge_attributes(data) merge_attributes(data)
true true
end end
@ -142,4 +142,4 @@ module Fog
end end
end end
end end

View file

@ -9,7 +9,7 @@ module Fog
model Fog::AWS::ElasticBeanstalk::Environment model Fog::AWS::ElasticBeanstalk::Environment
def all(options={}) def all(options={})
data = connection.describe_environments(options).body['DescribeEnvironmentsResult']['Environments'] data = service.describe_environments(options).body['DescribeEnvironmentsResult']['Environments']
load(data) # data is an array of attribute hashes load(data) # data is an array of attribute hashes
end end
@ -18,7 +18,7 @@ module Fog
def get(environment_name) def get(environment_name)
options = { 'EnvironmentNames' => [environment_name] } options = { 'EnvironmentNames' => [environment_name] }
if data = connection.describe_environments(options).body['DescribeEnvironmentsResult']['Environments'].first if data = service.describe_environments(options).body['DescribeEnvironmentsResult']['Environments'].first
new(data) new(data)
end end
end end

View file

@ -9,7 +9,7 @@ module Fog
model Fog::AWS::ElasticBeanstalk::Event model Fog::AWS::ElasticBeanstalk::Event
def all(options={}) def all(options={})
data = connection.describe_events(options).body['DescribeEventsResult']['Events'] data = service.describe_events(options).body['DescribeEventsResult']['Events']
load(data) # data is an array of attribute hashes load(data) # data is an array of attribute hashes
end end

View file

@ -24,7 +24,7 @@ module Fog
# Returns an array of options that may be set on this template # Returns an array of options that may be set on this template
def options def options
requires :name, :application_name requires :name, :application_name
data = connection.describe_configuration_options({ data = service.describe_configuration_options({
'ApplicationName' => application_name, 'ApplicationName' => application_name,
'TemplateName' => name 'TemplateName' => name
}) })
@ -33,7 +33,7 @@ module Fog
def destroy def destroy
requires :name, :application_name requires :name, :application_name
connection.delete_configuration_template(application_name, name) service.delete_configuration_template(application_name, name)
true true
end end
@ -51,7 +51,7 @@ module Fog
} }
options.delete_if {|key, value| value.nil?} options.delete_if {|key, value| value.nil?}
data = connection.create_configuration_template(options).body['CreateConfigurationTemplateResult'] data = service.create_configuration_template(options).body['CreateConfigurationTemplateResult']
merge_attributes(data) merge_attributes(data)
true true
end end
@ -67,7 +67,7 @@ module Fog
} }
options.delete_if {|key, value| value.nil?} options.delete_if {|key, value| value.nil?}
data = connection.update_configuration_template(options).body['UpdateConfigurationTemplateResult'] data = service.update_configuration_template(options).body['UpdateConfigurationTemplateResult']
merge_attributes(data) merge_attributes(data)
true true
end end
@ -75,4 +75,4 @@ module Fog
end end
end end
end end

View file

@ -21,7 +21,7 @@ module Fog
# Initialize with empty array # Initialize with empty array
data = [] data = []
applications = connection.describe_applications(application_filter).body['DescribeApplicationsResult']['Applications'] applications = service.describe_applications(application_filter).body['DescribeApplicationsResult']['Applications']
applications.each { |application| applications.each { |application|
application['ConfigurationTemplates'].each { |template_name| application['ConfigurationTemplates'].each { |template_name|
begin begin
@ -29,7 +29,7 @@ module Fog
'ApplicationName' => application['ApplicationName'], 'ApplicationName' => application['ApplicationName'],
'TemplateName' => template_name 'TemplateName' => template_name
} }
settings = connection.describe_configuration_settings(options).body['DescribeConfigurationSettingsResult']['ConfigurationSettings'] settings = service.describe_configuration_settings(options).body['DescribeConfigurationSettingsResult']['ConfigurationSettings']
if settings.length == 1 if settings.length == 1
# Add to data # Add to data
data << settings.first data << settings.first
@ -54,7 +54,7 @@ module Fog
# There is no describe call for templates, so we must use describe_configuration_settings. Unfortunately, # 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 # it throws an exception if template name doesn't exist, which is inconsistent, catch and return nil
begin begin
data = connection.describe_configuration_settings(options).body['DescribeConfigurationSettingsResult']['ConfigurationSettings'] data = service.describe_configuration_settings(options).body['DescribeConfigurationSettingsResult']['ConfigurationSettings']
if data.length == 1 if data.length == 1
result = new(data.first) result = new(data.first)
end end

View file

@ -20,7 +20,7 @@ module Fog
# Return events related to this version # Return events related to this version
def events def events
requires :label, :application_name requires :label, :application_name
connection.events.all({ service.events.all({
'ApplicationName' => application_name, 'ApplicationName' => application_name,
'VersionLabel' => label 'VersionLabel' => label
}) })
@ -29,7 +29,7 @@ module Fog
# Returns environments running this version # Returns environments running this version
def environments def environments
requires :label, :application_name requires :label, :application_name
connection.environments.all({ service.environments.all({
'ApplicationName' => application_name, 'ApplicationName' => application_name,
'VersionLabel' => label 'VersionLabel' => label
}) })
@ -37,7 +37,7 @@ module Fog
def destroy(delete_source_bundle = nil) def destroy(delete_source_bundle = nil)
requires :label, :application_name requires :label, :application_name
connection.delete_application_version(application_name, label, delete_source_bundle) service.delete_application_version(application_name, label, delete_source_bundle)
true true
end end
@ -53,7 +53,7 @@ module Fog
} }
options.delete_if {|key, value| value.nil?} options.delete_if {|key, value| value.nil?}
data = connection.create_application_version(options).body['CreateApplicationVersionResult']['ApplicationVersion'] data = service.create_application_version(options).body['CreateApplicationVersionResult']['ApplicationVersion']
merge_attributes(data) merge_attributes(data)
true true
end end
@ -69,11 +69,11 @@ module Fog
} }
options.delete_if {|key, value| value.nil?} options.delete_if {|key, value| value.nil?}
data = connection.update_application_version(options).body['UpdateApplicationVersionResult']['ApplicationVersion'] data = service.update_application_version(options).body['UpdateApplicationVersionResult']['ApplicationVersion']
merge_attributes(data) merge_attributes(data)
end end
end end
end end
end end
end end

View file

@ -9,12 +9,12 @@ module Fog
model Fog::AWS::ElasticBeanstalk::Version model Fog::AWS::ElasticBeanstalk::Version
def all(options={}) def all(options={})
data = connection.describe_application_versions(options).body['DescribeApplicationVersionsResult']['ApplicationVersions'] data = service.describe_application_versions(options).body['DescribeApplicationVersionsResult']['ApplicationVersions']
load(data) # data is an array of attribute hashes load(data) # data is an array of attribute hashes
end end
def get(application_name, version_label) def get(application_name, version_label)
if data = connection.describe_application_versions({ if data = service.describe_application_versions({
'ApplicationName' => application_name, 'ApplicationName' => application_name,
'VersionLabels' => [version_label] 'VersionLabels' => [version_label]
}).body['DescribeApplicationVersionsResult']['ApplicationVersions'] }).body['DescribeApplicationVersionsResult']['ApplicationVersions']