fog-aws 3.22.0 → 3.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -1305
  3. data/fog-aws.gemspec +6 -3
  4. data/lib/fog/aws/credential_fetcher.rb +15 -2
  5. data/lib/fog/aws/elasticache.rb +1 -1
  6. data/lib/fog/aws/kms.rb +5 -1
  7. data/lib/fog/aws/models/compute/dhcp_option.rb +1 -1
  8. data/lib/fog/aws/models/compute/flavors.rb +3 -3
  9. data/lib/fog/aws/models/compute/network_interfaces.rb +1 -1
  10. data/lib/fog/aws/models/elasticache/cluster.rb +1 -1
  11. data/lib/fog/aws/models/storage/file.rb +2 -2
  12. data/lib/fog/aws/models/storage/files.rb +3 -2
  13. data/lib/fog/aws/parsers/iam/list_server_certificates.rb +1 -1
  14. data/lib/fog/aws/parsers/kms/describe_key.rb +2 -2
  15. data/lib/fog/aws/parsers/kms/get_public_key.rb +30 -0
  16. data/lib/fog/aws/parsers/kms/schedule_key_deletion.rb +28 -0
  17. data/lib/fog/aws/parsers/kms/sign.rb +24 -0
  18. data/lib/fog/aws/parsers/rds/db_cluster_parser.rb +1 -1
  19. data/lib/fog/aws/parsers/rds/db_parser.rb +1 -1
  20. data/lib/fog/aws/parsers/rds/modify_db_subnet_group.rb +1 -1
  21. data/lib/fog/aws/parsers/redshift/cluster_subnet_group_parser.rb +1 -1
  22. data/lib/fog/aws/requests/auto_scaling/attach_load_balancer_target_groups.rb +1 -1
  23. data/lib/fog/aws/requests/auto_scaling/describe_scaling_activities.rb +1 -1
  24. data/lib/fog/aws/requests/auto_scaling/put_scheduled_update_group_action.rb +1 -1
  25. data/lib/fog/aws/requests/cloud_formation/create_change_set.rb +1 -1
  26. data/lib/fog/aws/requests/cloud_formation/create_stack.rb +1 -1
  27. data/lib/fog/aws/requests/cloud_formation/get_template_summary.rb +1 -1
  28. data/lib/fog/aws/requests/cloud_formation/update_stack.rb +1 -1
  29. data/lib/fog/aws/requests/cloud_watch/list_metrics.rb +1 -1
  30. data/lib/fog/aws/requests/compute/authorize_security_group_egress.rb +1 -1
  31. data/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +1 -1
  32. data/lib/fog/aws/requests/compute/create_network_interface.rb +1 -1
  33. data/lib/fog/aws/requests/compute/create_vpc.rb +1 -1
  34. data/lib/fog/aws/requests/compute/describe_network_interfaces.rb +2 -2
  35. data/lib/fog/aws/requests/compute/modify_network_interface_attribute.rb +1 -1
  36. data/lib/fog/aws/requests/compute/modify_volume.rb +1 -1
  37. data/lib/fog/aws/requests/compute/revoke_security_group_egress.rb +1 -1
  38. data/lib/fog/aws/requests/compute/revoke_security_group_ingress.rb +1 -1
  39. data/lib/fog/aws/requests/compute/run_instances.rb +2 -2
  40. data/lib/fog/aws/requests/data_pipeline/deactivate_pipeline.rb +1 -1
  41. data/lib/fog/aws/requests/ecs/list_task_definitions.rb +1 -1
  42. data/lib/fog/aws/requests/efs/create_file_system.rb +1 -1
  43. data/lib/fog/aws/requests/elasticache/authorize_cache_security_group_ingress.rb +1 -1
  44. data/lib/fog/aws/requests/elasticache/create_cache_cluster.rb +2 -2
  45. data/lib/fog/aws/requests/elasticache/describe_engine_default_parameters.rb +1 -1
  46. data/lib/fog/aws/requests/elb/delete_load_balancer_listeners.rb +1 -1
  47. data/lib/fog/aws/requests/elbv2/describe_tags.rb +2 -2
  48. data/lib/fog/aws/requests/glacier/initiate_job.rb +1 -1
  49. data/lib/fog/aws/requests/glacier/initiate_multipart_upload.rb +1 -1
  50. data/lib/fog/aws/requests/kinesis/list_streams.rb +1 -1
  51. data/lib/fog/aws/requests/kms/create_key.rb +74 -36
  52. data/lib/fog/aws/requests/kms/get_public_key.rb +35 -0
  53. data/lib/fog/aws/requests/kms/list_keys.rb +3 -4
  54. data/lib/fog/aws/requests/kms/schedule_key_deletion.rb +37 -0
  55. data/lib/fog/aws/requests/kms/sign.rb +62 -0
  56. data/lib/fog/aws/requests/rds/authorize_db_security_group_ingress.rb +2 -2
  57. data/lib/fog/aws/requests/rds/create_db_cluster.rb +1 -1
  58. data/lib/fog/aws/requests/rds/describe_db_snapshots.rb +1 -1
  59. data/lib/fog/aws/requests/rds/modify_db_instance.rb +1 -1
  60. data/lib/fog/aws/requests/rds/modify_db_parameter_group.rb +1 -1
  61. data/lib/fog/aws/requests/ses/send_raw_email.rb +1 -1
  62. data/lib/fog/aws/requests/sqs/change_message_visibility.rb +1 -1
  63. data/lib/fog/aws/requests/sqs/delete_message.rb +1 -1
  64. data/lib/fog/aws/requests/storage/copy_object.rb +1 -1
  65. data/lib/fog/aws/requests/storage/get_bucket.rb +2 -2
  66. data/lib/fog/aws/requests/storage/get_bucket_object_versions.rb +2 -2
  67. data/lib/fog/aws/requests/storage/list_parts.rb +1 -1
  68. data/lib/fog/aws/requests/storage/put_bucket.rb +0 -4
  69. data/lib/fog/aws/requests/storage/put_bucket_lifecycle.rb +1 -1
  70. data/lib/fog/aws/requests/storage/put_bucket_notification.rb +1 -1
  71. data/lib/fog/aws/requests/storage/put_object.rb +1 -1
  72. data/lib/fog/aws/requests/storage/upload_part_copy.rb +1 -1
  73. data/lib/fog/aws/ses.rb +19 -16
  74. data/lib/fog/aws/signaturev4.rb +1 -1
  75. data/lib/fog/aws/storage.rb +21 -11
  76. data/lib/fog/aws/version.rb +1 -1
  77. data/lib/fog/aws.rb +5 -2
  78. metadata +27 -6
