Module: Fog::AWS

Extended by:
Provider
Defined in:
lib/fog/aws/elb.rb,
lib/fog/aws/iam.rb,
lib/fog/aws/ses.rb,
lib/fog/cdn/aws.rb,
lib/fog/dns/aws.rb,
lib/fog/compute/aws.rb,
lib/fog/storage/aws.rb,
lib/fog/aws/simpledb.rb,
lib/fog/providers/aws.rb,
lib/fog/dns/models/aws/zone.rb,
lib/fog/dns/models/aws/zones.rb,
lib/fog/dns/models/aws/record.rb,
lib/fog/compute/models/aws/tag.rb,
lib/fog/dns/models/aws/records.rb,
lib/fog/compute/models/aws/tags.rb,
lib/fog/storage/models/aws/file.rb,
lib/fog/compute/models/aws/image.rb,
lib/fog/storage/models/aws/files.rb,
lib/fog/aws/requests/iam/get_user.rb,
lib/fog/compute/models/aws/flavor.rb,
lib/fog/compute/models/aws/images.rb,
lib/fog/compute/models/aws/server.rb,
lib/fog/compute/models/aws/volume.rb,
lib/fog/aws/requests/iam/get_group.rb,
lib/fog/compute/models/aws/address.rb,
lib/fog/compute/models/aws/flavors.rb,
lib/fog/compute/models/aws/servers.rb,
lib/fog/compute/models/aws/volumes.rb,
lib/fog/aws/requests/iam/list_users.rb,
lib/fog/aws/requests/ses/send_email.rb,
lib/fog/compute/models/aws/key_pair.rb,
lib/fog/compute/models/aws/snapshot.rb,
lib/fog/dns/requests/aws/get_change.rb,
lib/fog/aws/requests/iam/create_user.rb,
lib/fog/aws/requests/iam/delete_user.rb,
lib/fog/aws/requests/iam/list_groups.rb,
lib/fog/aws/requests/iam/update_user.rb,
lib/fog/aws/requests/simpledb/select.rb,
lib/fog/compute/models/aws/addresses.rb,
lib/fog/compute/models/aws/key_pairs.rb,
lib/fog/compute/models/aws/snapshots.rb,
lib/fog/storage/models/aws/directory.rb,
lib/fog/aws/requests/iam/create_group.rb,
lib/fog/aws/requests/iam/delete_group.rb,
lib/fog/aws/requests/iam/update_group.rb,
lib/fog/storage/models/aws/directories.rb,
lib/fog/aws/requests/ses/get_send_quota.rb,
lib/fog/aws/requests/ses/send_raw_email.rb,
lib/fog/storage/requests/aws/get_bucket.rb,
lib/fog/storage/requests/aws/get_object.rb,
lib/fog/storage/requests/aws/list_parts.rb,
lib/fog/storage/requests/aws/put_bucket.rb,
lib/fog/storage/requests/aws/put_object.rb,
lib/fog/storage/requests/aws/sync_clock.rb,
lib/fog/aws/requests/iam/get_user_policy.rb,
lib/fog/aws/requests/iam/put_user_policy.rb,
lib/fog/compute/requests/aws/create_tags.rb,
lib/fog/compute/requests/aws/delete_tags.rb,
lib/fog/dns/requests/aws/get_hosted_zone.rb,
lib/fog/storage/requests/aws/copy_object.rb,
lib/fog/storage/requests/aws/get_service.rb,
lib/fog/storage/requests/aws/head_object.rb,
lib/fog/storage/requests/aws/upload_part.rb,
lib/fog/aws/requests/iam/list_access_keys.rb,
lib/fog/aws/requests/iam/put_group_policy.rb,
lib/fog/cdn/requests/aws/get_distribution.rb,
lib/fog/compute/models/aws/security_group.rb,
lib/fog/compute/requests/aws/create_image.rb,
lib/fog/aws/requests/iam/add_user_to_group.rb,
lib/fog/aws/requests/iam/create_access_key.rb,
lib/fog/aws/requests/iam/delete_access_key.rb,
lib/fog/aws/requests/iam/update_access_key.rb,
lib/fog/aws/requests/simpledb/list_domains.rb,
lib/fog/cdn/requests/aws/post_distribution.rb,
lib/fog/cdn/requests/aws/post_invalidation.rb,
lib/fog/compute/models/aws/security_groups.rb,
lib/fog/compute/requests/aws/attach_volume.rb,
lib/fog/compute/requests/aws/create_volume.rb,
lib/fog/compute/requests/aws/delete_volume.rb,
lib/fog/compute/requests/aws/describe_tags.rb,
lib/fog/compute/requests/aws/detach_volume.rb,
lib/fog/compute/requests/aws/run_instances.rb,
lib/fog/dns/requests/aws/list_hosted_zones.rb,
lib/fog/storage/requests/aws/delete_bucket.rb,
lib/fog/storage/requests/aws/delete_object.rb,
lib/fog/aws/requests/iam/delete_user_policy.rb,
lib/fog/aws/requests/iam/list_user_policies.rb,
lib/fog/aws/requests/simpledb/create_domain.rb,
lib/fog/aws/requests/simpledb/delete_domain.rb,
lib/fog/compute/requests/aws/register_image.rb,
lib/fog/compute/requests/aws/stop_instances.rb,
lib/fog/dns/requests/aws/create_hosted_zone.rb,
lib/fog/dns/requests/aws/delete_hosted_zone.rb,
lib/fog/storage/requests/aws/get_bucket_acl.rb,
lib/fog/storage/requests/aws/get_object_acl.rb,
lib/fog/storage/requests/aws/get_object_url.rb,
lib/fog/storage/requests/aws/put_bucket_acl.rb,
lib/fog/storage/requests/aws/put_object_acl.rb,
lib/fog/storage/requests/aws/put_object_url.rb,
lib/fog/aws/requests/iam/delete_group_policy.rb,
lib/fog/aws/requests/iam/list_group_policies.rb,
lib/fog/aws/requests/ses/get_send_statistics.rb,
lib/fog/aws/requests/simpledb/get_attributes.rb,
lib/fog/aws/requests/simpledb/put_attributes.rb,
lib/fog/cdn/requests/aws/delete_distribution.rb,
lib/fog/compute/requests/aws/create_key_pair.rb,
lib/fog/compute/requests/aws/create_snapshot.rb,
lib/fog/compute/requests/aws/delete_key_pair.rb,
lib/fog/compute/requests/aws/delete_snapshot.rb,
lib/fog/compute/requests/aws/describe_images.rb,
lib/fog/compute/requests/aws/import_key_pair.rb,
lib/fog/compute/requests/aws/release_address.rb,
lib/fog/compute/requests/aws/start_instances.rb,
lib/fog/aws/requests/elb/create_load_balancer.rb,
lib/fog/aws/requests/elb/delete_load_balancer.rb,
lib/fog/aws/requests/iam/list_groups_for_user.rb,
lib/fog/aws/requests/ses/verify_email_address.rb,
lib/fog/aws/requests/simpledb/domain_metadata.rb,
lib/fog/compute/requests/aws/allocate_address.rb,
lib/fog/compute/requests/aws/deregister_image.rb,
lib/fog/compute/requests/aws/describe_regions.rb,
lib/fog/compute/requests/aws/describe_volumes.rb,
lib/fog/compute/requests/aws/reboot_instances.rb,
lib/fog/cdn/requests/aws/get_distribution_list.rb,
lib/fog/compute/requests/aws/associate_address.rb,
lib/fog/aws/requests/iam/remove_user_from_group.rb,
lib/fog/aws/requests/simpledb/delete_attributes.rb,
lib/fog/compute/requests/aws/describe_addresses.rb,
lib/fog/compute/requests/aws/describe_instances.rb,
lib/fog/compute/requests/aws/describe_key_pairs.rb,
lib/fog/compute/requests/aws/describe_snapshots.rb,
lib/fog/compute/requests/aws/get_console_output.rb,
lib/fog/storage/requests/aws/get_bucket_logging.rb,
lib/fog/storage/requests/aws/get_bucket_website.rb,
lib/fog/storage/requests/aws/get_object_torrent.rb,
lib/fog/storage/requests/aws/put_bucket_logging.rb,
lib/fog/storage/requests/aws/put_bucket_website.rb,
lib/fog/aws/requests/elb/describe_load_balancers.rb,
lib/fog/cdn/requests/aws/put_distribution_config.rb,
lib/fog/compute/requests/aws/terminate_instances.rb,
lib/fog/storage/requests/aws/get_bucket_location.rb,
lib/fog/storage/requests/aws/get_request_payment.rb,
lib/fog/storage/requests/aws/put_request_payment.rb,
lib/fog/aws/requests/elb/describe_instance_health.rb,
lib/fog/compute/requests/aws/disassociate_address.rb,
lib/fog/aws/requests/iam/list_signing_certificates.rb,
lib/fog/aws/requests/simpledb/batch_put_attributes.rb,
lib/fog/compute/requests/aws/create_security_group.rb,
lib/fog/compute/requests/aws/delete_security_group.rb,
lib/fog/dns/requests/aws/list_resource_record_sets.rb,
lib/fog/storage/requests/aws/delete_bucket_website.rb,
lib/fog/storage/requests/aws/get_bucket_versioning.rb,
lib/fog/storage/requests/aws/put_bucket_versioning.rb,
lib/fog/aws/requests/iam/delete_signing_certificate.rb,
lib/fog/aws/requests/iam/update_signing_certificate.rb,
lib/fog/aws/requests/iam/upload_signing_certificate.rb,
lib/fog/storage/requests/aws/abort_multipart_upload.rb,
lib/fog/storage/requests/aws/list_multipart_uploads.rb,
lib/fog/compute/requests/aws/modify_image_attributes.rb,
lib/fog/dns/requests/aws/change_resource_record_sets.rb,
lib/fog/compute/requests/aws/describe_security_groups.rb,
lib/fog/aws/requests/ses/delete_verified_email_address.rb,
lib/fog/aws/requests/ses/list_verified_email_addresses.rb,
lib/fog/compute/requests/aws/modify_snapshot_attribute.rb,
lib/fog/storage/requests/aws/complete_multipart_upload.rb,
lib/fog/storage/requests/aws/initiate_multipart_upload.rb,
lib/fog/storage/requests/aws/post_object_hidden_fields.rb,
lib/fog/storage/requests/aws/get_bucket_object_versions.rb,
lib/fog/compute/requests/aws/describe_availability_zones.rb,
lib/fog/compute/requests/aws/describe_reserved_instances.rb,
lib/fog/compute/requests/aws/revoke_security_group_ingress.rb,
lib/fog/compute/requests/aws/authorize_security_group_ingress.rb,
lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb,
lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb,
lib/fog/compute/requests/aws/describe_reserved_instances_offerings.rb,
lib/fog/aws/requests/elb/enable_availability_zones_for_load_balancer.rb,
lib/fog/aws/requests/elb/disable_availability_zones_for_load_balancer.rb

