aws-sdk-core 2.3.21 → 2.3.22
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/apis/dms/2016-01-01/api-2.json +149 -5
- data/apis/ecs/2014-11-13/api-2.json +4 -1
- data/apis/rds/2014-10-31/api-2.json +42 -5
- data/lib/aws-sdk-core.rb +1 -0
- data/lib/aws-sdk-core/credential_provider_chain.rb +5 -1
- data/lib/aws-sdk-core/ecs_credentials.rb +141 -0
- data/lib/aws-sdk-core/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20daa05adefaf0a766d8e784f423f6df7a9bf1d6
|
4
|
+
data.tar.gz: 23fa85056398323571966b5a0256596686cc79db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73aed38227f751257e22b8e97bc9c4d1f0a2396d7fc2642133af74f4b62f1ce79ade538abc1a886c2801b9c578bbd3947b0150260449a544c3469eaad3aefd89
|
7
|
+
data.tar.gz: df9b92e6db52f1ba5b1775e86ba44b6e290a4fa4b3b67631bee8875e1fcd9c4afe5c373749ea20d92bb8d7e14a0f99c0cc3b7b7668b312f9826f28287b713fc5
|
@@ -92,6 +92,19 @@
|
|
92
92
|
{"shape":"ResourceQuotaExceededFault"}
|
93
93
|
]
|
94
94
|
},
|
95
|
+
"DeleteCertificate":{
|
96
|
+
"name":"DeleteCertificate",
|
97
|
+
"http":{
|
98
|
+
"method":"POST",
|
99
|
+
"requestUri":"/"
|
100
|
+
},
|
101
|
+
"input":{"shape":"DeleteCertificateMessage"},
|
102
|
+
"output":{"shape":"DeleteCertificateResponse"},
|
103
|
+
"errors":[
|
104
|
+
{"shape":"ResourceNotFoundFault"},
|
105
|
+
{"shape":"InvalidResourceStateFault"}
|
106
|
+
]
|
107
|
+
},
|
95
108
|
"DeleteEndpoint":{
|
96
109
|
"name":"DeleteEndpoint",
|
97
110
|
"http":{
|
@@ -153,6 +166,18 @@
|
|
153
166
|
"input":{"shape":"DescribeAccountAttributesMessage"},
|
154
167
|
"output":{"shape":"DescribeAccountAttributesResponse"}
|
155
168
|
},
|
169
|
+
"DescribeCertificates":{
|
170
|
+
"name":"DescribeCertificates",
|
171
|
+
"http":{
|
172
|
+
"method":"POST",
|
173
|
+
"requestUri":"/"
|
174
|
+
},
|
175
|
+
"input":{"shape":"DescribeCertificatesMessage"},
|
176
|
+
"output":{"shape":"DescribeCertificatesResponse"},
|
177
|
+
"errors":[
|
178
|
+
{"shape":"ResourceNotFoundFault"}
|
179
|
+
]
|
180
|
+
},
|
156
181
|
"DescribeConnections":{
|
157
182
|
"name":"DescribeConnections",
|
158
183
|
"http":{
|
@@ -270,6 +295,19 @@
|
|
270
295
|
{"shape":"InvalidResourceStateFault"}
|
271
296
|
]
|
272
297
|
},
|
298
|
+
"ImportCertificate":{
|
299
|
+
"name":"ImportCertificate",
|
300
|
+
"http":{
|
301
|
+
"method":"POST",
|
302
|
+
"requestUri":"/"
|
303
|
+
},
|
304
|
+
"input":{"shape":"ImportCertificateMessage"},
|
305
|
+
"output":{"shape":"ImportCertificateResponse"},
|
306
|
+
"errors":[
|
307
|
+
{"shape":"ResourceAlreadyExistsFault"},
|
308
|
+
{"shape":"InvalidCertificateFault"}
|
309
|
+
]
|
310
|
+
},
|
273
311
|
"ListTagsForResource":{
|
274
312
|
"name":"ListTagsForResource",
|
275
313
|
"http":{
|
@@ -323,6 +361,7 @@
|
|
323
361
|
"input":{"shape":"ModifyReplicationSubnetGroupMessage"},
|
324
362
|
"output":{"shape":"ModifyReplicationSubnetGroupResponse"},
|
325
363
|
"errors":[
|
364
|
+
{"shape":"AccessDeniedFault"},
|
326
365
|
{"shape":"ResourceNotFoundFault"},
|
327
366
|
{"shape":"ResourceQuotaExceededFault"},
|
328
367
|
{"shape":"SubnetAlreadyInUse"},
|
@@ -446,6 +485,27 @@
|
|
446
485
|
},
|
447
486
|
"Boolean":{"type":"boolean"},
|
448
487
|
"BooleanOptional":{"type":"boolean"},
|
488
|
+
"Certificate":{
|
489
|
+
"type":"structure",
|
490
|
+
"members":{
|
491
|
+
"CertificateIdentifier":{"shape":"String"},
|
492
|
+
"CertificateCreationDate":{"shape":"TStamp"},
|
493
|
+
"CertificatePem":{"shape":"String"},
|
494
|
+
"CertificateArn":{"shape":"String"},
|
495
|
+
"CertificateOwner":{"shape":"String"},
|
496
|
+
"ValidFromDate":{"shape":"TStamp"},
|
497
|
+
"ValidToDate":{"shape":"TStamp"},
|
498
|
+
"SigningAlgorithm":{"shape":"String"},
|
499
|
+
"KeyLength":{"shape":"IntegerOptional"}
|
500
|
+
}
|
501
|
+
},
|
502
|
+
"CertificateList":{
|
503
|
+
"type":"list",
|
504
|
+
"member":{
|
505
|
+
"shape":"Certificate",
|
506
|
+
"locationName":"Certificate"
|
507
|
+
}
|
508
|
+
},
|
449
509
|
"Connection":{
|
450
510
|
"type":"structure",
|
451
511
|
"members":{
|
@@ -486,7 +546,9 @@
|
|
486
546
|
"DatabaseName":{"shape":"String"},
|
487
547
|
"ExtraConnectionAttributes":{"shape":"String"},
|
488
548
|
"KmsKeyId":{"shape":"String"},
|
489
|
-
"Tags":{"shape":"TagList"}
|
549
|
+
"Tags":{"shape":"TagList"},
|
550
|
+
"CertificateArn":{"shape":"String"},
|
551
|
+
"SslMode":{"shape":"DmsSslModeValue"}
|
490
552
|
}
|
491
553
|
},
|
492
554
|
"CreateEndpointResponse":{
|
@@ -509,6 +571,7 @@
|
|
509
571
|
"AvailabilityZone":{"shape":"String"},
|
510
572
|
"ReplicationSubnetGroupIdentifier":{"shape":"String"},
|
511
573
|
"PreferredMaintenanceWindow":{"shape":"String"},
|
574
|
+
"MultiAZ":{"shape":"BooleanOptional"},
|
512
575
|
"EngineVersion":{"shape":"String"},
|
513
576
|
"AutoMinorVersionUpgrade":{"shape":"BooleanOptional"},
|
514
577
|
"Tags":{"shape":"TagList"},
|
@@ -570,6 +633,19 @@
|
|
570
633
|
"ReplicationTask":{"shape":"ReplicationTask"}
|
571
634
|
}
|
572
635
|
},
|
636
|
+
"DeleteCertificateMessage":{
|
637
|
+
"type":"structure",
|
638
|
+
"required":["CertificateArn"],
|
639
|
+
"members":{
|
640
|
+
"CertificateArn":{"shape":"String"}
|
641
|
+
}
|
642
|
+
},
|
643
|
+
"DeleteCertificateResponse":{
|
644
|
+
"type":"structure",
|
645
|
+
"members":{
|
646
|
+
"Certificate":{"shape":"Certificate"}
|
647
|
+
}
|
648
|
+
},
|
573
649
|
"DeleteEndpointMessage":{
|
574
650
|
"type":"structure",
|
575
651
|
"required":["EndpointArn"],
|
@@ -632,6 +708,21 @@
|
|
632
708
|
"AccountQuotas":{"shape":"AccountQuotaList"}
|
633
709
|
}
|
634
710
|
},
|
711
|
+
"DescribeCertificatesMessage":{
|
712
|
+
"type":"structure",
|
713
|
+
"members":{
|
714
|
+
"Filters":{"shape":"FilterList"},
|
715
|
+
"MaxRecords":{"shape":"IntegerOptional"},
|
716
|
+
"Marker":{"shape":"String"}
|
717
|
+
}
|
718
|
+
},
|
719
|
+
"DescribeCertificatesResponse":{
|
720
|
+
"type":"structure",
|
721
|
+
"members":{
|
722
|
+
"Marker":{"shape":"String"},
|
723
|
+
"Certificates":{"shape":"CertificateList"}
|
724
|
+
}
|
725
|
+
},
|
635
726
|
"DescribeConnectionsMessage":{
|
636
727
|
"type":"structure",
|
637
728
|
"members":{
|
@@ -782,6 +873,15 @@
|
|
782
873
|
"Marker":{"shape":"String"}
|
783
874
|
}
|
784
875
|
},
|
876
|
+
"DmsSslModeValue":{
|
877
|
+
"type":"string",
|
878
|
+
"enum":[
|
879
|
+
"none",
|
880
|
+
"require",
|
881
|
+
"verify-ca",
|
882
|
+
"verify-full"
|
883
|
+
]
|
884
|
+
},
|
785
885
|
"Endpoint":{
|
786
886
|
"type":"structure",
|
787
887
|
"members":{
|
@@ -795,7 +895,9 @@
|
|
795
895
|
"ExtraConnectionAttributes":{"shape":"String"},
|
796
896
|
"Status":{"shape":"String"},
|
797
897
|
"KmsKeyId":{"shape":"String"},
|
798
|
-
"EndpointArn":{"shape":"String"}
|
898
|
+
"EndpointArn":{"shape":"String"},
|
899
|
+
"CertificateArn":{"shape":"String"},
|
900
|
+
"SslMode":{"shape":"DmsSslModeValue"}
|
799
901
|
}
|
800
902
|
},
|
801
903
|
"EndpointList":{
|
@@ -831,6 +933,20 @@
|
|
831
933
|
"locationName":"Value"
|
832
934
|
}
|
833
935
|
},
|
936
|
+
"ImportCertificateMessage":{
|
937
|
+
"type":"structure",
|
938
|
+
"required":["CertificateIdentifier"],
|
939
|
+
"members":{
|
940
|
+
"CertificateIdentifier":{"shape":"String"},
|
941
|
+
"CertificatePem":{"shape":"String"}
|
942
|
+
}
|
943
|
+
},
|
944
|
+
"ImportCertificateResponse":{
|
945
|
+
"type":"structure",
|
946
|
+
"members":{
|
947
|
+
"Certificate":{"shape":"Certificate"}
|
948
|
+
}
|
949
|
+
},
|
834
950
|
"InsufficientResourceCapacityFault":{
|
835
951
|
"type":"structure",
|
836
952
|
"members":{
|
@@ -840,6 +956,13 @@
|
|
840
956
|
},
|
841
957
|
"Integer":{"type":"integer"},
|
842
958
|
"IntegerOptional":{"type":"integer"},
|
959
|
+
"InvalidCertificateFault":{
|
960
|
+
"type":"structure",
|
961
|
+
"members":{
|
962
|
+
"message":{"shape":"ExceptionMessage"}
|
963
|
+
},
|
964
|
+
"exception":true
|
965
|
+
},
|
843
966
|
"InvalidResourceStateFault":{
|
844
967
|
"type":"structure",
|
845
968
|
"members":{
|
@@ -900,7 +1023,9 @@
|
|
900
1023
|
"ServerName":{"shape":"String"},
|
901
1024
|
"Port":{"shape":"IntegerOptional"},
|
902
1025
|
"DatabaseName":{"shape":"String"},
|
903
|
-
"ExtraConnectionAttributes":{"shape":"String"}
|
1026
|
+
"ExtraConnectionAttributes":{"shape":"String"},
|
1027
|
+
"CertificateArn":{"shape":"String"},
|
1028
|
+
"SslMode":{"shape":"DmsSslModeValue"}
|
904
1029
|
}
|
905
1030
|
},
|
906
1031
|
"ModifyEndpointResponse":{
|
@@ -919,6 +1044,7 @@
|
|
919
1044
|
"ReplicationInstanceClass":{"shape":"String"},
|
920
1045
|
"VpcSecurityGroupIds":{"shape":"VpcSecurityGroupIdList"},
|
921
1046
|
"PreferredMaintenanceWindow":{"shape":"String"},
|
1047
|
+
"MultiAZ":{"shape":"BooleanOptional"},
|
922
1048
|
"EngineVersion":{"shape":"String"},
|
923
1049
|
"AllowMajorVersionUpgrade":{"shape":"Boolean"},
|
924
1050
|
"AutoMinorVersionUpgrade":{"shape":"BooleanOptional"},
|
@@ -1039,12 +1165,21 @@
|
|
1039
1165
|
"ReplicationSubnetGroup":{"shape":"ReplicationSubnetGroup"},
|
1040
1166
|
"PreferredMaintenanceWindow":{"shape":"String"},
|
1041
1167
|
"PendingModifiedValues":{"shape":"ReplicationPendingModifiedValues"},
|
1168
|
+
"MultiAZ":{"shape":"Boolean"},
|
1042
1169
|
"EngineVersion":{"shape":"String"},
|
1043
1170
|
"AutoMinorVersionUpgrade":{"shape":"Boolean"},
|
1044
1171
|
"KmsKeyId":{"shape":"String"},
|
1045
1172
|
"ReplicationInstanceArn":{"shape":"String"},
|
1046
|
-
"ReplicationInstancePublicIpAddress":{
|
1047
|
-
|
1173
|
+
"ReplicationInstancePublicIpAddress":{
|
1174
|
+
"shape":"String",
|
1175
|
+
"deprecated":true
|
1176
|
+
},
|
1177
|
+
"ReplicationInstancePrivateIpAddress":{
|
1178
|
+
"shape":"String",
|
1179
|
+
"deprecated":true
|
1180
|
+
},
|
1181
|
+
"ReplicationInstancePublicIpAddresses":{"shape":"ReplicationInstancePublicIpAddressList"},
|
1182
|
+
"ReplicationInstancePrivateIpAddresses":{"shape":"ReplicationInstancePrivateIpAddressList"},
|
1048
1183
|
"PubliclyAccessible":{"shape":"Boolean"}
|
1049
1184
|
}
|
1050
1185
|
},
|
@@ -1055,11 +1190,20 @@
|
|
1055
1190
|
"locationName":"ReplicationInstance"
|
1056
1191
|
}
|
1057
1192
|
},
|
1193
|
+
"ReplicationInstancePrivateIpAddressList":{
|
1194
|
+
"type":"list",
|
1195
|
+
"member":{"shape":"String"}
|
1196
|
+
},
|
1197
|
+
"ReplicationInstancePublicIpAddressList":{
|
1198
|
+
"type":"list",
|
1199
|
+
"member":{"shape":"String"}
|
1200
|
+
},
|
1058
1201
|
"ReplicationPendingModifiedValues":{
|
1059
1202
|
"type":"structure",
|
1060
1203
|
"members":{
|
1061
1204
|
"ReplicationInstanceClass":{"shape":"String"},
|
1062
1205
|
"AllocatedStorage":{"shape":"IntegerOptional"},
|
1206
|
+
"MultiAZ":{"shape":"BooleanOptional"},
|
1063
1207
|
"EngineVersion":{"shape":"String"}
|
1064
1208
|
}
|
1065
1209
|
},
|
@@ -1039,6 +1039,7 @@
|
|
1039
1039
|
],
|
1040
1040
|
"members":{
|
1041
1041
|
"family":{"shape":"String"},
|
1042
|
+
"taskRoleArn":{"shape":"String"},
|
1042
1043
|
"containerDefinitions":{"shape":"ContainerDefinitions"},
|
1043
1044
|
"volumes":{"shape":"VolumeList"}
|
1044
1045
|
}
|
@@ -1246,6 +1247,7 @@
|
|
1246
1247
|
"taskDefinitionArn":{"shape":"String"},
|
1247
1248
|
"containerDefinitions":{"shape":"ContainerDefinitions"},
|
1248
1249
|
"family":{"shape":"String"},
|
1250
|
+
"taskRoleArn":{"shape":"String"},
|
1249
1251
|
"revision":{"shape":"Integer"},
|
1250
1252
|
"volumes":{"shape":"VolumeList"},
|
1251
1253
|
"status":{"shape":"TaskDefinitionStatus"},
|
@@ -1270,7 +1272,8 @@
|
|
1270
1272
|
"TaskOverride":{
|
1271
1273
|
"type":"structure",
|
1272
1274
|
"members":{
|
1273
|
-
"containerOverrides":{"shape":"ContainerOverrides"}
|
1275
|
+
"containerOverrides":{"shape":"ContainerOverrides"},
|
1276
|
+
"taskRoleArn":{"shape":"String"}
|
1274
1277
|
}
|
1275
1278
|
},
|
1276
1279
|
"Tasks":{
|
@@ -71,6 +71,23 @@
|
|
71
71
|
{"shape":"AuthorizationQuotaExceededFault"}
|
72
72
|
]
|
73
73
|
},
|
74
|
+
"CopyDBClusterParameterGroup":{
|
75
|
+
"name":"CopyDBClusterParameterGroup",
|
76
|
+
"http":{
|
77
|
+
"method":"POST",
|
78
|
+
"requestUri":"/"
|
79
|
+
},
|
80
|
+
"input":{"shape":"CopyDBClusterParameterGroupMessage"},
|
81
|
+
"output":{
|
82
|
+
"shape":"CopyDBClusterParameterGroupResult",
|
83
|
+
"resultWrapper":"CopyDBClusterParameterGroupResult"
|
84
|
+
},
|
85
|
+
"errors":[
|
86
|
+
{"shape":"DBParameterGroupNotFoundFault"},
|
87
|
+
{"shape":"DBParameterGroupQuotaExceededFault"},
|
88
|
+
{"shape":"DBParameterGroupAlreadyExistsFault"}
|
89
|
+
]
|
90
|
+
},
|
74
91
|
"CopyDBClusterSnapshot":{
|
75
92
|
"name":"CopyDBClusterSnapshot",
|
76
93
|
"http":{
|
@@ -930,7 +947,8 @@
|
|
930
947
|
},
|
931
948
|
"errors":[
|
932
949
|
{"shape":"DBClusterNotFoundFault"},
|
933
|
-
{"shape":"InvalidDBClusterStateFault"}
|
950
|
+
{"shape":"InvalidDBClusterStateFault"},
|
951
|
+
{"shape":"InvalidDBInstanceStateFault"}
|
934
952
|
]
|
935
953
|
},
|
936
954
|
"ListTagsForResource":{
|
@@ -1594,6 +1612,26 @@
|
|
1594
1612
|
"CharacterSetDescription":{"shape":"String"}
|
1595
1613
|
}
|
1596
1614
|
},
|
1615
|
+
"CopyDBClusterParameterGroupMessage":{
|
1616
|
+
"type":"structure",
|
1617
|
+
"required":[
|
1618
|
+
"SourceDBClusterParameterGroupIdentifier",
|
1619
|
+
"TargetDBClusterParameterGroupIdentifier",
|
1620
|
+
"TargetDBClusterParameterGroupDescription"
|
1621
|
+
],
|
1622
|
+
"members":{
|
1623
|
+
"SourceDBClusterParameterGroupIdentifier":{"shape":"String"},
|
1624
|
+
"TargetDBClusterParameterGroupIdentifier":{"shape":"String"},
|
1625
|
+
"TargetDBClusterParameterGroupDescription":{"shape":"String"},
|
1626
|
+
"Tags":{"shape":"TagList"}
|
1627
|
+
}
|
1628
|
+
},
|
1629
|
+
"CopyDBClusterParameterGroupResult":{
|
1630
|
+
"type":"structure",
|
1631
|
+
"members":{
|
1632
|
+
"DBClusterParameterGroup":{"shape":"DBClusterParameterGroup"}
|
1633
|
+
}
|
1634
|
+
},
|
1597
1635
|
"CopyDBClusterSnapshotMessage":{
|
1598
1636
|
"type":"structure",
|
1599
1637
|
"required":[
|
@@ -1676,9 +1714,7 @@
|
|
1676
1714
|
"type":"structure",
|
1677
1715
|
"required":[
|
1678
1716
|
"DBClusterIdentifier",
|
1679
|
-
"Engine"
|
1680
|
-
"MasterUsername",
|
1681
|
-
"MasterUserPassword"
|
1717
|
+
"Engine"
|
1682
1718
|
],
|
1683
1719
|
"members":{
|
1684
1720
|
"AvailabilityZones":{"shape":"AvailabilityZones"},
|
@@ -3302,7 +3338,8 @@
|
|
3302
3338
|
"FailoverDBClusterMessage":{
|
3303
3339
|
"type":"structure",
|
3304
3340
|
"members":{
|
3305
|
-
"DBClusterIdentifier":{"shape":"String"}
|
3341
|
+
"DBClusterIdentifier":{"shape":"String"},
|
3342
|
+
"TargetDBInstanceIdentifier":{"shape":"String"}
|
3306
3343
|
}
|
3307
3344
|
},
|
3308
3345
|
"FailoverDBClusterResult":{
|
data/lib/aws-sdk-core.rb
CHANGED
@@ -110,6 +110,7 @@ module Aws
|
|
110
110
|
autoload :Credentials, 'aws-sdk-core/credentials'
|
111
111
|
autoload :Deprecations, 'aws-sdk-core/deprecations'
|
112
112
|
autoload :EagerLoader, 'aws-sdk-core/eager_loader'
|
113
|
+
autoload :ECSCredentials, 'aws-sdk-core/ecs_credentials'
|
113
114
|
autoload :EmptyStructure, 'aws-sdk-core/empty_structure'
|
114
115
|
autoload :EndpointProvider, 'aws-sdk-core/endpoint_provider'
|
115
116
|
autoload :Errors, 'aws-sdk-core/errors'
|
@@ -68,7 +68,11 @@ module Aws
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def instance_profile_credentials(options)
|
71
|
-
|
71
|
+
if ENV["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"]
|
72
|
+
ECSCredentials.new(options)
|
73
|
+
else
|
74
|
+
InstanceProfileCredentials.new(options)
|
75
|
+
end
|
72
76
|
end
|
73
77
|
|
74
78
|
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'time'
|
3
|
+
require 'net/http'
|
4
|
+
|
5
|
+
module Aws
|
6
|
+
class ECSCredentials
|
7
|
+
|
8
|
+
include CredentialProvider
|
9
|
+
include RefreshingCredentials
|
10
|
+
|
11
|
+
# @api private
|
12
|
+
class Non200Response < RuntimeError; end
|
13
|
+
|
14
|
+
# These are the errors we trap when attempting to talk to the
|
15
|
+
# instance metadata service. Any of these imply the service
|
16
|
+
# is not present, no responding or some other non-recoverable
|
17
|
+
# error.
|
18
|
+
# @api private
|
19
|
+
NETWORK_ERRORS = [
|
20
|
+
Errno::EHOSTUNREACH,
|
21
|
+
Errno::ECONNREFUSED,
|
22
|
+
Errno::EHOSTDOWN,
|
23
|
+
Errno::ENETUNREACH,
|
24
|
+
SocketError,
|
25
|
+
Timeout::Error,
|
26
|
+
Non200Response,
|
27
|
+
]
|
28
|
+
|
29
|
+
# @param [Hash] options
|
30
|
+
# @option options [Integer] :retries (5) Number of times to retry
|
31
|
+
# when retrieving credentials.
|
32
|
+
# @option options [String] :ip_address ('169.254.170.2')
|
33
|
+
# @option options [Integer] :port (80)
|
34
|
+
# @option options [String] :credential_path By default, the value of the
|
35
|
+
# AWS_CONTAINER_CREDENTIALS_RELATIVE_URI environment variable.
|
36
|
+
# @option options [Float] :http_open_timeout (5)
|
37
|
+
# @option options [Float] :http_read_timeout (5)
|
38
|
+
# @option options [Numeric, Proc] :delay By default, failures are retried
|
39
|
+
# with exponential back-off, i.e. `sleep(1.2 ** num_failures)`. You can
|
40
|
+
# pass a number of seconds to sleep between failed attempts, or
|
41
|
+
# a Proc that accepts the number of failures.
|
42
|
+
# @option options [IO] :http_debug_output (nil) HTTP wire
|
43
|
+
# traces are sent to this object. You can specify something
|
44
|
+
# like $stdout.
|
45
|
+
def initialize options = {}
|
46
|
+
@retries = options[:retries] || 5
|
47
|
+
@ip_address = options[:ip_address] || '169.254.170.2'
|
48
|
+
@port = options[:port] || 80
|
49
|
+
@credential_path = options[:credential_path]
|
50
|
+
@credential_path ||= ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI']
|
51
|
+
unless @credential_path
|
52
|
+
raise ArgumentError.new(
|
53
|
+
"Cannot instantiate an ECS Credential Provider without a credential path."
|
54
|
+
)
|
55
|
+
end
|
56
|
+
@http_open_timeout = options[:http_open_timeout] || 5
|
57
|
+
@http_read_timeout = options[:http_read_timeout] || 5
|
58
|
+
@http_debug_output = options[:http_debug_output]
|
59
|
+
@backoff = backoff(options[:backoff])
|
60
|
+
super
|
61
|
+
end
|
62
|
+
|
63
|
+
# @return [Integer] The number of times to retry failed atttempts to
|
64
|
+
# fetch credentials from the instance metadata service. Defaults to 0.
|
65
|
+
attr_reader :retries
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def backoff(backoff)
|
70
|
+
case backoff
|
71
|
+
when Proc then backoff
|
72
|
+
when Numeric then lambda { |_| sleep(backoff) }
|
73
|
+
else lambda { |num_failures| Kernel.sleep(1.2 ** num_failures) }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def refresh
|
78
|
+
# Retry loading credentials up to 3 times is the instance metadata
|
79
|
+
# service is responding but is returning invalid JSON documents
|
80
|
+
# in response to the GET profile credentials call.
|
81
|
+
retry_errors([JSON::ParserError, StandardError], max_retries: 3) do
|
82
|
+
c = JSON.parse(get_credentials.to_s)
|
83
|
+
@credentials = Credentials.new(
|
84
|
+
c['AccessKeyId'],
|
85
|
+
c['SecretAccessKey'],
|
86
|
+
c['Token']
|
87
|
+
)
|
88
|
+
@expiration = c['Expiration'] ? Time.parse(c['Expiration']) : nil
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def get_credentials
|
93
|
+
# Retry loading credentials a configurable number of times if
|
94
|
+
# the instance metadata service is not responding.
|
95
|
+
begin
|
96
|
+
retry_errors(NETWORK_ERRORS, max_retries: @retries) do
|
97
|
+
open_connection do |conn|
|
98
|
+
http_get(conn, @credential_path)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
rescue
|
102
|
+
'{}'
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def open_connection
|
107
|
+
http = Net::HTTP.new(@ip_address, @port, nil)
|
108
|
+
http.open_timeout = @http_open_timeout
|
109
|
+
http.read_timeout = @http_read_timeout
|
110
|
+
http.set_debug_output(@http_debug_output) if @http_debug_output
|
111
|
+
http.start
|
112
|
+
yield(http).tap { http.finish }
|
113
|
+
end
|
114
|
+
|
115
|
+
def http_get(connection, path)
|
116
|
+
response = connection.request(Net::HTTP::Get.new(path))
|
117
|
+
if response.code.to_i == 200
|
118
|
+
response.body
|
119
|
+
else
|
120
|
+
raise Non200Response
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def retry_errors(error_classes, options = {}, &block)
|
125
|
+
max_retries = options[:max_retries]
|
126
|
+
retries = 0
|
127
|
+
begin
|
128
|
+
yield
|
129
|
+
rescue *error_classes => error
|
130
|
+
if retries < max_retries
|
131
|
+
@backoff.call(retries)
|
132
|
+
retries += 1
|
133
|
+
retry
|
134
|
+
else
|
135
|
+
raise
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
141
|
+
end
|
data/lib/aws-sdk-core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jmespath
|
@@ -301,6 +301,7 @@ files:
|
|
301
301
|
- lib/aws-sdk-core/ec2.rb
|
302
302
|
- lib/aws-sdk-core/ecr.rb
|
303
303
|
- lib/aws-sdk-core/ecs.rb
|
304
|
+
- lib/aws-sdk-core/ecs_credentials.rb
|
304
305
|
- lib/aws-sdk-core/efs.rb
|
305
306
|
- lib/aws-sdk-core/elasticache.rb
|
306
307
|
- lib/aws-sdk-core/elasticbeanstalk.rb
|