@@ -25,7 +25,7 @@ module Fog
25
25
  response = Excon::Response.new
26
26
  resource_arns = [*resource_arns]
27
27
 
28
- tag_describtions = resource_arns.map do |resource_arn|
28
+ tag_descriptions = resource_arns.map do |resource_arn|
29
29
  if self.data[:load_balancers_v2][resource_arn]
30
30
  {
31
31
  "Tags"=>self.data[:tags][resource_arn],
@@ -39,7 +39,7 @@ module Fog
39
39
  response.status = 200
40
40
  response.body = {
41
41
  "ResponseMetadata"=>{"RequestId"=> Fog::AWS::Mock.request_id },
42
- "DescribeTagsResult"=>{"TagDescriptions"=> tag_describtions}
42
+ "DescribeTagsResult"=>{"TagDescriptions"=> tag_descriptions}
43
43
  }
44
44
 
45
45
  response
@@ -2,7 +2,7 @@ module Fog
2
2
  module AWS
3
3
  class Glacier
4
4
  class Real
5
- # This operation initates a multipart upload of an archive to a vault
5
+ # This operation initiates a multipart upload of an archive to a vault
6
6
  #
7
7
  # ==== Parameters
8
8
  # * name<~String> The vault name
@@ -2,7 +2,7 @@ module Fog
2
2
  module AWS
3
3
  class Glacier
4
4
  class Real
5
- # This operation initates a multipart upload of an archive to a vault
5
+ # This operation initiates a multipart upload of an archive to a vault
6
6
  #
7
7
  # ==== Parameters
8
8
  # * name<~String> The vault name
@@ -2,7 +2,7 @@ module Fog
2
2
  module AWS
3
3
  class Kinesis
4
4
  class Real
5
- # List availabe streams
5
+ # List available streams
6
6
  #
7
7
  # ==== Options
8
8
  # * ExclusiveStartStreamName<~String>: The name of the stream to start the list with.
@@ -2,61 +2,99 @@ module Fog
2
2
  module AWS
3
3
  class KMS
4
4
  class Real
5
- DEFAULT_KEY_POLICY = <<-JSON
6
- {
7
- "Version": "2012-10-17",
8
- "Id": "key-default-1",
9
- "Statement": [
10
- {
11
- "Sid": "Enable IAM User Permissions",
12
- "Effect": "Allow",
13
- "Principal": {
14
- "AWS": "arn:aws:iam::915445820265:root"
15
- },
16
- "Action": "kms:*",
17
- "Resource": "*"
18
- }
19
- ]
20
- }
21
- JSON
22
-
23
5
  require 'fog/aws/parsers/kms/describe_key'
24
6
 
25
- def create_key(policy = nil, description = nil, usage = "ENCRYPT_DECRYPT")
26
- request(
27
- 'Action' => 'CreateKey',
28
- 'Description' => description,
29
- 'KeyUsage' => usage,
30
- 'Policy' => policy,
31
- :parser => Fog::Parsers::AWS::KMS::DescribeKey.new
32
- )
7
+ # Create Key
8
+ #
9
+ # ==== Parameters
10
+ # * options<~Hash>:
11
+ # * 'Description'<~String>:
12
+ # * 'KeyUsage'<~String>:
13
+ # * 'Policy'<~String>:
14
+ # * ... (see docs from see also)
15
+ #
16
+ # === Returns
17
+ #
18
+ # ==== See Also
19
+ # https://docs.aws.amazon.com/kms/latest/APIReference/API_CreateKey.html
20
+ def create_key(*args)
21
+ options = Fog::AWS::KMS.parse_create_key_args(args)
22
+ request({
23
+ 'Action' => 'CreateKey',
24
+ :parser => Fog::Parsers::AWS::KMS::DescribeKey.new
25
+ }.merge!(options))
33
26
  end
34
27
  end
35
28
 
36
29
  class Mock
37
- def create_key(policy = nil, description = nil, usage = "ENCRYPT_DECRYPT")
30
+ def create_key(*args)
31
+ options = Fog::AWS::KMS.parse_create_key_args(args)
32
+
38
33
  response = Excon::Response.new
39
34
  key_id = UUID.uuid
40
35
  key_arn = Fog::AWS::Mock.arn("kms", self.account_id, "key/#{key_id}", @region)
41
36
 
42
37
  key = {
43
- "KeyUsage" => usage,
44
- "AWSAccountId" => self.account_id,
45
- "KeyId" => key_id,
46
- "Description" => description,
47
- "CreationDate" => Time.now,
48
- "Arn" => key_arn,
49
- "Enabled" => true,
50
- }
38
+ 'Arn' => key_arn,
39
+ 'AWSAccountId' => self.account_id,
40
+ 'CreationDate' => Time.now.utc,
41
+ 'DeletionDate' => nil,
42
+ 'Description' => nil,
43
+ 'Enabled' => true,
44
+ 'KeyId' => key_id,
45
+ 'KeySpec' => 'SYMMETRIC_DEFAULT',
46
+ 'KeyState' => 'Enabled',
47
+ 'KeyUsage' => 'ENCRYPT_DECRYPT',
48
+ 'Policy' => nil
49
+ }.merge!(options)
51
50
 
