Skip to content

Commit

Permalink
feat(experimentalIdentityAndAuth): add `@smithy.rules#endpointRuleSet…
Browse files Browse the repository at this point in the history
…` auth scheme providers (#5579)

* feat(experimentalIdentityAndAuth): add `@smithy.rules#endpointRuleSet` auth scheme providers
* chore(experimentalIdentityAndAuth): remove experimental branches for S3 and EventBridge
  * Also, move to using `TopDownIndex` in `AddS3Config`.
  • Loading branch information
Steven Yuan authored Dec 14, 2023
1 parent 013665e commit 3814163
Show file tree
Hide file tree
Showing 5 changed files with 482 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(TypeScrip
if (!testServiceId(settings.getService(model))) {
return Collections.emptyMap();
}
if (settings.getExperimentalIdentityAndAuth()) {
return Collections.emptyMap();
}
// feat(experimentalIdentityAndAuth): control branch for EventBridge runtime config
switch (target) {
case SHARED:
return MapUtils.of("signerConstructor", writer -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
import software.amazon.smithy.codegen.core.SymbolProvider;
import software.amazon.smithy.model.Model;
import software.amazon.smithy.model.knowledge.OperationIndex;
import software.amazon.smithy.model.knowledge.TopDownIndex;
import software.amazon.smithy.model.shapes.MemberShape;
import software.amazon.smithy.model.shapes.OperationShape;
import software.amazon.smithy.model.shapes.ServiceShape;
import software.amazon.smithy.model.shapes.Shape;
import software.amazon.smithy.model.shapes.ShapeId;
import software.amazon.smithy.model.shapes.StructureShape;
import software.amazon.smithy.model.traits.DocumentationTrait;
import software.amazon.smithy.typescript.codegen.LanguageTarget;
Expand Down Expand Up @@ -85,9 +85,9 @@ public Model preprocessModel(Model model, TypeScriptSettings settings) {

Model.Builder modelBuilder = model.toBuilder();

TopDownIndex topDownIndex = TopDownIndex.of(model);
Set<StructureShape> inputShapes = new HashSet<>();
for (ShapeId operationId : serviceShape.getAllOperations()) {
OperationShape operationShape = model.expectShape(operationId, OperationShape.class);
for (OperationShape operationShape : topDownIndex.getContainedOperations(serviceShape)) {
if (NON_BUCKET_ENDPOINT_OPERATIONS.contains(operationShape.getId().getName(serviceShape))) {
continue;
}
Expand Down Expand Up @@ -120,11 +120,6 @@ public void addConfigInterfaceFields(
if (!isS3(service)) {
return;
}
writer.addImport("CreateSessionCommand", null, "./src/commands/CreateSessionCommand");
if (settings.getExperimentalIdentityAndAuth()) {
return;
}
// feat(experimentalIdentityAndAuth): control branch for S3 Config interface fields
writer.writeDocs("Whether to escape request path when signing the request.")
.write("signingEscapePath?: boolean;\n");
writer.writeDocs(
Expand All @@ -142,10 +137,6 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
if (!isS3(settings.getService(model))) {
return Collections.emptyMap();
}
if (settings.getExperimentalIdentityAndAuth()) {
return Collections.emptyMap();
}
// feat(experimentalIdentityAndAuth): control branch for S3 Config runtime config
switch (target) {
case SHARED:
return MapUtils.of("signingEscapePath", writer -> {
Expand Down Expand Up @@ -247,6 +238,10 @@ && isS3(s))
(m, s, o) -> MapUtils.of(
"session", Symbol.builder()
.name("[() => this, CreateSessionCommand]")
.addReference(Symbol.builder()
.name("CreateSessionCommand")
.namespace("./src/commands/CreateSessionCommand", "/")
.build())
.build()
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
if (!isS3Control(settings.getService(model))) {
return Collections.emptyMap();
}
if (settings.getExperimentalIdentityAndAuth()) {
return Collections.emptyMap();
}
// feat(experimentalIdentityAndAuth): control branch for S3 Control signingEscapePath
switch (target) {
case SHARED:
return MapUtils.of("signingEscapePath", writer -> {
Expand Down
Loading

0 comments on commit 3814163

Please sign in to comment.