fog-aws 3.10.0 → 3.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c26ecb900344f1066e888bd42bea0bb74295915f367cea6fc9ee76987fccf3bd
4
- data.tar.gz: 0267b3e9130ea0496810e4432da4d695a37ea959892d30020defc58b93a872d3
3
+ metadata.gz: a9f2992e8c7fe7d8b4ae1bba5a16d00fe98d3c531cd473d4b3a1109d6a774e16
4
+ data.tar.gz: 781c1889a4c0cf5d0fd8b1aa0d5ebf0101ea577aa0412265dd14aff339aacae4
5
5
  SHA512:
6
- metadata.gz: b94b3169aac81043a5847d4f644d03274ddfc1454ac6704f0c3c534e9031d693ce0cde7f50fd0ae396c4225d9145eacc27ed9be774bb2a80854e2f9d19b66baa
7
- data.tar.gz: b756f7198948b5f5971a6e78f4474525d2827d58f8a393d8e36fbc961806104f4e4d83e288a3d5845c9b94b595c047341e7a4d7f0258e45cdf21dcc4c6dbd71e
6
+ metadata.gz: 2c81e87c69e6497df16ea76263e57ccd6457acf85378882745ebd2c58322bce9d93fe773dbf68c8b68bcfb5e3aab5231a534d98d38e8101958cc075e0651f8b5
7
+ data.tar.gz: cd5d6b7fef8eea60e58c7393bb0921fac17e78ad345ab87f199b34d2d20425500a9837a9eef9fcd12f374aa43d979a6cc1a0b6a554acd029517313794f3ab9ab
data/CHANGELOG.md CHANGED
@@ -1,5 +1,127 @@
1
1
  # Changelog
2
2
 