52
51
  # @todo use default policy
53
52
 
54
53
  self.data[:keys][key_id] = key
55
54
 
56
- response.body = { "KeyMetadata" => key }
55
+ klass, arg = {
56
+ 'ECC_NIST_P256' => [OpenSSL::PKey::EC, 'prime256v1'],
57
+ 'ECC_NIST_P384' => [OpenSSL::PKey::EC, 'secp384r1'],
58
+ 'ECC_NIST_P521' => [OpenSSL::PKey::EC, 'secp521r1'],
59
+ 'ECC_SECG_P256K1' => [OpenSSL::PKey::EC, 'secp256k1'],
60
+ 'RSA_2048' => [OpenSSL::PKey::RSA, 2048],
61
+ 'RSA_3072' => [OpenSSL::PKey::RSA, 3072],
62
+ 'RSA_4096' => [OpenSSL::PKey::RSA, 4096]
63
+ }[key['KeySpec']]
64
+ raise "Unknown or not-yet-implemented #{key['KeySpec']} KeySpec for kms create_key mocks" unless klass
65
+
66
+ self.data[:pkeys][key_id] = klass.generate(arg)
67
+
68
+ response.body = { 'KeyMetadata' => key }
57
69
  response
58
70
  end
59
71
  end
72
+
73
+ # previous args (policy, description, usage) was deprecated in favor of a hash of options
74
+ def self.parse_create_key_args(args)
75
+ case args.size
76
+ when 0
77
+ {}
78
+ when 1
79
+ if args[0].is_a?(Hash)
80
+ args[0]
81
+ else
82
+ Fog::Logger.deprecation("create_key with distinct arguments is deprecated, use options hash instead [light_black](#{caller.first})[/]")
83
+ {
84
+ 'Policy' => args[0]
85
+ }
86
+ end
87
+ when 2, 3
88
+ Fog::Logger.deprecation("create_key with distinct arguments is deprecated, use options hash instead [light_black](#{caller.first})[/]")
89
+ {
90
+ 'Policy' => args[0],
91
+ 'Description' => args[1],
92
+ 'KeyUsage' => args[2] || 'ENCRYPT_DECRYPT'
93
+ }
94
+ else
95
+ raise "Unknown argument style: #{args.inspect}, use options hash instead."
96
+ end
97
+ end
60
98
  end
