fog-aws 3.28.0 → 3.33.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +47 -10
- data/fog-aws.gemspec +4 -3
- data/lib/fog/aws/kms.rb +5 -1
- data/lib/fog/aws/models/storage/file.rb +1 -1
- data/lib/fog/aws/parsers/compute/describe_instance_status.rb +5 -3
- data/lib/fog/aws/parsers/kms/describe_key.rb +2 -2
- data/lib/fog/aws/parsers/kms/get_public_key.rb +30 -0
- data/lib/fog/aws/parsers/kms/schedule_key_deletion.rb +28 -0
- data/lib/fog/aws/parsers/kms/sign.rb +24 -0
- data/lib/fog/aws/parsers/storage/list_objects_v2.rb +66 -0
- data/lib/fog/aws/requests/kms/create_key.rb +74 -36
- data/lib/fog/aws/requests/kms/get_public_key.rb +35 -0
- data/lib/fog/aws/requests/kms/list_keys.rb +3 -4
- data/lib/fog/aws/requests/kms/schedule_key_deletion.rb +37 -0
- data/lib/fog/aws/requests/kms/sign.rb +62 -0
- data/lib/fog/aws/requests/storage/list_objects_v2.rb +129 -0
- data/lib/fog/aws/requests/storage/post_object_restore.rb +24 -4
- data/lib/fog/aws/storage.rb +32 -14
- data/lib/fog/aws/version.rb +1 -1
- metadata +39 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ef6d261effc88541b56e982050d0003a3ed126e5380a3928f3a622eea66633b9
|
|
4
|
+
data.tar.gz: 0ba63812241e5c5694e62271c22bf9e654db0ae96f8b481ddd18c3d6731aa295
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0dab6002b97b2a17003ea277b62572ea04583f8dd109c77ef4dc8db17cec0d5b97e69fe475bba60791f08ee4ffb0bd14283880d3989f3a70bde4f6b5581ff52b
|
|
7
|
+
data.tar.gz: cc0419e84ba54e19b5e4909f94e2133816e40ffd3fac80ec96257c1046071a331b777e11a184d5a88abe84dc1a348f3f9aecc9527f90b047d346e3e631a072be
|
data/CHANGELOG.md
CHANGED
|
@@ -1,32 +1,69 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [v3.
|
|
3
|
+
## [v3.33.2](https://github.com/fog/fog-aws/tree/v3.33.2) (2026-04-20)
|
|
4
4
|
|
|
5
|
-
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.
|
|
5
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.33.0...v3.33.1)
|
|
6
|
+
|
|
7
|
+
**Merged pull requests:**
|
|
8
|
+
|
|
9
|
+
- bug(aws/storage): include non-standard port in Host header for signature v4 [\#755](https://github.com/fog/fog-aws/pull/755) ([stanhu](https://github.com/stanhu))
|
|
10
|
+
- Bump actions/checkout from 5 to 6 [\#753](https://github.com/fog/fog-aws/pull/753) ([dependabot](https://github.com/apps/dependabot))
|
|
11
|
+
|
|
12
|
+
## [v3.33.1](https://github.com/fog/fog-aws/tree/v3.33.1) (2025-11-03)
|
|
13
|
+
|
|
14
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.33.0...v3.33.1)
|
|
6
15
|
|
|
7
16
|
**Closed issues:**
|
|
8
17
|
|
|
9
|
-
-
|
|
18
|
+
- aws\_credentials\_refresh\_threshold\_seconds gets wiped when credentials are refreshed [\#751](https://github.com/fog/fog-aws/issues/751)
|
|
19
|
+
- Frozen string errors in ruby 3.4 [\#745](https://github.com/fog/fog-aws/issues/745)
|
|
10
20
|
|
|
11
21
|
**Merged pull requests:**
|
|
12
22
|
|
|
13
|
-
-
|
|
23
|
+
- bug\(aws/storage\): avoid overwriting refresh threshold with nil [\#752](https://github.com/fog/fog-aws/pull/752) ([geemus](https://github.com/geemus))
|
|
24
|
+
- Bump github/codeql-action from 3 to 4 [\#749](https://github.com/fog/fog-aws/pull/749) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
25
|
+
- Bump actions/checkout from 4 to 5 [\#748](https://github.com/fog/fog-aws/pull/748) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
14
26
|
|
|
15
|
-
## [v3.
|
|
27
|
+
## [v3.33.0](https://github.com/fog/fog-aws/tree/v3.33.0) (2025-08-07)
|
|
16
28
|
|
|
17
|
-
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.
|
|
29
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.32.0...v3.33.0)
|
|
30
|
+
|
|
31
|
+
**Closed issues:**
|
|
32
|
+
|
|
33
|
+
- Add support for ListObjectsV2 [\#741](https://github.com/fog/fog-aws/issues/741)
|
|
34
|
+
- NoMethodError (undefined method `copy\_object' for "close":String\) [\#702](https://github.com/fog/fog-aws/issues/702)
|
|
18
35
|
|
|
19
36
|
**Merged pull requests:**
|
|
20
37
|
|
|
21
|
-
-
|
|
38
|
+
- storage headers should be rejected in a case-insensitive way [\#747](https://github.com/fog/fog-aws/pull/747) ([geemus](https://github.com/geemus))
|
|
39
|
+
- Update rubyzip requirement from ~\> 2.4.1 to ~\> 3.0.0 [\#746](https://github.com/fog/fog-aws/pull/746) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
40
|
+
- Fix \#741 Added list objects v2 api support [\#744](https://github.com/fog/fog-aws/pull/744) ([Ankk98](https://github.com/Ankk98))
|
|
41
|
+
- Update base64 requirement from ~\> 0.2.0 to \>= 0.2, \< 0.4 [\#743](https://github.com/fog/fog-aws/pull/743) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
42
|
+
|
|
43
|
+
## [v3.32.0](https://github.com/fog/fog-aws/tree/v3.32.0) (2025-05-27)
|
|
44
|
+
|
|
45
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.31.0...v3.32.0)
|
|
22
46
|
|
|
23
|
-
|
|
47
|
+
**Closed issues:**
|
|
48
|
+
|
|
49
|
+
- Add ability to specify s3 restore object tier in post\_object\_restore [\#740](https://github.com/fog/fog-aws/issues/740)
|
|
50
|
+
|
|
51
|
+
**Merged pull requests:**
|
|
52
|
+
|
|
53
|
+
- Add ability to specify s3 restore object tier in post\_object\_restore [\#742](https://github.com/fog/fog-aws/pull/742) ([Ankk98](https://github.com/Ankk98))
|
|
54
|
+
|
|
55
|
+
## [v3.31.0](https://github.com/fog/fog-aws/tree/v3.31.0) (2025-04-21)
|
|
56
|
+
|
|
57
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.30.0...v3.31.0)
|
|
58
|
+
|
|
59
|
+
**Closed issues:**
|
|
24
60
|
|
|
25
|
-
[
|
|
61
|
+
- Compute.describe\_instance\_status\(\) fails [\#734](https://github.com/fog/fog-aws/issues/734)
|
|
26
62
|
|
|
27
63
|
**Merged pull requests:**
|
|
28
64
|
|
|
29
|
-
-
|
|
65
|
+
- Fix Compute.describe\_instance\_status parser [\#735](https://github.com/fog/fog-aws/pull/735) ([kitherill](https://github.com/kitherill))
|
|
66
|
+
- Update rubyzip requirement from ~\> 2.3.0 to ~\> 2.4.1 [\#733](https://github.com/fog/fog-aws/pull/733) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
30
67
|
|
|
31
68
|
|
|
32
69
|
|
data/fog-aws.gemspec
CHANGED
|
@@ -22,14 +22,15 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
|
|
23
23
|
spec.required_ruby_version = '>= 2.0.0'
|
|
24
24
|
|
|
25
|
+
spec.add_development_dependency 'benchmark'
|
|
25
26
|
spec.add_development_dependency 'bundler'
|
|
26
27
|
spec.add_development_dependency 'github_changelog_generator', '~> 1.16'
|
|
27
28
|
spec.add_development_dependency 'rake', '>= 12.3.3'
|
|
28
|
-
spec.add_development_dependency 'rubyzip', '~>
|
|
29
|
+
spec.add_development_dependency 'rubyzip', '~> 3.0.0'
|
|
29
30
|
spec.add_development_dependency 'shindo', '~> 0.3'
|
|
30
31
|
|
|
31
|
-
spec.add_dependency 'base64', '
|
|
32
|
-
spec.add_dependency 'fog-core', '~> 2.
|
|
32
|
+
spec.add_dependency 'base64', '>= 0.2', '< 0.4'
|
|
33
|
+
spec.add_dependency 'fog-core', '~> 2.6'
|
|
33
34
|
spec.add_dependency 'fog-json', '~> 1.1'
|
|
34
35
|
spec.add_dependency 'fog-xml', '~> 0.1'
|
|
35
36
|
|
data/lib/fog/aws/kms.rb
CHANGED
|
@@ -20,6 +20,9 @@ module Fog
|
|
|
20
20
|
request :list_keys
|
|
21
21
|
request :create_key
|
|
22
22
|
request :describe_key
|
|
23
|
+
request :get_public_key
|
|
24
|
+
request :schedule_key_deletion
|
|
25
|
+
request :sign
|
|
23
26
|
|
|
24
27
|
model_path 'fog/aws/models/kms'
|
|
25
28
|
model :key
|
|
@@ -30,7 +33,8 @@ module Fog
|
|
|
30
33
|
@data ||= Hash.new do |hash, region|
|
|
31
34
|
hash[region] = Hash.new do |region_hash, access_key|
|
|
32
35
|
region_hash[access_key] = {
|
|
33
|
-
:
|
|
36
|
+
keys: {},
|
|
37
|
+
pkeys: {}
|
|
34
38
|
}
|
|
35
39
|
end
|
|
36
40
|
end
|
|
@@ -281,7 +281,7 @@ module Fog
|
|
|
281
281
|
merge_attributes(data.body)
|
|
282
282
|
else
|
|
283
283
|
data = service.put_object(directory.key, key, body, options)
|
|
284
|
-
merge_attributes(data.headers.reject {|key, value| ['
|
|
284
|
+
merge_attributes(data.headers.reject {|key, value| ['connection', 'content-length', 'content-type'].include?(key.downcase)})
|
|
285
285
|
end
|
|
286
286
|
self.etag = self.etag.gsub('"','') if self.etag
|
|
287
287
|
self.content_length = Fog::Storage.get_body_size(body)
|
|
@@ -4,7 +4,7 @@ module Fog
|
|
|
4
4
|
module Compute
|
|
5
5
|
class DescribeInstanceStatus < Fog::Parsers::Base
|
|
6
6
|
def new_instance!
|
|
7
|
-
@instance = { 'instanceState' => {}, 'systemStatus' => { 'details' => [] }, 'instanceStatus' => { 'details' => [] }, 'eventsSet' => [] }
|
|
7
|
+
@instance = { 'instanceState' => {}, 'systemStatus' => { 'details' => [] }, 'instanceStatus' => { 'details' => [] }, 'attachedEbsStatus' => { 'details' => [] }, 'eventsSet' => [] }
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def new_item!
|
|
@@ -31,6 +31,8 @@ module Fog
|
|
|
31
31
|
@inside = :instanceState
|
|
32
32
|
when 'instanceStatus'
|
|
33
33
|
@inside = :instanceStatus
|
|
34
|
+
when 'attachedEbsStatus'
|
|
35
|
+
@inside = :attachedEbsStatus
|
|
34
36
|
when 'eventsSet'
|
|
35
37
|
@inside = :eventsSet
|
|
36
38
|
end
|
|
@@ -43,13 +45,13 @@ module Fog
|
|
|
43
45
|
@instance[name] = value
|
|
44
46
|
when 'nextToken', 'requestId'
|
|
45
47
|
@response[name] = value
|
|
46
|
-
when 'systemStatus', 'instanceState', 'instanceStatus', 'eventsSet'
|
|
48
|
+
when 'systemStatus', 'instanceState', 'instanceStatus', 'attachedEbsStatus', 'eventsSet'
|
|
47
49
|
@inside = nil
|
|
48
50
|
when 'item'
|
|
49
51
|
case @inside
|
|
50
52
|
when :eventsSet
|
|
51
53
|
@instance['eventsSet'] << @item
|
|
52
|
-
when :systemStatus, :instanceStatus
|
|
54
|
+
when :systemStatus, :instanceStatus, :attachedEbsStatus
|
|
53
55
|
@instance[@inside.to_s]['details'] << @item
|
|
54
56
|
when nil
|
|
55
57
|
@response['instanceStatusSet'] << @instance
|
|
@@ -17,9 +17,9 @@ module Fog
|
|
|
17
17
|
|
|
18
18
|
def end_element(name)
|
|
19
19
|
case name
|
|
20
|
-
when '
|
|
20
|
+
when 'Arn', 'AWSAccountId', 'Description', 'KeyId', 'KeySpec', 'KeyState', 'KeyUsage'
|
|
21
21
|
@key[name] = value
|
|
22
|
-
when 'CreationDate'
|
|
22
|
+
when 'CreationDate', 'DeletionDate'
|
|
23
23
|
@key[name] = Time.parse(value)
|
|
24
24
|
when 'Enabled'
|
|
25
25
|
@key[name] = (value == 'true')
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Parsers
|
|
3
|
+
module AWS
|
|
4
|
+
module KMS
|
|
5
|
+
class GetPublicKey < Fog::Parsers::Base
|
|
6
|
+
def reset
|
|
7
|
+
@response = {}
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def start_element(name, attrs = [])
|
|
11
|
+
super
|
|
12
|
+
case name
|
|
13
|
+
when 'EncryptionAlgorithms', 'KeyAgreementAlgorithms', 'SigningAlgorithms'
|
|
14
|
+
@response[name] = []
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def end_element(name)
|
|
19
|
+
case name
|
|
20
|
+
when 'KeyId', 'KeySpec', 'KeyUsage', 'PublicKey'
|
|
21
|
+
@response[name] = value
|
|
22
|
+
when 'EncryptionAlgorithms', 'KeyAgreementAlgorithms', 'SigningAlgorithms'
|
|
23
|
+
@response[name] << value
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Parsers
|
|
3
|
+
module AWS
|
|
4
|
+
module KMS
|
|
5
|
+
class ScheduleKeyDeletion < Fog::Parsers::Base
|
|
6
|
+
def reset
|
|
7
|
+
@response = {}
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def start_element(name, attrs = [])
|
|
11
|
+
super
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def end_element(name)
|
|
15
|
+
case name
|
|
16
|
+
when 'DeletionDate'
|
|
17
|
+
@response[name] = Time.parse(value)
|
|
18
|
+
when 'KeyId', 'KeyState'
|
|
19
|
+
@response[name] = value
|
|
20
|
+
when 'PendingWindowInDays'
|
|
21
|
+
@response[name] = value.to_i
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Parsers
|
|
3
|
+
module AWS
|
|
4
|
+
module KMS
|
|
5
|
+
class Sign < Fog::Parsers::Base
|
|
6
|
+
def reset
|
|
7
|
+
@response = {}
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def start_element(name, attrs = [])
|
|
11
|
+
super
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def end_element(name)
|
|
15
|
+
case name
|
|
16
|
+
when 'KeyId', 'Signature', 'SigningAlgorithm'
|
|
17
|
+
@response[name] = value
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Parsers
|
|
3
|
+
module AWS
|
|
4
|
+
module Storage
|
|
5
|
+
class ListObjectsV2 < Fog::Parsers::Base
|
|
6
|
+
# Initialize parser state
|
|
7
|
+
def initialize
|
|
8
|
+
super
|
|
9
|
+
@common_prefix = {}
|
|
10
|
+
@object = { 'Owner' => {} }
|
|
11
|
+
reset
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def reset
|
|
15
|
+
@object = { 'Owner' => {} }
|
|
16
|
+
@response = { 'Contents' => [], 'CommonPrefixes' => [] }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def start_element(name, attrs = [])
|
|
20
|
+
super
|
|
21
|
+
case name
|
|
22
|
+
when 'CommonPrefixes'
|
|
23
|
+
@in_common_prefixes = true
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def end_element(name)
|
|
28
|
+
case name
|
|
29
|
+
when 'CommonPrefixes'
|
|
30
|
+
@in_common_prefixes = false
|
|
31
|
+
when 'Contents'
|
|
32
|
+
@response['Contents'] << @object
|
|
33
|
+
@object = { 'Owner' => {} }
|
|
34
|
+
when 'DisplayName', 'ID'
|
|
35
|
+
@object['Owner'][name] = value
|
|
36
|
+
when 'ETag'
|
|
37
|
+
@object[name] = value.gsub('"', '') if value != nil
|
|
38
|
+
when 'IsTruncated'
|
|
39
|
+
if value == 'true'
|
|
40
|
+
@response['IsTruncated'] = true
|
|
41
|
+
else
|
|
42
|
+
@response['IsTruncated'] = false
|
|
43
|
+
end
|
|
44
|
+
when 'LastModified'
|
|
45
|
+
@object['LastModified'] = Time.parse(value)
|
|
46
|
+
when 'ContinuationToken', 'NextContinuationToken', 'Name', 'StartAfter'
|
|
47
|
+
@response[name] = value
|
|
48
|
+
when 'MaxKeys', 'KeyCount'
|
|
49
|
+
@response[name] = value.to_i
|
|
50
|
+
when 'Prefix'
|
|
51
|
+
if @in_common_prefixes
|
|
52
|
+
@response['CommonPrefixes'] << value
|
|
53
|
+
else
|
|
54
|
+
@response[name] = value
|
|
55
|
+
end
|
|
56
|
+
when 'Size'
|
|
57
|
+
@object['Size'] = value.to_i
|
|
58
|
+
when 'Delimiter', 'Key', 'StorageClass'
|
|
59
|
+
@object[name] = value
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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(
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
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([])
|
|
47
|
-
r << {
|
|
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
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module AWS
|
|
3
|
+
class Storage
|
|
4
|
+
class Real
|
|
5
|
+
require 'fog/aws/parsers/storage/list_objects_v2'
|
|
6
|
+
|
|
7
|
+
# List information about objects in an S3 bucket using ListObjectsV2
|
|
8
|
+
#
|
|
9
|
+
# @param bucket_name [String] name of bucket to list object keys from
|
|
10
|
+
# @param options [Hash] config arguments for list. Defaults to {}.
|
|
11
|
+
# @option options delimiter [String] causes keys with the same string between the prefix
|
|
12
|
+
# value and the first occurrence of delimiter to be rolled up
|
|
13
|
+
# @option options continuation-token [String] continuation token from a previous request
|
|
14
|
+
# @option options fetch-owner [Boolean] specifies whether to return owner information
|
|
15
|
+
# @option options max-keys [Integer] limits number of object keys returned
|
|
16
|
+
# @option options prefix [String] limits object keys to those beginning with its value
|
|
17
|
+
# @option options start-after [String] starts listing after this specified key
|
|
18
|
+
#
|
|
19
|
+
# @return [Excon::Response] response:
|
|
20
|
+
# * body [Hash]:
|
|
21
|
+
# * Delimiter [String] - Delimiter specified for query
|
|
22
|
+
# * IsTruncated [Boolean] - Whether or not the listing is truncated
|
|
23
|
+
# * ContinuationToken [String] - Token specified in the request
|
|
24
|
+
# * NextContinuationToken [String] - Token to use in subsequent requests
|
|
25
|
+
# * KeyCount [Integer] - Number of keys returned
|
|
26
|
+
# * MaxKeys [Integer] - Maximum number of keys specified for query
|
|
27
|
+
# * Name [String] - Name of the bucket
|
|
28
|
+
# * Prefix [String] - Prefix specified for query
|
|
29
|
+
# * StartAfter [String] - StartAfter specified in the request
|
|
30
|
+
# * CommonPrefixes [Array] - Array of strings for common prefixes
|
|
31
|
+
# * Contents [Array]:
|
|
32
|
+
# * ETag [String] - Etag of object
|
|
33
|
+
# * Key [String] - Name of object
|
|
34
|
+
# * LastModified [String] - Timestamp of last modification of object
|
|
35
|
+
# * Owner [Hash]:
|
|
36
|
+
# * DisplayName [String] - Display name of object owner
|
|
37
|
+
# * ID [String] - Id of object owner
|
|
38
|
+
# * Size [Integer] - Size of object
|
|
39
|
+
# * StorageClass [String] - Storage class of object
|
|
40
|
+
#
|
|
41
|
+
# @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html
|
|
42
|
+
|
|
43
|
+
def list_objects_v2(bucket_name, options = {})
|
|
44
|
+
unless bucket_name
|
|
45
|
+
raise ArgumentError.new('bucket_name is required')
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Add list-type=2 to indicate ListObjectsV2
|
|
49
|
+
options = options.merge('list-type' => '2')
|
|
50
|
+
|
|
51
|
+
request({
|
|
52
|
+
:expects => 200,
|
|
53
|
+
:headers => {},
|
|
54
|
+
:bucket_name => bucket_name,
|
|
55
|
+
:idempotent => true,
|
|
56
|
+
:method => 'GET',
|
|
57
|
+
:parser => Fog::Parsers::AWS::Storage::ListObjectsV2.new,
|
|
58
|
+
:query => options
|
|
59
|
+
})
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
class Mock # :nodoc:all
|
|
64
|
+
def list_objects_v2(bucket_name, options = {})
|
|
65
|
+
prefix = options['prefix']
|
|
66
|
+
continuation_token = options['continuation-token']
|
|
67
|
+
delimiter = options['delimiter']
|
|
68
|
+
max_keys = options['max-keys']
|
|
69
|
+
start_after = options['start-after']
|
|
70
|
+
fetch_owner = options['fetch-owner']
|
|
71
|
+
common_prefixes = []
|
|
72
|
+
|
|
73
|
+
unless bucket_name
|
|
74
|
+
raise ArgumentError.new('bucket_name is required')
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
response = Excon::Response.new
|
|
78
|
+
if bucket = self.data[:buckets][bucket_name]
|
|
79
|
+
contents = bucket[:objects].values.map(&:first).sort {|x,y| x['Key'] <=> y['Key']}.reject do |object|
|
|
80
|
+
(prefix && object['Key'][0...prefix.length] != prefix) ||
|
|
81
|
+
(start_after && object['Key'] <= start_after) ||
|
|
82
|
+
(continuation_token && object['Key'] <= continuation_token) ||
|
|
83
|
+
(delimiter && object['Key'][(prefix ? prefix.length : 0)..-1].include?(delimiter) \
|
|
84
|
+
&& common_prefixes << object['Key'].sub(/^(#{prefix}[^#{delimiter}]+.).*/, '\1')) ||
|
|
85
|
+
object.key?(:delete_marker)
|
|
86
|
+
end.map do |object|
|
|
87
|
+
data = object.reject {|key, value| !['ETag', 'Key', 'StorageClass'].include?(key)}
|
|
88
|
+
data.merge!({
|
|
89
|
+
'LastModified' => Time.parse(object['Last-Modified']),
|
|
90
|
+
'Owner' => fetch_owner ? bucket['Owner'] : nil,
|
|
91
|
+
'Size' => object['Content-Length'].to_i
|
|
92
|
+
})
|
|
93
|
+
data
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
max_keys = max_keys || 1000
|
|
97
|
+
size = [max_keys, 1000].min
|
|
98
|
+
truncated_contents = contents[0...size]
|
|
99
|
+
next_token = truncated_contents.size != contents.size ? truncated_contents.last['Key'] : nil
|
|
100
|
+
|
|
101
|
+
response.status = 200
|
|
102
|
+
common_prefixes_uniq = common_prefixes.uniq
|
|
103
|
+
response.body = {
|
|
104
|
+
'CommonPrefixes' => common_prefixes_uniq,
|
|
105
|
+
'Contents' => truncated_contents,
|
|
106
|
+
'IsTruncated' => truncated_contents.size != contents.size,
|
|
107
|
+
'ContinuationToken' => continuation_token,
|
|
108
|
+
'NextContinuationToken' => next_token,
|
|
109
|
+
'KeyCount' => truncated_contents.size + common_prefixes_uniq.size,
|
|
110
|
+
'MaxKeys' => max_keys,
|
|
111
|
+
'Name' => bucket['Name'],
|
|
112
|
+
'Prefix' => prefix,
|
|
113
|
+
'StartAfter' => start_after
|
|
114
|
+
}
|
|
115
|
+
if max_keys && max_keys < response.body['Contents'].length
|
|
116
|
+
response.body['IsTruncated'] = true
|
|
117
|
+
response.body['Contents'] = response.body['Contents'][0...max_keys]
|
|
118
|
+
response.body['KeyCount'] = response.body['Contents'].size + response.body['CommonPrefixes'].size
|
|
119
|
+
end
|
|
120
|
+
else
|
|
121
|
+
response.status = 404
|
|
122
|
+
raise(Excon::Errors.status_error({:expects => 200}, response))
|
|
123
|
+
end
|
|
124
|
+
response
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
@@ -6,7 +6,9 @@ module Fog
|
|
|
6
6
|
#
|
|
7
7
|
# @param bucket_name [String] Name of bucket containing object
|
|
8
8
|
# @param object_name [String] Name of object to restore
|
|
9
|
-
# @
|
|
9
|
+
# @param options [Hash] Optional parameters
|
|
10
|
+
# @option options [Integer] :days Number of days to restore object for. Defaults to 100000 (a very long time)
|
|
11
|
+
# @option options [String] :tier Glacier retrieval tier. Can be 'Standard', 'Bulk', or 'Expedited'
|
|
10
12
|
#
|
|
11
13
|
# @return [Excon::Response] response:
|
|
12
14
|
# * status [Integer] 200 (OK) Object is previously restored
|
|
@@ -15,11 +17,24 @@ module Fog
|
|
|
15
17
|
#
|
|
16
18
|
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectPOSTrestore.html
|
|
17
19
|
#
|
|
18
|
-
def post_object_restore(bucket_name, object_name,
|
|
20
|
+
def post_object_restore(bucket_name, object_name, options = {})
|
|
19
21
|
raise ArgumentError.new('bucket_name is required') unless bucket_name
|
|
20
22
|
raise ArgumentError.new('object_name is required') unless object_name
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
unless options.is_a?(Hash)
|
|
25
|
+
Fog::Logger.deprecation("post_object_restore with a bare days parameter is deprecated, use post_object_restore(bucket_name, object_name, :days => days) instead [light_black](#{caller.first})[/]")
|
|
26
|
+
options = { :days => options }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
days = options[:days] || 100000
|
|
30
|
+
tier = options[:tier]
|
|
31
|
+
|
|
32
|
+
data = '<RestoreRequest xmlns="http://s3.amazonaws.com/doc/2006-03-01/">'
|
|
33
|
+
data += '<Days>' + days.to_s + '</Days>'
|
|
34
|
+
if tier
|
|
35
|
+
data += '<GlacierJobParameters><Tier>' + tier + '</Tier></GlacierJobParameters>'
|
|
36
|
+
end
|
|
37
|
+
data += '</RestoreRequest>'
|
|
23
38
|
|
|
24
39
|
headers = {}
|
|
25
40
|
headers['Content-MD5'] = Base64.encode64(OpenSSL::Digest::MD5.digest(data)).strip
|
|
@@ -39,7 +54,12 @@ module Fog
|
|
|
39
54
|
end
|
|
40
55
|
|
|
41
56
|
class Mock # :nodoc:all
|
|
42
|
-
def post_object_restore(bucket_name, object_name,
|
|
57
|
+
def post_object_restore(bucket_name, object_name, options = {})
|
|
58
|
+
unless options.is_a?(Hash)
|
|
59
|
+
Fog::Logger.deprecation("post_object_restore with a bare days parameter is deprecated, use post_object_restore(bucket_name, object_name, :days => days) instead [light_black](#{caller.first})[/]")
|
|
60
|
+
options = { :days => options }
|
|
61
|
+
end
|
|
62
|
+
|
|
43
63
|
response = get_object(bucket_name, object_name)
|
|
44
64
|
response.body = nil
|
|
45
65
|
response
|
data/lib/fog/aws/storage.rb
CHANGED
|
@@ -7,6 +7,8 @@ module Fog
|
|
|
7
7
|
|
|
8
8
|
DEFAULT_REGION = 'us-east-1'
|
|
9
9
|
ACCELERATION_HOST = 's3-accelerate.amazonaws.com'
|
|
10
|
+
AWS_FIPS_REGIONS = %w(us-east-1 us-east-2 us-west-1 us-west-2 us-gov-east-1 us-gov-west-1 ca-central-1 ca-west-1).freeze
|
|
11
|
+
AWS_GOVCLOUD_REGIONS = %w(us-gov-east-1 us-gov-west-1).freeze
|
|
10
12
|
|
|
11
13
|
DEFAULT_SCHEME = 'https'
|
|
12
14
|
DEFAULT_SCHEME_PORT = {
|
|
@@ -16,10 +18,7 @@ module Fog
|
|
|
16
18
|
|
|
17
19
|
DEFAULT_CONNECTION_OPTIONS = {
|
|
18
20
|
retry_limit: 5,
|
|
19
|
-
retry_interval: 1
|
|
20
|
-
retry_errors: [
|
|
21
|
-
Excon::Error::Timeout, Excon::Error::Socket, Excon::Error::Server
|
|
22
|
-
]
|
|
21
|
+
retry_interval: 1
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
MIN_MULTIPART_CHUNK_SIZE = 5242880
|
|
@@ -27,9 +26,12 @@ module Fog
|
|
|
27
26
|
|
|
28
27
|
VALID_QUERY_KEYS = %w[
|
|
29
28
|
acl
|
|
29
|
+
continuation-token
|
|
30
30
|
cors
|
|
31
31
|
delete
|
|
32
|
+
fetch-owner
|
|
32
33
|
lifecycle
|
|
34
|
+
list-type
|
|
33
35
|
location
|
|
34
36
|
logging
|
|
35
37
|
notification
|
|
@@ -43,6 +45,7 @@ module Fog
|
|
|
43
45
|
response-content-type
|
|
44
46
|
response-expires
|
|
45
47
|
restore
|
|
48
|
+
start-after
|
|
46
49
|
tagging
|
|
47
50
|
torrent
|
|
48
51
|
uploadId
|
|
@@ -103,6 +106,7 @@ module Fog
|
|
|
103
106
|
request :head_object_url
|
|
104
107
|
request :initiate_multipart_upload
|
|
105
108
|
request :list_multipart_uploads
|
|
109
|
+
request :list_objects_v2
|
|
106
110
|
request :list_parts
|
|
107
111
|
request :post_object_hidden_fields
|
|
108
112
|
request :post_object_restore
|
|
@@ -261,13 +265,17 @@ module Fog
|
|
|
261
265
|
end
|
|
262
266
|
|
|
263
267
|
def region_to_host(region=nil)
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
's3.amazonaws.com'
|
|
267
|
-
when %r{\Acn-.*}
|
|
268
|
-
"s3.#{region}.amazonaws.com.cn"
|
|
268
|
+
if ENV['AWS_USE_FIPS_ENDPOINT'] == 'true' && AWS_FIPS_REGIONS.include?(region)
|
|
269
|
+
"s3-fips.#{region}.amazonaws.com" # https://aws.amazon.com/compliance/fips/
|
|
269
270
|
else
|
|
270
|
-
|
|
271
|
+
case region.to_s
|
|
272
|
+
when DEFAULT_REGION, ''
|
|
273
|
+
's3.amazonaws.com'
|
|
274
|
+
when %r{\Acn-.*}
|
|
275
|
+
"s3.#{region}.amazonaws.com.cn"
|
|
276
|
+
else
|
|
277
|
+
"s3.#{region}.amazonaws.com"
|
|
278
|
+
end
|
|
271
279
|
end
|
|
272
280
|
end
|
|
273
281
|
|
|
@@ -581,6 +589,13 @@ module Fog
|
|
|
581
589
|
@port = options[:port] || DEFAULT_SCHEME_PORT[@scheme]
|
|
582
590
|
end
|
|
583
591
|
|
|
592
|
+
# GovCloud doesn't support S3 Transfer Acceleration https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-s3.html
|
|
593
|
+
# S3 Transfer Acceleration doesn't support FIPS endpoints. When both fog_aws_accelerate=true and AWS_USE_FIPS_ENDPOINT=true, don't use Accelerate.
|
|
594
|
+
if @acceleration && (AWS_GOVCLOUD_REGIONS.include?(@region) || ENV['AWS_USE_FIPS_ENDPOINT'] == 'true')
|
|
595
|
+
Fog::Logger.warning("fog: S3 Transfer Acceleration is not available in GovCloud regions or when AWS_USE_FIPS_ENDPOINT=true. Disabling acceleration.")
|
|
596
|
+
@acceleration = false
|
|
597
|
+
end
|
|
598
|
+
|
|
584
599
|
@host = ACCELERATION_HOST if @acceleration
|
|
585
600
|
setup_credentials(options)
|
|
586
601
|
end
|
|
@@ -593,7 +608,9 @@ module Fog
|
|
|
593
608
|
|
|
594
609
|
|
|
595
610
|
def setup_credentials(options)
|
|
596
|
-
|
|
611
|
+
if options[:aws_credentials_refresh_threshold_seconds]
|
|
612
|
+
@aws_credentials_refresh_threshold_seconds = options[:aws_credentials_refresh_threshold_seconds]
|
|
613
|
+
end
|
|
597
614
|
|
|
598
615
|
@aws_access_key_id = options[:aws_access_key_id]
|
|
599
616
|
@aws_secret_access_key = options[:aws_secret_access_key]
|
|
@@ -601,7 +618,7 @@ module Fog
|
|
|
601
618
|
@aws_credentials_expire_at = options[:aws_credentials_expire_at]
|
|
602
619
|
|
|
603
620
|
if @signature_version == 4
|
|
604
|
-
@signer = Fog::AWS::SignatureV4.new(
|
|
621
|
+
@signer = Fog::AWS::SignatureV4.new(@aws_access_key_id, @aws_secret_access_key, @region, 's3')
|
|
605
622
|
elsif @signature_version == 2
|
|
606
623
|
@hmac = Fog::HMAC.new('sha1', @aws_secret_access_key)
|
|
607
624
|
end
|
|
@@ -641,8 +658,9 @@ module Fog
|
|
|
641
658
|
params = request_params(params)
|
|
642
659
|
scheme = params.delete(:scheme)
|
|
643
660
|
host = params.delete(:host)
|
|
644
|
-
port = params.delete(:port)
|
|
645
|
-
params[:headers]['Host'] = host
|
|
661
|
+
port = params.delete(:port)
|
|
662
|
+
params[:headers]['Host'] = port ? "#{host}:#{port}" : host
|
|
663
|
+
port ||= DEFAULT_SCHEME_PORT[scheme]
|
|
646
664
|
|
|
647
665
|
|
|
648
666
|
if @signature_version == 4
|
data/lib/fog/aws/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fog-aws
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.33.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Josh Lane
|
|
8
8
|
- Wesley Beary
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: benchmark
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
14
27
|
- !ruby/object:Gem::Dependency
|
|
15
28
|
name: bundler
|
|
16
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -59,14 +72,14 @@ dependencies:
|
|
|
59
72
|
requirements:
|
|
60
73
|
- - "~>"
|
|
61
74
|
- !ruby/object:Gem::Version
|
|
62
|
-
version:
|
|
75
|
+
version: 3.0.0
|
|
63
76
|
type: :development
|
|
64
77
|
prerelease: false
|
|
65
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
66
79
|
requirements:
|
|
67
80
|
- - "~>"
|
|
68
81
|
- !ruby/object:Gem::Version
|
|
69
|
-
version:
|
|
82
|
+
version: 3.0.0
|
|
70
83
|
- !ruby/object:Gem::Dependency
|
|
71
84
|
name: shindo
|
|
72
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -85,30 +98,36 @@ dependencies:
|
|
|
85
98
|
name: base64
|
|
86
99
|
requirement: !ruby/object:Gem::Requirement
|
|
87
100
|
requirements:
|
|
88
|
-
- - "
|
|
101
|
+
- - ">="
|
|
89
102
|
- !ruby/object:Gem::Version
|
|
90
|
-
version: 0.2
|
|
103
|
+
version: '0.2'
|
|
104
|
+
- - "<"
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
version: '0.4'
|
|
91
107
|
type: :runtime
|
|
92
108
|
prerelease: false
|
|
93
109
|
version_requirements: !ruby/object:Gem::Requirement
|
|
94
110
|
requirements:
|
|
95
|
-
- - "
|
|
111
|
+
- - ">="
|
|
112
|
+
- !ruby/object:Gem::Version
|
|
113
|
+
version: '0.2'
|
|
114
|
+
- - "<"
|
|
96
115
|
- !ruby/object:Gem::Version
|
|
97
|
-
version: 0.
|
|
116
|
+
version: '0.4'
|
|
98
117
|
- !ruby/object:Gem::Dependency
|
|
99
118
|
name: fog-core
|
|
100
119
|
requirement: !ruby/object:Gem::Requirement
|
|
101
120
|
requirements:
|
|
102
121
|
- - "~>"
|
|
103
122
|
- !ruby/object:Gem::Version
|
|
104
|
-
version: '2.
|
|
123
|
+
version: '2.6'
|
|
105
124
|
type: :runtime
|
|
106
125
|
prerelease: false
|
|
107
126
|
version_requirements: !ruby/object:Gem::Requirement
|
|
108
127
|
requirements:
|
|
109
128
|
- - "~>"
|
|
110
129
|
- !ruby/object:Gem::Version
|
|
111
|
-
version: '2.
|
|
130
|
+
version: '2.6'
|
|
112
131
|
- !ruby/object:Gem::Dependency
|
|
113
132
|
name: fog-json
|
|
114
133
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -614,7 +633,10 @@ files:
|
|
|
614
633
|
- lib/fog/aws/parsers/iam/upload_server_certificate.rb
|
|
615
634
|
- lib/fog/aws/parsers/iam/upload_signing_certificate.rb
|
|
616
635
|
- lib/fog/aws/parsers/kms/describe_key.rb
|
|
636
|
+
- lib/fog/aws/parsers/kms/get_public_key.rb
|
|
617
637
|
- lib/fog/aws/parsers/kms/list_keys.rb
|
|
638
|
+
- lib/fog/aws/parsers/kms/schedule_key_deletion.rb
|
|
639
|
+
- lib/fog/aws/parsers/kms/sign.rb
|
|
618
640
|
- lib/fog/aws/parsers/lambda/base.rb
|
|
619
641
|
- lib/fog/aws/parsers/rds/authorize_db_security_group_ingress.rb
|
|
620
642
|
- lib/fog/aws/parsers/rds/base.rb
|
|
@@ -745,6 +767,7 @@ files:
|
|
|
745
767
|
- lib/fog/aws/parsers/storage/get_service.rb
|
|
746
768
|
- lib/fog/aws/parsers/storage/initiate_multipart_upload.rb
|
|
747
769
|
- lib/fog/aws/parsers/storage/list_multipart_uploads.rb
|
|
770
|
+
- lib/fog/aws/parsers/storage/list_objects_v2.rb
|
|
748
771
|
- lib/fog/aws/parsers/storage/list_parts.rb
|
|
749
772
|
- lib/fog/aws/parsers/storage/upload_part_copy_object.rb
|
|
750
773
|
- lib/fog/aws/parsers/sts/assume_role.rb
|
|
@@ -1236,7 +1259,10 @@ files:
|
|
|
1236
1259
|
- lib/fog/aws/requests/kinesis/split_shard.rb
|
|
1237
1260
|
- lib/fog/aws/requests/kms/create_key.rb
|
|
1238
1261
|
- lib/fog/aws/requests/kms/describe_key.rb
|
|
1262
|
+
- lib/fog/aws/requests/kms/get_public_key.rb
|
|
1239
1263
|
- lib/fog/aws/requests/kms/list_keys.rb
|
|
1264
|
+
- lib/fog/aws/requests/kms/schedule_key_deletion.rb
|
|
1265
|
+
- lib/fog/aws/requests/kms/sign.rb
|
|
1240
1266
|
- lib/fog/aws/requests/lambda/add_permission.rb
|
|
1241
1267
|
- lib/fog/aws/requests/lambda/create_event_source_mapping.rb
|
|
1242
1268
|
- lib/fog/aws/requests/lambda/create_function.rb
|
|
@@ -1414,6 +1440,7 @@ files:
|
|
|
1414
1440
|
- lib/fog/aws/requests/storage/head_object_url.rb
|
|
1415
1441
|
- lib/fog/aws/requests/storage/initiate_multipart_upload.rb
|
|
1416
1442
|
- lib/fog/aws/requests/storage/list_multipart_uploads.rb
|
|
1443
|
+
- lib/fog/aws/requests/storage/list_objects_v2.rb
|
|
1417
1444
|
- lib/fog/aws/requests/storage/list_parts.rb
|
|
1418
1445
|
- lib/fog/aws/requests/storage/post_object_hidden_fields.rb
|
|
1419
1446
|
- lib/fog/aws/requests/storage/post_object_restore.rb
|
|
@@ -1458,7 +1485,6 @@ licenses:
|
|
|
1458
1485
|
- MIT
|
|
1459
1486
|
metadata:
|
|
1460
1487
|
changelog_uri: https://github.com/fog/fog-aws/blob/master/CHANGELOG.md
|
|
1461
|
-
post_install_message:
|
|
1462
1488
|
rdoc_options: []
|
|
1463
1489
|
require_paths:
|
|
1464
1490
|
- lib
|
|
@@ -1473,8 +1499,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1473
1499
|
- !ruby/object:Gem::Version
|
|
1474
1500
|
version: '0'
|
|
1475
1501
|
requirements: []
|
|
1476
|
-
rubygems_version:
|
|
1477
|
-
signing_key:
|
|
1502
|
+
rubygems_version: 4.0.3
|
|
1478
1503
|
specification_version: 4
|
|
1479
1504
|
summary: Module for the 'fog' gem to support Amazon Web Services.
|
|
1480
1505
|
test_files: []
|