Defined Under Namespace

Classes: CDN, Compute, DNS, ELB, IAM, Mock, SES, SimpleDB, Storage

Class Method Summary collapse

Methods included from Provider

extended, service, services

Class Method Details

.indexed_filters(filters) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fog/providers/aws.rb', line 29

def self.indexed_filters(filters)
  params = {}
  filters.keys.each_with_index do |key, key_index|
    key_index += 1
    params[format('Filter.%d.Name', key_index)] = key
    [*filters[key]].each_with_index do |value, value_index|
      value_index += 1
      params[format('Filter.%d.Value.%d', key_index, value_index)] = value
    end
  end
  params
end

.indexed_param(key, values) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/providers/aws.rb', line 18

def self.indexed_param(key, values)
  params = {}
  unless key.include?('%d')
    key << '.%d'
  end
  [*values].each_with_index do |value, index|
    params[format(key, index + 1)] = value
  end
  params
end

.signed_params(params, options = {}) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/fog/providers/aws.rb', line 42

def self.signed_params(params, options = {})
  params.merge!({
    'AWSAccessKeyId'    => options[:aws_access_key_id],
    'SignatureMethod'   => 'HmacSHA256',
    'SignatureVersion'  => '2',
    'Timestamp'         => Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ"),
    'Version'           => options[:version]
  })

  body = ''
  for key in params.keys.sort
    unless (value = params[key]).nil?
      body << "#{key}=#{CGI.escape(value.to_s).gsub(/\+/, '%20')}&"
    end
  end
  string_to_sign = "POST\n#{options[:host]}:#{options[:port]}\n#{options[:path]}\n" << body.chop
  signed_string = options[:hmac].sign(string_to_sign)
  body << "Signature=#{CGI.escape(Base64.encode64(signed_string).chomp!).gsub(/\+/, '%20')}"

  body
end