61
99
  end
62
100
  end
@@ -0,0 +1,35 @@
1
+ module Fog
2
+ module AWS
3
+ class KMS
4
+ class Real
5
+ require 'fog/aws/parsers/kms/get_public_key'
6
+
7
+ def get_public_key(identifier, grant_tokens = nil)
8
+ request(
9
+ 'Action' => 'GetPublicKey',
10
+ 'GrantTokens' => grant_tokens,
11
+ 'KeyId' => identifier,
12
+ :parser => Fog::Parsers::AWS::KMS::GetPublicKey.new
13
+ )
14
+ end
15
+ end
16
+
17
+ class Mock
18
+ def get_public_key(identifier, _grant_tokens = [])
19
+ response = Excon::Response.new
20
+ key = self.data[:keys][identifier]
21
+ pkey = self.data[:pkeys][identifier]
22
+
23
+ response.body = {
24
+ 'KeyId' => key['Arn'],
25
+ 'KeyUsage' => key['KeyUsage'],
26
+ 'KeySpec' => key['KeySpec'],
27
+ 'PublicKey' => Base64.strict_encode64(pkey.public_to_der),
28
+ 'SigningAlgorithms' => key['SigningAlgorithms']
29
+ }
30
+ response
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -2,7 +2,6 @@ module Fog
2
2
  module AWS
3
3
  class KMS
4
4
  class Real
5
-
6
5
  require 'fog/aws/parsers/kms/list_keys'
7
6
 
8
7
  def list_keys(options={})
@@ -43,9 +42,9 @@ module Fog
43
42
  key_set = if marker
44
43
  self.data[:markers][marker] || []
45
44
  else
46
- self.data[:keys].inject([]) { |r,(k,v)|
47
- r << { "KeyId" => k, "KeyArn" => v["Arn"] }
48
- }
45
+ self.data[:keys].inject([]) do |r, (k, v)|
46
+ r << { 'KeyArn' => v['Arn'], 'KeyId' => k }
47
+ end
49
48
  end
50
49
 
51
50
  keys = if limit
@@ -0,0 +1,37 @@
1
+ module Fog
2
+ module AWS
3
+ class KMS
4
+ class Real
5
+ require 'fog/aws/parsers/kms/schedule_key_deletion'
6
+
7
+ def schedule_key_deletion(identifier, pending_window_in_days)
8
+ request(
9
+ 'Action' => 'ScheduleKeyDeletion',
10
+ 'KeyId' => identifier,
11
+ 'PendingWindowInDays' => pending_window_in_days,
12
+ :parser => Fog::Parsers::AWS::KMS::ScheduleKeyDeletion.new
13
+ )
14
+ end
15
+ end
16
+
17
+ class Mock
18
+ def schedule_key_deletion(identifier, pending_window_in_days)
19
+ response = Excon::Response.new
20
+ key = self.data[:keys][identifier]
21
+
22
+ key['DeletionDate'] = Time.now + (60 * 60 * 24 * pending_window_in_days)
23
+ key['Enabled'] = false
24
+ key['KeyState'] = 'PendingDeletion'
25
+
26
+ response.body = {
27
+ 'DeletionDate' => key['DeletionDate'],
28
+ 'KeyId' => key['KeyId'],
29
+ 'KeyState' => key['KeyState'],
30
+ 'PendingWindowInDays' => pending_window_in_days
31
+ }
32
+ response
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,62 @@
1
+ module Fog
2
+ module AWS
3
+ class KMS
4
+ class Real
5
+ require 'fog/aws/parsers/kms/sign'
6
+
7
+ # Sign
8
+ #
9
+ # ==== Parameters
10
+ # * identifier<~String>: id, arn, alias name, or alias arn for key to sign with
11
+ # * message<~String>: base64 encoded message to sign
12
+ #
13
+ # === Returns
14
+ # * response<~Excon::Response>:
15
+ #
16
+ # ==== See Also
17
+ # https://docs.aws.amazon.com/kms/latest/APIReference/API_Sign.html
18
+ #
19
+ def sign(identifier, message, algorithm, options = {})
20
+ request({
21
+ 'Action' => 'Sign',
22
+ 'KeyId' => identifier,
23
+ 'Message' => message,
24
+ 'SigningAlgorithm' => algorithm,
25
+ :parser => Fog::Parsers::AWS::KMS::Sign.new
26
+ }.merge!(options))
27
+ end
28
+ end
29
+
30
+ class Mock
31
+ def sign(identifier, message, algorithm, options = {})
32
+ response = Excon::Response.new
33
+ pkey = self.data[:pkeys][identifier]
34
+ unless pkey
35
+ response.status = 404
36
+ raise(Excon::Errors.status_error({ expects: 200 }, response))
37
+ end
38
+
39
+ data = Base64.decode64(message)
40
+
41
+ # FIXME: SM2 support?
42
+ sha = "SHA#{algorithm.split('_SHA_').last}"
43
+ signopts = {}
44
+ signopts[:rsa_padding_mode] = 'pss' if algorithm.start_with?('RSASSA_PSS')
45
+
46
+ signature = if options['MessageType'] == 'DIGEST'
47
+ pkey.sign_raw(sha, data, signopts)
48
+ else
49
+ pkey.sign(sha, data, signopts)
50
+ end
51
+
52
+ response.body = {
53
+ 'KeyId' => identifier,
54
+ 'Signature' => Base64.strict_encode64(signature),
55
+ 'SigningAlgorithm' => algorithm
56
+ }
57
+ response
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -43,12 +43,12 @@ module Fog
43
43
  if sec_group = self.data[:security_groups][name]
