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:
parent
e8108fdce0
commit
017a1b67f9
9 changed files with 38 additions and 38 deletions
|
@ -18,27 +18,27 @@ module Fog
|
|||
|
||||
def environments
|
||||
requires :name
|
||||
connection.environments.all({'ApplicationName' => name})
|
||||
service.environments.all({'ApplicationName' => name})
|
||||
end
|
||||
|
||||
def events
|
||||
requires :name
|
||||
connection.events.all({'ApplicationName' => name})
|
||||
service.events.all({'ApplicationName' => name})
|
||||
end
|
||||
|
||||
def templates
|
||||
requires :name
|
||||
connection.templates.all({'ApplicationName' => name})
|
||||
service.templates.all({'ApplicationName' => name})
|
||||
end
|
||||
|
||||
def versions
|
||||
requires :name
|
||||
connection.versions.all({'ApplicationName' => name})
|
||||
service.versions.all({'ApplicationName' => name})
|
||||
end
|
||||
|
||||
def destroy
|
||||
requires :name
|
||||
connection.delete_application(name)
|
||||
service.delete_application(name)
|
||||
true
|
||||
end
|
||||
|
||||
|
@ -50,7 +50,7 @@ module Fog
|
|||
}
|
||||
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)
|
||||
true
|
||||
end
|
||||
|
@ -59,4 +59,4 @@ module Fog
|
|||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,12 +9,12 @@ module Fog
|
|||
model Fog::AWS::ElasticBeanstalk::Application
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,7 +40,7 @@ module Fog
|
|||
# Returns the current live resources for this environment
|
||||
def live_resources
|
||||
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
|
||||
end
|
||||
|
@ -54,26 +54,26 @@ module Fog
|
|||
# Return events related to this version
|
||||
def events
|
||||
requires :id
|
||||
connection.events.all({'EnvironmentId' => id})
|
||||
service.events.all({'EnvironmentId' => id})
|
||||
end
|
||||
|
||||
# Restarts the app servers in this environment
|
||||
def restart_app_server
|
||||
requires :id
|
||||
connection.restart_app_server({'EnvironmentId' => id})
|
||||
service.restart_app_server({'EnvironmentId' => id})
|
||||
reload
|
||||
end
|
||||
|
||||
# Rebuilds the environment
|
||||
def rebuild
|
||||
requires :id
|
||||
connection.rebuild_environment({'EnvironmentId' => id})
|
||||
service.rebuild_environment({'EnvironmentId' => id})
|
||||
reload
|
||||
end
|
||||
|
||||
def swap_cnames(source)
|
||||
requires :name
|
||||
connection.swap_environment_cnames({
|
||||
service.swap_environment_cnames({
|
||||
'SourceEnvironmentName' => source.name,
|
||||
'DestinationEnvironmentName' => name
|
||||
})
|
||||
|
@ -84,7 +84,7 @@ module Fog
|
|||
# Return the version object for this environment
|
||||
def version
|
||||
requires :application_name, :version_label
|
||||
connection.versions.get(application_name, version_label)
|
||||
service.versions.get(application_name, version_label)
|
||||
end
|
||||
|
||||
# Update the running version of this environment
|
||||
|
@ -102,7 +102,7 @@ module Fog
|
|||
raise "Version label not specified."
|
||||
end
|
||||
|
||||
data = connection.update_environment({
|
||||
data = service.update_environment({
|
||||
'EnvironmentId' => id,
|
||||
'VersionLabel' => new_version_label
|
||||
}).body['UpdateEnvironmentResult']
|
||||
|
@ -112,7 +112,7 @@ module Fog
|
|||
|
||||
def destroy
|
||||
requires :id
|
||||
connection.terminate_environment({'EnvironmentId' => id})
|
||||
service.terminate_environment({'EnvironmentId' => id})
|
||||
true
|
||||
end
|
||||
|
||||
|
@ -133,7 +133,7 @@ module Fog
|
|||
}
|
||||
options.delete_if {|key, value| value.nil?}
|
||||
|
||||
data = connection.create_environment(options).body['CreateEnvironmentResult']
|
||||
data = service.create_environment(options).body['CreateEnvironmentResult']
|
||||
merge_attributes(data)
|
||||
true
|
||||
end
|
||||
|
@ -142,4 +142,4 @@ module Fog
|
|||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
model Fog::AWS::ElasticBeanstalk::Environment
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
|
@ -18,7 +18,7 @@ module Fog
|
|||
def get(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)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
model Fog::AWS::ElasticBeanstalk::Event
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ module Fog
|
|||
# Returns an array of options that may be set on this template
|
||||
def options
|
||||
requires :name, :application_name
|
||||
data = connection.describe_configuration_options({
|
||||
data = service.describe_configuration_options({
|
||||
'ApplicationName' => application_name,
|
||||
'TemplateName' => name
|
||||
})
|
||||
|
@ -33,7 +33,7 @@ module Fog
|
|||
|
||||
def destroy
|
||||
requires :name, :application_name
|
||||
connection.delete_configuration_template(application_name, name)
|
||||
service.delete_configuration_template(application_name, name)
|
||||
true
|
||||
end
|
||||
|
||||
|
@ -51,7 +51,7 @@ module Fog
|
|||
}
|
||||
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)
|
||||
true
|
||||
end
|
||||
|
@ -67,7 +67,7 @@ module Fog
|
|||
}
|
||||
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)
|
||||
true
|
||||
end
|
||||
|
@ -75,4 +75,4 @@ module Fog
|
|||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ module Fog
|
|||
# Initialize with empty array
|
||||
data = []
|
||||
|
||||
applications = connection.describe_applications(application_filter).body['DescribeApplicationsResult']['Applications']
|
||||
applications = service.describe_applications(application_filter).body['DescribeApplicationsResult']['Applications']
|
||||
applications.each { |application|
|
||||
application['ConfigurationTemplates'].each { |template_name|
|
||||
begin
|
||||
|
@ -29,7 +29,7 @@ module Fog
|
|||
'ApplicationName' => application['ApplicationName'],
|
||||
'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
|
||||
# Add to data
|
||||
data << settings.first
|
||||
|
@ -54,7 +54,7 @@ module Fog
|
|||
# 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']
|
||||
data = service.describe_configuration_settings(options).body['DescribeConfigurationSettingsResult']['ConfigurationSettings']
|
||||
if data.length == 1
|
||||
result = new(data.first)
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ module Fog
|
|||
# Return events related to this version
|
||||
def events
|
||||
requires :label, :application_name
|
||||
connection.events.all({
|
||||
service.events.all({
|
||||
'ApplicationName' => application_name,
|
||||
'VersionLabel' => label
|
||||
})
|
||||
|
@ -29,7 +29,7 @@ module Fog
|
|||
# Returns environments running this version
|
||||
def environments
|
||||
requires :label, :application_name
|
||||
connection.environments.all({
|
||||
service.environments.all({
|
||||
'ApplicationName' => application_name,
|
||||
'VersionLabel' => label
|
||||
})
|
||||
|
@ -37,7 +37,7 @@ module Fog
|
|||
|
||||
def destroy(delete_source_bundle = nil)
|
||||
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
|
||||
end
|
||||
|
||||
|
@ -53,7 +53,7 @@ module Fog
|
|||
}
|
||||
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)
|
||||
true
|
||||
end
|
||||
|
@ -69,11 +69,11 @@ module Fog
|
|||
}
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,12 +9,12 @@ module Fog
|
|||
model Fog::AWS::ElasticBeanstalk::Version
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
def get(application_name, version_label)
|
||||
if data = connection.describe_application_versions({
|
||||
if data = service.describe_application_versions({
|
||||
'ApplicationName' => application_name,
|
||||
'VersionLabels' => [version_label]
|
||||
}).body['DescribeApplicationVersionsResult']['ApplicationVersions']
|
||||
|
|
Loading…
Reference in a new issue