Skip to content

Commit

Permalink
feat: support Sigv4 for non AWS services (#2385)
Browse files Browse the repository at this point in the history
* feat(middleware-signing): support SigV4 for non AWS services

There is no regionInfo to determine signingService. The signingName
will instead directly come from input. And region will be used as
signingRegion.

* feat(codegen): support SigV4 for non AWS services

Write `signingName` from the SigV4 trait for non AWS service.
`region` is used for the signingRegion.
A separate SigV4Auth is used for SigV4 logic for non AWS services.

* fix(codegen): use Region plugin explicitly for AWS service

The models for the protocol tests don't seem to have the SigV4 trait,
so can't rely solely on it for using the Region plugin. e.g,
https://github.com/awslabs/smithy/blob/main/smithy-aws-protocol-tests/model/restJson1/main.smithy#L11-L13

* chore(clients): update clients with updates for SigV4 for non AWS services

* test(middleware-signing): add test for non AWS service SigV4

* chore(codegen): reduce duplication for writing region

* Reverting unnecessary changes to protocol tests
  • Loading branch information
gosar authored Jun 3, 2021
1 parent 3110d62 commit 0a251aa
Show file tree
Hide file tree
Showing 271 changed files with 493 additions and 322 deletions.
2 changes: 1 addition & 1 deletion clients/client-accessanalyzer/AccessAnalyzerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-acm-pca/ACMPCAClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-acm/ACMClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-amp/AmpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-amplify/AmplifyClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-amplifybackend/AmplifyBackendClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-api-gateway/APIGatewayClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-apigatewayv2/ApiGatewayV2Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-app-mesh/AppMeshClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-appconfig/AppConfigClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-appflow/AppflowClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-appintegrations/AppIntegrationsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-appstream/AppStreamClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-appsync/AppSyncClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-athena/AthenaClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-auditmanager/AuditManagerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-auto-scaling/AutoScalingClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-backup/BackupClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-batch/BatchClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-braket/BraketClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-budgets/BudgetsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-chime/ChimeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-cloud9/Cloud9Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-clouddirectory/CloudDirectoryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-cloudformation/CloudFormationClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-cloudfront/CloudFrontClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-cloudhsm-v2/CloudHSMV2Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-cloudhsm/CloudHSMClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-cloudsearch/CloudSearchClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-cloudtrail/CloudTrailClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-cloudwatch-events/CloudWatchEventsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-cloudwatch-logs/CloudWatchLogsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-cloudwatch/CloudWatchClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-codeartifact/CodeartifactClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-codebuild/CodeBuildClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-codecommit/CodeCommitClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
2 changes: 1 addition & 1 deletion clients/client-codedeploy/CodeDeployClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
serviceId?: string;

/**
* The AWS region to which this client will send requests or use as signingRegion
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;

Expand Down
Loading

0 comments on commit 0a251aa

Please sign in to comment.