44
44
  if opts.key?('CIDRIP')
45
45
  if sec_group['IPRanges'].find{|h| h['CIDRIP'] == opts['CIDRIP']}
46
- raise Fog::AWS::RDS::AuthorizationAlreadyExists.new("AuthorizationAlreadyExists => #{opts['CIDRIP']} is alreay defined")
46
+ raise Fog::AWS::RDS::AuthorizationAlreadyExists.new("AuthorizationAlreadyExists => #{opts['CIDRIP']} is already defined")
47
47
  end
48
48
  sec_group['IPRanges'] << opts.merge({"Status" => 'authorizing'})
49
49
  else
50
50
  if sec_group['EC2SecurityGroups'].find{|h| h['EC2SecurityGroupName'] == opts['EC2SecurityGroupName'] || h['EC2SecurityGroupId'] == opts['EC2SecurityGroupId']}
51
- raise Fog::AWS::RDS::AuthorizationAlreadyExists.new("AuthorizationAlreadyExists => #{opts['EC2SecurityGroupName']} is alreay defined")
51
+ raise Fog::AWS::RDS::AuthorizationAlreadyExists.new("AuthorizationAlreadyExists => #{opts['EC2SecurityGroupName']} is already defined")
52
52
  end
53
53
  sec_group['EC2SecurityGroups'] << opts.merge({"Status" => 'authorizing'})
54
54
  end
@@ -12,7 +12,7 @@ module Fog
12
12
  # * AvailabilityZones<~Array> - A list of EC2 Availability Zones that instances in the DB cluster can be created in
13
13
  # * BackupRetentionPeriod<~String> - The number of days for which automated backups are retained
14
14
  # * CharacterSetName<~String> - A value that indicates that the DB cluster should be associated with the specified CharacterSet
15
- # * DatabaseName<~String> - The name for your database of up to 8 alpha-numeric characters. If you do not provide a name, Amazon RDS will not create a database in the DB cluster you are creating
15
+ # * DatabaseName<~String> - The name for your database of up to 8 alphanumeric characters. If you do not provide a name, Amazon RDS will not create a database in the DB cluster you are creating
16
16
  # * DBClusterIdentifier<~String> - The DB cluster identifier. This parameter is stored as a lowercase string
17
17
  # * DBClusterParameterGroupName<~String> - The name of the DB cluster parameter group to associate with this DB cluster
18
18
  # * DBSubnetGroupName<~String> - A DB subnet group to associate with this DB cluster
@@ -9,7 +9,7 @@ module Fog
9
9
  # ==== Parameters
10
10
  # * DBInstanceIdentifier <~String> - ID of instance to retrieve information for. if absent information for all instances is returned
11
11
  # * DBSnapshotIdentifier <~String> - ID of snapshot to retrieve information for. if absent information for all snapshots is returned
