fog-aws 3.5.2 → 3.6.6
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/.gitignore +1 -0
- data/CHANGELOG.md +82 -7
- data/LICENSE.md +1 -1
- data/README.md +39 -6
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/fog-aws.gemspec +3 -3
- data/lib/fog/aws.rb +6 -1
- data/lib/fog/aws/credential_fetcher.rb +27 -4
- data/lib/fog/aws/elasticache.rb +4 -2
- data/lib/fog/aws/elb.rb +1 -1
- data/lib/fog/aws/elbv2.rb +72 -0
- data/lib/fog/aws/kinesis.rb +23 -15
- data/lib/fog/aws/models/compute/flavors.rb +1556 -134
- 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/snapshot.rb +7 -6
- data/lib/fog/aws/models/compute/vpc.rb +8 -2
- data/lib/fog/aws/models/storage/directory.rb +0 -1
- data/lib/fog/aws/models/storage/file.rb +3 -0
- data/lib/fog/aws/parsers/compute/create_snapshot.rb +1 -1
- data/lib/fog/aws/parsers/compute/create_subnet.rb +33 -6
- data/lib/fog/aws/parsers/compute/describe_subnets.rb +33 -6
- data/lib/fog/aws/parsers/dns/create_hosted_zone.rb +1 -1
- data/lib/fog/aws/parsers/dns/get_hosted_zone.rb +3 -3
- data/lib/fog/aws/parsers/dns/list_hosted_zones.rb +3 -1
- data/lib/fog/aws/parsers/elbv2/create_load_balancer.rb +88 -0
- data/lib/fog/aws/parsers/elbv2/describe_listeners.rb +110 -0
- data/lib/fog/aws/parsers/elbv2/describe_load_balancers.rb +88 -0
- data/lib/fog/aws/parsers/elbv2/describe_tags.rb +53 -0
- data/lib/fog/aws/parsers/elbv2/empty.rb +10 -0
- data/lib/fog/aws/parsers/storage/get_object_tagging.rb +33 -0
- data/lib/fog/aws/parsers/sts/assume_role_with_web_identity.rb +1 -1
- data/lib/fog/aws/requests/compute/create_vpc.rb +2 -2
- 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/requests/elbv2/add_tags.rb +45 -0
- data/lib/fog/aws/requests/elbv2/create_load_balancer.rb +160 -0
- data/lib/fog/aws/requests/elbv2/describe_listeners.rb +38 -0
- data/lib/fog/aws/requests/elbv2/describe_load_balancers.rb +100 -0
- data/lib/fog/aws/requests/elbv2/describe_tags.rb +50 -0
- data/lib/fog/aws/requests/elbv2/remove_tags.rb +45 -0
- data/lib/fog/aws/requests/storage/get_object_tagging.rb +41 -0
- data/lib/fog/aws/requests/storage/put_object_tagging.rb +42 -0
- data/lib/fog/aws/requests/sts/assume_role_with_web_identity.rb +7 -6
- data/lib/fog/aws/storage.rb +2 -0
- data/lib/fog/aws/version.rb +1 -1
- data/tests/credentials_tests.rb +20 -0
- data/tests/parsers/elbv2/create_load_balancer_tests.rb +48 -0
- data/tests/parsers/elbv2/describe_listeners_tests.rb +76 -0
- data/tests/parsers/elbv2/describe_load_balancers_tests.rb +54 -0
- data/tests/parsers/elbv2/describe_tags_tests.rb +35 -0
- data/tests/requests/compute/vpc_tests.rb +6 -0
- data/tests/requests/elbv2/helper.rb +66 -0
- data/tests/requests/elbv2/load_balancer_tests.rb +50 -0
- metadata +32 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c594413eed794d4a0e79b9fbba4c9549df6e0a6e83a3e174ea68b6359e71c342
|
4
|
+
data.tar.gz: 4b5284a9b08122c2150ae5f5e9c7965214d83359c90f5f8bf70eac77465efea3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7fbd8ea26343f7a3de26cc9d64dbe3993eac2433faed55f3d5ad55004c9d5c790e55774dac9b597038986c662c6d0a3fe01c260a9f5901a1c21e259856f377e
|
7
|
+
data.tar.gz: bb87840f38386b34e8360d5adf4cb0e0824c7c302f44d96aa7d3f70f2021da718e187ac6b6174691d4c101ede0f21431c0660f403f9e2ffe159feefc0b3dbac9
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,86 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [
|
3
|
+
## [v3.6.5](https://github.com/fog/fog-aws/tree/v3.6.5) (2020-05-22)
|
4
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.6.4...v3.6.5)
|
4
5
|
|
5
|
-
|
6
|
+
**Closed issues:**
|
7
|
+
|
8
|
+
- Fog::Compute::AWS is deprecated, please use Fog::AWS::Compute warning [\#565](https://github.com/fog/fog-aws/issues/565)
|
9
|
+
- Duplicate compute flavours [\#563](https://github.com/fog/fog-aws/issues/563)
|
10
|
+
- 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)
|
11
|
+
|
12
|
+
**Merged pull requests:**
|
13
|
+
|
14
|
+
- Fix naming of various AWS compute flavors [\#564](https://github.com/fog/fog-aws/pull/564) ([abrom](https://github.com/abrom))
|
15
|
+
- Gracefully handle failure of IMDSv2 and allow fallback to IMDSv1 [\#562](https://github.com/fog/fog-aws/pull/562) ([atyndall](https://github.com/atyndall))
|
16
|
+
|
17
|
+
## [v3.6.4](https://github.com/fog/fog-aws/tree/v3.6.4) (2020-05-14)
|
18
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.6.3...v3.6.4)
|
19
|
+
|
20
|
+
**Closed issues:**
|
21
|
+
|
22
|
+
- Is fog-aws compatible with AWS Trust Services? [\#558](https://github.com/fog/fog-aws/issues/558)
|
23
|
+
|
24
|
+
**Merged pull requests:**
|
25
|
+
|
26
|
+
- Add support for IMDSv2 in CredentialFetcher [\#559](https://github.com/fog/fog-aws/pull/559) ([atyndall](https://github.com/atyndall))
|
27
|
+
- Don’t install development scripts [\#557](https://github.com/fog/fog-aws/pull/557) ([amarshall](https://github.com/amarshall))
|
28
|
+
|
29
|
+
## [v3.6.3](https://github.com/fog/fog-aws/tree/v3.6.3) (2020-04-22)
|
30
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.6.2...v3.6.3)
|
31
|
+
|
32
|
+
**Merged pull requests:**
|
33
|
+
|
34
|
+
- Add South Africa \(Cape Town\) Region [\#556](https://github.com/fog/fog-aws/pull/556) ([lvangool](https://github.com/lvangool))
|
35
|
+
- Adds Instance Type r5.16xlarge and r5.8xlarge [\#555](https://github.com/fog/fog-aws/pull/555) ([rupikakapoor](https://github.com/rupikakapoor))
|
36
|
+
- Update kinesis.rb [\#553](https://github.com/fog/fog-aws/pull/553) ([ioquatix](https://github.com/ioquatix))
|
37
|
+
|
38
|
+
## [v3.6.2](https://github.com/fog/fog-aws/tree/v3.6.2) (2020-03-24)
|
39
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.5.2...v3.6.2)
|
40
|
+
|
41
|
+
**Closed issues:**
|
42
|
+
|
43
|
+
- config.assets.prefix is being looked at as a bucket name [\#551](https://github.com/fog/fog-aws/issues/551)
|
44
|
+
- Class name typo: AssumeRoleWithWithWebIdentity [\#548](https://github.com/fog/fog-aws/issues/548)
|
45
|
+
- filename too long [\#544](https://github.com/fog/fog-aws/issues/544)
|
46
|
+
|
47
|
+
**Merged pull requests:**
|
48
|
+
|
49
|
+
- Adding two missing regions to Fog::AWS.regions [\#552](https://github.com/fog/fog-aws/pull/552) ([lvangool](https://github.com/lvangool))
|
50
|
+
- 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))
|
51
|
+
- 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))
|
52
|
+
- Add missing AWS flavors [\#547](https://github.com/fog/fog-aws/pull/547) ([ybart](https://github.com/ybart))
|
53
|
+
- Update elasticache mocking regions [\#545](https://github.com/fog/fog-aws/pull/545) ([yads](https://github.com/yads))
|
54
|
+
- Feature/elbv2 creation endpoint [\#542](https://github.com/fog/fog-aws/pull/542) ([KevinLoiseau](https://github.com/KevinLoiseau))
|
55
|
+
- Fix/sd 8581/retrieve provider snapshot status from provider [\#541](https://github.com/fog/fog-aws/pull/541) ([toubs13](https://github.com/toubs13))
|
56
|
+
- Fix/missing implementation in listener parser [\#540](https://github.com/fog/fog-aws/pull/540) ([KevinLoiseau](https://github.com/KevinLoiseau))
|
57
|
+
- Enhance/elbv2 tag endpoints [\#539](https://github.com/fog/fog-aws/pull/539) ([KevinLoiseau](https://github.com/KevinLoiseau))
|
58
|
+
- Improve documentation and development setup [\#538](https://github.com/fog/fog-aws/pull/538) ([gustavosobral](https://github.com/gustavosobral))
|
59
|
+
- Add object tagging [\#537](https://github.com/fog/fog-aws/pull/537) ([gustavosobral](https://github.com/gustavosobral))
|
60
|
+
- 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))
|
61
|
+
- Remove useless attribute location from directory model [\#535](https://github.com/fog/fog-aws/pull/535) ([KevinLoiseau](https://github.com/KevinLoiseau))
|
62
|
+
- 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))
|
63
|
+
- Add missing m5a flavors [\#533](https://github.com/fog/fog-aws/pull/533) ([ybart](https://github.com/ybart))
|
64
|
+
- Enhance/add some attributes to hosted zone parsers [\#531](https://github.com/fog/fog-aws/pull/531) ([KevinLoiseau](https://github.com/KevinLoiseau))
|
65
|
+
- Fix VPC tenancy on creation [\#530](https://github.com/fog/fog-aws/pull/530) ([ramonpm](https://github.com/ramonpm))
|
66
|
+
- Fix subnet's parsings [\#529](https://github.com/fog/fog-aws/pull/529) ([KevinLoiseau](https://github.com/KevinLoiseau))
|
67
|
+
|
68
|
+
## [v3.5.2](https://github.com/fog/fog-aws/tree/v3.5.2) (2019-07-16)
|
69
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.5.1...v3.5.2)
|
70
|
+
|
71
|
+
**Closed issues:**
|
72
|
+
|
73
|
+
- Support for Hong Kong Region \(ap-east-1\)? [\#527](https://github.com/fog/fog-aws/issues/527)
|
74
|
+
- Make S3 Signature v4 Streaming Optional [\#523](https://github.com/fog/fog-aws/issues/523)
|
75
|
+
|
76
|
+
**Merged pull requests:**
|
77
|
+
|
78
|
+
- Add ap-east-1 \(Hong Kong\) to Fog::AWS.regions [\#528](https://github.com/fog/fog-aws/pull/528) ([tisba](https://github.com/tisba))
|
79
|
+
- Update shared\_mock\_methods.rb [\#526](https://github.com/fog/fog-aws/pull/526) ([MiWieczo](https://github.com/MiWieczo))
|
80
|
+
- Make S3 Signature v4 streaming optional [\#525](https://github.com/fog/fog-aws/pull/525) ([stanhu](https://github.com/stanhu))
|
81
|
+
|
82
|
+
## [v3.5.1](https://github.com/fog/fog-aws/tree/v3.5.1) (2019-06-10)
|
83
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.5.0...v3.5.1)
|
6
84
|
|
7
85
|
**Merged pull requests:**
|
8
86
|
|
@@ -215,7 +293,7 @@
|
|
215
293
|
- Add a top-level require that matches the gem name [\#367](https://github.com/fog/fog-aws/pull/367) ([lanej](https://github.com/lanej))
|
216
294
|
- Fixed credential refresh when instance metadata host is inaccessible [\#366](https://github.com/fog/fog-aws/pull/366) ([ankane](https://github.com/ankane))
|
217
295
|
- Handle multipart upload of empty files [\#365](https://github.com/fog/fog-aws/pull/365) ([fcheung](https://github.com/fcheung))
|
218
|
-
- Add p2 instance types [\#362](https://github.com/fog/fog-aws/pull/362) ([
|
296
|
+
- Add p2 instance types [\#362](https://github.com/fog/fog-aws/pull/362) ([caged](https://github.com/caged))
|
219
297
|
- Exponential backoff [\#361](https://github.com/fog/fog-aws/pull/361) ([VVMichaelSawyer](https://github.com/VVMichaelSawyer))
|
220
298
|
- Skip call to instance metadata host if region is specified [\#360](https://github.com/fog/fog-aws/pull/360) ([ankane](https://github.com/ankane))
|
221
299
|
|
@@ -363,6 +441,7 @@
|
|
363
441
|
- Expanding IAM support [\#274](https://github.com/fog/fog-aws/pull/274) ([MrPrimate](https://github.com/MrPrimate))
|
364
442
|
- Rds snapshot improvements [\#269](https://github.com/fog/fog-aws/pull/269) ([tekken](https://github.com/tekken))
|
365
443
|
- add default region to use\_iam\_profile [\#268](https://github.com/fog/fog-aws/pull/268) ([shaiguitar](https://github.com/shaiguitar))
|
444
|
+
- autoscaler attach/detatch [\#229](https://github.com/fog/fog-aws/pull/229) ([shaiguitar](https://github.com/shaiguitar))
|
366
445
|
|
367
446
|
## [v0.9.4](https://github.com/fog/fog-aws/tree/v0.9.4) (2016-06-28)
|
368
447
|
[Full Changelog](https://github.com/fog/fog-aws/compare/v0.9.3...v0.9.4)
|
@@ -417,10 +496,6 @@
|
|
417
496
|
## [v0.8.2](https://github.com/fog/fog-aws/tree/v0.8.2) (2016-03-04)
|
418
497
|
[Full Changelog](https://github.com/fog/fog-aws/compare/v0.9.0...v0.8.2)
|
419
498
|
|
420
|
-
**Merged pull requests:**
|
421
|
-
|
422
|
-
- autoscaler attach/detatch [\#229](https://github.com/fog/fog-aws/pull/229) ([shaiguitar](https://github.com/shaiguitar))
|
423
|
-
|
424
499
|
## [v0.9.0](https://github.com/fog/fog-aws/tree/v0.9.0) (2016-03-03)
|
425
500
|
[Full Changelog](https://github.com/fog/fog-aws/compare/v0.8.1...v0.9.0)
|
426
501
|
|
data/LICENSE.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2014-
|
3
|
+
Copyright (c) 2014-2019 [CONTRIBUTORS.md](https://github.com/fog/fog-aws/blob/master/CONTRIBUTORS.md)
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
this software and associated documentation files (the "Software"), to deal in
|
data/README.md
CHANGED
@@ -2,11 +2,9 @@
|
|
2
2
|
|
3
3
|

|
4
4
|
[](https://travis-ci.org/fog/fog-aws)
|
5
|
-
[](https://gemnasium.com/fog/fog-aws)
|
6
5
|
[](https://codeclimate.com/github/fog/fog-aws)
|
7
6
|
[](https://codeclimate.com/github/fog/fog-aws)
|
8
7
|
|
9
|
-
|
10
8
|
## Installation
|
11
9
|
|
12
10
|
Add this line to your application's Gemfile:
|
@@ -39,7 +37,10 @@ default:
|
|
39
37
|
aws_secret_access_key: <YOUR_SECRET_ACCESS_KEY>
|
40
38
|
```
|
41
39
|
|
42
|
-
###
|
40
|
+
### EC2
|
41
|
+
|
42
|
+
#### Connecting to the EC2 Service:
|
43
|
+
|
43
44
|
```ruby
|
44
45
|
ec2 = Fog::Compute.new :provider => 'AWS', :region => 'us-west-2'
|
45
46
|
```
|
@@ -50,7 +51,7 @@ You can review all the requests available with this service using ```#requests``
|
|
50
51
|
ec2.requests # => [:allocate_address, :assign_private_ip_addresses, :associate_address, ...]
|
51
52
|
```
|
52
53
|
|
53
|
-
|
54
|
+
#### Launch an EC2 on-demand instance:
|
54
55
|
|
55
56
|
```ruby
|
56
57
|
response = ec2.run_instances(
|
@@ -67,19 +68,51 @@ instance.wait_for { ready? }
|
|
67
68
|
puts instance.public_ip_address # => "356.300.501.20"
|
68
69
|
```
|
69
70
|
|
70
|
-
|
71
|
+
#### Terminate an EC2 instance:
|
71
72
|
|
72
73
|
```ruby
|
73
74
|
instance = ec2.servers.get("i-02db5af4")
|
74
75
|
instance.destroy
|
75
76
|
```
|
76
77
|
|
77
|
-
Fog::AWS is more than EC2 since it supports many services provided by AWS. The best way to learn and to know about how many services are supported is to take a look at the source code. To review the tests directory and to play with the library in ```
|
78
|
+
`Fog::AWS` is more than EC2 since it supports many services provided by AWS. The best way to learn and to know about how many services are supported is to take a look at the source code. To review the tests directory and to play with the library in ```bin/console``` can be very helpful resources as well.
|
79
|
+
|
80
|
+
### S3
|
81
|
+
|
82
|
+
#### Connecting to the S3 Service:
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
s3 = Fog::Storage.new(provider: 'AWS', region: 'eu-central-1')
|
86
|
+
```
|
87
|
+
|
88
|
+
#### Creating a file:
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
directory = s3.directories.new(key: 'gaudi-portal-dev')
|
92
|
+
file = directory.files.create(key: 'user/1/Gemfile', body: File.open('Gemfile'), tags: 'Org-Id=1&Service-Name=My-Service')
|
93
|
+
```
|
94
|
+
|
95
|
+
#### Listing files:
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
directory = s3.directories.get('gaudi-portal-dev', prefix: 'user/1/')
|
99
|
+
directory.files
|
100
|
+
```
|
101
|
+
|
102
|
+
#### Generating a URL for a file:
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
directory.files.new(key: 'user/1/Gemfile').url(Time.now + 60)
|
106
|
+
```
|
78
107
|
|
79
108
|
## Documentation
|
80
109
|
|
81
110
|
See the [online documentation](http://www.rubydoc.info/github/fog/fog-aws) for a complete API reference.
|
82
111
|
|
112
|
+
## Development
|
113
|
+
|
114
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
115
|
+
|
83
116
|
## Contributing
|
84
117
|
|
85
118
|
1. Fork it ( https://github.com/fog/fog-aws/fork )
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "fog-aws"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
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
|
|
@@ -23,8 +23,8 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
25
25
|
spec.add_development_dependency 'github_changelog_generator', '~> 1.14'
|
26
|
-
spec.add_development_dependency 'rake', '
|
27
|
-
spec.add_development_dependency 'rubyzip', '~> 1.
|
26
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
27
|
+
spec.add_development_dependency 'rubyzip', '~> 1.3.0'
|
28
28
|
spec.add_development_dependency 'shindo', '~> 0.3'
|
29
29
|
|
30
30
|
spec.add_dependency 'fog-core', '~> 2.1'
|
data/lib/fog/aws.rb
CHANGED
@@ -26,6 +26,7 @@ module Fog
|
|
26
26
|
autoload :ECS, File.expand_path('../aws/ecs', __FILE__)
|
27
27
|
autoload :EFS, File.expand_path('../aws/efs', __FILE__)
|
28
28
|
autoload :ELB, File.expand_path('../aws/elb', __FILE__)
|
29
|
+
autoload :ELBV2, File.expand_path('../aws/elbv2', __FILE__)
|
29
30
|
autoload :EMR, File.expand_path('../aws/emr', __FILE__)
|
30
31
|
autoload :ElasticBeanstalk, File.expand_path('../aws/beanstalk', __FILE__)
|
31
32
|
autoload :Elasticache, File.expand_path('../aws/elasticache', __FILE__)
|
@@ -58,6 +59,7 @@ module Fog
|
|
58
59
|
service(:ecs, 'ECS')
|
59
60
|
service(:efs, 'EFS')
|
60
61
|
service(:elb, 'ELB')
|
62
|
+
service(:elbv2, 'ELBV2')
|
61
63
|
service(:emr, 'EMR')
|
62
64
|
service(:federation, 'Federation')
|
63
65
|
service(:glacier, 'Glacier')
|
@@ -218,6 +220,7 @@ module Fog
|
|
218
220
|
|
219
221
|
def self.regions
|
220
222
|
@regions ||= [
|
223
|
+
'af-south-1',
|
221
224
|
'ap-east-1',
|
222
225
|
'ap-northeast-1', 'ap-northeast-2', 'ap-northeast-3',
|
223
226
|
'ap-south-1',
|
@@ -227,10 +230,12 @@ module Fog
|
|
227
230
|
'cn-northwest-1',
|
228
231
|
'eu-central-1',
|
229
232
|
'eu-north-1',
|
230
|
-
'eu-west-1', 'eu-west-2', 'eu-west-3',
|
233
|
+
'eu-west-1', 'eu-west-2', 'eu-west-3', 'eu-south-1',
|
234
|
+
'me-south-1',
|
231
235
|
'us-east-1', 'us-east-2',
|
232
236
|
'us-west-1', 'us-west-2',
|
233
237
|
'sa-east-1',
|
238
|
+
'us-gov-east-1',
|
234
239
|
'us-gov-west-1'
|
235
240
|
]
|
236
241
|
end
|
@@ -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/elasticache.rb
CHANGED
@@ -171,8 +171,10 @@ module Fog
|
|
171
171
|
@aws_credentials_expire_at = Time::now + 20
|
172
172
|
setup_credentials(options)
|
173
173
|
@region = options[:region] || 'us-east-1'
|
174
|
-
unless ['ap-
|
175
|
-
'
|
174
|
+
unless ['ap-south-1', 'ap-northeast-1', 'ap-northeast-2', 'ap-northeast-3', 'ap-southeast-1', 'ap-southeast-2',
|
175
|
+
'eu-west-1', 'eu-west-2', 'eu-west-3', 'eu-central-1',
|
176
|
+
'us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1',
|
177
|
+
'sa-east-1', 'cn-north-1', 'cn-northwest-1', 'ap-east-1', 'us-gov-west-1'].include?(@region)
|
176
178
|
raise ArgumentError, "Unknown region: #{@region.inspect}"
|
177
179
|
end
|
178
180
|
end
|
data/lib/fog/aws/elb.rb
CHANGED
@@ -142,7 +142,7 @@ module Fog
|
|
142
142
|
@port = options[:port] || 443
|
143
143
|
@scheme = options[:scheme] || 'https'
|
144
144
|
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
145
|
-
@version
|
145
|
+
@version ||= options[:version] || '2012-06-01'
|
146
146
|
|
147
147
|
setup_credentials(options)
|
148
148
|
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class ELBV2 < ELB
|
4
|
+
requires :aws_access_key_id, :aws_secret_access_key
|
5
|
+
recognizes :region, :host, :path, :port, :scheme, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at, :version, :instrumentor, :instrumentor_name
|
6
|
+
|
7
|
+
request_path 'fog/aws/requests/elbv2'
|
8
|
+
request :add_tags
|
9
|
+
request :create_load_balancer
|
10
|
+
request :describe_tags
|
11
|
+
request :remove_tags
|
12
|
+
request :describe_load_balancers
|
13
|
+
request :describe_listeners
|
14
|
+
|
15
|
+
class Real < ELB::Real
|
16
|
+
def initialize(options={})
|
17
|
+
@version = '2015-12-01'
|
18
|
+
|
19
|
+
super(options)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class Mock
|
24
|
+
def self.data
|
25
|
+
@data ||= Hash.new do |hash, region|
|
26
|
+
owner_id = Fog::AWS::Mock.owner_id
|
27
|
+
hash[region] = Hash.new do |region_hash, key|
|
28
|
+
region_hash[key] = {
|
29
|
+
:owner_id => owner_id,
|
30
|
+
:load_balancers_v2 => {}
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.dns_name(name, region)
|
37
|
+
"#{name}-#{Fog::Mock.random_hex(8)}.#{region}.elb.amazonaws.com"
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.reset
|
41
|
+
@data = nil
|
42
|
+
end
|
43
|
+
|
44
|
+
attr_reader :region
|
45
|
+
|
46
|
+
def initialize(options={})
|
47
|
+
@use_iam_profile = options[:use_iam_profile]
|
48
|
+
|
49
|
+
@region = options[:region] || 'us-east-1'
|
50
|
+
setup_credentials(options)
|
51
|
+
|
52
|
+
Fog::AWS.validate_region!(@region)
|
53
|
+
end
|
54
|
+
|
55
|
+
def setup_credentials(options)
|
56
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
57
|
+
@aws_secret_access_key = options[:aws_secret_access_key]
|
58
|
+
|
59
|
+
@signer = Fog::AWS::SignatureV4.new(@aws_access_key_id, @aws_secret_access_key,@region,'elasticloadbalancing')
|
60
|
+
end
|
61
|
+
|
62
|
+
def data
|
63
|
+
self.class.data[@region][@aws_access_key_id]
|
64
|
+
end
|
65
|
+
|
66
|
+
def reset_data
|
67
|
+
self.class.data[@region].delete(@aws_access_key_id)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|