fog-aws 3.19.0 → 3.33.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -1231
- data/README.md +1 -1
- data/fog-aws.gemspec +7 -4
- data/lib/fog/aws/auto_scaling.rb +1 -1
- data/lib/fog/aws/beanstalk.rb +1 -1
- data/lib/fog/aws/cdn.rb +1 -1
- data/lib/fog/aws/cloud_formation.rb +1 -1
- data/lib/fog/aws/cloud_watch.rb +1 -1
- data/lib/fog/aws/compute.rb +1 -1
- data/lib/fog/aws/credential_fetcher.rb +16 -2
- data/lib/fog/aws/data_pipeline.rb +1 -1
- data/lib/fog/aws/dns.rb +1 -1
- data/lib/fog/aws/dynamodb.rb +1 -1
- data/lib/fog/aws/ecs.rb +1 -1
- data/lib/fog/aws/elasticache.rb +2 -2
- data/lib/fog/aws/elb.rb +1 -1
- data/lib/fog/aws/elbv2.rb +1 -1
- data/lib/fog/aws/emr.rb +1 -1
- data/lib/fog/aws/glacier.rb +1 -1
- data/lib/fog/aws/iam.rb +1 -1
- data/lib/fog/aws/kinesis.rb +1 -1
- data/lib/fog/aws/kms.rb +6 -2
- data/lib/fog/aws/lambda.rb +1 -1
- data/lib/fog/aws/models/compute/dhcp_option.rb +1 -1
- data/lib/fog/aws/models/compute/flavors.rb +2008 -778
- data/lib/fog/aws/models/compute/network_interfaces.rb +1 -1
- data/lib/fog/aws/models/elasticache/cluster.rb +1 -1
- data/lib/fog/aws/models/storage/file.rb +4 -3
- data/lib/fog/aws/models/storage/files.rb +3 -2
- data/lib/fog/aws/parsers/compute/describe_instance_status.rb +5 -3
- data/lib/fog/aws/parsers/iam/list_server_certificates.rb +1 -1
- 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/rds/db_cluster_parser.rb +1 -1
- data/lib/fog/aws/parsers/rds/db_parser.rb +1 -1
- data/lib/fog/aws/parsers/rds/modify_db_subnet_group.rb +1 -1
- data/lib/fog/aws/parsers/redshift/cluster_subnet_group_parser.rb +1 -1
- data/lib/fog/aws/parsers/storage/list_objects_v2.rb +66 -0
- data/lib/fog/aws/rds.rb +1 -1
- data/lib/fog/aws/redshift.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/attach_load_balancer_target_groups.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/describe_scaling_activities.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/put_scheduled_update_group_action.rb +1 -1
- data/lib/fog/aws/requests/cloud_formation/create_change_set.rb +1 -1
- data/lib/fog/aws/requests/cloud_formation/create_stack.rb +1 -1
- data/lib/fog/aws/requests/cloud_formation/get_template_summary.rb +1 -1
- data/lib/fog/aws/requests/cloud_formation/update_stack.rb +1 -1
- data/lib/fog/aws/requests/cloud_watch/list_metrics.rb +1 -1
- data/lib/fog/aws/requests/compute/authorize_security_group_egress.rb +1 -1
- data/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +1 -1
- data/lib/fog/aws/requests/compute/create_network_interface.rb +1 -1
- data/lib/fog/aws/requests/compute/create_vpc.rb +1 -1
- data/lib/fog/aws/requests/compute/describe_network_interfaces.rb +2 -2
- data/lib/fog/aws/requests/compute/modify_network_interface_attribute.rb +1 -1
- data/lib/fog/aws/requests/compute/modify_volume.rb +1 -1
- data/lib/fog/aws/requests/compute/revoke_security_group_egress.rb +1 -1
- data/lib/fog/aws/requests/compute/revoke_security_group_ingress.rb +1 -1
- data/lib/fog/aws/requests/compute/run_instances.rb +2 -2
- data/lib/fog/aws/requests/data_pipeline/deactivate_pipeline.rb +1 -1
- data/lib/fog/aws/requests/ecs/list_task_definitions.rb +1 -1
- data/lib/fog/aws/requests/efs/create_file_system.rb +1 -1
- data/lib/fog/aws/requests/elasticache/authorize_cache_security_group_ingress.rb +1 -1
- data/lib/fog/aws/requests/elasticache/create_cache_cluster.rb +2 -2
- data/lib/fog/aws/requests/elasticache/describe_engine_default_parameters.rb +1 -1
- data/lib/fog/aws/requests/elb/delete_load_balancer_listeners.rb +1 -1
- data/lib/fog/aws/requests/elbv2/describe_tags.rb +2 -2
- data/lib/fog/aws/requests/glacier/initiate_job.rb +1 -1
- data/lib/fog/aws/requests/glacier/initiate_multipart_upload.rb +1 -1
- data/lib/fog/aws/requests/kinesis/list_streams.rb +1 -1
- 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/rds/authorize_db_security_group_ingress.rb +2 -2
- data/lib/fog/aws/requests/rds/create_db_cluster.rb +1 -1
- data/lib/fog/aws/requests/rds/describe_db_snapshots.rb +1 -1
- data/lib/fog/aws/requests/rds/modify_db_instance.rb +1 -1
- data/lib/fog/aws/requests/rds/modify_db_parameter_group.rb +1 -1
- data/lib/fog/aws/requests/ses/send_raw_email.rb +1 -1
- data/lib/fog/aws/requests/sqs/change_message_visibility.rb +1 -1
- data/lib/fog/aws/requests/sqs/delete_message.rb +1 -1
- data/lib/fog/aws/requests/storage/copy_object.rb +2 -1
- data/lib/fog/aws/requests/storage/get_bucket.rb +2 -2
- data/lib/fog/aws/requests/storage/get_bucket_object_versions.rb +2 -2
- data/lib/fog/aws/requests/storage/list_objects_v2.rb +129 -0
- data/lib/fog/aws/requests/storage/list_parts.rb +1 -1
- data/lib/fog/aws/requests/storage/post_object_restore.rb +24 -4
- data/lib/fog/aws/requests/storage/put_bucket.rb +0 -4
- data/lib/fog/aws/requests/storage/put_bucket_lifecycle.rb +1 -1
- data/lib/fog/aws/requests/storage/put_bucket_notification.rb +1 -1
- data/lib/fog/aws/requests/storage/put_object.rb +1 -1
- data/lib/fog/aws/requests/storage/sync_clock.rb +1 -1
- data/lib/fog/aws/requests/storage/upload_part_copy.rb +1 -1
- data/lib/fog/aws/ses.rb +20 -17
- data/lib/fog/aws/signaturev4.rb +1 -1
- data/lib/fog/aws/simpledb.rb +1 -1
- data/lib/fog/aws/sns.rb +1 -1
- data/lib/fog/aws/sqs.rb +1 -1
- data/lib/fog/aws/storage.rb +33 -9
- data/lib/fog/aws/support.rb +1 -1
- data/lib/fog/aws/version.rb +1 -1
- data/lib/fog/aws.rb +4 -1
- metadata +37 -11
@@ -25,7 +25,7 @@ module Fog
|
|
25
25
|
response = Excon::Response.new
|
26
26
|
resource_arns = [*resource_arns]
|
27
27
|
|
28
|
-
|
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"=>
|
42
|
+
"DescribeTagsResult"=>{"TagDescriptions"=> tag_descriptions}
|
43
43
|
}
|
44
44
|
|
45
45
|
response
|
@@ -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
|
@@ -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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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,
|
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]
|
@@ -34,6 +34,7 @@ module Fog
|
|
34
34
|
:headers => headers,
|
35
35
|
:bucket_name => target_bucket_name,
|
36
36
|
:object_name => target_object_name,
|
37
|
+
:idempotent => true,
|
37
38
|
:method => 'PUT',
|
38
39
|
:parser => Fog::Parsers::AWS::Storage::CopyObject.new,
|
39
40
|
})
|
@@ -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
|
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
|
-
# *
|
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
|
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
|
-
# *
|
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
|
@@ -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
|
@@ -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
|
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
|