12
- # * SnapshotType <~String> - type of snapshot to retrive (automated|manual)
12
+ # * SnapshotType <~String> - type of snapshot to retrieve (automated|manual)
13
13
  # * Marker <~String> - An optional marker provided in the previous DescribeDBInstances request
14
14
  # * MaxRecords <~Integer> - Max number of records to return (between 20 and 100)
15
15
  # Only one of DBInstanceIdentifier or DBSnapshotIdentifier can be specified
@@ -56,7 +56,7 @@ module Fog
56
56
  self.data[:modify_time] = Time.now
57
57
  # TODO verify the params options
58
58
  # if apply_immediately is false, all the options go to pending_modified_values and then apply and clear after either
59
- # a reboot or the maintainance window
59
+ # a reboot or the maintenance window
60
60
  #if apply_immediately
61
61
  # modified_server = server.merge(options)
62
62
  #else
@@ -10,7 +10,7 @@ module Fog
10
10
  # * DBParameterGroupName <~String> - name of the parameter group
11
11
  # * Parameters<~Array> - Array of up to 20 Hashes describing parameters to set
12
12
  # * 'ParameterName'<~String> - parameter name.
13
- # * 'ParameterValue'<~String> - new paremeter value
13
+ # * 'ParameterValue'<~String> - new parameter value
14
14
  # * 'ApplyMethod'<~String> - immediate | pending-reboot whether to set the parameter immediately or not (may require an instance restart)
15
15
  #
16
16
  # ==== Returns
@@ -9,7 +9,7 @@ module Fog
9
9
  # ==== Parameters
10
10
  # * RawMessage <~String> - The message to be sent.
11
11
  # * Options <~Hash>
12
- # * Source <~String> - The sender's email address. Takes precenence over Return-Path if specified in RawMessage
12
+ # * Source <~String> - The sender's email address. Takes precedence over Return-Path if specified in RawMessage
13
13
  # * Destinations <~Array> - All destinations for this email.
14
14
  #
15
15
  # ==== Returns
@@ -8,7 +8,7 @@ module Fog
8
8
  #
9
9
  # ==== Parameters
10
10
  # * queue_url<~String> - Url of queue for message to update
11
- # * receipt_handle<~String> - Token from previous recieve message
11
+ # * receipt_handle<~String> - Token from previous receive message
12
12
  # * visibility_timeout<~Integer> - New visibility timeout in 0..43200
13
13
  #
14
14
  # ==== See Also
@@ -8,7 +8,7 @@ module Fog
8
8
  #
9
9
  # ==== Parameters
10
10
  # * queue_url<~String> - Url of queue to delete message from
11
- # * receipt_handle<~String> - Token from previous recieve message
11
+ # * receipt_handle<~String> - Token from previous receive message
12
12
  #
13
13
  # ==== See Also
14
14
  # http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/APIReference/Query_QueryDeleteMessage.html
@@ -17,7 +17,7 @@ module Fog
17
17
  # @option options [Time] x-amz-copy_source-if-modified_since Copies object it it has been modified since this time
18
18
  # @option options [String] x-amz-copy_source-if-none-match Copies object if its etag does not match this value
19
19
  # @option options [Time] x-amz-copy_source-if-unmodified-since Copies object it it has not been modified since this time
20
- # @option options [String] x-amz-storage-class Default is 'STANDARD', set to 'REDUCED_REDUNDANCY' for non-critical, reproducable data
20
+ # @option options [String] x-amz-storage-class Default is 'STANDARD', set to 'REDUCED_REDUNDANCY' for non-critical, reproducible data
21
21
  #
22
22
  #
23
23
  # @return [Excon::Response]
@@ -9,7 +9,7 @@ module Fog
9
9
  # @param bucket_name [String] name of bucket to list object keys from
10
10
  # @param options [Hash] config arguments for list. Defaults to {}.
11
11
  # @option options delimiter [String] causes keys with the same string between the prefix
12
- # value and the first occurence of delimiter to be rolled up
12
+ # value and the first occurrence of delimiter to be rolled up
13
13
  # @option options marker [String] limits object keys to only those that appear
14
14
  # lexicographically after its value.
15
15
  # @option options max-keys [Integer] limits number of object keys returned
@@ -17,7 +17,7 @@ module Fog
17
17
  #
18
18
  # @return [Excon::Response] response:
19
19
  # * body [Hash]:
20
- # * Delimeter [String] - Delimiter specified for query
20
+ # * Delimiter [String] - Delimiter specified for query
21
21
  # * IsTruncated [Boolean] - Whether or not the listing is truncated
22
22
  # * Marker [String]- Marker specified for query
23
23
  # * MaxKeys [Integer] - Maximum number of keys specified for query
@@ -8,7 +8,7 @@ module Fog
8
8
  #
9
9
  # @param bucket_name [String] name of bucket to list object keys from
10
10
  # @param options [Hash] config arguments for list
11
- # @option options delimiter [String] causes keys with the same string between the prefix value and the first occurence of delimiter to be rolled up
11
+ # @option options delimiter [String] causes keys with the same string between the prefix value and the first occurrence of delimiter to be rolled up
12
12
  # @option options key-marker [String] limits object keys to only those that appear lexicographically after its value.
13
13
  # @option options max-keys [Integer] limits number of object keys returned
14
14
  # @option options prefix [String] limits object keys to those beginning with its value.
@@ -16,7 +16,7 @@ module Fog
16
16
  #
17
17
  # @return [Excon::Response] response:
18
18
  # * body [Hash]:
19
- # * Delimeter [String] - Delimiter specified for query
19
+ # * Delimiter [String] - Delimiter specified for query
20
20
  # * KeyMarker [String] - Key marker specified for query
21
21
  # * MaxKeys [Integer] - Maximum number of keys specified for query
22
22
  # * Name [String] - Name of the bucket
@@ -21,7 +21,7 @@ module Fog
21
21
  # * ID [String] Id of upload initiator
22
22
  # * IsTruncated [Boolean] Whether or not the listing is truncated
23
23
  # * Key [String] Key where multipart upload was initiated
24
- # * MaxParts [String] maximum number of replies alllowed in response
24
+ # * MaxParts [String] maximum number of replies allowed in response
25
25
  # * NextPartNumberMarker [String] last item in list, for further pagination
26
26
  # * Part [Array]:
27
27
  # * ETag [String] ETag of part
@@ -61,10 +61,6 @@ DATA
61
61
  end
62
62
  if !self.data[:buckets][bucket_name]
63
63
  self.data[:buckets][bucket_name] = bucket
64
- elsif self.region != 'us-east-1'
65
- response.status = 409
66
- Fog::Logger.warning "Your region '#{self.region}' does not match the default region 'us-east-1'"
67
- raise(Excon::Errors.status_error({:expects => 201}, response))
68
64
  end
69
65
  response
70
66
  end
@@ -47,7 +47,7 @@ module Fog
47
47
  if rule['NoncurrentVersionExpiration']['NoncurrentDays']
48
48
  NoncurrentVersionExpiration { NoncurrentDays rule['NoncurrentVersionExpiration']['NoncurrentDays'] }
49
49
  elsif rule['NoncurrentVersionExpiration']['Date']
