Skip to content

Commit 5f71696

Browse files
authored
aws/endpoints: Fix SDK endpoint signing name resolution (#181)
Fixes how the SDK derives service signing names. If the signing name is not modeled in the endpoints package the service will fallback to the signing name modeled in the service model. Fix #163 Fix #153 V2 Port of aws/aws-sdk-go#1854
1 parent 3354369 commit 5f71696

File tree

12 files changed

+398
-85
lines changed

12 files changed

+398
-85
lines changed

aws/endpoints.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,21 @@ func (v ResolveWithEndpoint) ResolveEndpoint(service, region string) (Endpoint,
3232

3333
// Endpoint represents the endpoint a service client should make requests to.
3434
type Endpoint struct {
35-
URL string
36-
SigningName string
35+
// The URL of the endpoint.
36+
URL string
37+
38+
// The service name that should be used for signing the requests to the
39+
// endpoint.
40+
SigningName string
41+
42+
// The region that should be used for signing the request to the endpoint.
3743
SigningRegion string
44+
45+
// States that the signing name for this endpoint was derived from metadata
46+
// passed in, but was not explicitly modeled.
47+
SigningNameDerived bool
48+
49+
// The signing method that should be used for signign the requests to the
50+
// endpoint.
3851
SigningMethod string
3952
}

aws/endpoints/v3model.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,20 @@ func (e endpoint) resolve(service, region, dnsSuffix string, defs []endpoint, op
229229
if len(signingRegion) == 0 {
230230
signingRegion = region
231231
}
232+
232233
signingName := e.CredentialScope.Service
234+
var signingNameDerived bool
233235
if len(signingName) == 0 {
234236
signingName = service
237+
signingNameDerived = true
235238
}
236239

237240
return aws.Endpoint{
238-
URL: u,
239-
SigningRegion: signingRegion,
240-
SigningName: signingName,
241-
SigningMethod: getByPriority(e.SignatureVersions, signerPriority, defaultSigner),
241+
URL: u,
242+
SigningRegion: signingRegion,
243+
SigningName: signingName,
244+
SigningNameDerived: signingNameDerived,
245+
SigningMethod: getByPriority(e.SignatureVersions, signerPriority, defaultSigner),
242246
}
243247
}
244248

0 commit comments

Comments
 (0)