fog-aws 3.6.6 → 3.10.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.
data/Gemfile CHANGED
@@ -11,4 +11,4 @@ end
11
11
  group :test do
12
12
  gem "simplecov"
13
13
  gem "codeclimate-test-reporter", "~> 1.0.0"
14
- end
14
+ end
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://travis-ci.org/fog/fog-aws.svg?branch=master)](https://travis-ci.org/fog/fog-aws)
4
+ [![Build Status](https://github.com/fog/fog-aws/actions/workflows/ruby.yml/badge.svg)](https://github.com/fog/fog-aws/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
 
@@ -105,6 +105,26 @@ directory.files
105
105
  directory.files.new(key: 'user/1/Gemfile').url(Time.now + 60)
106
106
  ```
107
107
 
108
+ #### Copying a file
109
+
110
+ ```ruby
111
+ directory = s3.directories.new(key: 'gaudi-portal-dev')
112
+ file = directory.files.get('user/1/Gemfile')
113
+ file.copy("target-bucket", "user/2/Gemfile.copy")
114
+ ```
115
+
116
+ To speed transfers of large files, the `concurrency` option can be used
117
+ to spawn multiple threads. Note that the file must be at least 5 MB for
118
+ multipart uploads to work. For example:
119
+
120
+ ```ruby
121
+ directory = s3.directories.new(key: 'gaudi-portal-dev')
122
+ file = directory.files.get('user/1/Gemfile')
123
+ file.multipart_chunk_size = 10 * 1024 * 1024
124
+ file.concurrency = 10
125
+ file.copy("target-bucket", "user/2/Gemfile.copy")
126
+ ```
127
+
108
128
  ## Documentation
109
129
 
110
130
  See the [online documentation](http://www.rubydoc.info/github/fog/fog-aws) for a complete API reference.
data/fog-aws.gemspec CHANGED
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.required_ruby_version = '>= 2.0.0'
23
23
 
24
- spec.add_development_dependency 'bundler', '~> 2.0'
25
- spec.add_development_dependency 'github_changelog_generator', '~> 1.14'
24
+ spec.add_development_dependency 'bundler'
25
+ spec.add_development_dependency 'github_changelog_generator', '~> 1.16'
26
26
  spec.add_development_dependency 'rake', '>= 12.3.3'
27
27
  spec.add_development_dependency 'rubyzip', '~> 1.3.0'
28
28
  spec.add_development_dependency 'shindo', '~> 0.3'
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'securerandom'
4
+
1
5
  module Fog
2
6
  module AWS
3
7
  module CredentialFetcher
@@ -9,6 +13,8 @@ module Fog
9
13
 
10
14
  CONTAINER_CREDENTIALS_HOST = "http://169.254.170.2"
11
15
 
16
+ STS_GLOBAL_ENDPOINT = "https://sts.amazonaws.com"
17
+
12
18
  module ServiceMethods
13
19
  def fetch_credentials(options)
14
20
  if options[:use_iam_profile] && Fog.mocking?
@@ -23,6 +29,30 @@ module Fog
23
29
  connection = options[:connection] || Excon.new(CONTAINER_CREDENTIALS_HOST)
24
30
  credential_path = options[:credential_path] || ENV["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"]
25
31
  role_data = connection.get(:path => credential_path, :idempotent => true, :expects => 200).body
32
+ session = Fog::JSON.decode(role_data)
33
+
34
+ if region.nil?
35
+ connection = options[:metadata_connection] || Excon.new(INSTANCE_METADATA_HOST)
36
+ token_header = fetch_credentials_token_header(connection, options[:disable_imds_v2])
37
+ region = connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200, :headers => token_header).body[0..-2]
38
+ end
39
+ elsif ENV["AWS_WEB_IDENTITY_TOKEN_FILE"]
40
+ params = {
41
+ :Action => "AssumeRoleWithWebIdentity",
42
+ :RoleArn => options[:role_arn] || ENV.fetch("AWS_ROLE_ARN"),
43
+ :RoleSessionName => options[:role_session_name] || ENV["AWS_ROLE_SESSION_NAME"] || "fog-aws-#{SecureRandom.hex}",
44
+ :WebIdentityToken => File.read(options[:aws_web_identity_token_file] || ENV.fetch("AWS_WEB_IDENTITY_TOKEN_FILE")),
45
+ :Version => "2011-06-15",
46
+ }
47
+ connection = options[:connection] || Excon.new(STS_GLOBAL_ENDPOINT, :query => params)
48
+ document = Nokogiri::XML(connection.get(:idempotent => true, :expects => 200).body)
49
+
50
+ session = {
51
+ "AccessKeyId" => document.css("AccessKeyId").children.text,
52
+ "SecretAccessKey" => document.css("SecretAccessKey").children.text,
53
+ "Token" => document.css("SessionToken").children.text,
54
+ "Expiration" => document.css("Expiration").children.text,
55
+ }
26
56
 
27
57
  if region.nil?
28
58
  connection = options[:metadata_connection] || Excon.new(INSTANCE_METADATA_HOST)
@@ -34,16 +64,17 @@ module Fog
34
64
  token_header = fetch_credentials_token_header(connection, options[:disable_imds_v2])
35
65
  role_name = connection.get(:path => INSTANCE_METADATA_PATH, :idempotent => true, :expects => 200, :headers => token_header).body
36
66
  role_data = connection.get(:path => INSTANCE_METADATA_PATH+role_name, :idempotent => true, :expects => 200, :headers => token_header).body
67
+ session = Fog::JSON.decode(role_data)
68
+
37
69
  region ||= connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200, :headers => token_header).body[0..-2]
38
70
  end
39
-
40
- session = Fog::JSON.decode(role_data)
71
+
41
72
  credentials = {}
42
73
  credentials[:aws_access_key_id] = session['AccessKeyId']
43
74
  credentials[:aws_secret_access_key] = session['SecretAccessKey']
44
75
  credentials[:aws_session_token] = session['Token']
45
76
  credentials[:aws_credentials_expire_at] = Time.xmlschema session['Expiration']
46
-
77
+
47
78
  # set region by default to the one the instance is in.
48
79
  credentials[:region] = region
49
80
  #these indicate the metadata service is unavailable or has no profile setup
@@ -366,6 +366,106 @@ module Fog
366
366
  :ebs_optimized_available => true,
367
367
  :instance_store_volumes => 0
368
368
  },
369
+ {
370
+ :id => 'm6g.metal',
371
+ :name => 'M6G Metal',
372
+ :bits => 64,
373
+ :cores => 64,
374
+ :disk => 0,
375
+ :ram => 274878,
376
+ :ebs_optimized_available => true,
377
+ :instance_store_volumes => 0
378
+ },
379
+ {
380
+ :id => 'm6gd.medium',
381
+ :name => 'M6GD Medium',
382
+ :bits => 64,
383
+ :cores => 1,
384
+ :disk => 59,
385
+ :ram => 4295,
386
+ :ebs_optimized_available => true,
387
+ :instance_store_volumes => 1
388
+ },
389
+ {
390
+ :id => 'm6gd.large',
391
+ :name => 'M6GD Large',
392
+ :bits => 64,
393
+ :cores => 2,
394
+ :disk => 118,
395
+ :ram => 8590,
396
+ :ebs_optimized_available => true,
397
+ :instance_store_volumes => 1
398
+ },
399
+ {
400
+ :id => 'm6gd.xlarge',
401
+ :name => 'M6GD Extra Large',
402
+ :bits => 64,
403
+ :cores => 4,
404
+ :disk => 237,
405
+ :ram => 17180,
406
+ :ebs_optimized_available => true,
407
+ :instance_store_volumes => 1
408
+ },
409
+ {
410
+ :id => 'm6gd.2xlarge',
411
+ :name => 'M6GD Double Extra Large',
412
+ :bits => 64,
413
+ :cores => 8,
414
+ :disk => 474,
415
+ :ram => 34360,
416
+ :ebs_optimized_available => true,
417
+ :instance_store_volumes => 1
418
+ },
419
+ {
420
+ :id => 'm6gd.4xlarge',
421
+ :name => 'M6GD Quadruple Extra Large',
422
+ :bits => 64,
423
+ :cores => 16,
424
+ :disk => 950,
425
+ :ram => 68719,
426
+ :ebs_optimized_available => true,
427
+ :instance_store_volumes => 1
428
+ },
429
+ {
430
+ :id => 'm6gd.8xlarge',
431
+ :name => 'M6GD Octuple Extra Large',
432
+ :bits => 64,
433
+ :cores => 32,
434
+ :disk => 1900,
435
+ :ram => 137439,
436
+ :ebs_optimized_available => true,
437
+ :instance_store_volumes => 1
438
+ },
439
+ {
440
+ :id => 'm6gd.12xlarge',
441
+ :name => 'M6GD Twelve Extra Large',
442
+ :bits => 64,
443
+ :cores => 48,
444
+ :disk => 2850,
445
+ :ram => 206158,
446
+ :ebs_optimized_available => true,
447
+ :instance_store_volumes => 2
448
+ },
449
+ {
450
+ :id => 'm6gd.16xlarge',
451
+ :name => 'M6GD Sixteen Extra Large',
452
+ :bits => 64,
453
+ :cores => 64,
454
+ :disk => 3800,
455
+ :ram => 274878,
456
+ :ebs_optimized_available => true,
457
+ :instance_store_volumes => 2
458
+ },
459
+ {
460
+ :id => 'm6gd.metal',
461
+ :name => 'M6GD Metal',
462
+ :bits => 64,
463
+ :cores => 64,
464
+ :disk => 3800,
465
+ :ram => 274878,
466
+ :ebs_optimized_available => true,
467
+ :instance_store_volumes => 2
468
+ },
369
469
  {
370
470
  :id => 'm1.small',
371
471
  :name => 'M1 Small Instance',
@@ -776,6 +876,186 @@ module Fog
776
876
  :ebs_optimized_available => true,
777
877
  :instance_store_volumes => 0
778
878
  },
879
+ {
880
+ :id => 'c6g.medium',
881
+ :name => 'C6G Medium',
882
+ :bits => 64,
883
+ :cores => 1,
884
+ :disk => 0,
885
+ :ram => 2147,
886
+ :ebs_optimized_available => true,
887
+ :instance_store_volumes => 0
888
+ },
889
+ {
890
+ :id => 'c6g.large',
891
+ :name => 'C6G Large',
892
+ :bits => 64,
893
+ :cores => 2,
894
+ :disk => 0,
895
+ :ram => 4295,
896
+ :ebs_optimized_available => true,
897
+ :instance_store_volumes => 0
898
+ },
899
+ {
900
+ :id => 'c6g.xlarge',
901
+ :name => 'C6G Extra Large',
902
+ :bits => 64,
903
+ :cores => 4,
904
+ :disk => 0,
905
+ :ram => 8590,
906
+ :ebs_optimized_available => true,
907
+ :instance_store_volumes => 0
908
+ },
909
+ {
910
+ :id => 'c6g.2xlarge',
911
+ :name => 'C6G Double Extra Large',
912
+ :bits => 64,
913
+ :cores => 8,
914
+ :disk => 0,
915
+ :ram => 17180,
916
+ :ebs_optimized_available => true,
917
+ :instance_store_volumes => 0
918
+ },
919
+ {
920
+ :id => 'c6g.4xlarge',
921
+ :name => 'C6G Quadruple Extra Large',
922
+ :bits => 64,
923
+ :cores => 16,
924
+ :disk => 0,
925
+ :ram => 34360,
926
+ :ebs_optimized_available => true,
927
+ :instance_store_volumes => 0
928
+ },
929
+ {
930
+ :id => 'c6g.8xlarge',
931
+ :name => 'C6G Octuple Extra Large',
932
+ :bits => 64,
933
+ :cores => 32,
934
+ :disk => 0,
935
+ :ram => 68719,
936
+ :ebs_optimized_available => true,
937
+ :instance_store_volumes => 0
938
+ },
939
+ {
940
+ :id => 'c6g.12xlarge',
941
+ :name => 'C6G Twelve Extra Large',
942
+ :bits => 64,
943
+ :cores => 48,
944
+ :disk => 0,
945
+ :ram => 103079,
946
+ :ebs_optimized_available => true,
947
+ :instance_store_volumes => 0
948
+ },
949
+ {
950
+ :id => 'c6g.16xlarge',
951
+ :name => 'C6G Sixteen Extra Large',
952
+ :bits => 64,
953
+ :cores => 64,
954
+ :disk => 0,
955
+ :ram => 137439,
956
+ :ebs_optimized_available => true,
957
+ :instance_store_volumes => 0
958
+ },
959
+ {
960
+ :id => 'c6g.metal',
961
+ :name => 'C6G Metal',
962
+ :bits => 64,
963
+ :cores => 64,
964
+ :disk => 0,
965
+ :ram => 137439,
966
+ :ebs_optimized_available => true,
967
+ :instance_store_volumes => 0
968
+ },
969
+ {
970
+ :id => 'c6gd.medium',
971
+ :name => 'C6GD Medium',
972
+ :bits => 64,
973
+ :cores => 1,
974
+ :disk => 59,
975
+ :ram => 2147,
976
+ :ebs_optimized_available => true,
977
+ :instance_store_volumes => 1
978
+ },
979
+ {
980
+ :id => 'c6gd.large',
981
+ :name => 'C6GD Large',
982
+ :bits => 64,
983
+ :cores => 2,
984
+ :disk => 118,
985
+ :ram => 4295,
986
+ :ebs_optimized_available => true,
987
+ :instance_store_volumes => 1
988
+ },
989
+ {
990
+ :id => 'c6gd.xlarge',
991
+ :name => 'C6GD Extra Large',
992
+ :bits => 64,
993
+ :cores => 4,
994
+ :disk => 237,
995
+ :ram => 8590,
996
+ :ebs_optimized_available => true,
997
+ :instance_store_volumes => 1
998
+ },
999
+ {
1000
+ :id => 'c6gd.2xlarge',
1001
+ :name => 'C6GD Double Extra Large',
1002
+ :bits => 64,
1003
+ :cores => 8,
1004
+ :disk => 474,
1005
+ :ram => 17180,
1006
+ :ebs_optimized_available => true,
1007
+ :instance_store_volumes => 1
1008
+ },
1009
+ {
1010
+ :id => 'c6gd.4xlarge',
1011
+ :name => 'C6GD Quadruple Extra Large',
1012
+ :bits => 64,
1013
+ :cores => 16,
1014
+ :disk => 950,
1015
+ :ram => 34360,
1016
+ :ebs_optimized_available => true,
1017
+ :instance_store_volumes => 1
1018
+ },
1019
+ {
1020
+ :id => 'c6gd.8xlarge',
1021
+ :name => 'C6GD Octuple Extra Large',
1022
+ :bits => 64,
1023
+ :cores => 32,
1024
+ :disk => 1900,
1025
+ :ram => 68719,
1026
+ :ebs_optimized_available => true,
1027
+ :instance_store_volumes => 1
1028
+ },
1029
+ {
1030
+ :id => 'c6gd.12xlarge',
1031
+ :name => 'C6GD Twelve Extra Large',
1032
+ :bits => 64,
1033
+ :cores => 48,
1034
+ :disk => 2850,
1035
+ :ram => 103079,
1036
+ :ebs_optimized_available => true,
1037
+ :instance_store_volumes => 2
1038
+ },
1039
+ {
1040
+ :id => 'c6gd.16xlarge',
1041
+ :name => 'C6GD Sixteen Extra Large',
1042
+ :bits => 64,
1043
+ :cores => 64,
1044
+ :disk => 3800,
1045
+ :ram => 137439,
1046
+ :ebs_optimized_available => true,
1047
+ :instance_store_volumes => 2
1048
+ },
1049
+ {
1050
+ :id => 'c6gd.metal',
1051
+ :name => 'C6GD Metal',
1052
+ :bits => 64,
1053
+ :cores => 64,
1054
+ :disk => 3800,
1055
+ :ram => 137439,
1056
+ :ebs_optimized_available => true,
1057
+ :instance_store_volumes => 2
1058
+ },
779
1059
  {
780
1060
  :id => 'g2.2xlarge',
781
1061
  :name => 'GPU Double Extra Large',
@@ -1696,6 +1976,186 @@ module Fog
1696
1976
  :ebs_optimized_available => true,
1697
1977
  :instance_store_volumes => 4
1698
1978
  },
1979
+ {
1980
+ :id => 'r6g.medium',
1981
+ :name => 'R6G Medium',
1982
+ :bits => 64,
1983
+ :cores => 1,
1984
+ :disk => 0,
1985
+ :ram => 8590,
1986
+ :ebs_optimized_available => true,
1987
+ :instance_store_volumes => 0
1988
+ },
1989
+ {
1990
+ :id => 'r6g.large',
1991
+ :name => 'R6G Large',
1992
+ :bits => 64,
1993
+ :cores => 2,
1994
+ :disk => 0,
1995
+ :ram => 17180,
1996
+ :ebs_optimized_available => true,
1997
+ :instance_store_volumes => 0
1998
+ },
1999
+ {
2000
+ :id => 'r6g.xlarge',
2001
+ :name => 'R6G Extra Large',
2002
+ :bits => 64,
2003
+ :cores => 4,
2004
+ :disk => 0,
2005
+ :ram => 34360,
2006
+ :ebs_optimized_available => true,
2007
+ :instance_store_volumes => 0
2008
+ },
2009
+ {
2010
+ :id => 'r6g.2xlarge',
2011
+ :name => 'R6G Double Extra Large',
2012
+ :bits => 64,
2013
+ :cores => 8,
2014
+ :disk => 0,
2015
+ :ram => 68719,
2016
+ :ebs_optimized_available => true,
2017
+ :instance_store_volumes => 0
2018
+ },
2019
+ {
2020
+ :id => 'r6g.4xlarge',
2021
+ :name => 'R6G Quadruple Extra Large',
2022
+ :bits => 64,
2023
+ :cores => 16,
2024
+ :disk => 0,
2025
+ :ram => 137439,
2026
+ :ebs_optimized_available => true,
2027
+ :instance_store_volumes => 0
2028
+ },
2029
+ {
2030
+ :id => 'r6g.8xlarge',
2031
+ :name => 'R6G Octuple Extra Large',
2032
+ :bits => 64,
2033
+ :cores => 32,
2034
+ :disk => 0,
2035
+ :ram => 274878,
2036
+ :ebs_optimized_available => true,
2037
+ :instance_store_volumes => 0
2038
+ },
2039
+ {
2040
+ :id => 'r6g.12xlarge',
2041
+ :name => 'R6G Twelve Extra Large',
2042
+ :bits => 64,
2043
+ :cores => 48,
2044
+ :disk => 0,
2045
+ :ram => 412317,
2046
+ :ebs_optimized_available => true,
2047
+ :instance_store_volumes => 0
2048
+ },
2049
+ {
2050
+ :id => 'r6g.16xlarge',
2051
+ :name => 'R6G Sixteen Extra Large',
2052
+ :bits => 64,
2053
+ :cores => 64,
2054
+ :disk => 0,
2055
+ :ram => 549756,
2056
+ :ebs_optimized_available => true,
2057
+ :instance_store_volumes => 0
2058
+ },
2059
+ {
2060
+ :id => 'r6g.metal',
2061
+ :name => 'R6G Metal',
2062
+ :bits => 64,
2063
+ :cores => 64,
2064
+ :disk => 0,
2065
+ :ram => 549756,
2066
+ :ebs_optimized_available => true,
2067
+ :instance_store_volumes => 0
2068
+ },
2069
+ {
2070
+ :id => 'r6gd.medium',
2071
+ :name => 'R6GD Medium',
2072
+ :bits => 64,
2073
+ :cores => 1,
2074
+ :disk => 59,
2075
+ :ram => 8590,
2076
+ :ebs_optimized_available => true,
2077
+ :instance_store_volumes => 1
2078
+ },
2079
+ {
2080
+ :id => 'r6gd.large',
2081
+ :name => 'R6GD Large',
2082
+ :bits => 64,
2083
+ :cores => 2,
2084
+ :disk => 118,
2085
+ :ram => 17180,
2086
+ :ebs_optimized_available => true,
2087
+ :instance_store_volumes => 1
2088
+ },
2089
+ {
2090
+ :id => 'r6gd.xlarge',
2091
+ :name => 'R6GD Extra Large',
2092
+ :bits => 64,
2093
+ :cores => 4,
2094
+ :disk => 237,
2095
+ :ram => 34360,
2096
+ :ebs_optimized_available => true,
2097
+ :instance_store_volumes => 1
2098
+ },
2099
+ {
2100
+ :id => 'r6gd.2xlarge',
2101
+ :name => 'R6GD Double Extra Large',
2102
+ :bits => 64,
2103
+ :cores => 8,
2104
+ :disk => 474,
2105
+ :ram => 68719,
2106
+ :ebs_optimized_available => true,
2107
+ :instance_store_volumes => 1
2108
+ },
2109
+ {
2110
+ :id => 'r6gd.4xlarge',
2111
+ :name => 'R6GD Quadruple Extra Large',
2112
+ :bits => 64,
2113
+ :cores => 16,
2114
+ :disk => 950,
2115
+ :ram => 137439,
2116
+ :ebs_optimized_available => true,
2117
+ :instance_store_volumes => 1
2118
+ },
2119
+ {
2120
+ :id => 'r6gd.8xlarge',
2121
+ :name => 'R6GD Octuple Extra Large',
2122
+ :bits => 64,
2123
+ :cores => 32,
2124
+ :disk => 1900,
2125
+ :ram => 274878,
2126
+ :ebs_optimized_available => true,
2127
+ :instance_store_volumes => 1
2128
+ },
2129
+ {
2130
+ :id => 'r6gd.12xlarge',
2131
+ :name => 'R6GD Twelve Extra Large',
2132
+ :bits => 64,
2133
+ :cores => 48,
2134
+ :disk => 2850,
2135
+ :ram => 412317,
2136
+ :ebs_optimized_available => true,
2137
+ :instance_store_volumes => 2
2138
+ },
2139
+ {
2140
+ :id => 'r6gd.16xlarge',
2141
+ :name => 'R6GD Sixteen Extra Large',
2142
+ :bits => 64,
2143
+ :cores => 64,
2144
+ :disk => 3800,
2145
+ :ram => 549756,
2146
+ :ebs_optimized_available => true,
2147
+ :instance_store_volumes => 2
2148
+ },
2149
+ {
2150
+ :id => 'r6gd.metal',
2151
+ :name => 'R6GD Metal',
2152
+ :bits => 64,
2153
+ :cores => 64,
2154
+ :disk => 3800,
2155
+ :ram => 549756,
2156
+ :ebs_optimized_available => true,
2157
+ :instance_store_volumes => 2
2158
+ },
1699
2159
  {
1700
2160
  :id => "x1.16xlarge",
1701
2161
  :name => "X1 Sixteen Extra Large",