50
- NoncurrentVersoinExpiration {
50
+ NoncurrentVersionExpiration {
51
51
  if Date rule['NoncurrentVersionExpiration']['Date'].is_a?(Time)
52
52
  rule['NoncurrentVersionExpiration']['Date'].utc.iso8601
53
53
  else
@@ -5,7 +5,7 @@ module Fog
5
5
  # Change notification configuration for an S3 bucket
6
6
  #
7
7
  # @param bucket_name [String] name of bucket to set notification configuration for
8
- # * notications [Hash]:
8
+ # * notifications [Hash]:
9
9
  # * Topics [Array] SNS topic configurations for the notification
10
10
  # * ID [String] Unique identifier for the configuration
11
11
  # * Topic [String] Amazon SNS topic ARN to which Amazon S3 will publish a message when it detects events of specified type
@@ -16,7 +16,7 @@ module Fog
16
16
  # @option options Content-Type [String] Standard MIME type describing contents (defaults to MIME::Types.of.first)
17
17
  # @option options Expires [String] Cache expiry
18
18
  # @option options x-amz-acl [String] Permissions, must be in ['private', 'public-read', 'public-read-write', 'authenticated-read']
19
- # @option options x-amz-storage-class [String] Default is 'STANDARD', set to 'REDUCED_REDUNDANCY' for non-critical, reproducable data
19
+ # @option options x-amz-storage-class [String] Default is 'STANDARD', set to 'REDUCED_REDUNDANCY' for non-critical, reproducible data
20
20
  # @option options x-amz-meta-#{name} Headers to be returned with object, note total size of request without body must be less than 8 KB. Each name, value pair must conform to US-ASCII.
21
21
  # @option options x-amz-server-side-encryption [String] Sets HTTP header for server-side encryption. Set to 'AES256' for SSE-S3 and SSE-C. Set to 'aws:kms' for SSE-KMS
22
22
  # @option options x-amz-server-side​-encryption​-customer-algorithm [String] Algorithm to use to when encrypting the object for SSE-C.
@@ -35,7 +35,7 @@ module Fog
35
35
  # @option options [Time] x-amz-copy_source-if-modified_since Copies object it it has been modified since this time
36
36
  # @option options [String] x-amz-copy_source-if-none-match Copies object if its etag does not match this value
37
37
  # @option options [Time] x-amz-copy_source-if-unmodified-since Copies object it it has not been modified since this time
38
- # @option options [Time] x-amz-copy-source-range Specifes the range of bytes to copy from the source object
38
+ # @option options [Time] x-amz-copy-source-range Specifies the range of bytes to copy from the source object
39
39
  #
40
40
  # @return [Excon::Response]
41
41
  # * body [Hash]:
data/lib/fog/aws/ses.rb CHANGED
@@ -48,18 +48,21 @@ module Fog
48
48
  def initialize(options={})
49
49
 
50
50
  @use_iam_profile = options[:use_iam_profile]
51
- setup_credentials(options)
52
51
 
53
52
  @instrumentor = options[:instrumentor]
54
53
  @instrumentor_name = options[:instrumentor_name] || 'fog.aws.ses'
55
54
  @connection_options = options[:connection_options] || {}
56
55
  options[:region] ||= 'us-east-1'
56
+ @region = options[:region]
57
+
57
58
  @host = options[:host] || "email.#{options[:region]}.amazonaws.com"
58
59
  @path = options[:path] || '/'
59
60
  @persistent = options[:persistent] || false
60
61
  @port = options[:port] || 443
61
62
  @scheme = options[:scheme] || 'https'
62
63
  @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
64
+
65
+ setup_credentials(options)
63
66
  end
64
67
 
65
68
  def reload
@@ -74,7 +77,7 @@ module Fog
74
77
  @aws_session_token = options[:aws_session_token]
75
78
  @aws_credentials_expire_at = options[:aws_credentials_expire_at]
76
79
 
77
- @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key)
80
+ @signer = Fog::AWS::SignatureV4.new(@aws_access_key_id, @aws_secret_access_key, @region, 'ses')
78
81
  end
79
82
 
80
83
  def request(params)
@@ -87,20 +90,20 @@ module Fog
87
90
  'Content-Type' => 'application/x-www-form-urlencoded',
88
91
  'Date' => Fog::Time.now.to_date_header,
89
92
  }
90
- headers['x-amz-security-token'] = @aws_session_token if @aws_session_token
91
- #AWS3-HTTPS AWSAccessKeyId=<Your AWS Access Key ID>, Algorithm=HmacSHA256, Signature=<Signature>
92
- headers['X-Amzn-Authorization'] = 'AWS3-HTTPS '
93
- headers['X-Amzn-Authorization'] << 'AWSAccessKeyId=' << @aws_access_key_id
94
- headers['X-Amzn-Authorization'] << ', Algorithm=HmacSHA256'
95
- headers['X-Amzn-Authorization'] << ', Signature=' << Base64.encode64(@hmac.sign(headers['Date'])).chomp!
96
-
97
- body = ''
98
- for key in params.keys.sort
99
- unless (value = params[key]).nil?
100
- body << "#{key}=#{CGI.escape(value.to_s).gsub(/\+/, '%20')}&"
101
- end
102
- end
103
- body.chop! # remove trailing '&'
93
+
94
+ body, headers = AWS.signed_params_v4(
95
+ params,
96
+ { 'Content-Type' => 'application/x-www-form-urlencoded' },
97
+ {
98
+ :method => 'POST',
99
+ :aws_session_token => @aws_session_token,
100
+ :signer => @signer,
101
+ :host => @host,
102
+ :path => @path,
103
+ :port => @port,
104
+ :version => '2010-12-01'
105
+ }
106
+ )
104
107
 
105
108
  if @instrumentor
106
109
  @instrumentor.instrument("#{@instrumentor_name}.request", params) do
@@ -106,7 +106,7 @@ DATA
106
106
  end
107
107
 
108
108
  def canonical_headers(headers)
109
- canonical_headers = ''
109
+ canonical_headers = +''
110
110
 
111
111
  for key in headers.keys.sort_by {|k| k.to_s.downcase}
112
112
  canonical_headers << "#{key.to_s.downcase}:#{headers[key].to_s.strip}\n"