-
Notifications
You must be signed in to change notification settings - Fork 548
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(client-cloudfront-keyvaluestore): use sigv4a signer by default (#…
- Loading branch information
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
.../java/software/amazon/smithy/aws/typescript/codegen/AddCloudFrontKeyValueStorePlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package software.amazon.smithy.aws.typescript.codegen; | ||
|
||
import java.util.Collections; | ||
import java.util.Map; | ||
import java.util.function.Consumer; | ||
import software.amazon.smithy.aws.traits.ServiceTrait; | ||
import software.amazon.smithy.codegen.core.SymbolProvider; | ||
import software.amazon.smithy.model.Model; | ||
import software.amazon.smithy.model.shapes.Shape; | ||
import software.amazon.smithy.typescript.codegen.LanguageTarget; | ||
import software.amazon.smithy.typescript.codegen.TypeScriptSettings; | ||
import software.amazon.smithy.typescript.codegen.TypeScriptWriter; | ||
import software.amazon.smithy.typescript.codegen.integration.TypeScriptIntegration; | ||
import software.amazon.smithy.utils.MapUtils; | ||
import software.amazon.smithy.utils.SmithyInternalApi; | ||
|
||
/** | ||
* Adds customizations for CloudFront KeyValueStore service. | ||
*/ | ||
@SmithyInternalApi | ||
public final class AddCloudFrontKeyValueStorePlugin implements TypeScriptIntegration { | ||
public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(TypeScriptSettings settings, Model model, | ||
SymbolProvider symbolProvider, LanguageTarget target) { | ||
if (!testServiceId(settings.getService(model))) { | ||
return Collections.emptyMap(); | ||
} | ||
switch (target) { | ||
case SHARED: | ||
return MapUtils.of("signerConstructor", writer -> { | ||
writer.addDependency(AwsDependency.SIGNATURE_V4_MULTIREGION) | ||
.addImport("SignatureV4MultiRegion", "SignatureV4MultiRegion", | ||
AwsDependency.SIGNATURE_V4_MULTIREGION) | ||
.write("SignatureV4MultiRegion"); | ||
}); | ||
default: | ||
return Collections.emptyMap(); | ||
} | ||
} | ||
|
||
private static boolean testServiceId(Shape serviceShape) { | ||
return serviceShape.getTrait(ServiceTrait.class) | ||
.map(ServiceTrait::getSdkId).orElse("") | ||
.equals("CloudFront KeyValueStore"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters