Module: Fog::AWS

Extended by:
Provider
Defined in:
lib/fog/aws.rb,
lib/fog/aws/elb.rb,
lib/fog/aws/emr.rb,
lib/fog/aws/iam.rb,
lib/fog/aws/rds.rb,
lib/fog/aws/ses.rb,
lib/fog/aws/sns.rb,
lib/fog/aws/sqs.rb,
lib/fog/aws/sts.rb,
lib/fog/aws/dynamodb.rb,
lib/fog/aws/simpledb.rb,
lib/fog/aws/beanstalk.rb,
lib/fog/aws/cloud_watch.rb,
lib/fog/aws/elasticache.rb,
lib/fog/aws/auto_scaling.rb,
lib/fog/aws/cloud_formation.rb,
lib/fog/aws/models/iam/user.rb,
lib/fog/aws/models/iam/users.rb,
lib/fog/aws/models/elb/policy.rb,
lib/fog/aws/models/iam/policy.rb,
lib/fog/aws/models/rds/server.rb,
lib/fog/aws/credential_fetcher.rb,
lib/fog/aws/models/rds/servers.rb,
lib/fog/aws/models/elb/listener.rb,
lib/fog/aws/models/elb/policies.rb,
lib/fog/aws/models/iam/policies.rb,
lib/fog/aws/models/rds/snapshot.rb,
lib/fog/aws/models/elb/listeners.rb,
lib/fog/aws/models/rds/parameter.rb,
lib/fog/aws/models/rds/snapshots.rb,
lib/fog/aws/requests/sns/publish.rb,
lib/fog/aws/models/iam/access_key.rb,
lib/fog/aws/models/rds/parameters.rb,
lib/fog/aws/requests/iam/get_role.rb,
lib/fog/aws/requests/iam/get_user.rb,
lib/fog/aws/models/beanstalk/event.rb,
lib/fog/aws/models/iam/access_keys.rb,
lib/fog/aws/requests/dynamodb/scan.rb,
lib/fog/aws/requests/iam/get_group.rb,
lib/fog/aws/requests/sns/subscribe.rb,
lib/fog/aws/models/beanstalk/events.rb,
lib/fog/aws/requests/dynamodb/query.rb,
lib/fog/aws/requests/iam/list_roles.rb,
lib/fog/aws/requests/iam/list_users.rb,
lib/fog/aws/requests/ses/send_email.rb,
lib/fog/aws/models/beanstalk/version.rb,
lib/fog/aws/models/cloud_watch/alarm.rb,
lib/fog/aws/models/elb/load_balancer.rb,
lib/fog/aws/requests/iam/create_role.rb,
lib/fog/aws/requests/iam/create_user.rb,
lib/fog/aws/requests/iam/delete_role.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/aws/requests/sns/list_topics.rb,
lib/fog/aws/requests/sns/unsubscribe.rb,
lib/fog/aws/requests/sqs/list_queues.rb,
lib/fog/aws/models/auto_scaling/group.rb,
lib/fog/aws/models/beanstalk/template.rb,
lib/fog/aws/models/beanstalk/versions.rb,
lib/fog/aws/models/cloud_watch/alarms.rb,
lib/fog/aws/models/cloud_watch/metric.rb,
lib/fog/aws/models/elb/load_balancers.rb,
lib/fog/aws/models/rds/security_group.rb,
lib/fog/aws/requests/emr/run_job_flow.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/aws/requests/sns/create_topic.rb,
lib/fog/aws/requests/sns/delete_topic.rb,
lib/fog/aws/requests/sqs/create_queue.rb,
lib/fog/aws/requests/sqs/delete_queue.rb,
lib/fog/aws/requests/sqs/send_message.rb,
lib/fog/aws/models/auto_scaling/groups.rb,
lib/fog/aws/models/beanstalk/templates.rb,
lib/fog/aws/models/cloud_watch/metrics.rb,
lib/fog/aws/models/elasticache/cluster.rb,
lib/fog/aws/models/rds/parameter_group.rb,
lib/fog/aws/models/rds/security_groups.rb,
lib/fog/aws/requests/dynamodb/get_item.rb,
lib/fog/aws/requests/dynamodb/put_item.rb,
lib/fog/aws/models/elasticache/clusters.rb,
lib/fog/aws/models/rds/parameter_groups.rb,
lib/fog/aws/requests/ses/get_send_quota.rb,
lib/fog/aws/requests/ses/send_raw_email.rb,
lib/fog/aws/requests/sns/add_permission.rb,
lib/fog/aws/requests/sqs/delete_message.rb,
lib/fog/aws/models/auto_scaling/activity.rb,
lib/fog/aws/models/auto_scaling/instance.rb,
lib/fog/aws/models/beanstalk/application.rb,
lib/fog/aws/models/beanstalk/environment.rb,
lib/fog/aws/requests/iam/get_role_policy.rb,
lib/fog/aws/requests/iam/get_user_policy.rb,
lib/fog/aws/requests/iam/put_role_policy.rb,
lib/fog/aws/requests/iam/put_user_policy.rb,
lib/fog/aws/requests/sqs/receive_message.rb,
lib/fog/aws/models/auto_scaling/instances.rb,
lib/fog/aws/models/beanstalk/applications.rb,
lib/fog/aws/models/beanstalk/environments.rb,
lib/fog/aws/models/cloud_watch/alarm_data.rb,
lib/fog/aws/requests/dynamodb/delete_item.rb,
lib/fog/aws/requests/dynamodb/list_tables.rb,
lib/fog/aws/requests/dynamodb/update_item.rb,
lib/fog/aws/requests/iam/get_group_policy.rb,
lib/fog/aws/requests/iam/list_access_keys.rb,
lib/fog/aws/requests/iam/put_group_policy.rb,
lib/fog/aws/models/auto_scaling/activities.rb,
lib/fog/aws/models/cloud_watch/alarm_datum.rb,
lib/fog/aws/requests/dynamodb/create_table.rb,
lib/fog/aws/requests/dynamodb/delete_table.rb,
lib/fog/aws/requests/dynamodb/update_table.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/get_login_profile.rb,
lib/fog/aws/requests/iam/update_access_key.rb,
lib/fog/aws/requests/simpledb/list_domains.rb,
lib/fog/aws/requests/sns/remove_permission.rb,
lib/fog/aws/requests/sts/get_session_token.rb,
lib/fog/aws/requests/emr/add_job_flow_steps.rb,
lib/fog/aws/requests/emr/describe_job_flows.rb,
lib/fog/aws/requests/iam/delete_role_policy.rb,
lib/fog/aws/requests/iam/delete_user_policy.rb,
lib/fog/aws/requests/iam/list_role_policies.rb,
lib/fog/aws/requests/iam/list_user_policies.rb,
lib/fog/aws/requests/rds/create_db_instance.rb,
lib/fog/aws/requests/rds/create_db_snapshot.rb,
lib/fog/aws/requests/rds/delete_db_instance.rb,
lib/fog/aws/requests/rds/delete_db_snapshot.rb,
lib/fog/aws/requests/rds/modify_db_instance.rb,
lib/fog/aws/requests/rds/reboot_db_instance.rb,
lib/fog/aws/requests/simpledb/create_domain.rb,
lib/fog/aws/requests/simpledb/delete_domain.rb,
lib/fog/aws/requests/sns/list_subscriptions.rb,
lib/fog/aws/models/cloud_watch/alarm_history.rb,
lib/fog/aws/requests/dynamodb/batch_get_item.rb,
lib/fog/aws/requests/dynamodb/describe_table.rb,
lib/fog/aws/requests/emr/add_instance_groups.rb,
lib/fog/aws/requests/emr/terminate_job_flows.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/aws/models/auto_scaling/configuration.rb,
lib/fog/aws/models/elasticache/security_group.rb,
lib/fog/aws/requests/cloud_watch/list_metrics.rb,
lib/fog/aws/requests/elb/create_load_balancer.rb,
lib/fog/aws/requests/elb/delete_load_balancer.rb,
lib/fog/aws/requests/iam/create_account_alias.rb,
lib/fog/aws/requests/iam/create_login_profile.rb,
lib/fog/aws/requests/iam/delete_account_alias.rb,
lib/fog/aws/requests/iam/delete_login_profile.rb,
lib/fog/aws/requests/iam/get_instance_profile.rb,
lib/fog/aws/requests/iam/list_account_aliases.rb,
lib/fog/aws/requests/iam/list_groups_for_user.rb,
lib/fog/aws/requests/iam/update_login_profile.rb,
lib/fog/aws/requests/ses/verify_email_address.rb,
lib/fog/aws/requests/simpledb/domain_metadata.rb,
lib/fog/aws/requests/sns/confirm_subscription.rb,
lib/fog/aws/requests/sns/get_topic_attributes.rb,
lib/fog/aws/requests/sns/set_topic_attributes.rb,
lib/fog/aws/requests/sqs/get_queue_attributes.rb,
lib/fog/aws/requests/sqs/set_queue_attributes.rb,
lib/fog/aws/requests/sts/get_federation_token.rb,
lib/fog/aws/models/auto_scaling/configurations.rb,
lib/fog/aws/models/cloud_watch/alarm_histories.rb,
lib/fog/aws/models/elasticache/parameter_group.rb,
lib/fog/aws/models/elasticache/security_groups.rb,
lib/fog/aws/requests/beanstalk/describe_events.rb,
lib/fog/aws/requests/cloud_watch/delete_alarms.rb,
lib/fog/aws/requests/dynamodb/batch_write_item.rb,
lib/fog/aws/requests/rds/describe_db_instances.rb,
lib/fog/aws/requests/rds/describe_db_snapshots.rb,
lib/fog/aws/models/cloud_watch/metric_statistic.rb,
lib/fog/aws/models/elasticache/parameter_groups.rb,
lib/fog/aws/requests/auto_scaling/delete_policy.rb,
lib/fog/aws/requests/elb/configure_health_check.rb,
lib/fog/aws/requests/emr/modify_instance_groups.rb,
lib/fog/aws/requests/iam/get_server_certificate.rb,
lib/fog/aws/requests/iam/list_instance_profiles.rb,
lib/fog/aws/requests/iam/remove_user_from_group.rb,
lib/fog/aws/requests/rds/describe_db_parameters.rb,
lib/fog/aws/requests/simpledb/delete_attributes.rb,
lib/fog/aws/models/cloud_watch/metric_statistics.rb,
lib/fog/aws/requests/auto_scaling/execute_policy.rb,
lib/fog/aws/requests/cloud_watch/describe_alarms.rb,
lib/fog/aws/requests/cloud_watch/put_metric_data.rb,
lib/fog/aws/requests/cloud_watch/set_alarm_state.rb,
lib/fog/aws/requests/elasticache/describe_events.rb,
lib/fog/aws/requests/elb/describe_load_balancers.rb,
lib/fog/aws/requests/iam/create_instance_profile.rb,
lib/fog/aws/requests/iam/delete_instance_profile.rb,
lib/fog/aws/requests/beanstalk/create_application.rb,
lib/fog/aws/requests/beanstalk/create_environment.rb,
lib/fog/aws/requests/beanstalk/delete_application.rb,
lib/fog/aws/requests/beanstalk/restart_app_server.rb,
lib/fog/aws/requests/beanstalk/update_application.rb,
lib/fog/aws/requests/beanstalk/update_environment.rb,
lib/fog/aws/requests/cloud_formation/create_stack.rb,
lib/fog/aws/requests/cloud_formation/delete_stack.rb,
lib/fog/aws/requests/cloud_formation/get_template.rb,
lib/fog/aws/requests/cloud_formation/update_stack.rb,
lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb,
lib/fog/aws/requests/elb/describe_instance_health.rb,
lib/fog/aws/requests/iam/list_server_certificates.rb,
lib/fog/aws/requests/rds/create_db_security_group.rb,
lib/fog/aws/requests/rds/delete_db_security_group.rb,
lib/fog/aws/requests/auto_scaling/resume_processes.rb,
lib/fog/aws/requests/beanstalk/rebuild_environment.rb,
lib/fog/aws/requests/iam/delete_server_certificate.rb,
lib/fog/aws/requests/iam/list_signing_certificates.rb,
lib/fog/aws/requests/iam/update_server_certificate.rb,
lib/fog/aws/requests/iam/upload_server_certificate.rb,
lib/fog/aws/requests/rds/create_db_parameter_group.rb,
lib/fog/aws/requests/rds/delete_db_parameter_group.rb,
lib/fog/aws/requests/rds/modify_db_parameter_group.rb,
lib/fog/aws/requests/simpledb/batch_put_attributes.rb,
lib/fog/aws/requests/sqs/change_message_visibility.rb,
lib/fog/aws/requests/auto_scaling/describe_policies.rb,
lib/fog/aws/requests/auto_scaling/suspend_processes.rb,
lib/fog/aws/requests/emr/set_termination_protection.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/aws/requests/auto_scaling/put_scaling_policy.rb,
lib/fog/aws/requests/beanstalk/describe_applications.rb,
lib/fog/aws/requests/beanstalk/describe_environments.rb,
lib/fog/aws/requests/beanstalk/terminate_environment.rb,
lib/fog/aws/requests/cloud_formation/describe_stacks.rb,
lib/fog/aws/requests/elb/create_load_balancer_policy.rb,
lib/fog/aws/requests/elb/delete_load_balancer_policy.rb,
lib/fog/aws/requests/rds/describe_db_engine_versions.rb,
lib/fog/aws/requests/rds/describe_db_security_groups.rb,
lib/fog/aws/requests/sns/list_subscriptions_by_topic.rb,
lib/fog/aws/requests/auto_scaling/set_instance_health.rb,
lib/fog/aws/requests/beanstalk/check_dns_availability.rb,
lib/fog/aws/requests/cloud_watch/enable_alarm_actions.rb,
lib/fog/aws/requests/elasticache/create_cache_cluster.rb,
lib/fog/aws/requests/elasticache/delete_cache_cluster.rb,
lib/fog/aws/requests/elasticache/modify_cache_cluster.rb,
lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb,
lib/fog/aws/requests/iam/add_role_to_instance_profile.rb,
lib/fog/aws/requests/rds/describe_db_parameter_groups.rb,
lib/fog/aws/requests/auto_scaling/set_desired_capacity.rb,
lib/fog/aws/requests/beanstalk/create_storage_location.rb,
lib/fog/aws/requests/beanstalk/swap_environment_cnames.rb,
lib/fog/aws/requests/cloud_formation/validate_template.rb,
lib/fog/aws/requests/cloud_watch/disable_alarm_actions.rb,
lib/fog/aws/requests/cloud_watch/get_metric_statistics.rb,
lib/fog/aws/requests/ses/delete_verified_email_address.rb,
lib/fog/aws/requests/ses/list_verified_email_addresses.rb,
lib/fog/aws/requests/beanstalk/request_environment_info.rb,
lib/fog/aws/requests/cloud_watch/describe_alarm_history.rb,
lib/fog/aws/requests/elb/create_load_balancer_listeners.rb,
lib/fog/aws/requests/elb/delete_load_balancer_listeners.rb,
lib/fog/aws/requests/rds/describe_db_reserved_instances.rb,
lib/fog/aws/requests/beanstalk/retrieve_environment_info.rb,
lib/fog/aws/requests/elasticache/describe_cache_clusters.rb,
lib/fog/aws/requests/elb/attach_load_balancer_to_subnets.rb,
lib/fog/aws/requests/elb/describe_load_balancer_policies.rb,
lib/fog/aws/requests/iam/list_instance_profiles_for_role.rb,
lib/fog/aws/requests/rds/create_db_instance_read_replica.rb,
lib/fog/aws/requests/auto_scaling/delete_scheduled_action.rb,
lib/fog/aws/requests/beanstalk/create_application_version.rb,
lib/fog/aws/requests/beanstalk/delete_application_version.rb,
lib/fog/aws/requests/beanstalk/update_application_version.rb,
lib/fog/aws/requests/rds/revoke_db_security_group_ingress.rb,
lib/fog/aws/requests/cloud_formation/describe_stack_events.rb,
lib/fog/aws/requests/elasticache/describe_cache_parameters.rb,
lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb,
lib/fog/aws/requests/iam/remove_role_from_instance_profile.rb,
lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb,
lib/fog/aws/requests/auto_scaling/delete_auto_scaling_group.rb,
lib/fog/aws/requests/auto_scaling/describe_adjustment_types.rb,
lib/fog/aws/requests/auto_scaling/enable_metrics_collection.rb,
lib/fog/aws/requests/auto_scaling/update_auto_scaling_group.rb,
lib/fog/aws/requests/cloud_watch/describe_alarms_for_metric.rb,
lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb,
lib/fog/aws/requests/auto_scaling/describe_scheduled_actions.rb,
lib/fog/aws/requests/auto_scaling/disable_metrics_collection.rb,
lib/fog/aws/requests/beanstalk/create_configuration_template.rb,
lib/fog/aws/requests/beanstalk/delete_configuration_template.rb,
lib/fog/aws/requests/beanstalk/describe_application_versions.rb,
lib/fog/aws/requests/beanstalk/update_configuration_template.rb,
lib/fog/aws/requests/elasticache/create_cache_security_group.rb,
lib/fog/aws/requests/elasticache/delete_cache_security_group.rb,
lib/fog/aws/requests/elasticache/reset_cache_parameter_group.rb,
lib/fog/aws/requests/elb/create_app_cookie_stickiness_policy.rb,
lib/fog/aws/requests/elb/describe_load_balancer_policy_types.rb,
lib/fog/aws/requests/rds/authorize_db_security_group_ingress.rb,
lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb,
lib/fog/aws/requests/auto_scaling/delete_launch_configuration.rb,
lib/fog/aws/requests/auto_scaling/describe_scaling_activities.rb,
lib/fog/aws/requests/beanstalk/describe_configuration_options.rb,
lib/fog/aws/requests/beanstalk/describe_environment_resources.rb,
lib/fog/aws/requests/beanstalk/list_available_solution_stacks.rb,
lib/fog/aws/requests/cloud_formation/describe_stack_resources.rb,
lib/fog/aws/requests/elasticache/create_cache_parameter_group.rb,
lib/fog/aws/requests/elasticache/delete_cache_parameter_group.rb,
lib/fog/aws/requests/elasticache/modify_cache_parameter_group.rb,
lib/fog/aws/requests/rds/restore_db_instance_from_db_snapshot.rb,
lib/fog/aws/requests/rds/restore_db_instance_to_point_in_time.rb,
lib/fog/aws/requests/auto_scaling/describe_auto_scaling_groups.rb,
lib/fog/aws/requests/beanstalk/describe_configuration_settings.rb,
lib/fog/aws/requests/beanstalk/validate_configuration_settings.rb,
lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb,
lib/fog/aws/requests/beanstalk/delete_environment_configuration.rb,
lib/fog/aws/requests/elasticache/describe_cache_security_groups.rb,
lib/fog/aws/requests/elb/apply_security_groups_to_load_balancer.rb,
lib/fog/aws/requests/elb/set_load_balancer_policies_of_listener.rb,
lib/fog/aws/requests/auto_scaling/describe_launch_configurations.rb,
lib/fog/aws/requests/auto_scaling/describe_scaling_process_types.rb,
lib/fog/aws/requests/auto_scaling/put_notification_configuration.rb,
lib/fog/aws/requests/elasticache/describe_cache_parameter_groups.rb,
lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb,
lib/fog/aws/requests/auto_scaling/describe_auto_scaling_instances.rb,
lib/fog/aws/requests/auto_scaling/describe_metric_collection_types.rb,
lib/fog/aws/requests/auto_scaling/delete_notification_configuration.rb,
lib/fog/aws/requests/auto_scaling/put_scheduled_update_group_action.rb,
lib/fog/aws/requests/elasticache/describe_engine_default_parameters.rb,
lib/fog/aws/requests/elb/set_load_balancer_listener_ssl_certificate.rb,
lib/fog/aws/requests/elasticache/revoke_cache_security_group_ingress.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,
lib/fog/aws/requests/elasticache/authorize_cache_security_group_ingress.rb,
lib/fog/aws/requests/auto_scaling/terminate_instance_in_auto_scaling_group.rb

Defined Under Namespace

Modules: CredentialFetcher Classes: AutoScaling, CloudFormation, CloudWatch, DynamoDB, ELB, EMR, ElasticBeanstalk, Elasticache, IAM, Mock, RDS, SES, SNS, SQS, STS, SimpleDB

Class Method Summary collapse

Methods included from Provider

[], extended, service, services

Class Method Details

.escape(string) ⇒ Object



84
85
86
87
88
# File 'lib/fog/aws.rb', line 84

def self.escape(string)
  string.gsub(/([^a-zA-Z0-9_.\-~]+)/) {
    "%" + $1.unpack("H2" * $1.bytesize).join("%").upcase
  }
end

.indexed_filters(filters) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/fog/aws.rb', line 71

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



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fog/aws.rb', line 28

def self.indexed_param(key, values)
  params = {}
  unless key.include?('%d')
    key << '.%d'
  end
  [*values].each_with_index do |value, index|
    if value.respond_to?('keys')
      k = format(key, index + 1)
      value.each do | vkey, vvalue |
        params["#{k}.#{vkey}"] = vvalue
      end
    else
      params[format(key, index + 1)] = value
    end
  end
  params
end

.indexed_request_param(name, values) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/fog/aws.rb', line 63

def self.indexed_request_param(name, values)
  idx = -1
  Array(values).inject({}) do |params, value|
    params["#{name}.#{idx += 1}"] = value
    params
  end
end

.parse_security_group_options(group_name, options) ⇒ Object



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/fog/aws.rb', line 277

def self.parse_security_group_options(group_name, options)
  options ||= Hash.new
  if group_name.is_a?(Hash)
    options = group_name
  elsif group_name
    if options.key?('GroupName')
      raise Fog::Compute::AWS::Error, 'Arguments specified both group_name and GroupName in options'
    end
    options = options.clone
    options['GroupName'] = group_name
  end
  name_specified = options.key?('GroupName') && !options['GroupName'].nil?
  group_id_specified = options.key?('GroupId') && !options['GroupId'].nil?
  unless name_specified || group_id_specified
    raise Fog::Compute::AWS::Error, 'Neither GroupName nor GroupId specified'
  end
  if name_specified && group_id_specified
    options.delete('GroupName')
  end
  options
end

.serialize_keys(key, value, options = {}) ⇒ Object



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

def self.serialize_keys(key, value, options = {})
  case value
  when Hash
    value.each do | k, v |
      options.merge!(serialize_keys("#{key}.#{k}", v))
    end
    return options
  when Array
    value.each_with_index do | it, idx |
      options.merge!(serialize_keys("#{key}.member.#{(idx + 1)}", it))
    end
    return options
  else
    return {key => value}
  end
end

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



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/fog/aws.rb', line 90

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]
  })

  params.merge!({
    'SecurityToken'     => options[:aws_session_token]
  }) if options[:aws_session_token]

  body = ''
  for key in params.keys.sort
    unless (value = params[key]).nil?
      body << "#{key}=#{escape(value.to_s)}&"
    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=#{escape(Base64.encode64(signed_string).chomp!)}"

  body
end