3
+ ## [Unreleased](https://github.com/fog/fog-aws/tree/HEAD)
4
+
5
+ [Full Changelog](https://github.com/fog/fog-aws/compare/v3.11.0...HEAD)
6
+
7
+ ## [v3.11.0](https://github.com/fog/fog-aws/tree/v3.11.0) (2021-08-05)
8
+
9
+ [Full Changelog](https://github.com/fog/fog-aws/compare/v3.10.0...v3.11.0)
10
+
11
+ **Closed issues:**
12
+
13
+ - Support for Regional STS Endpoints [\#604](https://github.com/fog/fog-aws/issues/604)
14
+ - Pass tags when creating EBS ? [\#603](https://github.com/fog/fog-aws/issues/603)
15
+ - S3 multiple delete api should handle delete for multiple versions for a single object [\#598](https://github.com/fog/fog-aws/issues/598)
16
+ - Fog does not return error from s3 [\#586](https://github.com/fog/fog-aws/issues/586)
17
+ - Add support for r6g and c6g instance types [\#580](https://github.com/fog/fog-aws/issues/580)
18
+ - Using internal S3 provider ... and something funky is going on! [\#575](https://github.com/fog/fog-aws/issues/575)
19
+ - How to upload File to S3 with with accelerate? [\#554](https://github.com/fog/fog-aws/issues/554)
20
+ - How to use assume\_role\_with\_web\_identity auth for S3 storage? [\#543](https://github.com/fog/fog-aws/issues/543)
21
+ - Fog::AWS::Glacier::TreeHash::add\_part works only sometimes [\#520](https://github.com/fog/fog-aws/issues/520)
22
+ - fog-aws: Fog::AWS::Glacier::Job doesn't support RetrievalByteRange [\#519](https://github.com/fog/fog-aws/issues/519)
23
+ - Path style is being deprecated [\#516](https://github.com/fog/fog-aws/issues/516)
24
+ - Fog::DNS::AWS can't read zones [\#513](https://github.com/fog/fog-aws/issues/513)
25
+ - Lambda Parser can't handle VPC config, containing array of hash values [\#509](https://github.com/fog/fog-aws/issues/509)
26
+ - Excon::Error::Forbidden: Expected\(200\) \<=\> Actual\(403 Forbidden\) [\#508](https://github.com/fog/fog-aws/issues/508)
27
+ - file.save does not work with STDIN [\#500](https://github.com/fog/fog-aws/issues/500)
28
+ - ELBv2 Support ? [\#489](https://github.com/fog/fog-aws/issues/489)
29
+ - S3 Select Support? [\#484](https://github.com/fog/fog-aws/issues/484)
30
+ - nil:NilClass error [\#483](https://github.com/fog/fog-aws/issues/483)
31
+ - Mocks for VM creation require access and secret key when using instance profiles [\#482](https://github.com/fog/fog-aws/issues/482)
32
+ - Always use bucket virtual hostname? [\#464](https://github.com/fog/fog-aws/issues/464)
33
+ - Spot instance creation : Support for BlockDurationMinutes [\#461](https://github.com/fog/fog-aws/issues/461)
34
+ - How can I remove the `Content-Encoding` metadata properties if I upload from fog [\#447](https://github.com/fog/fog-aws/issues/447)
35
+ - AWS::ECS with `use_iam_profile` errors out [\#441](https://github.com/fog/fog-aws/issues/441)
36
+ - Option to turn off Warnings [\#426](https://github.com/fog/fog-aws/issues/426)
37
+ - Accessing AWS S3 using EC2 Instance Profile [\#423](https://github.com/fog/fog-aws/issues/423)
38
+ - Support step and target tracking auto scaling policies [\#422](https://github.com/fog/fog-aws/issues/422)
39
+ - could not create ec2 volume with custom encryption key, volume only create with default 'aws/ebs' encryption key [\#420](https://github.com/fog/fog-aws/issues/420)
40
+ - Download File with content\_disposition [\#418](https://github.com/fog/fog-aws/issues/418)
41
+ - Fog::Compute::AWS::Error iamInstanceProfile.name is invalid [\#410](https://github.com/fog/fog-aws/issues/410)
42
+ - Mocks for EC2 instance creation do not behave as expected [\#404](https://github.com/fog/fog-aws/issues/404)
43
+ - Cannot copy an encrypted snapshot from one account to another account [\#398](https://github.com/fog/fog-aws/issues/398)
44
+ - Fog::Compute::AWS::Image\#deregister ignores non-root snapshots. [\#380](https://github.com/fog/fog-aws/issues/380)
45
+ - AWS S3 overwrites files with same name [\#378](https://github.com/fog/fog-aws/issues/378)
46
+ - Support S3 object tagging [\#377](https://github.com/fog/fog-aws/issues/377)
47
+ - Reqeust to support Aws::DynamoDBStreams [\#373](https://github.com/fog/fog-aws/issues/373)
48
+ - Not all Rds versions and Instance Types are rendered [\#371](https://github.com/fog/fog-aws/issues/371)
49
+ - Tag instances upon creation of new instance [\#359](https://github.com/fog/fog-aws/issues/359)
50
+ - Creating instances in AWS fails with Socket Error [\#352](https://github.com/fog/fog-aws/issues/352)
51
+ - `NameError: uninitialized constant Fog::ServicesMixin` when requiring `fog/storage` [\#345](https://github.com/fog/fog-aws/issues/345)
52
+ - Add full support for target groups [\#328](https://github.com/fog/fog-aws/issues/328)
53
+ - Fog transfer acceleration endpoints [\#303](https://github.com/fog/fog-aws/issues/303)
54
+ - "Fog::DNS\[:aws\] | change\_resource\_record\_sets \(aws, dns\)" test suite flaky [\#301](https://github.com/fog/fog-aws/issues/301)
55
+ - Cross account access using IAM role [\#294](https://github.com/fog/fog-aws/issues/294)
56
+ - Write timeout trying to upload a large file to S3 [\#291](https://github.com/fog/fog-aws/issues/291)
57
+ - Support Autoscaling lifecycle hooks [\#289](https://github.com/fog/fog-aws/issues/289)
58
+ - directories ignore region option [\#287](https://github.com/fog/fog-aws/issues/287)
59
+ - Feature: Access logs for ELB [\#271](https://github.com/fog/fog-aws/issues/271)
60
+ - S3: retry on 500 internal server error [\#264](https://github.com/fog/fog-aws/issues/264)
61
+ - Alias for server side encryption not working [\#260](https://github.com/fog/fog-aws/issues/260)
62
+ - InvalidParameterCombination =\> You cannot move a DB instance with Single-Az enabled to a VPC \(Fog::AWS::RDS::Error\) [\#255](https://github.com/fog/fog-aws/issues/255)
63
+ - Using STS [\#253](https://github.com/fog/fog-aws/issues/253)
64
+ - Auto Scaling Group does not enable metrics [\#251](https://github.com/fog/fog-aws/issues/251)
65
+ - aws has no storage service [\#248](https://github.com/fog/fog-aws/issues/248)
66
+ - Timeouts on Compute\#describe\_volumes due to extreme numbers of volumes [\#244](https://github.com/fog/fog-aws/issues/244)
67
+ - Support CreateReusableDelegationSet [\#243](https://github.com/fog/fog-aws/issues/243)
68
+ - Tags server creation in Mock vs Real [\#239](https://github.com/fog/fog-aws/issues/239)
69
+ - Excon::Errors::SocketError Broken pipe \(Errno::EPIPE\) when use Activeadmin upload image by nested form [\#237](https://github.com/fog/fog-aws/issues/237)
70
+ - Fog Mock doesn't update [\#236](https://github.com/fog/fog-aws/issues/236)
71
+ - ECS service\_update does not support "deploymentConfig" [\#234](https://github.com/fog/fog-aws/issues/234)
72
+ - Fog::Storage::AWS::Files\#each always iterates over entire collection [\#232](https://github.com/fog/fog-aws/issues/232)
73
+ - repeated bucket name in the URL on AWS and issue with :path\_style [\#228](https://github.com/fog/fog-aws/issues/228)
74
+ - Already initialized constant warnings [\#212](https://github.com/fog/fog-aws/issues/212)
75
+ - SQS API version is outdated [\#198](https://github.com/fog/fog-aws/issues/198)
76
+ - Problem when using irb [\#195](https://github.com/fog/fog-aws/issues/195)
77
+ - compute.servers \(via DescribeInstances\) does not include tags reliably [\#192](https://github.com/fog/fog-aws/issues/192)
78
+ - EBS create volume io1 or gp2 [\#186](https://github.com/fog/fog-aws/issues/186)
79
+ - Aws cloudformation stack-policy-body [\#179](https://github.com/fog/fog-aws/issues/179)
80
+ - EXCON\_DEBUG and DEBUG env variables do not help debug -S key issues [\#177](https://github.com/fog/fog-aws/issues/177)
81
+ - AWS4 SignatureDoesNotMatch if header contains two spaces [\#160](https://github.com/fog/fog-aws/issues/160)
82
+ - Add support for elasticache redis replication groups [\#136](https://github.com/fog/fog-aws/issues/136)
83
+ - Getting SignatureDoesNotMatch error with eu-central-1 [\#127](https://github.com/fog/fog-aws/issues/127)
84
+ - Cannot saving auto scaling group [\#125](https://github.com/fog/fog-aws/issues/125)
85
+ - fog-aws not working with dynamoDB Local [\#118](https://github.com/fog/fog-aws/issues/118)
86
+ - Fog::Compute::AWS::Error InvalidParameterValue =\> secondary-addresses [\#115](https://github.com/fog/fog-aws/issues/115)
87
+ - Is there an equivalent to describe-instance-status? [\#66](https://github.com/fog/fog-aws/issues/66)
88
+ - No usage instructions in Readme [\#64](https://github.com/fog/fog-aws/issues/64)
89
+ - AWS - distributionConfig.enabled' failed to satisfy constraint: Member must not be null [\#48](https://github.com/fog/fog-aws/issues/48)
90
+ - Clarify versioning on README [\#42](https://github.com/fog/fog-aws/issues/42)
91
+ - AWS SQS AddPermission API missing [\#26](https://github.com/fog/fog-aws/issues/26)
92
+ - AWS China region [\#25](https://github.com/fog/fog-aws/issues/25)
93
+ - AWS CloudFormation ListStacks options [\#24](https://github.com/fog/fog-aws/issues/24)
94
+ - Setting region of AWS::Compute after initialization [\#23](https://github.com/fog/fog-aws/issues/23)
95
+ - Support AWS Support API [\#22](https://github.com/fog/fog-aws/issues/22)
96
+ - InvalidClientTokenId =\> The security token included in the request is invalid [\#21](https://github.com/fog/fog-aws/issues/21)
97
+ - Change architecture attribute in AWS::Compute::Server model [\#20](https://github.com/fog/fog-aws/issues/20)
98
+ - Add support for Amazon Kinesis [\#19](https://github.com/fog/fog-aws/issues/19)
99
+ - Bring AWS CloudFront API Models/Requests up to date [\#17](https://github.com/fog/fog-aws/issues/17)
100
+ - AWS security group tests have become unstable [\#16](https://github.com/fog/fog-aws/issues/16)
101
+ - AWS auto scaling: availability zones are not a required parameter [\#15](https://github.com/fog/fog-aws/issues/15)
102
+ - Is anyone going to add support for AWS ElasticTranscoder [\#14](https://github.com/fog/fog-aws/issues/14)
103
+ - add missing attributes to aws describe\_reserved\_instances parser [\#13](https://github.com/fog/fog-aws/issues/13)
104
+ - AWS AutoScaling group min\_size & max\_size getting set to 0 [\#12](https://github.com/fog/fog-aws/issues/12)
105
+ - auto\_scaling\_group.instances does not return only instances for that group [\#11](https://github.com/fog/fog-aws/issues/11)
106
+ - Why are the credential keys not generalized? [\#10](https://github.com/fog/fog-aws/issues/10)
107
+ - Invalid XML Character in S3 Response [\#8](https://github.com/fog/fog-aws/issues/8)
108
+ - reading s3 upload progress [\#7](https://github.com/fog/fog-aws/issues/7)
109
+ - delete\_on\_termination=true attribute on new volume is not set on create [\#6](https://github.com/fog/fog-aws/issues/6)
110
+ - user\_data is still base64 encoded in Real launch\_configurations [\#5](https://github.com/fog/fog-aws/issues/5)
111
+
112
+ **Merged pull requests:**
113
+
114
+ - Add storage option to configure multipart put/copy [\#616](https://github.com/fog/fog-aws/pull/616) ([slonopotamus](https://github.com/slonopotamus))
115
+ - Bump actions/stale from 3.0.19 to 4 [\#615](https://github.com/fog/fog-aws/pull/615) ([dependabot[bot]](https://github.com/apps/dependabot))
116
+ - Update file.rb [\#613](https://github.com/fog/fog-aws/pull/613) ([iqre8](https://github.com/iqre8))
117
+ - fix storage for ruby 3.0 [\#611](https://github.com/fog/fog-aws/pull/611) ([vincentjoseph](https://github.com/vincentjoseph))
118
+ - Implement AWS TagSpecifications \(closes \#603\) [\#610](https://github.com/fog/fog-aws/pull/610) ([eLvErDe](https://github.com/eLvErDe))
119
+ - Bump actions/stale from 3.0.18 to 3.0.19 [\#609](https://github.com/fog/fog-aws/pull/609) ([dependabot[bot]](https://github.com/apps/dependabot))
120
+ - Bump actions/stale from 3 to 3.0.18 [\#608](https://github.com/fog/fog-aws/pull/608) ([dependabot[bot]](https://github.com/apps/dependabot))
121
+ - Bump actions/checkout from 2 to 2.3.4 [\#607](https://github.com/fog/fog-aws/pull/607) ([dependabot[bot]](https://github.com/apps/dependabot))
122
+ - drop git in gemspec [\#602](https://github.com/fog/fog-aws/pull/602) ([abrahamparayil](https://github.com/abrahamparayil))
123
+ - Update rubyzip requirement from ~\> 1.3.0 to ~\> 2.3.0 [\#601](https://github.com/fog/fog-aws/pull/601) ([dependabot[bot]](https://github.com/apps/dependabot))
124
+
3
125
  ## [v3.10.0](https://github.com/fog/fog-aws/tree/v3.10.0) (2021-03-22)
4
126
 
5
127
  [Full Changelog](https://github.com/fog/fog-aws/compare/v3.9.0...v3.10.0)
@@ -12,7 +134,6 @@
12
134
  - Enable hibernation on creation of ec2 instance [\#566](https://github.com/fog/fog-aws/issues/566)
13
135
  - Tests broken with fog-core 2.1.0 [\#504](https://github.com/fog/fog-aws/issues/504)
14
136
  - changelog? [\#471](https://github.com/fog/fog-aws/issues/471)
15
- - Changelog: Listing breaking changes [\#419](https://github.com/fog/fog-aws/issues/419)
16
137
  - How to use iam\_instance\_profile? [\#342](https://github.com/fog/fog-aws/issues/342)
17
138
  - how to support additional aws regions, e.g. cn-north-1 [\#164](https://github.com/fog/fog-aws/issues/164)
18
139
  - Still empty content-encoding when it is not set [\#130](https://github.com/fog/fog-aws/issues/130)
@@ -883,7 +1004,7 @@
883
1004
  - Fix mock VPC ELB creation in regions other than us-east-1 [\#94](https://github.com/fog/fog-aws/pull/94) ([mrpoundsign](https://github.com/mrpoundsign))
884
1005
  - Fix repository URL in README.md [\#91](https://github.com/fog/fog-aws/pull/91) ([tricknotes](https://github.com/tricknotes))
885
1006
  - adding support for d2 instance type [\#90](https://github.com/fog/fog-aws/pull/90) ([yumminhuang](https://github.com/yumminhuang))
886
- - Support weight round robin mock [\#89](https://github.com/fog/fog-aws/pull/89) ([freddy1666](https://github.com/freddy1666))
1007
+ - Support weight round robin mock [\#89](https://github.com/fog/fog-aws/pull/89) ([freddy61025](https://github.com/freddy61025))
887
1008
  - Update README.md [\#87](https://github.com/fog/fog-aws/pull/87) ([nomadium](https://github.com/nomadium))
888
1009
  - Add mock for EC2 request\_spot\_instances API request [\#86](https://github.com/fog/fog-aws/pull/86) ([nomadium](https://github.com/nomadium))
889
1010
  - Move more requires to autoload [\#85](https://github.com/fog/fog-aws/pull/85) ([plribeiro3000](https://github.com/plribeiro3000))
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Fog::Aws
2
2
 
3
3
  ![Gem Version](https://badge.fury.io/rb/fog-aws.svg)
4
- [![Build Status](https://github.com/fog/fog-aws/actions/workflows/ruby.yml/badge.svg)](https://github.com/fog/fog-aws/workflows/ruby.yml)
4
+ [![Build Status](https://github.com/fog/fog-aws/actions/workflows/ruby.yml/badge.svg)](https://github.com/fog/fog-aws/actions/workflows/ruby.yml)
5
5
  [![Test Coverage](https://codeclimate.com/github/fog/fog-aws/badges/coverage.svg)](https://codeclimate.com/github/fog/fog-aws)
6
6
  [![Code Climate](https://codeclimate.com/github/fog/fog-aws.svg)](https://codeclimate.com/github/fog/fog-aws)
7
7
 
data/fog-aws.gemspec CHANGED
@@ -14,7 +14,8 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = "https://github.com/fog/fog-aws"
15
15
  spec.license = "MIT"
16
16
 
17
- spec.files = `git ls-files -z`.split("\x0")
17
+ spec.files = Dir['lib/**/*.rb', 'tests/**/*', 'CHANGELOG.md', 'CONTRIBUTING.md',
18
+ 'CONTRIBUTORS.md', 'LICENSE.md', 'README.md', 'fog-aws.gemspec',]
18
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
21
  spec.require_paths = ["lib"]
@@ -24,7 +25,7 @@ Gem::Specification.new do |spec|
24
25
  spec.add_development_dependency 'bundler'
25
26
  spec.add_development_dependency 'github_changelog_generator', '~> 1.16'
26
27
  spec.add_development_dependency 'rake', '>= 12.3.3'
27
- spec.add_development_dependency 'rubyzip', '~> 1.3.0'
28
+ spec.add_development_dependency 'rubyzip', '~> 2.3.0'
28
29
  spec.add_development_dependency 'shindo', '~> 0.3'
29
30
 
30
31
  spec.add_dependency 'fog-core', '~> 2.1'
@@ -233,21 +233,24 @@ module Fog
233
233
  'fromPort' => -1,
234
234
  'toPort' => -1,
235
235
  'ipProtocol' => 'icmp',
236
- 'ipRanges' => []
236
+ 'ipRanges' => [],
237
+ 'ipv6Ranges' => []
237
238
  },
238
239
  {
239
240
  'groups' => [{'groupName' => 'default', 'userId' => owner_id, 'groupId' => security_group_id}],
240
241
  'fromPort' => 0,
241
242
  'toPort' => 65535,
242
243
  'ipProtocol' => 'tcp',
243
- 'ipRanges' => []
244
+ 'ipRanges' => [],
245
+ 'ipv6Ranges' => []
244
246
  },
245
247
  {
246
248
  'groups' => [{'groupName' => 'default', 'userId' => owner_id, 'groupId' => security_group_id}],
247
249
  'fromPort' => 0,
248
250
  'toPort' => 65535,
249
251
  'ipProtocol' => 'udp',
250
- 'ipRanges' => []
252
+ 'ipRanges' => [],
253
+ 'ipv6Ranges' => []
251
254
  }
252
255
  ],
253
256
  'ownerId' => owner_id
@@ -13,8 +13,6 @@ module Fog
13
13
 
14
14
  CONTAINER_CREDENTIALS_HOST = "http://169.254.170.2"
15
15
 
16
- STS_GLOBAL_ENDPOINT = "https://sts.amazonaws.com"
17
-
18
16
  module ServiceMethods
19
17
  def fetch_credentials(options)
20
18
  if options[:use_iam_profile] && Fog.mocking?
@@ -23,7 +21,7 @@ module Fog
23
21
  if options[:use_iam_profile]
24
22
  begin
25
23
  role_data = nil
26
- region = options[:region]
24
+ region = options[:region] || ENV["AWS_DEFAULT_REGION"]
27
25
 
28
26
  if ENV["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"]
29
27
  connection = options[:connection] || Excon.new(CONTAINER_CREDENTIALS_HOST)
@@ -44,7 +42,15 @@ module Fog
44
42
  :WebIdentityToken => File.read(options[:aws_web_identity_token_file] || ENV.fetch("AWS_WEB_IDENTITY_TOKEN_FILE")),
45
43
  :Version => "2011-06-15",
46
44
  }
47
- connection = options[:connection] || Excon.new(STS_GLOBAL_ENDPOINT, :query => params)
45
+
46
+ sts_endpoint =
47
+ if ENV["AWS_STS_REGIONAL_ENDPOINTS"] == "regional" && region
48
+ "https://sts.#{region}.amazonaws.com"
49
+ else
50
+ "https://sts.amazonaws.com"
51
+ end
52
+
53
+ connection = options[:connection] || Excon.new(sts_endpoint, :query => params)
48
54
  document = Nokogiri::XML(connection.get(:idempotent => true, :expects => 200).body)
49
55
 
50
56
  session = {
@@ -65,18 +71,19 @@ module Fog
65
71
  role_name = connection.get(:path => INSTANCE_METADATA_PATH, :idempotent => true, :expects => 200, :headers => token_header).body
66
72
  role_data = connection.get(:path => INSTANCE_METADATA_PATH+role_name, :idempotent => true, :expects => 200, :headers => token_header).body
67
73
  session = Fog::JSON.decode(role_data)
68
-
74
+
69
75
  region ||= connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200, :headers => token_header).body[0..-2]
70
76
  end
71
-
77
+
72
78
  credentials = {}
73
79
  credentials[:aws_access_key_id] = session['AccessKeyId']
74
80
  credentials[:aws_secret_access_key] = session['SecretAccessKey']
75
81
  credentials[:aws_session_token] = session['Token']
76
82
  credentials[:aws_credentials_expire_at] = Time.xmlschema session['Expiration']
77
-
83
+
78
84
  # set region by default to the one the instance is in.
79
85
  credentials[:region] = region
86
+ credentials[:sts_endpoint] = sts_endpoint if sts_endpoint
80
87
  #these indicate the metadata service is unavailable or has no profile setup
81
88
  credentials
82
89
  rescue Excon::Error => e
@@ -62,7 +62,8 @@ module Fog
62
62
  # options::
63
63
  # A hash that can contain any of the following keys:
64
64
  # :cidr_ip (defaults to "0.0.0.0/0")
65
- # :group - ("account:group_name" or "account:group_id"), cannot be used with :cidr_ip
65
+ # :cidr_ipv6 cannot be used with :cidr_ip
66
+ # :group - ("account:group_name" or "account:group_id"), cannot be used with :cidr_ip or :cidr_ipv6
66
67
  # :ip_protocol (defaults to "tcp")
67
68
  #
68
69
  # == Returns:
@@ -178,7 +179,8 @@ module Fog
178
179
  # options::
179
180
  # A hash that can contain any of the following keys:
180
181
  # :cidr_ip (defaults to "0.0.0.0/0")
181
- # :group - ("account:group_name" or "account:group_id"), cannot be used with :cidr_ip
182
+ # :cidr_ipv6 cannot be used with :cidr_ip
183
+ # :group - ("account:group_name" or "account:group_id"), cannot be used with :cidr_ip or :cidr_ipv6
182
184
  # :ip_protocol (defaults to "tcp")
183
185
  #
184
186
  # == Returns:
@@ -327,9 +329,15 @@ module Fog
327
329
  }
328
330
 
329
331
  if options[:group].nil?
330
- ip_permission['IpRanges'] = [
331
- { 'CidrIp' => options[:cidr_ip] || '0.0.0.0/0' }
332
- ]
332
+ if options[:cidr_ipv6].nil?
333
+ ip_permission['IpRanges'] = [
334
+ { 'CidrIp' => options[:cidr_ip] || '0.0.0.0/0' }
335
+ ]
336
+ else
337
+ ip_permission['Ipv6Ranges'] = [
338
+ { 'CidrIpv6' => options[:cidr_ipv6] }
339
+ ]
340
+ end
333
341
  else
334
342
  ip_permission['Groups'] = [
335
343
  group_info(options[:group])
@@ -50,6 +50,7 @@ module Fog
50
50
  attribute :subnet_id, :aliases => 'subnetId'
51
51
  attribute :tenancy
52
52
  attribute :tags, :aliases => 'tagSet'
53
+ attribute :tag_specifications, :aliases => 'tagSpecifications'
53
54
  attribute :user_data
54
55
  attribute :virtualization_type, :aliases => 'virtualizationType'
55
56
  attribute :vpc_id, :aliases => 'vpcId'
@@ -166,6 +167,7 @@ module Fog
166
167
  'SecurityGroupId' => security_group_ids,
167
168
  'SubnetId' => subnet_id,
168
169
  'UserData' => user_data,
170
+ 'TagSpecifications' => tag_specifications,
169
171
  }
170
172
  options.delete_if {|key, value| value.nil?}
171
173
 
@@ -4,8 +4,11 @@ module Fog
4
4
  module AWS
5
5
  class Storage
6
6
  class File < Fog::Model
7
- MIN_MULTIPART_CHUNK_SIZE = 5242880
8
- MAX_SINGLE_PUT_SIZE = 5368709120
7
+ # @deprecated use {Fog::AWS::Storage::MIN_MULTIPART_CHUNK_SIZE} instead
8
+ MIN_MULTIPART_CHUNK_SIZE = Fog::AWS::Storage::MIN_MULTIPART_CHUNK_SIZE
9
+ # @deprecated use {Fog::AWS::Storage::MAX_SINGLE_PUT_SIZE} instead
10
+ MAX_SINGLE_PUT_SIZE = Fog::AWS::Storage::MAX_SINGLE_PUT_SIZE
11
+ # @deprecated not used for anything
9
12
  MULTIPART_COPY_THRESHOLD = 15728640
10
13
 
11
14
  # @see AWS Object docs http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectOps.html
@@ -30,6 +33,7 @@ module Fog
30
33
  attribute :version, :aliases => 'x-amz-version-id'
31
34
  attribute :kms_key_id, :aliases => 'x-amz-server-side-encryption-aws-kms-key-id'
32
35
  attribute :tags, :aliases => 'x-amz-tagging'
36
+ attribute :website_redirect_location, :aliases => 'x-amz-website-redirect-location'
33
37
 
34
38
  UploadPartData = Struct.new(:part_number, :upload_options, :etag)
35
39
 
@@ -64,7 +68,7 @@ module Fog
64
68
  # Use small chunk sizes to minimize memory. E.g. 5242880 = 5mb
65
69
  attr_reader :multipart_chunk_size
66
70
  def multipart_chunk_size=(mp_chunk_size)
67
- raise ArgumentError.new("minimum multipart_chunk_size is #{MIN_MULTIPART_CHUNK_SIZE}") if mp_chunk_size < MIN_MULTIPART_CHUNK_SIZE
71
+ service.validate_chunk_size(mp_chunk_size, 'multipart_chunk_size')
68
72
  @multipart_chunk_size = mp_chunk_size
69
73
  end
70
74
 
@@ -144,10 +148,9 @@ module Fog
144
148
  def copy(target_directory_key, target_file_key, options = {})
145
149
  requires :directory, :key
146
150
 
147
- # With a single PUT operation you can upload objects up to 5 GB in size. Automatically set MP for larger objects.
148
- self.multipart_chunk_size = MIN_MULTIPART_CHUNK_SIZE * 2 if !multipart_chunk_size && self.content_length.to_i > MAX_SINGLE_PUT_SIZE
151
+ self.multipart_chunk_size = service.max_copy_chunk_size if multipart_chunk_size.nil?
149
152
 
150
- if multipart_chunk_size && self.content_length.to_i >= multipart_chunk_size
153
+ if multipart_chunk_size > 0 && self.content_length.to_i >= multipart_chunk_size
151
154
  upload_part_options = options.select { |key, _| ALLOWED_UPLOAD_PART_OPTIONS.include?(key.to_sym) }
152
155
  upload_part_options = upload_part_options.merge({ 'x-amz-copy-source' => "#{directory.key}/#{key}" })
153
156
  multipart_copy(options, upload_part_options, target_directory_key, target_file_key)
@@ -249,6 +252,7 @@ module Fog
249
252
  # @option options [String] storage_class sets x-amz-storage-class HTTP header. Defaults to 'STANDARD'. Or, 'REDUCED_REDUNDANCY'
250
253
  # @option options [String] encryption sets HTTP encryption header. Set to 'AES256' to encrypt files at rest on S3
251
254
  # @option options [String] tags sets x-amz-tagging HTTP header. For example, 'Org-Id=1' or 'Org-Id=1&Service=MyService'
255
+ # @option options [String] website_redirect_location sets x-amz-website-redirect-location HTTP header. For example, 'website_redirect_location=http://www.rubydoc.info/github/fog/fog-aws'
252
256
  # @return [Boolean] true if no errors
253
257
  #
254
258
  def save(options = {})
@@ -266,12 +270,11 @@ module Fog
266
270
  options.merge!(metadata)
267
271
  options['x-amz-storage-class'] = storage_class if storage_class
268
272
  options['x-amz-tagging'] = tags if tags
273
+ options['x-amz-website-redirect-location'] = website_redirect_location if website_redirect_location
269
274
  options.merge!(encryption_headers)
270
275
 
271
- # With a single PUT operation you can upload objects up to 5 GB in size. Automatically set MP for larger objects.
272
- self.multipart_chunk_size = MIN_MULTIPART_CHUNK_SIZE if !multipart_chunk_size && Fog::Storage.get_body_size(body) > MAX_SINGLE_PUT_SIZE
273
-
274
- if multipart_chunk_size && Fog::Storage.get_body_size(body) >= multipart_chunk_size && body.respond_to?(:read)
276
+ self.multipart_chunk_size = service.max_put_chunk_size if multipart_chunk_size.nil?
277
+ if multipart_chunk_size > 0 && Fog::Storage.get_body_size(body) >= multipart_chunk_size && body.respond_to?(:read)
275
278
  data = multipart_save(options)
276
279
  merge_attributes(data.body)
277
280
  else
@@ -5,9 +5,10 @@ module Fog
5
5
  class DescribeSecurityGroups < Fog::Parsers::Base
6
6
  def reset
7
7
  @group = {}
8
- @ip_permission = { 'groups' => [], 'ipRanges' => []}
9
- @ip_permission_egress = { 'groups' => [], 'ipRanges' => []}
8
+ @ip_permission = { 'groups' => [], 'ipRanges' => [], 'ipv6Ranges' => []}
9
+ @ip_permission_egress = { 'groups' => [], 'ipRanges' => [], 'ipv6Ranges' => []}
10
10
  @ip_range = {}
11
+ @ipv6_range = {}
11
12
  @security_group = { 'ipPermissions' => [], 'ipPermissionsEgress' => [], 'tagSet' => {} }
12
13
  @response = { 'securityGroupInfo' => [] }
13
14
  @tag = {}
@@ -24,6 +25,8 @@ module Fog
24
25
  @in_ip_permissions_egress = true
25
26
  when 'ipRanges'
26
27
  @in_ip_ranges = true
28
+ when 'ipv6Ranges'
29
+ @in_ipv6_ranges = true
27
30
  when 'tagSet'
28
31
  @in_tag_set = true
29
32
  end
@@ -44,6 +47,8 @@ module Fog
44
47
  case name
45
48
  when 'cidrIp'
46
49
  @ip_range[name] = value
50
+ when 'cidrIpv6'
51
+ @ipv6_range[name] = value
47
52
  when 'fromPort', 'toPort'
48
53
  if @in_ip_permissions_egress
49
54
  @ip_permission_egress[name] = value.to_i
@@ -72,6 +77,8 @@ module Fog
72
77
  end
73
78
  when 'ipRanges'
74
79
  @in_ip_ranges = false
80
+ when 'ipv6Ranges'
81
+ @in_ipv6_ranges = false
75
82
  when 'item'
76
83
  if @in_groups
77
84
  if @in_ip_permissions_egress
@@ -87,12 +94,19 @@ module Fog
87
94
  @ip_permission['ipRanges'] << @ip_range
88
95
  end
89
96
  @ip_range = {}
97
+ elsif @in_ipv6_ranges
98
+ if @in_ip_permissions_egress
99
+ @ip_permission_egress['ipv6Ranges'] << @ipv6_range
100
+ else
101
+ @ip_permission['ipv6Ranges'] << @ipv6_range
102
+ end
103
+ @ipv6_range = {}
90
104
  elsif @in_ip_permissions
91
105
  @security_group['ipPermissions'] << @ip_permission
92
- @ip_permission = { 'groups' => [], 'ipRanges' => []}
106
+ @ip_permission = { 'groups' => [], 'ipRanges' => [], 'ipv6Ranges' => []}
93
107
  elsif @in_ip_permissions_egress
94
108
  @security_group['ipPermissionsEgress'] << @ip_permission_egress
95
- @ip_permission_egress = { 'groups' => [], 'ipRanges' => []}
109
+ @ip_permission_egress = { 'groups' => [], 'ipRanges' => [], 'ipv6Ranges' => []}
96
110
  else
97
111
  @response['securityGroupInfo'] << @security_group
98
112
  @security_group = { 'ipPermissions' => [], 'ipPermissionsEgress' => [], 'tagSet' => {} }
@@ -30,6 +30,9 @@ module Fog
30
30
  # * 'IpRanges'<~Array>:
31
31
  # * ip_range<~Hash>:
32
32
  # * 'CidrIp'<~String> - CIDR range
33
+ # * 'Ipv6Ranges'<~Array>:
34
+ # * ip_range<~Hash>:
35
+ # * 'CidrIpv6'<~String> - CIDR range
33
36
  # * 'ToPort'<~Integer> - End of port range (or -1 for ICMP wildcard)
34
37
  #
35
38
  # === Returns
@@ -72,6 +75,10 @@ module Fog
72
75
  range_index += 1
73
76
  params[format('IpPermissions.%d.IpRanges.%d.CidrIp', key_index, range_index)] = ip_range['CidrIp']
74
77
  end
78
+ (permission['Ipv6Ranges'] || []).each_with_index do |ip_range, range_index|
79
+ range_index += 1
80
+ params[format('IpPermissions.%d.Ipv6Ranges.%d.CidrIpv6', key_index, range_index)] = ip_range['CidrIpv6']
81
+ end
75
82
  end
76
83
  params.reject {|k, v| v.nil? }
77
84
  end
@@ -186,6 +193,14 @@ module Fog
186
193
  'groups' => [],
187
194
  'ipRanges' => [{'cidrIp' => options['CidrIp']}]
188
195
  }
196
+ elsif options['CidrIpv6']
197
+ normalized_permissions << {
198
+ 'ipProtocol' => options['IpProtocol'],
199
+ 'fromPort' => Integer(options['FromPort']),
200
+ 'toPort' => Integer(options['ToPort']),
201
+ 'groups' => [],
202
+ 'ipv6Ranges' => [{'cidrIpv6' => options['CidrIpv6']}]
203
+ }
189
204
  elsif options['IpPermissions']
190
205
  options['IpPermissions'].each do |permission|
191
206
 
@@ -27,6 +27,8 @@ module Fog
27
27
  # * 'ipProtocol'<~String> - Ip protocol, must be in ['tcp', 'udp', 'icmp']
28
28
  # * 'ipRanges'<~Array>:
29
29
  # * 'cidrIp'<~String> - CIDR range
30
+ # * 'ipv6Ranges'<~Array>:
31
+ # * 'cidrIpv6'<~String> - CIDR ipv6 range
30
32
  # * 'toPort'<~Integer> - End of port range (or -1 for ICMP wildcard)
31
33
  # * 'ownerId'<~String> - AWS Access Key Id of the owner of the security group
32
34
  # * 'NextToken'<~String> - The token to retrieve the next page of results
@@ -44,6 +44,11 @@ module Fog
44
44
  # * 'PrivateIpAddresses.Primary'<~Bool> - Indicates whether the private IP address is the primary private IP address.
45
45
  # * 'SecondaryPrivateIpAddressCount'<~Bool> - The number of private IP addresses to assign to the network interface.
46
46
  # * 'AssociatePublicIpAddress'<~String> - Indicates whether to assign a public IP address to an instance in a VPC. The public IP address is assigned to a specific network interface
47
+ # * 'TagSpecifications'<~Array>: array of hashes
48
+ # * 'ResourceType'<~String> - Type of resource to apply tags on, e.g: instance or volume
49
+ # * 'Tags'<~Array> - List of hashs reprensenting tag to be set
50
+ # * 'Key'<~String> - Tag name
51
+ # * 'Value'<~String> - Tag value
47
52
  # * 'ClientToken'<~String> - unique case-sensitive token for ensuring idempotency
48
53
  # * 'DisableApiTermination'<~Boolean> - specifies whether or not to allow termination of the instance from the api
49
54
  # * 'SecurityGroup'<~Array> or <~String> - Name of security group(s) for instances (not supported for VPC)
@@ -144,6 +149,45 @@ module Fog
144
149
  end
145
150
  end
146
151
  end
152
+ if tag_specifications = options.delete('TagSpecifications')
153
+ # From https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/EC2/Client.html#run_instances-instance_method
154
+ # And https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html
155
+ # Discussed at https://github.com/fog/fog-aws/issues/603
156
+ #
157
+ # Example
158
+ #
159
+ # TagSpecifications: [
160
+ # {
161
+ # ResourceType: "instance",
162
+ # Tags: [
163
+ # {
164
+ # Key: "Project",
165
+ # Value: "MyProject",
166
+ # },
167
+ # ],
168
+ # },
169
+ # {
170
+ # ResourceType: "volume",
171
+ # Tags: [
172
+ # {
173
+ # Key: "Project",
174
+ # Value: "MyProject",
175
+ # },
176
+ # ],
177
+ # },
178
+ # ]
179
+ tag_specifications.each_with_index do |val, idx|
180
+ resource_type = val["ResourceType"]
181
+ tags = val["Tags"]
182
+ options["TagSpecification.#{idx}.ResourceType"] = resource_type
183
+ tags.each_with_index do |tag, tag_idx|
184
+ aws_tag_key = "TagSpecification.#{idx}.Tag.#{tag_idx}.Key"
185
+ aws_tag_value = "TagSpecification.#{idx}.Tag.#{tag_idx}.Value"
186
+ options[aws_tag_key] = tag["Key"]
187
+ options[aws_tag_value] = tag["Value"]
188
+ end
189
+ end
190
+ end
147
191
 
148
192
  idempotent = !(options['ClientToken'].nil? || options['ClientToken'].empty?)
149
193
 
@@ -50,7 +50,7 @@ module Fog
50
50
 
51
51
  idempotent = true
52
52
  if block_given?
53
- params[:response_block] = Proc.new
53
+ params[:response_block] = Proc.new(&block)
54
54
  idempotent = false
55
55
  end
56
56