mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[compute|aws] fix helpers to use Fog::AWS
This commit is contained in:
parent
6eae9b6154
commit
768fcafaa9
36 changed files with 49 additions and 49 deletions
|
@ -80,7 +80,7 @@ module Fog
|
|||
idempotent = params.delete(:idempotent)
|
||||
parser = params.delete(:parser)
|
||||
|
||||
body = AWS.signed_params(
|
||||
body = Fog::AWS.signed_params(
|
||||
params,
|
||||
{
|
||||
:aws_access_key_id => @aws_access_key_id,
|
||||
|
|
|
@ -100,7 +100,7 @@ module Fog
|
|||
idempotent = params.delete(:idempotent)
|
||||
parser = params.delete(:parser)
|
||||
|
||||
body = AWS.signed_params(
|
||||
body = Fog::AWS.signed_params(
|
||||
params,
|
||||
{
|
||||
:aws_access_key_id => @aws_access_key_id,
|
||||
|
|
|
@ -93,7 +93,7 @@ module Fog
|
|||
idempotent = params.delete(:idempotent)
|
||||
parser = params.delete(:parser)
|
||||
|
||||
body = AWS.signed_params(
|
||||
body = Fog::AWS.signed_params(
|
||||
params,
|
||||
{
|
||||
:aws_access_key_id => @aws_access_key_id,
|
||||
|
|
|
@ -115,7 +115,7 @@ module Fog
|
|||
idempotent = params.delete(:idempotent)
|
||||
parser = params.delete(:parser)
|
||||
|
||||
body = AWS.signed_params(
|
||||
body = Fog::AWS.signed_params(
|
||||
params,
|
||||
{
|
||||
:aws_access_key_id => @aws_access_key_id,
|
||||
|
|
|
@ -36,7 +36,7 @@ module Fog
|
|||
end
|
||||
|
||||
if options['NotificationARNs']
|
||||
params.merge!(AWS.indexed_param("NotificationARNs.member", [*options['NotificationARNs']]))
|
||||
params.merge!(Fog::AWS.indexed_param("NotificationARNs.member", [*options['NotificationARNs']]))
|
||||
end
|
||||
|
||||
if options['Parameters']
|
||||
|
|
|
@ -23,7 +23,7 @@ module Fog
|
|||
# * 'CreateLoadBalancerResult'<~Hash>:
|
||||
# * 'DNSName'<~String> - DNS name for the newly created ELB
|
||||
def create_load_balancer(availability_zones, lb_name, listeners)
|
||||
params = AWS.indexed_param('AvailabilityZones.member', [*availability_zones])
|
||||
params = Fog::AWS.indexed_param('AvailabilityZones.member', [*availability_zones])
|
||||
|
||||
listener_protocol = []
|
||||
listener_lb_port = []
|
||||
|
@ -36,10 +36,10 @@ module Fog
|
|||
listener_ssl_certificate_id.push(listener['SSLCertificateId'])
|
||||
end
|
||||
|
||||
params.merge!(AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol))
|
||||
params.merge!(AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port))
|
||||
params.merge!(AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port))
|
||||
params.merge!(AWS.indexed_param('Listeners.member.%d.SSLCertificateId', listener_ssl_certificate_id))
|
||||
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol))
|
||||
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port))
|
||||
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port))
|
||||
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.SSLCertificateId', listener_ssl_certificate_id))
|
||||
|
||||
request({
|
||||
'Action' => 'CreateLoadBalancer',
|
||||
|
|
|
@ -33,10 +33,10 @@ module Fog
|
|||
listener_ssl_certificate_id.push(listener['SSLCertificateId'])
|
||||
end
|
||||
|
||||
params.merge!(AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol))
|
||||
params.merge!(AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port))
|
||||
params.merge!(AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port))
|
||||
params.merge!(AWS.indexed_param('Listeners.member.%d.SSLCertificateId', listener_ssl_certificate_id))
|
||||
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol))
|
||||
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port))
|
||||
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port))
|
||||
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.SSLCertificateId', listener_ssl_certificate_id))
|
||||
|
||||
request({
|
||||
'Action' => 'CreateLoadBalancerListeners',
|
||||
|
|
|
@ -16,7 +16,7 @@ module Fog
|
|||
# * 'ResponseMetadata'<~Hash>:
|
||||
# * 'RequestId'<~String> - Id of request
|
||||
def delete_load_balancer_listeners(lb_name, load_balancer_ports)
|
||||
params = AWS.indexed_param('LoadBalancerPorts.memeber.%d', load_balancer_ports)
|
||||
params = Fog::AWS.indexed_param('LoadBalancerPorts.memeber.%d', load_balancer_ports)
|
||||
|
||||
request({
|
||||
'Action' => 'DeleteLoadBalancerListeners',
|
||||
|
|
|
@ -20,7 +20,7 @@ module Fog
|
|||
# * 'Instances'<~Array> - array of hashes describing instances currently enabled
|
||||
# * 'InstanceId'<~String>
|
||||
def deregister_instances_from_load_balancer(instance_ids, lb_name)
|
||||
params = AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids])
|
||||
params = Fog::AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids])
|
||||
request({
|
||||
'Action' => 'DeregisterInstancesFromLoadBalancer',
|
||||
'LoadBalancerName' => lb_name,
|
||||
|
|
|
@ -23,7 +23,7 @@ module Fog
|
|||
# * 'InstanceId'<~String>
|
||||
# * 'ReasonCode'<~String>
|
||||
def describe_instance_health(lb_name, instance_ids = [])
|
||||
params = AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids])
|
||||
params = Fog::AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids])
|
||||
request({
|
||||
'Action' => 'DescribeInstanceHealth',
|
||||
'LoadBalancerName' => lb_name,
|
||||
|
|
|
@ -43,7 +43,7 @@ module Fog
|
|||
# * 'GroupName'<~String> - Name of the source security group to use with inbound security group rules
|
||||
# * 'OwnerAlias'<~String> - Owner of the source security group
|
||||
def describe_load_balancers(lb_name = [])
|
||||
params = AWS.indexed_param('LoadBalancerNames.member', [*lb_name])
|
||||
params = Fog::AWS.indexed_param('LoadBalancerNames.member', [*lb_name])
|
||||
request({
|
||||
'Action' => 'DescribeLoadBalancers',
|
||||
:parser => Fog::Parsers::AWS::ELB::DescribeLoadBalancers.new
|
||||
|
|
|
@ -19,7 +19,7 @@ module Fog
|
|||
# * 'DisableAvailabilityZonesForLoadBalancerResult'<~Hash>:
|
||||
# * 'AvailabilityZones'<~Array> - array of strings describing instances currently enabled
|
||||
def disable_availability_zones_for_load_balancer(availability_zones, lb_name)
|
||||
params = AWS.indexed_param('AvailabilityZones.member', [*availability_zones])
|
||||
params = Fog::AWS.indexed_param('AvailabilityZones.member', [*availability_zones])
|
||||
request({
|
||||
'Action' => 'DisableAvailabilityZonesForLoadBalancer',
|
||||
'LoadBalancerName' => lb_name,
|
||||
|
|
|
@ -19,7 +19,7 @@ module Fog
|
|||
# * 'EnableAvailabilityZonesForLoadBalancerResult'<~Hash>:
|
||||
# * 'AvailabilityZones'<~Array> - array of strings describing instances currently enabled
|
||||
def enable_availability_zones_for_load_balancer(availability_zones, lb_name)
|
||||
params = AWS.indexed_param('AvailabilityZones.member', [*availability_zones])
|
||||
params = Fog::AWS.indexed_param('AvailabilityZones.member', [*availability_zones])
|
||||
request({
|
||||
'Action' => 'EnableAvailabilityZonesForLoadBalancer',
|
||||
'LoadBalancerName' => lb_name,
|
||||
|
|
|
@ -20,7 +20,7 @@ module Fog
|
|||
# * 'Instances'<~Array> - array of hashes describing instances currently enabled
|
||||
# * 'InstanceId'<~String>
|
||||
def register_instances_with_load_balancer(instance_ids, lb_name)
|
||||
params = AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids])
|
||||
params = Fog::AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids])
|
||||
request({
|
||||
'Action' => 'RegisterInstancesWithLoadBalancer',
|
||||
'LoadBalancerName' => lb_name,
|
||||
|
|
|
@ -25,7 +25,7 @@ module Fog
|
|||
def set_load_balancer_policies_of_listener(lb_name, load_balancer_port, policy_names)
|
||||
params = {'LoadBalancerPort' => load_balancer_port}
|
||||
if policy_names.any?
|
||||
params.merge!(AWS.indexed_param('PolicyNames.member', policy_names))
|
||||
params.merge!(Fog::AWS.indexed_param('PolicyNames.member', policy_names))
|
||||
else
|
||||
params['PolicyNames'] = ''
|
||||
end
|
||||
|
|
|
@ -32,7 +32,7 @@ module Fog
|
|||
def create_db_instance(db_name, options={})
|
||||
|
||||
if security_groups = options.delete('DBSecurityGroups')
|
||||
options.merge!(AWS.indexed_param('DBSecurityGroups.member.%d', [*security_groups]))
|
||||
options.merge!(Fog::AWS.indexed_param('DBSecurityGroups.member.%d', [*security_groups]))
|
||||
end
|
||||
|
||||
request({
|
||||
|
|
|
@ -29,7 +29,7 @@ module Fog
|
|||
def modify_db_instance(db_name, apply_immediately, options={})
|
||||
|
||||
if security_groups = options.delete('DBSecurityGroups')
|
||||
options.merge!(AWS.indexed_param('DBSecurityGroups.member.%d', [*security_groups]))
|
||||
options.merge!(Fog::AWS.indexed_param('DBSecurityGroups.member.%d', [*security_groups]))
|
||||
end
|
||||
|
||||
request({
|
||||
|
|
|
@ -29,9 +29,9 @@ module Fog
|
|||
parameter_apply_methods.push(parameter['ApplyMethod'])
|
||||
end
|
||||
params = {}
|
||||
params.merge!(AWS.indexed_param('Parameters.member.%d.ParameterName', parameter_names))
|
||||
params.merge!(AWS.indexed_param('Parameters.member.%d.ParameterValue', parameter_values))
|
||||
params.merge!(AWS.indexed_param('Parameters.member.%d.ApplyMethod', parameter_apply_methods))
|
||||
params.merge!(Fog::AWS.indexed_param('Parameters.member.%d.ParameterName', parameter_names))
|
||||
params.merge!(Fog::AWS.indexed_param('Parameters.member.%d.ParameterValue', parameter_values))
|
||||
params.merge!(Fog::AWS.indexed_param('Parameters.member.%d.ApplyMethod', parameter_apply_methods))
|
||||
|
||||
request({
|
||||
'Action' => 'ModifyDBParameterGroup',
|
||||
|
|
|
@ -40,7 +40,7 @@ module Fog
|
|||
}
|
||||
|
||||
for key, values in destination
|
||||
params.merge!(AWS.indexed_param("Destination.#{key}.member", [*values]))
|
||||
params.merge!(Fog::AWS.indexed_param("Destination.#{key}.member", [*values]))
|
||||
end
|
||||
|
||||
for key, value in message['Subject']
|
||||
|
@ -54,7 +54,7 @@ module Fog
|
|||
end
|
||||
|
||||
if options.has_key?('ReplyToAddresses')
|
||||
params.merge!(AWS.indexed_param("ReplyToAddresses.member", [*options['ReplyToAddresses']]))
|
||||
params.merge!(Fog::AWS.indexed_param("ReplyToAddresses.member", [*options['ReplyToAddresses']]))
|
||||
end
|
||||
|
||||
if options.has_key?('ReturnPath')
|
||||
|
|
|
@ -22,7 +22,7 @@ module Fog
|
|||
def send_raw_email(raw_message, options = {})
|
||||
params = {}
|
||||
if options.has_key?('Destinations')
|
||||
params.merge!(AWS.indexed_param('Destinations.member', [*options['Destinations']]))
|
||||
params.merge!(Fog::AWS.indexed_param('Destinations.member', [*options['Destinations']]))
|
||||
end
|
||||
if options.has_key?('Source')
|
||||
params['Source'] = options['Source']
|
||||
|
|
|
@ -121,7 +121,7 @@ module Fog
|
|||
end
|
||||
|
||||
def encode_attribute_names(attributes)
|
||||
AWS.indexed_param('AttributeName', attributes.map {|attribute| attributes.to_s})
|
||||
Fog::AWS.indexed_param('AttributeName', attributes.map {|attribute| attributes.to_s})
|
||||
end
|
||||
|
||||
def encode_batch_attributes(items, replace_attributes = Hash.new([]))
|
||||
|
@ -155,7 +155,7 @@ module Fog
|
|||
idempotent = params.delete(:idempotent)
|
||||
parser = params.delete(:parser)
|
||||
|
||||
body = AWS.signed_params(
|
||||
body = Fog::AWS.signed_params(
|
||||
params,
|
||||
{
|
||||
:aws_access_key_id => @aws_access_key_id,
|
||||
|
|
|
@ -241,7 +241,7 @@ module Fog
|
|||
idempotent = params.delete(:idempotent)
|
||||
parser = params.delete(:parser)
|
||||
|
||||
body = AWS.signed_params(
|
||||
body = Fog::AWS.signed_params(
|
||||
params,
|
||||
{
|
||||
:aws_access_key_id => @aws_access_key_id,
|
||||
|
|
|
@ -24,7 +24,7 @@ module Fog
|
|||
Formatador.display_line("[yellow][WARN] describe_addresses with #{filters.class} param is deprecated, use describe_addresses('public-ip' => []) instead[/] [light_black](#{caller.first})[/]")
|
||||
filters = {'public-ip' => [*filters]}
|
||||
end
|
||||
params = AWS.indexed_filters(filters)
|
||||
params = Fog::AWS.indexed_filters(filters)
|
||||
request({
|
||||
'Action' => 'DescribeAddresses',
|
||||
:idempotent => true,
|
||||
|
|
|
@ -25,7 +25,7 @@ module Fog
|
|||
Formatador.display_line("[yellow][WARN] describe_availability_zones with #{filters.class} param is deprecated, use describe_availability_zones('zone-name' => []) instead[/] [light_black](#{caller.first})[/]")
|
||||
filters = {'public-ip' => [*filters]}
|
||||
end
|
||||
params = AWS.indexed_filters(filters)
|
||||
params = Fog::AWS.indexed_filters(filters)
|
||||
request({
|
||||
'Action' => 'DescribeAvailabilityZones',
|
||||
:idempotent => true,
|
||||
|
|
|
@ -45,7 +45,7 @@ module Fog
|
|||
options[key] = filters.delete(key)
|
||||
end
|
||||
end
|
||||
params = AWS.indexed_filters(filters).merge!(options)
|
||||
params = Fog::AWS.indexed_filters(filters).merge!(options)
|
||||
request({
|
||||
'Action' => 'DescribeImages',
|
||||
:idempotent => true,
|
||||
|
|
|
@ -62,7 +62,7 @@ module Fog
|
|||
if filters['instance-id'] && !filters['instance-id'].is_a?(Array)
|
||||
params.merge!('InstanceId' => filters.delete('instance-id'))
|
||||
end
|
||||
params.merge!(AWS.indexed_filters(filters))
|
||||
params.merge!(Fog::AWS.indexed_filters(filters))
|
||||
|
||||
request({
|
||||
'Action' => 'DescribeInstances',
|
||||
|
|
|
@ -24,7 +24,7 @@ module Fog
|
|||
Formatador.display_line("[yellow][WARN] describe_key_pairs with #{filters.class} param is deprecated, use describe_key_pairs('key-name' => []) instead[/] [light_black](#{caller.first})[/]")
|
||||
filters = {'key-name' => [*filters]}
|
||||
end
|
||||
params = AWS.indexed_filters(filters)
|
||||
params = Fog::AWS.indexed_filters(filters)
|
||||
request({
|
||||
'Action' => 'DescribeKeyPairs',
|
||||
:idempotent => true,
|
||||
|
|
|
@ -24,7 +24,7 @@ module Fog
|
|||
Formatador.display_line("[yellow][WARN] describe_regions with #{filters.class} param is deprecated, use describe_regions('region-name' => []) instead[/] [light_black](#{caller.first})[/]")
|
||||
filters = {'region-name' => [*filters]}
|
||||
end
|
||||
params = AWS.indexed_filters(filters)
|
||||
params = Fog::AWS.indexed_filters(filters)
|
||||
request({
|
||||
'Action' => 'DescribeRegions',
|
||||
:idempotent => true,
|
||||
|
|
|
@ -32,7 +32,7 @@ module Fog
|
|||
Formatador.display_line("[yellow][WARN] describe_reserved_instances with #{filters.class} param is deprecated, use describe_reserved_instances('reserved-instances-id' => []) instead[/] [light_black](#{caller.first})[/]")
|
||||
filters = {'reserved-instances-id' => [*filters]}
|
||||
end
|
||||
params = AWS.indexed_filters(filters)
|
||||
params = Fog::AWS.indexed_filters(filters)
|
||||
request({
|
||||
'Action' => 'DescribeReservedInstances',
|
||||
:idempotent => true,
|
||||
|
|
|
@ -25,7 +25,7 @@ module Fog
|
|||
#
|
||||
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeReservedInstancesOfferings.html]
|
||||
def describe_reserved_instances_offerings(filters = {})
|
||||
params = AWS.indexed_filters(filters)
|
||||
params = Fog::AWS.indexed_filters(filters)
|
||||
request({
|
||||
'Action' => 'DescribeReservedInstancesOfferings',
|
||||
:idempotent => true,
|
||||
|
|
|
@ -34,7 +34,7 @@ module Fog
|
|||
Formatador.display_line("[yellow][WARN] describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead[/] [light_black](#{caller.first})[/]")
|
||||
filters = {'group-name' => [*filters]}
|
||||
end
|
||||
params = AWS.indexed_filters(filters)
|
||||
params = Fog::AWS.indexed_filters(filters)
|
||||
request({
|
||||
'Action' => 'DescribeSecurityGroups',
|
||||
:idempotent => true,
|
||||
|
|
|
@ -40,7 +40,7 @@ module Fog
|
|||
end
|
||||
end
|
||||
options['RestorableBy'] ||= 'self'
|
||||
params = AWS.indexed_filters(filters).merge!(options)
|
||||
params = Fog::AWS.indexed_filters(filters).merge!(options)
|
||||
request({
|
||||
'Action' => 'DescribeSnapshots',
|
||||
:idempotent => true,
|
||||
|
|
|
@ -22,7 +22,7 @@ module Fog
|
|||
#
|
||||
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html]
|
||||
def describe_tags(filters = {})
|
||||
params = AWS.indexed_filters(filters)
|
||||
params = Fog::AWS.indexed_filters(filters)
|
||||
request({
|
||||
'Action' => 'DescribeTags',
|
||||
:idempotent => true,
|
||||
|
|
|
@ -34,7 +34,7 @@ module Fog
|
|||
Formatador.display_line("[yellow][WARN] describe_volumes with #{filters.class} param is deprecated, use describe_volumes('volume-id' => []) instead[/] [light_black](#{caller.first})[/]")
|
||||
filters = {'volume-id' => [*filters]}
|
||||
end
|
||||
params = AWS.indexed_filters(filters)
|
||||
params = Fog::AWS.indexed_filters(filters)
|
||||
request({
|
||||
'Action' => 'DescribeVolumes',
|
||||
:idempotent => true,
|
||||
|
|
|
@ -18,9 +18,9 @@ module Fog
|
|||
#
|
||||
def modify_image_attributes(image_id, attribute, operation_type, options = {})
|
||||
params = {}
|
||||
params.merge!(AWS.indexed_param('UserId', options['UserId']))
|
||||
params.merge!(AWS.indexed_param('UserGroup', options['UserGroup']))
|
||||
params.merge!(AWS.indexed_param('ProductCode', options['ProductCode']))
|
||||
params.merge!(Fog::AWS.indexed_param('UserId', options['UserId']))
|
||||
params.merge!(Fog::AWS.indexed_param('UserGroup', options['UserGroup']))
|
||||
params.merge!(Fog::AWS.indexed_param('ProductCode', options['ProductCode']))
|
||||
request({
|
||||
'Action' => 'ModifyImageAttribute',
|
||||
'Attribute' => attribute,
|
||||
|
|
|
@ -18,7 +18,7 @@ module Fog
|
|||
#
|
||||
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html]
|
||||
def stop_instances(instance_id)
|
||||
params = AWS.indexed_param('InstanceId', instance_id)
|
||||
params = Fog::AWS.indexed_param('InstanceId', instance_id)
|
||||
request({
|
||||
'Action' => 'StopInstances',
|
||||
:idempotent => true,
|
||||
|
|
Loading…
Add table
Reference in a new issue