fog-aws 3.6.2 → 3.6.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +91 -4
- data/fog-aws.gemspec +1 -1
- data/lib/fog/aws.rb +2 -1
- data/lib/fog/aws/credential_fetcher.rb +27 -4
- data/lib/fog/aws/kinesis.rb +23 -15
- data/lib/fog/aws/models/compute/flavors.rb +12 -12
- data/lib/fog/aws/models/compute/server.rb +4 -2
- data/lib/fog/aws/models/compute/servers.rb +2 -0
- data/lib/fog/aws/models/compute/vpc.rb +1 -1
- data/lib/fog/aws/requests/compute/run_instances.rb +20 -0
- data/lib/fog/aws/requests/compute/stop_instances.rb +11 -3
- data/lib/fog/aws/storage.rb +1 -1
- data/lib/fog/aws/version.rb +1 -1
- data/tests/credentials_tests.rb +20 -0
- metadata +3 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b18145d8a9c814854524a02640ca995f074ae8a63c232ab50a6fc84f7387237c
|
4
|
+
data.tar.gz: 36346830f2b660a561b372b9fd8b7c48d58f95bb53971d480199477909d4fe9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29957fd751f2ee82a52cf0bbbff5740a5e80e6e3c6a9cd9aa5da486b4cd1c2fbe1a19486a2ecddfd92731183e4650ca839886ce2ba7d6a5ff991db6d814fbd3e
|
7
|
+
data.tar.gz: f869e131ec87666ad2e0741e858d2f107613fc7e1151683e32dc650e844420ec0692beaae74eeb018e3297d346c14cbe59a76af7c1d754c62fc9052426e80bfb
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,92 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v3.6.7](https://github.com/fog/fog-aws/tree/HEAD)(2020-08-26)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.6.6...HEAD)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- S3 dot Region endpoint structure applied [\#574](https://github.com/fog/fog-aws/pull/574) ([gharutyunyan-vineti](https://github.com/gharutyunyan-vineti))
|
10
|
+
|
11
|
+
## [v3.6.6](https://github.com/fog/fog-aws/tree/v3.6.6) (2020-06-23)
|
12
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.6.5...v3.6.6)
|
13
|
+
|
14
|
+
**Closed issues:**
|
15
|
+
|
16
|
+
- max\_keys param in storage.directories.get.... what am I missing? [\#568](https://github.com/fog/fog-aws/issues/568)
|
17
|
+
- Fog Logs? [\#561](https://github.com/fog/fog-aws/issues/561)
|
18
|
+
|
19
|
+
**Merged pull requests:**
|
20
|
+
|
21
|
+
- added missing region EU South \(Milan\) [\#570](https://github.com/fog/fog-aws/pull/570) ([saldan](https://github.com/saldan))
|
22
|
+
- hibernation option to compute [\#569](https://github.com/fog/fog-aws/pull/569) ([taniahagan](https://github.com/taniahagan))
|
23
|
+
- Fix VPC model is\_default requires [\#567](https://github.com/fog/fog-aws/pull/567) ([biinari](https://github.com/biinari))
|
24
|
+
|
25
|
+
## [v3.6.5](https://github.com/fog/fog-aws/tree/v3.6.5) (2020-05-22)
|
26
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.6.4...v3.6.5)
|
27
|
+
|
28
|
+
**Closed issues:**
|
29
|
+
|
30
|
+
- Fog::Compute::AWS is deprecated, please use Fog::AWS::Compute warning [\#565](https://github.com/fog/fog-aws/issues/565)
|
31
|
+
- Duplicate compute flavours [\#563](https://github.com/fog/fog-aws/issues/563)
|
32
|
+
- 3.6.4 does not fetch iam credentials using IMDSv2 when running from inside containers with IMDSv2 Defaults [\#560](https://github.com/fog/fog-aws/issues/560)
|
33
|
+
|
34
|
+
**Merged pull requests:**
|
35
|
+
|
36
|
+
- Fix naming of various AWS compute flavors [\#564](https://github.com/fog/fog-aws/pull/564) ([abrom](https://github.com/abrom))
|
37
|
+
- Gracefully handle failure of IMDSv2 and allow fallback to IMDSv1 [\#562](https://github.com/fog/fog-aws/pull/562) ([atyndall](https://github.com/atyndall))
|
38
|
+
|
39
|
+
## [v3.6.4](https://github.com/fog/fog-aws/tree/v3.6.4) (2020-05-14)
|
40
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.6.3...v3.6.4)
|
41
|
+
|
42
|
+
**Closed issues:**
|
43
|
+
|
44
|
+
- Is fog-aws compatible with AWS Trust Services? [\#558](https://github.com/fog/fog-aws/issues/558)
|
45
|
+
|
46
|
+
**Merged pull requests:**
|
47
|
+
|
48
|
+
- Add support for IMDSv2 in CredentialFetcher [\#559](https://github.com/fog/fog-aws/pull/559) ([atyndall](https://github.com/atyndall))
|
49
|
+
- Don’t install development scripts [\#557](https://github.com/fog/fog-aws/pull/557) ([amarshall](https://github.com/amarshall))
|
50
|
+
|
51
|
+
## [v3.6.3](https://github.com/fog/fog-aws/tree/v3.6.3) (2020-04-22)
|
52
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.6.2...v3.6.3)
|
53
|
+
|
54
|
+
**Merged pull requests:**
|
55
|
+
|
56
|
+
- Add South Africa \(Cape Town\) Region [\#556](https://github.com/fog/fog-aws/pull/556) ([lvangool](https://github.com/lvangool))
|
57
|
+
- Adds Instance Type r5.16xlarge and r5.8xlarge [\#555](https://github.com/fog/fog-aws/pull/555) ([rupikakapoor](https://github.com/rupikakapoor))
|
58
|
+
- Update kinesis.rb [\#553](https://github.com/fog/fog-aws/pull/553) ([ioquatix](https://github.com/ioquatix))
|
59
|
+
|
60
|
+
## [v3.6.2](https://github.com/fog/fog-aws/tree/v3.6.2) (2020-03-24)
|
61
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.5.2...v3.6.2)
|
62
|
+
|
63
|
+
**Closed issues:**
|
64
|
+
|
65
|
+
- config.assets.prefix is being looked at as a bucket name [\#551](https://github.com/fog/fog-aws/issues/551)
|
66
|
+
- Class name typo: AssumeRoleWithWithWebIdentity [\#548](https://github.com/fog/fog-aws/issues/548)
|
67
|
+
- filename too long [\#544](https://github.com/fog/fog-aws/issues/544)
|
68
|
+
|
69
|
+
**Merged pull requests:**
|
70
|
+
|
71
|
+
- Adding two missing regions to Fog::AWS.regions [\#552](https://github.com/fog/fog-aws/pull/552) ([lvangool](https://github.com/lvangool))
|
72
|
+
- Adds missing param WebIdentityToken for the request to the AWS api [\#550](https://github.com/fog/fog-aws/pull/550) ([dgoradia](https://github.com/dgoradia))
|
73
|
+
- Fixes type in class name for STS assume\_role\_with\_web\_identity parser [\#549](https://github.com/fog/fog-aws/pull/549) ([dgoradia](https://github.com/dgoradia))
|
74
|
+
- Add missing AWS flavors [\#547](https://github.com/fog/fog-aws/pull/547) ([ybart](https://github.com/ybart))
|
75
|
+
- Update elasticache mocking regions [\#545](https://github.com/fog/fog-aws/pull/545) ([yads](https://github.com/yads))
|
76
|
+
- Feature/elbv2 creation endpoint [\#542](https://github.com/fog/fog-aws/pull/542) ([KevinLoiseau](https://github.com/KevinLoiseau))
|
77
|
+
- Fix/sd 8581/retrieve provider snapshot status from provider [\#541](https://github.com/fog/fog-aws/pull/541) ([toubs13](https://github.com/toubs13))
|
78
|
+
- Fix/missing implementation in listener parser [\#540](https://github.com/fog/fog-aws/pull/540) ([KevinLoiseau](https://github.com/KevinLoiseau))
|
79
|
+
- Enhance/elbv2 tag endpoints [\#539](https://github.com/fog/fog-aws/pull/539) ([KevinLoiseau](https://github.com/KevinLoiseau))
|
80
|
+
- Improve documentation and development setup [\#538](https://github.com/fog/fog-aws/pull/538) ([gustavosobral](https://github.com/gustavosobral))
|
81
|
+
- Add object tagging [\#537](https://github.com/fog/fog-aws/pull/537) ([gustavosobral](https://github.com/gustavosobral))
|
82
|
+
- Fix load balancers parser to handle more than one availability zone with addresses [\#536](https://github.com/fog/fog-aws/pull/536) ([KevinLoiseau](https://github.com/KevinLoiseau))
|
83
|
+
- Remove useless attribute location from directory model [\#535](https://github.com/fog/fog-aws/pull/535) ([KevinLoiseau](https://github.com/KevinLoiseau))
|
84
|
+
- Create service ELBV2 to handle specificities of 2015-12-01 API version [\#534](https://github.com/fog/fog-aws/pull/534) ([KevinLoiseau](https://github.com/KevinLoiseau))
|
85
|
+
- Add missing m5a flavors [\#533](https://github.com/fog/fog-aws/pull/533) ([ybart](https://github.com/ybart))
|
86
|
+
- Enhance/add some attributes to hosted zone parsers [\#531](https://github.com/fog/fog-aws/pull/531) ([KevinLoiseau](https://github.com/KevinLoiseau))
|
87
|
+
- Fix VPC tenancy on creation [\#530](https://github.com/fog/fog-aws/pull/530) ([ramonpm](https://github.com/ramonpm))
|
88
|
+
- Fix subnet's parsings [\#529](https://github.com/fog/fog-aws/pull/529) ([KevinLoiseau](https://github.com/KevinLoiseau))
|
89
|
+
|
3
90
|
## [v3.5.2](https://github.com/fog/fog-aws/tree/v3.5.2) (2019-07-16)
|
4
91
|
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.5.1...v3.5.2)
|
5
92
|
|
@@ -12,7 +99,7 @@
|
|
12
99
|
|
13
100
|
- Add ap-east-1 \(Hong Kong\) to Fog::AWS.regions [\#528](https://github.com/fog/fog-aws/pull/528) ([tisba](https://github.com/tisba))
|
14
101
|
- Update shared\_mock\_methods.rb [\#526](https://github.com/fog/fog-aws/pull/526) ([MiWieczo](https://github.com/MiWieczo))
|
15
|
-
-
|
102
|
+
- Make S3 Signature v4 streaming optional [\#525](https://github.com/fog/fog-aws/pull/525) ([stanhu](https://github.com/stanhu))
|
16
103
|
|
17
104
|
## [v3.5.1](https://github.com/fog/fog-aws/tree/v3.5.1) (2019-06-10)
|
18
105
|
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.5.0...v3.5.1)
|
@@ -206,7 +293,6 @@
|
|
206
293
|
|
207
294
|
- Update changelog for 1.4.0 [\#383](https://github.com/fog/fog-aws/pull/383) ([greysteil](https://github.com/greysteil))
|
208
295
|
- Allow specifying kms key id to use [\#382](https://github.com/fog/fog-aws/pull/382) ([fcheung](https://github.com/fcheung))
|
209
|
-
- added support to retrieve and create vpc with ipv6 cidr block [\#381](https://github.com/fog/fog-aws/pull/381) ([chanakyacool](https://github.com/chanakyacool))
|
210
296
|
- Add MaxResults filter to describe reserved instances offerings [\#376](https://github.com/fog/fog-aws/pull/376) ([KevinLoiseau](https://github.com/KevinLoiseau))
|
211
297
|
- Fix Fog::Compute::AWS::Images\#all [\#375](https://github.com/fog/fog-aws/pull/375) ([eddiej](https://github.com/eddiej))
|
212
298
|
- Fix AWS credential mocking [\#374](https://github.com/fog/fog-aws/pull/374) ([v-yarotsky](https://github.com/v-yarotsky))
|
@@ -224,6 +310,7 @@
|
|
224
310
|
|
225
311
|
**Merged pull requests:**
|
226
312
|
|
313
|
+
- added support to retrieve and create vpc with ipv6 cidr block [\#381](https://github.com/fog/fog-aws/pull/381) ([chanakyacool](https://github.com/chanakyacool))
|
227
314
|
- add NextContinuationToken support to GetBucket operation [\#370](https://github.com/fog/fog-aws/pull/370) ([khoan](https://github.com/khoan))
|
228
315
|
- Add a top-level require that matches the gem name [\#367](https://github.com/fog/fog-aws/pull/367) ([lanej](https://github.com/lanej))
|
229
316
|
- Fixed credential refresh when instance metadata host is inaccessible [\#366](https://github.com/fog/fog-aws/pull/366) ([ankane](https://github.com/ankane))
|
@@ -494,7 +581,7 @@
|
|
494
581
|
- make net/ssh require optional [\#197](https://github.com/fog/fog-aws/pull/197) ([geemus](https://github.com/geemus))
|
495
582
|
- Cache cluster security group parser [\#190](https://github.com/fog/fog-aws/pull/190) ([eherot](https://github.com/eherot))
|
496
583
|
- Allow region to be set for STS [\#189](https://github.com/fog/fog-aws/pull/189) ([fcheung](https://github.com/fcheung))
|
497
|
-
- add cn support for s3 [\#187](https://github.com/fog/fog-aws/pull/187) ([
|
584
|
+
- add cn support for s3 [\#187](https://github.com/fog/fog-aws/pull/187) ([ming535](https://github.com/ming535))
|
498
585
|
- mock instance stop and start properly [\#184](https://github.com/fog/fog-aws/pull/184) ([ehowe](https://github.com/ehowe))
|
499
586
|
- Disable idempotent option when block is passed to get\_object [\#183](https://github.com/fog/fog-aws/pull/183) ([ghost](https://github.com/ghost))
|
500
587
|
- Yield arguments to Mock\#get\_object block more similar to Excon [\#182](https://github.com/fog/fog-aws/pull/182) ([tdg5](https://github.com/tdg5))
|
@@ -818,4 +905,4 @@
|
|
818
905
|
## [fog-brightbox_v0.0.1](https://github.com/fog/fog-aws/tree/fog-brightbox_v0.0.1) (2014-02-19)
|
819
906
|
|
820
907
|
|
821
|
-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
908
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/fog-aws.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0")
|
18
|
-
spec.executables = spec.files.grep(%r{^
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
data/lib/fog/aws.rb
CHANGED
@@ -220,6 +220,7 @@ module Fog
|
|
220
220
|
|
221
221
|
def self.regions
|
222
222
|
@regions ||= [
|
223
|
+
'af-south-1',
|
223
224
|
'ap-east-1',
|
224
225
|
'ap-northeast-1', 'ap-northeast-2', 'ap-northeast-3',
|
225
226
|
'ap-south-1',
|
@@ -229,7 +230,7 @@ module Fog
|
|
229
230
|
'cn-northwest-1',
|
230
231
|
'eu-central-1',
|
231
232
|
'eu-north-1',
|
232
|
-
'eu-west-1', 'eu-west-2', 'eu-west-3',
|
233
|
+
'eu-west-1', 'eu-west-2', 'eu-west-3', 'eu-south-1',
|
233
234
|
'me-south-1',
|
234
235
|
'us-east-1', 'us-east-2',
|
235
236
|
'us-west-1', 'us-west-2',
|
@@ -3,6 +3,7 @@ module Fog
|
|
3
3
|
module CredentialFetcher
|
4
4
|
|
5
5
|
INSTANCE_METADATA_HOST = "http://169.254.169.254"
|
6
|
+
INSTANCE_METADATA_TOKEN = "/latest/api/token"
|
6
7
|
INSTANCE_METADATA_PATH = "/latest/meta-data/iam/security-credentials/"
|
7
8
|
INSTANCE_METADATA_AZ = "/latest/meta-data/placement/availability-zone/"
|
8
9
|
|
@@ -25,13 +26,15 @@ module Fog
|
|
25
26
|
|
26
27
|
if region.nil?
|
27
28
|
connection = options[:metadata_connection] || Excon.new(INSTANCE_METADATA_HOST)
|
28
|
-
|
29
|
+
token_header = fetch_credentials_token_header(connection, options[:disable_imds_v2])
|
30
|
+
region = connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200, :headers => token_header).body[0..-2]
|
29
31
|
end
|
30
32
|
else
|
31
33
|
connection = options[:connection] || Excon.new(INSTANCE_METADATA_HOST)
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
token_header = fetch_credentials_token_header(connection, options[:disable_imds_v2])
|
35
|
+
role_name = connection.get(:path => INSTANCE_METADATA_PATH, :idempotent => true, :expects => 200, :headers => token_header).body
|
36
|
+
role_data = connection.get(:path => INSTANCE_METADATA_PATH+role_name, :idempotent => true, :expects => 200, :headers => token_header).body
|
37
|
+
region ||= connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200, :headers => token_header).body[0..-2]
|
35
38
|
end
|
36
39
|
|
37
40
|
session = Fog::JSON.decode(role_data)
|
@@ -53,6 +56,26 @@ module Fog
|
|
53
56
|
super
|
54
57
|
end
|
55
58
|
end
|
59
|
+
|
60
|
+
def fetch_credentials_token_header(connection, disable_imds_v2)
|
61
|
+
return nil if disable_imds_v2
|
62
|
+
|
63
|
+
token = connection.put(
|
64
|
+
:path => INSTANCE_METADATA_TOKEN,
|
65
|
+
:idempotent => true,
|
66
|
+
:expects => 200,
|
67
|
+
:retry_interval => 1,
|
68
|
+
:retry_limit => 3,
|
69
|
+
:read_timeout => 1,
|
70
|
+
:write_timeout => 1,
|
71
|
+
:connect_timeout => 1,
|
72
|
+
:headers => { "X-aws-ec2-metadata-token-ttl-seconds" => "300" }
|
73
|
+
).body
|
74
|
+
|
75
|
+
{ "X-aws-ec2-metadata-token" => token }
|
76
|
+
rescue Excon::Error
|
77
|
+
nil
|
78
|
+
end
|
56
79
|
end
|
57
80
|
|
58
81
|
module ConnectionMethods
|
data/lib/fog/aws/kinesis.rb
CHANGED
@@ -125,23 +125,26 @@ module Fog
|
|
125
125
|
end
|
126
126
|
|
127
127
|
class Mock
|
128
|
-
|
129
|
-
@mutex ||= Mutex.new
|
130
|
-
end
|
131
|
-
def mutex; self.class.mutex; end
|
128
|
+
@mutex = Mutex.new
|
132
129
|
|
133
130
|
def self.data
|
134
|
-
@
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
131
|
+
@mutex.synchronize do
|
132
|
+
@data ||= Hash.new do |hash, region|
|
133
|
+
hash[region] = Hash.new do |region_hash, key|
|
134
|
+
region_hash[key] = {
|
135
|
+
:kinesis_streams => {}
|
136
|
+
}
|
137
|
+
end
|
139
138
|
end
|
139
|
+
|
140
|
+
yield @data if block_given?
|
140
141
|
end
|
141
142
|
end
|
142
143
|
|
143
144
|
def self.reset
|
144
|
-
@
|
145
|
+
@mutex.synchronize do
|
146
|
+
@data = nil
|
147
|
+
end
|
145
148
|
end
|
146
149
|
|
147
150
|
def initialize(options={})
|
@@ -153,31 +156,36 @@ module Fog
|
|
153
156
|
end
|
154
157
|
|
155
158
|
def data
|
156
|
-
self.class.data
|
159
|
+
self.class.data do |data|
|
160
|
+
data[@region][@aws_access_key_id]
|
161
|
+
end
|
157
162
|
end
|
158
163
|
|
159
164
|
def reset_data
|
160
|
-
self.class.data
|
165
|
+
self.class.data do |data|
|
166
|
+
data[@region].delete(@aws_access_key_id)
|
167
|
+
end
|
161
168
|
end
|
162
169
|
|
163
170
|
def self.next_sequence_number
|
164
|
-
mutex.synchronize do
|
171
|
+
@mutex.synchronize do
|
165
172
|
@sequence_number ||= -1
|
166
173
|
@sequence_number += 1
|
167
174
|
@sequence_number.to_s
|
168
175
|
end
|
169
176
|
end
|
177
|
+
|
170
178
|
def next_sequence_number; self.class.next_sequence_number; end
|
171
179
|
|
172
180
|
def self.next_shard_id
|
173
|
-
mutex.synchronize do
|
181
|
+
@mutex.synchronize do
|
174
182
|
@shard_id ||= -1
|
175
183
|
@shard_id += 1
|
176
184
|
"shardId-#{@shard_id.to_s.rjust(12, "0")}"
|
177
185
|
end
|
178
186
|
end
|
187
|
+
|
179
188
|
def next_shard_id; self.class.next_shard_id; end
|
180
|
-
|
181
189
|
end
|
182
190
|
|
183
191
|
end
|
@@ -68,7 +68,7 @@ module Fog
|
|
68
68
|
},
|
69
69
|
{
|
70
70
|
:id => 't1.micro',
|
71
|
-
:name => 'Micro Instance',
|
71
|
+
:name => 'T1 Micro Instance',
|
72
72
|
:bits => 32,
|
73
73
|
:cores => 1,
|
74
74
|
:disk => 0,
|
@@ -88,7 +88,7 @@ module Fog
|
|
88
88
|
},
|
89
89
|
{
|
90
90
|
:id => 't2.micro',
|
91
|
-
:name => 'Micro Instance',
|
91
|
+
:name => 'T2 Micro Instance',
|
92
92
|
:bits => 64,
|
93
93
|
:cores => 1,
|
94
94
|
:disk => 0,
|
@@ -98,7 +98,7 @@ module Fog
|
|
98
98
|
},
|
99
99
|
{
|
100
100
|
:id => 't2.small',
|
101
|
-
:name => 'Small Instance',
|
101
|
+
:name => 'T2 Small Instance',
|
102
102
|
:bits => 64,
|
103
103
|
:cores => 1,
|
104
104
|
:disk => 0,
|
@@ -108,7 +108,7 @@ module Fog
|
|
108
108
|
},
|
109
109
|
{
|
110
110
|
:id => 't2.medium',
|
111
|
-
:name => 'Medium Instance',
|
111
|
+
:name => 'T2 Medium Instance',
|
112
112
|
:bits => 64,
|
113
113
|
:cores => 2,
|
114
114
|
:disk => 0,
|
@@ -118,7 +118,7 @@ module Fog
|
|
118
118
|
},
|
119
119
|
{
|
120
120
|
:id => 't2.large',
|
121
|
-
:name => 'Large Instance',
|
121
|
+
:name => 'T2 Large Instance',
|
122
122
|
:bits => 64,
|
123
123
|
:cores => 2,
|
124
124
|
:disk => 0,
|
@@ -128,7 +128,7 @@ module Fog
|
|
128
128
|
},
|
129
129
|
{
|
130
130
|
:id => 't2.xlarge',
|
131
|
-
:name => 'Extra Large Instance',
|
131
|
+
:name => 'T2 Extra Large Instance',
|
132
132
|
:bits => 64,
|
133
133
|
:cores => 4,
|
134
134
|
:disk => 0,
|
@@ -138,7 +138,7 @@ module Fog
|
|
138
138
|
},
|
139
139
|
{
|
140
140
|
:id => 't2.2xlarge',
|
141
|
-
:name => 'Double Extra Large Instance',
|
141
|
+
:name => 'T2 Double Extra Large Instance',
|
142
142
|
:bits => 64,
|
143
143
|
:cores => 8,
|
144
144
|
:disk => 0,
|
@@ -368,7 +368,7 @@ module Fog
|
|
368
368
|
},
|
369
369
|
{
|
370
370
|
:id => 'm1.small',
|
371
|
-
:name => 'Small Instance',
|
371
|
+
:name => 'M1 Small Instance',
|
372
372
|
:bits => 32,
|
373
373
|
:cores => 1,
|
374
374
|
:disk => 160,
|
@@ -378,7 +378,7 @@ module Fog
|
|
378
378
|
},
|
379
379
|
{
|
380
380
|
:id => 'm1.medium',
|
381
|
-
:name => 'Medium Instance',
|
381
|
+
:name => 'M1 Medium Instance',
|
382
382
|
:bits => 32,
|
383
383
|
:cores => 1,
|
384
384
|
:disk => 400,
|
@@ -388,7 +388,7 @@ module Fog
|
|
388
388
|
},
|
389
389
|
{
|
390
390
|
:id => 'm1.large',
|
391
|
-
:name => 'Large Instance',
|
391
|
+
:name => 'M1 Large Instance',
|
392
392
|
:bits => 64,
|
393
393
|
:cores => 2,
|
394
394
|
:disk => 850,
|
@@ -398,7 +398,7 @@ module Fog
|
|
398
398
|
},
|
399
399
|
{
|
400
400
|
:id => 'm1.xlarge',
|
401
|
-
:name => 'Extra Large Instance',
|
401
|
+
:name => 'M1 Extra Large Instance',
|
402
402
|
:bits => 64,
|
403
403
|
:cores => 4,
|
404
404
|
:disk => 1690,
|
@@ -1778,7 +1778,7 @@ module Fog
|
|
1778
1778
|
},
|
1779
1779
|
{
|
1780
1780
|
:id => "u-6tb1.metal",
|
1781
|
-
:name => "
|
1781
|
+
:name => "U 6TB Metal",
|
1782
1782
|
:bits => 64,
|
1783
1783
|
:cores => 448,
|
1784
1784
|
:ram => 6597071,
|
@@ -14,6 +14,7 @@ module Fog
|
|
14
14
|
attribute :associate_public_ip, :aliases => 'associatePublicIP'
|
15
15
|
attribute :availability_zone, :aliases => 'availabilityZone'
|
16
16
|
attribute :block_device_mapping, :aliases => 'blockDeviceMapping'
|
17
|
+
attribute :hibernation_options, :aliases => 'hibernationOptions'
|
17
18
|
attribute :network_interfaces, :aliases => 'networkInterfaces'
|
18
19
|
attribute :client_token, :aliases => 'clientToken'
|
19
20
|
attribute :disable_api_termination, :aliases => 'disableApiTermination'
|
@@ -144,6 +145,7 @@ module Fog
|
|
144
145
|
|
145
146
|
options = {
|
146
147
|
'BlockDeviceMapping' => block_device_mapping,
|
148
|
+
'HibernationOptions' => hibernation_options,
|
147
149
|
'NetworkInterfaces' => network_interfaces,
|
148
150
|
'ClientToken' => client_token,
|
149
151
|
'DisableApiTermination' => disable_api_termination,
|
@@ -227,9 +229,9 @@ module Fog
|
|
227
229
|
true
|
228
230
|
end
|
229
231
|
|
230
|
-
def stop(
|
232
|
+
def stop(options = {})
|
231
233
|
requires :id
|
232
|
-
service.stop_instances(id,
|
234
|
+
service.stop_instances(id, options)
|
233
235
|
true
|
234
236
|
end
|
235
237
|
|
@@ -22,6 +22,7 @@ module Fog
|
|
22
22
|
# ami_launch_index=nil,
|
23
23
|
# availability_zone=nil,
|
24
24
|
# block_device_mapping=nil,
|
25
|
+
# hibernation_options=nil,
|
25
26
|
# network_interfaces=nil,
|
26
27
|
# client_token=nil,
|
27
28
|
# dns_name=nil,
|
@@ -119,6 +120,7 @@ module Fog
|
|
119
120
|
# ami_launch_index=0,
|
120
121
|
# availability_zone="us-east-1b",
|
121
122
|
# block_device_mapping=[],
|
123
|
+
# hibernation_options=[],
|
122
124
|
# client_token=nil,
|
123
125
|
# dns_name="ec2-25-2-474-44.compute-1.amazonaws.com",
|
124
126
|
# groups=["default"],
|
@@ -30,6 +30,8 @@ module Fog
|
|
30
30
|
# * 'Ebs.Encrypted'<~Boolean> - specifies whether or not the volume is to be encrypted unless snapshot is specified
|
31
31
|
# * 'Ebs.VolumeType'<~String> - Type of EBS volue. Valid options in ['standard', 'io1'] default is 'standard'.
|
32
32
|
# * 'Ebs.Iops'<~String> - The number of I/O operations per second (IOPS) that the volume supports. Required when VolumeType is 'io1'
|
33
|
+
# * 'HibernationOptions'<~Array>: array of hashes
|
34
|
+
# * 'Configured'<~Boolean> - specifies whether or not the instance is configued for hibernation. This parameter is valid only if the instance meets the hibernation prerequisites.
|
33
35
|
# * 'NetworkInterfaces'<~Array>: array of hashes
|
34
36
|
# * 'NetworkInterfaceId'<~String> - An existing interface to attach to a single instance
|
35
37
|
# * 'DeviceIndex'<~String> - The device index. Applies both to attaching an existing network interface and creating a network interface
|
@@ -75,6 +77,8 @@ module Fog
|
|
75
77
|
# * 'deviceName'<~String> - specifies how volume is exposed to instance
|
76
78
|
# * 'status'<~String> - status of attached volume
|
77
79
|
# * 'volumeId'<~String> - Id of attached volume
|
80
|
+
# * 'hibernationOptions'<~Array>
|
81
|
+
# * 'configured'<~Boolean> - whether or not the instance is enabled for hibernation
|
78
82
|
# * 'dnsName'<~String> - public dns name, blank until instance is running
|
79
83
|
# * 'imageId'<~String> - image id of ami used to launch instance
|
80
84
|
# * 'instanceId'<~String> - id of the instance
|
@@ -111,6 +115,13 @@ module Fog
|
|
111
115
|
end
|
112
116
|
end
|
113
117
|
end
|
118
|
+
if hibernation_options = options.delete('HibernationOptions')
|
119
|
+
hibernation_options.each_with_index do |mapping, index|
|
120
|
+
for key, value in mapping
|
121
|
+
options.merge!({ format("HibernationOptions.%d.#{key}", index) => value })
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
114
125
|
if security_groups = options.delete('SecurityGroup')
|
115
126
|
options.merge!(Fog::AWS.indexed_param('SecurityGroup', [*security_groups]))
|
116
127
|
end
|
@@ -182,6 +193,14 @@ module Fog
|
|
182
193
|
}
|
183
194
|
end
|
184
195
|
|
196
|
+
hibernation_options = (options['HibernationOptions'] || []).reduce([]) do |mapping, device|
|
197
|
+
configure = device.fetch("Configure", true)
|
198
|
+
|
199
|
+
mapping << {
|
200
|
+
"Configure" => configure,
|
201
|
+
}
|
202
|
+
end
|
203
|
+
|
185
204
|
if options['SubnetId']
|
186
205
|
if options['PrivateIpAddress']
|
187
206
|
ni_options = {'PrivateIpAddress' => options['PrivateIpAddress']}
|
@@ -221,6 +240,7 @@ module Fog
|
|
221
240
|
'associatePublicIP' => options['associatePublicIP'] || false,
|
222
241
|
'architecture' => 'i386',
|
223
242
|
'blockDeviceMapping' => block_device_mapping,
|
243
|
+
'hibernationOptions' => hibernation_options,
|
224
244
|
'networkInterfaces' => network_interfaces,
|
225
245
|
'clientToken' => options['clientToken'],
|
226
246
|
'dnsName' => nil,
|
@@ -16,9 +16,17 @@ module Fog
|
|
16
16
|
# * TODO: fill in the blanks
|
17
17
|
#
|
18
18
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html]
|
19
|
-
def stop_instances(instance_id,
|
19
|
+
def stop_instances(instance_id, options = {})
|
20
20
|
params = Fog::AWS.indexed_param('InstanceId', instance_id)
|
21
|
-
|
21
|
+
unless options.is_a?(Hash)
|
22
|
+
Fog::Logger.warning("stop_instances with #{options.class} param is deprecated, use stop_instances('force' => boolean) instead [light_black](#{caller.first})[/]")
|
23
|
+
options = {'force' => options}
|
24
|
+
end
|
25
|
+
params.merge!('Force' => 'true') if options['force']
|
26
|
+
if options['hibernate']
|
27
|
+
params.merge!('Hibernate' => 'true')
|
28
|
+
params.merge!('Force' => 'false')
|
29
|
+
end
|
22
30
|
request({
|
23
31
|
'Action' => 'StopInstances',
|
24
32
|
:idempotent => true,
|
@@ -28,7 +36,7 @@ module Fog
|
|
28
36
|
end
|
29
37
|
|
30
38
|
class Mock
|
31
|
-
def stop_instances(instance_id,
|
39
|
+
def stop_instances(instance_id, options = {})
|
32
40
|
instance_ids = Array(instance_id)
|
33
41
|
|
34
42
|
instance_set = self.data[:instances].values
|
data/lib/fog/aws/storage.rb
CHANGED
data/lib/fog/aws/version.rb
CHANGED
data/tests/credentials_tests.rb
CHANGED
@@ -7,6 +7,8 @@ Shindo.tests('AWS | credentials', ['aws']) do
|
|
7
7
|
Fog.unmock!
|
8
8
|
begin
|
9
9
|
Excon.defaults[:mock] = true
|
10
|
+
Excon.stub({ method: :put, path: '/latest/api/token' }, { status: 200, body: 'token1234' })
|
11
|
+
|
10
12
|
Excon.stub({ method: :get, path: '/latest/meta-data/iam/security-credentials/' }, { status: 200, body: 'arole' })
|
11
13
|
Excon.stub({ method: :get, path: '/latest/meta-data/placement/availability-zone/' }, { status: 200, body: 'us-west-1a' })
|
12
14
|
|
@@ -28,6 +30,23 @@ Shindo.tests('AWS | credentials', ['aws']) do
|
|
28
30
|
aws_credentials_expire_at: expires_at) { Fog::AWS::Compute.fetch_credentials(use_iam_profile: true) }
|
29
31
|
end
|
30
32
|
|
33
|
+
tests('#fetch_credentials when the v2 token 404s') do
|
34
|
+
Excon.stub({ method: :put, path: '/latest/api/token' }, { status: 404, body: 'not found' })
|
35
|
+
returns(aws_access_key_id: 'dummykey',
|
36
|
+
aws_secret_access_key: 'dummysecret',
|
37
|
+
aws_session_token: 'dummytoken',
|
38
|
+
region: 'us-west-1',
|
39
|
+
aws_credentials_expire_at: expires_at) { Fog::AWS::Compute.fetch_credentials(use_iam_profile: true) }
|
40
|
+
end
|
41
|
+
|
42
|
+
tests('#fetch_credentials when the v2 disabled') do
|
43
|
+
returns(aws_access_key_id: 'dummykey',
|
44
|
+
aws_secret_access_key: 'dummysecret',
|
45
|
+
aws_session_token: 'dummytoken',
|
46
|
+
region: 'us-west-1',
|
47
|
+
aws_credentials_expire_at: expires_at) { Fog::AWS::Compute.fetch_credentials(use_iam_profile: true, disable_imds_v2: true) }
|
48
|
+
end
|
49
|
+
|
31
50
|
ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI'] = '/v1/credentials?id=task_id'
|
32
51
|
Excon.stub({ method: :get, path: '/v1/credentials?id=task_id' }, { status: 200, body: Fog::JSON.encode(credentials) })
|
33
52
|
|
@@ -62,6 +81,7 @@ Shindo.tests('AWS | credentials', ['aws']) do
|
|
62
81
|
|
63
82
|
default_credentials = Fog::AWS::Compute.fetch_credentials({})
|
64
83
|
tests('#fetch_credentials when the url 404s') do
|
84
|
+
Excon.stub({ method: :put, path: '/latest/api/token' }, { status: 404, body: 'not found' })
|
65
85
|
Excon.stub({ method: :get, path: '/latest/meta-data/iam/security-credentials/' }, { status: 404, body: 'not bound' })
|
66
86
|
Excon.stub({ method: :get, path: '/latest/meta-data/placement/availability-zone/' }, { status: 400, body: 'not found' })
|
67
87
|
returns(default_credentials) { Fog::AWS::Compute.fetch_credentials(use_iam_profile: true) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.
|
4
|
+
version: 3.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Lane
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-08-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -143,9 +143,7 @@ description: |-
|
|
143
143
|
email:
|
144
144
|
- me@joshualane.com
|
145
145
|
- geemus@gmail.com
|
146
|
-
executables:
|
147
|
-
- console
|
148
|
-
- setup
|
146
|
+
executables: []
|
149
147
|
extensions: []
|
150
148
|
extra_rdoc_files: []
|
151
149
|
files:
|