diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/emitters/tasks/EndpointProviderTasks.java b/codegen/src/main/java/software/amazon/awssdk/codegen/emitters/tasks/EndpointProviderTasks.java index b72a33263c5b..3cef2e27db3e 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/emitters/tasks/EndpointProviderTasks.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/emitters/tasks/EndpointProviderTasks.java @@ -34,7 +34,6 @@ import software.amazon.awssdk.codegen.poet.rules.EndpointProviderTestSpec; import software.amazon.awssdk.codegen.poet.rules.EndpointResolverUtilsSpec; import software.amazon.awssdk.codegen.poet.rules.EndpointRulesClientTestSpec; -import software.amazon.awssdk.codegen.poet.rules2.EndpointProviderSpec2; public final class EndpointProviderTasks extends BaseGeneratorTasks { private final GeneratorTaskParams generatorTaskParams; @@ -49,14 +48,8 @@ protected List createTasks() throws Exception { List tasks = new ArrayList<>(); tasks.add(generateInterface()); tasks.add(generateParams()); - if (shouldGenerateCompiledEndpointRules()) { - tasks.add(generateDefaultProvider2()); - tasks.add(new RulesEngineRuntimeLiteGeneratorTask(generatorTaskParams)); - tasks.add(new RulesEngineRuntimeGeneratorTask2(generatorTaskParams)); - } else { - tasks.add(generateDefaultProvider()); - tasks.add(new RulesEngineRuntimeGeneratorTask(generatorTaskParams)); - } + tasks.add(generateDefaultProvider2()); + tasks.add(new RulesEngineRuntimeGeneratorTask(generatorTaskParams)); if (shouldGenerateJmesPathRuntime()) { tasks.add(new JmesPathRuntimeGeneratorTask(generatorTaskParams)); } @@ -82,12 +75,8 @@ private GeneratorTask generateParams() { return new PoetGeneratorTask(endpointRulesDir(), model.getFileHeader(), new EndpointParametersClassSpec(model)); } - private GeneratorTask generateDefaultProvider() { - return new PoetGeneratorTask(endpointRulesInternalDir(), model.getFileHeader(), new EndpointProviderSpec(model)); - } - private GeneratorTask generateDefaultProvider2() { - return new PoetGeneratorTask(endpointRulesInternalDir(), model.getFileHeader(), new EndpointProviderSpec2(model)); + return new PoetGeneratorTask(endpointRulesInternalDir(), model.getFileHeader(), new EndpointProviderSpec(model)); } private GeneratorTask generateDefaultPartitionsProvider() { @@ -95,11 +84,6 @@ private GeneratorTask generateDefaultPartitionsProvider() { new DefaultPartitionDataProviderSpec(model)); } - private boolean shouldGenerateCompiledEndpointRules() { - CustomizationConfig customizationConfig = generatorTaskParams.getModel().getCustomizationConfig(); - return customizationConfig.isEnableGenerateCompiledEndpointRules(); - } - private Collection generateInterceptors() { return Arrays.asList( new PoetGeneratorTask(endpointRulesInternalDir(), model.getFileHeader(), new EndpointResolverUtilsSpec(model))); diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/emitters/tasks/RulesEngineRuntimeGeneratorTask2.java b/codegen/src/main/java/software/amazon/awssdk/codegen/emitters/tasks/RulesEngineRuntimeGeneratorTask2.java deleted file mode 100644 index 744177e9e50c..000000000000 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/emitters/tasks/RulesEngineRuntimeGeneratorTask2.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package software.amazon.awssdk.codegen.emitters.tasks; - -import java.io.IOException; -import java.io.InputStream; -import java.io.UncheckedIOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; -import software.amazon.awssdk.codegen.emitters.GeneratorTask; -import software.amazon.awssdk.codegen.emitters.GeneratorTaskParams; -import software.amazon.awssdk.codegen.emitters.SimpleGeneratorTask; -import software.amazon.awssdk.codegen.poet.rules.EndpointRulesSpecUtils; -import software.amazon.awssdk.utils.IoUtils; -import software.amazon.awssdk.utils.StringUtils; -import software.amazon.awssdk.utils.Validate; - -public final class RulesEngineRuntimeGeneratorTask2 extends BaseGeneratorTasks { - private final String engineInternalClassDir; - private final String engineInternalPackageName; - private final String fileHeader; - private final EndpointRulesSpecUtils endpointRulesSpecUtils; - - public RulesEngineRuntimeGeneratorTask2(GeneratorTaskParams generatorTaskParams) { - super(generatorTaskParams); - this.engineInternalClassDir = generatorTaskParams.getPathProvider().getEndpointRulesInternalDirectory(); - this.engineInternalPackageName = generatorTaskParams.getModel().getMetadata().getFullInternalEndpointRulesPackageName(); - this.fileHeader = generatorTaskParams.getModel().getFileHeader(); - this.endpointRulesSpecUtils = new EndpointRulesSpecUtils(generatorTaskParams.getModel()); - } - - @Override - protected List createTasks() throws Exception { - List copyTasks = new ArrayList<>(); - List rulesEngineFiles = endpointRulesSpecUtils.rulesEngineResourceFiles2(); - for (String path : rulesEngineJavaFilePaths(rulesEngineFiles)) { - String newFileName = computeNewName(path); - copyTasks.add(new SimpleGeneratorTask(engineInternalClassDir, - newFileName, - fileHeader, - () -> rulesEngineFileContent("/" + path))); - } - - return copyTasks; - } - - private List rulesEngineJavaFilePaths(Collection runtimeEngineFiles) { - return runtimeEngineFiles.stream() - .filter(e -> e.endsWith(".java.resource")) - .collect(Collectors.toList()); - } - - private String rulesEngineFileContent(String path) { - return "package " + engineInternalPackageName + ";\n" + - "\n" - + loadResourceAsString(path); - } - - private String loadResourceAsString(String path) { - try { - return IoUtils.toUtf8String(loadResource(path)); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - private InputStream loadResource(String name) { - InputStream resourceAsStream = RulesEngineRuntimeGeneratorTask2.class.getResourceAsStream(name); - Validate.notNull(resourceAsStream, "Failed to load resource from %s", name); - return resourceAsStream; - } - - private String computeNewName(String path) { - String[] pathComponents = path.split("/"); - return StringUtils.replace(pathComponents[pathComponents.length - 1], ".resource", ""); - } -} diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/emitters/tasks/RulesEngineRuntimeLiteGeneratorTask.java b/codegen/src/main/java/software/amazon/awssdk/codegen/emitters/tasks/RulesEngineRuntimeLiteGeneratorTask.java deleted file mode 100644 index d223f2d6ace9..000000000000 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/emitters/tasks/RulesEngineRuntimeLiteGeneratorTask.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package software.amazon.awssdk.codegen.emitters.tasks; - -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import software.amazon.awssdk.codegen.emitters.GeneratorTaskParams; -import software.amazon.awssdk.codegen.model.config.customization.CustomizationConfig; - -/** A version of {@link software.amazon.awssdk.codegen.emitters.tasks.RulesEngineRuntimeGeneratorTask} that copies a minimal - * set of the interpreter related classes. This set represents the only classes that need to be copied when compiled rules are - * enabled. - * - * @see CustomizationConfig#isEnableGenerateCompiledEndpointRules() - */ -public final class RulesEngineRuntimeLiteGeneratorTask extends RulesEngineRuntimeGeneratorTask { - // Note: leading slashes are important to disambiguate between files that share the same suffix - private static final List FILES_TO_COPY = Stream.of("/Outputs.java.resource", - "/RegionOverride.java.resource", - "/Partition.java.resource", - "/PartitionDataProvider.java.resource", - "/AwsEndpointProviderUtils.java.resource", - "/Arn.java.resource", - "/Value.java.resource", - "/Identifier.java.resource", - "/EndpointAuthSchemeStrategy.java.resource", - "/EndpointAttributeProvider.java.resource", - "/EndpointAuthSchemeStrategyFactory.java.resource", - "/DefaultEndpointAuthSchemeStrategy.java.resource") - .collect(Collectors.toList()); - - public RulesEngineRuntimeLiteGeneratorTask(GeneratorTaskParams generatorTaskParams) { - super(generatorTaskParams); - } - - protected List rulesEngineJavaFilePaths(Collection runtimeEngineFiles) { - return super.rulesEngineJavaFilePaths(runtimeEngineFiles) - .stream() - .filter(e -> FILES_TO_COPY.stream().anyMatch(e::endsWith)) - .collect(Collectors.toList()); - } -} diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/CustomizationConfig.java b/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/CustomizationConfig.java index d15ef90cd2e1..2b3a3cdb3cdb 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/CustomizationConfig.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/CustomizationConfig.java @@ -314,11 +314,6 @@ public class CustomizationConfig { private boolean s3ExpressAuthSupport; - /** - * Set to true to enable compiled endpoint rules. Currently defaults to false. - */ - private boolean enableGenerateCompiledEndpointRules = false; - /** * Customization related to auth scheme derived from endpoints. */ @@ -817,14 +812,6 @@ public void setUseS3ExpressSessionAuth(boolean useS3ExpressSessionAuth) { this.useS3ExpressSessionAuth = useS3ExpressSessionAuth; } - public boolean isEnableGenerateCompiledEndpointRules() { - return enableGenerateCompiledEndpointRules; - } - - public void setEnableGenerateCompiledEndpointRules(boolean enableGenerateCompiledEndpointRules) { - this.enableGenerateCompiledEndpointRules = enableGenerateCompiledEndpointRules; - } - public Map getSkipEndpointTests() { return skipEndpointTests; } diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/auth/scheme/AuthSchemeParamsSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/auth/scheme/AuthSchemeParamsSpec.java index 86af5542e886..9599b90732fa 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/auth/scheme/AuthSchemeParamsSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/auth/scheme/AuthSchemeParamsSpec.java @@ -147,6 +147,13 @@ private void addAccessorMethods(TypeSpec.Builder b) { .addJavadoc("Returns the region. The region parameter may be used with the $S auth scheme.", AwsV4AuthScheme.SCHEME_ID) .build()); + b.addMethod(MethodSpec.methodBuilder("regionId") + .addModifiers(Modifier.PUBLIC, Modifier.DEFAULT) + .returns(String.class) + .addJavadoc("Returns the region ID as a string. Returns null if region is not set.") + .addStatement("$T region = region()", Region.class) + .addStatement("return region == null ? null : region.id()") + .build()); } if (authSchemeSpecUtils.hasSigV4aSupport()) { diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/auth/scheme/DefaultAuthSchemeParamsSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/auth/scheme/DefaultAuthSchemeParamsSpec.java index 28b62024a00d..cb8e31dd3aaf 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/auth/scheme/DefaultAuthSchemeParamsSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/auth/scheme/DefaultAuthSchemeParamsSpec.java @@ -187,6 +187,13 @@ private void addFieldsAndAccessors(TypeSpec.Builder b) { .returns(Region.class) .addStatement("return region") .build()); + + b.addMethod(MethodSpec.methodBuilder("regionId") + .addModifiers(Modifier.PUBLIC) + .addAnnotation(Override.class) + .returns(String.class) + .addStatement("return region == null ? null : region.id()") + .build()); } if (authSchemeSpecUtils.hasSigV4aSupport()) { diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/AssignIdentifierVisitor.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/AssignIdentifierVisitor.java similarity index 95% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/AssignIdentifierVisitor.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/AssignIdentifierVisitor.java index 61679386a5e1..1ff5df78053f 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/AssignIdentifierVisitor.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/AssignIdentifierVisitor.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; /** * Assigns an identifier to each rule then we use as a name for the generated method. diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/AssignTypesVisitor.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/AssignTypesVisitor.java similarity index 99% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/AssignTypesVisitor.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/AssignTypesVisitor.java index b13167acaac1..626c9f2f1319 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/AssignTypesVisitor.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/AssignTypesVisitor.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.ArrayList; import java.util.List; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/BooleanAndExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/BooleanAndExpression.java similarity index 98% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/BooleanAndExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/BooleanAndExpression.java index 1ea95065bafc..9f3d628d3932 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/BooleanAndExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/BooleanAndExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.ArrayList; import java.util.Collections; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/BooleanNotExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/BooleanNotExpression.java similarity index 98% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/BooleanNotExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/BooleanNotExpression.java index 93ee93dff9cd..f2efd0e050b1 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/BooleanNotExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/BooleanNotExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.Objects; import software.amazon.awssdk.utils.Validate; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/CodeGeneratorVisitor.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/CodeGeneratorVisitor.java similarity index 99% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/CodeGeneratorVisitor.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/CodeGeneratorVisitor.java index 34d6a64a3154..0fa69d2923d9 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/CodeGeneratorVisitor.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/CodeGeneratorVisitor.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/CodegenExpressionBuidler.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/CodegenExpressionBuidler.java similarity index 95% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/CodegenExpressionBuidler.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/CodegenExpressionBuidler.java index 6488f015ad7b..150895ebd2d5 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/CodegenExpressionBuidler.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/CodegenExpressionBuidler.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.List; import java.util.Map; @@ -64,10 +64,6 @@ public RuleSetExpression root() { return root; } - public String regionParamName() { - return symbolTable.regionParamName(); - } - public SymbolTable symbolTable() { return symbolTable; } diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/ComputeScopeTree.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/ComputeScopeTree.java similarity index 99% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/ComputeScopeTree.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/ComputeScopeTree.java index 42f612f87418..0ee98f43d7cd 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/ComputeScopeTree.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/ComputeScopeTree.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.ArrayDeque; import java.util.ArrayList; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/EndpointExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointExpression.java similarity index 98% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/EndpointExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointExpression.java index 29fa872718bb..24206049728f 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/EndpointExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.Objects; import software.amazon.awssdk.utils.Validate; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointParametersClassSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointParametersClassSpec.java index eebe516b02d2..25ec2e4842e9 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointParametersClassSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointParametersClassSpec.java @@ -25,6 +25,7 @@ import javax.lang.model.element.Modifier; import software.amazon.awssdk.annotations.SdkPublicApi; import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; +import software.amazon.awssdk.codegen.model.rules.endpoints.BuiltInParameter; import software.amazon.awssdk.codegen.model.rules.endpoints.ParameterModel; import software.amazon.awssdk.codegen.poet.ClassSpec; import software.amazon.awssdk.codegen.poet.PoetUtils; @@ -56,6 +57,12 @@ public TypeSpec poetSpec() { parameters().forEach((name, model) -> { b.addField(endpointRulesSpecUtils.parameterClassField(name, model)); b.addMethod(endpointRulesSpecUtils.parameterClassAccessorMethod(name, model)); + // For Region-typed params, add a "{name}Id()" convenience method that returns the + // region ID as a String (null-safe). This is used by the compiled endpoint rules + // which operate on String values. + if (model.getBuiltInEnum() == BuiltInParameter.AWS_REGION) { + b.addMethod(regionIdAccessorMethod(name)); + } }); b.addMethod(toBuilderMethod()); @@ -156,6 +163,26 @@ private String variableName(String name) { return intermediateModel.getNamingStrategy().getVariableName(name); } + /** + * Creates a convenience accessor for Region-typed parameters that returns the region ID as a String. + * For instance, for a parameter named "Region": + * + *
+     *     public String regionId() {
+     *         return region == null ? null : region.id();
+     *     }
+     * 
+ */ + private MethodSpec regionIdAccessorMethod(String name) { + String varName = variableName(name); + String methodName = endpointRulesSpecUtils.paramMethodName(name) + "Id"; + return MethodSpec.methodBuilder(methodName) + .addModifiers(Modifier.PUBLIC) + .returns(String.class) + .addStatement("return $N == null ? null : $N.id()", varName, varName) + .build(); + } + private MethodSpec.Builder toBuilderConstructor() { MethodSpec.Builder constructorBuilder = MethodSpec.constructorBuilder(); constructorBuilder.addModifiers(Modifier.PRIVATE); diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointProviderSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointProviderSpec.java index eb7d17b4e57f..c6ded1e3b003 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointProviderSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointProviderSpec.java @@ -17,189 +17,216 @@ import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; -import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.MethodSpec; -import com.squareup.javapoet.ParameterSpec; -import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; -import com.squareup.javapoet.TypeVariableName; -import com.squareup.javapoet.WildcardTypeName; -import java.util.HashMap; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.concurrent.CompletableFuture; import javax.lang.model.element.Modifier; import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.awscore.endpoints.AwsEndpointAttribute; import software.amazon.awssdk.codegen.model.config.customization.EndpointAuthSchemeConfig; +import software.amazon.awssdk.codegen.model.config.customization.KeyTypePair; import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; import software.amazon.awssdk.codegen.model.intermediate.Metadata; import software.amazon.awssdk.codegen.model.rules.endpoints.BuiltInParameter; import software.amazon.awssdk.codegen.model.rules.endpoints.ParameterModel; +import software.amazon.awssdk.codegen.model.rules.endpoints.RuleModel; +import software.amazon.awssdk.codegen.model.service.EndpointRuleSetModel; import software.amazon.awssdk.codegen.poet.ClassSpec; import software.amazon.awssdk.codegen.poet.PoetUtils; +import software.amazon.awssdk.codegen.poet.rules.EndpointRulesSpecUtils; import software.amazon.awssdk.core.exception.SdkClientException; -import software.amazon.awssdk.endpoints.Endpoint; -import software.amazon.awssdk.endpoints.EndpointUrl; import software.amazon.awssdk.utils.CompletableFutureUtils; -import software.amazon.awssdk.utils.Logger; import software.amazon.awssdk.utils.Validate; public class EndpointProviderSpec implements ClassSpec { - private static final String RULE_SET_FIELD_NAME = "ENDPOINT_RULE_SET"; - private static final String LOGGER_FIELD_NAME = "LOG"; - private final IntermediateModel intermediateModel; private final EndpointRulesSpecUtils endpointRulesSpecUtils; + private final Map knownEndpointAttributes; + private final CodegenExpressionBuidler utils; + private final RuleRuntimeTypeMirror typeMirror; public EndpointProviderSpec(IntermediateModel intermediateModel) { this.intermediateModel = intermediateModel; this.endpointRulesSpecUtils = new EndpointRulesSpecUtils(intermediateModel); + String packageName = intermediateModel.getMetadata().getFullInternalEndpointRulesPackageName(); + this.typeMirror = new RuleRuntimeTypeMirror(packageName); + EndpointRuleSetModel model = intermediateModel.getEndpointRuleSetModel(); + this.utils = createCodegenRulesUtil(model.getRules(), model.getParameters(), typeMirror); + this.knownEndpointAttributes = knownEndpointAttributes(intermediateModel); + } + + private static RuleType fromParameterModel(ParameterModel model) { + switch (model.getType().toLowerCase(Locale.ENGLISH)) { + case "boolean": + return RuleRuntimeTypeMirror.BOOLEAN; + case "string": + return RuleRuntimeTypeMirror.STRING; + case "stringarray": + return RuleRuntimeTypeMirror.LIST_OF_STRING; + default: + throw new IllegalStateException("Cannot find rule type for: " + model.getType()); + } } - @Override - public TypeSpec poetSpec() { - FieldSpec endpointAuthSchemeStrategyFieldSpec = endpointAuthSchemeStrategyFieldSpec(); - TypeSpec.Builder b = PoetUtils.createClassBuilder(className()) - .addModifiers(Modifier.PUBLIC, Modifier.FINAL) - .addSuperinterface(endpointRulesSpecUtils.providerInterfaceName()) - .addField(logger()) - .addField(ruleSet()) - .addField(endpointAuthSchemeStrategyFieldSpec) - .addMethod(resolveEndpointMethod()) - .addMethod(toIdentifierValueMap()) - .addAnnotation(SdkInternalApi.class); - - MethodSpec constructorMethod = constructorMethodSpec(endpointAuthSchemeStrategyFieldSpec.name); - MethodSpec valueAsEndpointOrThrowMethod = valueAsEndpointOrThrowMethodSpec(); + private static RuleModel createRootRule(List rules) { + RuleModel root = new RuleModel(); + root.setRules(rules); + root.setType("tree"); + root.setConditions(Collections.emptyList()); + return root; + } - b.addMethod(constructorMethod); - b.addMethod(valueAsEndpointOrThrowMethod); - b.addMethod(ruleSetBuildMethod(b)); - b.addMethod(equalsMethod()); - b.addMethod(hashCodeMethod()); - addKnownPropertiesMethodSpec(b, endpointAuthSchemeStrategyFieldSpec.name); + private static CodegenExpressionBuidler createCodegenRulesUtil(List rules, + Map parameters, + RuleRuntimeTypeMirror typeMirror) { + RuleSetExpression root = ExpressionParser.parseRuleSetExpression(createRootRule(rules)); + return CodegenExpressionBuidler.from(root, typeMirror, initSymbolTable(parameters)); + } - return b.build(); + private static SymbolTable initSymbolTable(Map parameters) { + SymbolTable.Builder builder = SymbolTable.builder(); + parameters.forEach((k, v) -> { + builder.putParam(k, fromParameterModel(v)); + if (v.getBuiltInEnum() == BuiltInParameter.AWS_REGION) { + builder.addRegionParam(k); + } + }); + return builder.build(); } - private FieldSpec endpointAuthSchemeStrategyFieldSpec() { - return FieldSpec.builder(endpointRulesSpecUtils.rulesRuntimeClassName("EndpointAuthSchemeStrategy"), - "endpointAuthSchemeStrategy", Modifier.PRIVATE, Modifier.FINAL) - .build(); + private static Map knownEndpointAttributes(IntermediateModel intermediateModel) { + Map knownEndpointAttributes = null; + EndpointAuthSchemeConfig config = intermediateModel.getCustomizationConfig().getEndpointAuthSchemeConfig(); + if (config != null) { + knownEndpointAttributes = config.getEndpointProviderTestKeys(); + } + if (knownEndpointAttributes == null) { + knownEndpointAttributes = Collections.emptyMap(); + } + return knownEndpointAttributes; } - private MethodSpec constructorMethodSpec(String endpointAuthSchemeFieldName) { - MethodSpec.Builder b = MethodSpec.constructorBuilder().addModifiers(Modifier.PUBLIC); - EndpointAuthSchemeConfig endpointAuthSchemeConfig = - intermediateModel.getCustomizationConfig().getEndpointAuthSchemeConfig(); - String factoryLocalVarName = "endpointAuthSchemeStrategyFactory"; - if (endpointAuthSchemeConfig != null && endpointAuthSchemeConfig.getAuthSchemeStrategyFactoryClass() != null) { - String endpointAuthSchemeStrategyFactory = endpointAuthSchemeConfig.getAuthSchemeStrategyFactoryClass(); - b.addStatement("$T $N = new $T()", - endpointRulesSpecUtils.rulesRuntimeClassName("EndpointAuthSchemeStrategyFactory"), - factoryLocalVarName, - PoetUtils.classNameFromFqcn(endpointAuthSchemeStrategyFactory)); - } else { - b.addStatement("$T $N = new $T()", - endpointRulesSpecUtils.rulesRuntimeClassName("EndpointAuthSchemeStrategyFactory"), - factoryLocalVarName, - endpointRulesSpecUtils.rulesRuntimeClassName("DefaultEndpointAuthSchemeStrategyFactory")); + @Override + public TypeSpec poetSpec() { + TypeSpec.Builder builder = PoetUtils.createClassBuilder(className()) + .addModifiers(Modifier.PUBLIC, Modifier.FINAL) + .addSuperinterface(endpointRulesSpecUtils.providerInterfaceName()) + .addAnnotation(SdkInternalApi.class); + + builder.addMethod(resolveEndpointMethod()); + List methods = new ArrayList<>(); + createRuleMethod(utils.root(), methods); + for (MethodSpec.Builder methodBuilder : methods) { + builder.addMethod(methodBuilder.build()); } - b.addStatement("this.$N = $N.endpointAuthSchemeStrategy()", endpointAuthSchemeFieldName, factoryLocalVarName); - return b.build(); + builder.addMethod(equalsMethod()); + builder.addMethod(hashCodeMethod()); + return builder.build(); } - private MethodSpec valueAsEndpointOrThrowMethodSpec() { - String valueParamName = "value"; - ParameterSpec param = ParameterSpec.builder(endpointRulesSpecUtils.rulesRuntimeClassName("Value"), valueParamName) - .build(); - MethodSpec.Builder b = MethodSpec.methodBuilder("valueAsEndpointOrThrow") - .returns(ClassName.get(Endpoint.class)) - .addParameter(param); + @Override + public ClassName className() { + Metadata md = intermediateModel.getMetadata(); + return ClassName.get(md.getFullInternalEndpointRulesPackageName(), + "Default" + endpointRulesSpecUtils.providerInterfaceName().simpleName()); + } - CodeBlock.Builder methodCode = - CodeBlock.builder() - .beginControlFlow("if ($N instanceof $T)", - valueParamName, - endpointRulesSpecUtils.rulesRuntimeClassName("Value.Endpoint")) - .addStatement("$T endpoint = $N.expectEndpoint()", - endpointRulesSpecUtils.rulesRuntimeClassName("Value.Endpoint"), valueParamName) - .addStatement("$T builder = Endpoint.builder()", Endpoint.Builder.class) - .addStatement("builder.endpointUrl($T.fromString(endpoint.getUrl()))", EndpointUrl.class) - .addStatement("$T headers = endpoint.getHeaders()", - ParameterizedTypeName.get(ClassName.get(Map.class), - TypeName.get(String.class), - ParameterizedTypeName.get(List.class, String.class))) - .beginControlFlow("if (headers != null)") - .addStatement("headers.forEach((name, values) -> values.forEach(v -> builder.putHeader(name, v)))") - .endControlFlow() - .addStatement("addKnownProperties(builder, endpoint.getProperties())") - .addStatement("return builder.build()") + private MethodSpec resolveEndpointMethod() { + MethodSpec.Builder builder = MethodSpec.methodBuilder("resolveEndpoint") + .addModifiers(Modifier.PUBLIC) + .returns(endpointRulesSpecUtils.resolverReturnType()) + .addAnnotation(Override.class) + .addParameter(endpointRulesSpecUtils.parametersClassName(), "params"); + + builder.addCode(validateRequiredParams()); + builder.beginControlFlow("try"); + builder.addStatement("$T result = $L(params)", ruleResult(), utils.root().ruleId()); + builder.beginControlFlow("if (result.canContinue())") + .addStatement("throw $T.create($S)", SdkClientException.class, "Rule engine did not reach an error or " + + "endpoint result") + .endControlFlow(); + + builder.beginControlFlow("if (result.isError())") + .addStatement("String errorMsg = result.error()") + .beginControlFlow("if (errorMsg.contains(\"Invalid ARN\") && errorMsg.contains(\":s3:::\"))") + .addStatement("errorMsg += $S", ". Use the bucket name instead of simple bucket ARNs in " + + "GetBucketLocationRequest.") + .endControlFlow() + .addStatement("throw $T.create(errorMsg)", SdkClientException.class) + .endControlFlow(); + + builder.addStatement("return $T.completedFuture(result.endpoint())", CompletableFuture.class); + builder.nextControlFlow("catch ($T error)", Exception.class); + builder.addStatement("return $T.failedFuture(error)", CompletableFutureUtils.class); + builder.endControlFlow(); + + return builder.build(); + } - .nextControlFlow("else if ($N instanceof $T)", - valueParamName, - endpointRulesSpecUtils.rulesRuntimeClassName("Value.Str")) - .addStatement("$T errorMsg = $N.expectString()", String.class, valueParamName) - .beginControlFlow("if (errorMsg.contains($S) && errorMsg.contains($S))", - "Invalid ARN", ":s3:::") - .addStatement("errorMsg += $S", ". Use the bucket name instead of simple bucket ARNs in " - + "GetBucketLocationRequest.") - .endControlFlow() - .addStatement("throw $T.create(errorMsg)", SdkClientException.class) - .nextControlFlow("else") - .addStatement("throw SdkClientException.create($S + $N)", - "Rule engine return neither an endpoint result or error value. Returned value was: ", - valueParamName) - .endControlFlow(); + private CodeBlock validateRequiredParams() { + CodeBlock.Builder b = CodeBlock.builder(); + Map parameters = intermediateModel.getEndpointRuleSetModel().getParameters(); + parameters.entrySet().stream() + .filter(e -> Boolean.TRUE.equals(e.getValue().isRequired())) + .forEach(e -> { + b.addStatement("$T.notNull($N.$N(), $S)", + Validate.class, + "params", + endpointRulesSpecUtils.paramMethodName(e.getKey()), + String.format("Parameter '%s' must not be null", e.getKey())); + }); - b.addCode(methodCode.build()); return b.build(); } - private void addKnownPropertiesMethodSpec(TypeSpec.Builder b, String endpointAuthSpecStrategyFieldName) { - EndpointAuthSchemeConfig endpointAuthSchemeConfig = - intermediateModel.getCustomizationConfig().getEndpointAuthSchemeConfig(); - if (endpointAuthSchemeConfig != null && endpointAuthSchemeConfig.getKnownEndpointProperties() != null) { - addKnownEndpointPropertiesMethodOverride(b, endpointAuthSchemeConfig.getKnownEndpointProperties()); - } else { - b.addMethod(defaultAddKnownEndpointPropertyMethod(endpointAuthSpecStrategyFieldName)); + private void createRuleMethod(RuleSetExpression expr, List methods) { + MethodSpec.Builder builder = methodBuilderForRule(expr); + methods.add(builder); + CodeBlock.Builder block = CodeBlock.builder(); + codegenExpr(expr, block); + builder.addCode(block.build()); + if (expr.isTree()) { + for (RuleSetExpression child : expr.children()) { + if (child.isTree()) { + createRuleMethod(child, methods); + } + } } } - private MethodSpec defaultAddKnownEndpointPropertyMethod(String endpointAuthSpecStrategyFieldName) { - String builderParamName = "builder"; - String propertiesParamName = "properties"; - MethodSpec.Builder b = addKnowPropertiesSignature(builderParamName, propertiesParamName); + private MethodSpec.Builder methodBuilderForRule(RuleSetExpression expr) { + MethodSpec.Builder builder = + MethodSpec.methodBuilder(expr.ruleId()) + .addModifiers(Modifier.PRIVATE, Modifier.STATIC) + .returns(ruleResult()); + ComputeScopeTree.Scope scope = utils.scopesByName().get(expr.ruleId()); + builder.addParameter(endpointRulesSpecUtils.parametersClassName(), "params"); + for (String param : scope.usesLocals()) { + if (scope.defines().contains(param)) { + continue; + } + RuleType type = utils.symbolTable().localType(param); + builder.addParameter(type.javaType(), param); + } + return builder; + } - CodeBlock.Builder switchStatementCode = CodeBlock.builder(); - switchStatementCode.beginControlFlow("switch (n)") - .add("case $S:\n", "authSchemes").indent() - .add(CodeBlock.builder() - .addStatement("$N.putAttribute($T.AUTH_SCHEMES, $N.createAuthSchemes(v))", - builderParamName, - AwsEndpointAttribute.class, - endpointAuthSpecStrategyFieldName) - .build()) - .addStatement("break") - .add("default:\n").indent() - .add(CodeBlock.builder() - .addStatement("$N.debug(() -> $S + n)", - LOGGER_FIELD_NAME, - "Ignoring unknown endpoint property: ") - .build()) - .addStatement("break") - .endControlFlow(); - CodeBlock.Builder methodCode = CodeBlock.builder(); - CodeBlock lambda = CodeBlock.builder() - .add("(n, v) -> {\n").indent() - .add(switchStatementCode.build()) - .unindent().add("}") - .build(); - methodCode.add("$N.forEach($L);", propertiesParamName, lambda); - b.addCode(methodCode.build()); - return b.build(); + private void codegenExpr(RuleSetExpression expr, CodeBlock.Builder builder) { + CodeGeneratorVisitor visitor = new CodeGeneratorVisitor(typeMirror, + utils.symbolTable(), + knownEndpointAttributes, + utils.scopesByName(), + builder); + visitor.visitRuleSetExpression(expr); + } + + private TypeName ruleResult() { + return typeMirror.rulesResult().type(); } private MethodSpec equalsMethod() { @@ -220,181 +247,4 @@ private MethodSpec hashCodeMethod() { .addStatement("return getClass().hashCode()") .build(); } - - private void addKnownEndpointPropertiesMethodOverride(TypeSpec.Builder b, String knowPropertyExpression) { - MethodSpec singlePropertyMethod = - MethodSpec.methodBuilder("addKnownProperty") - .addModifiers(Modifier.PRIVATE) - .addTypeVariable(TypeVariableName.get("T")) - .addParameter(ParameterSpec.builder( - ParameterizedTypeName.get(endpointRulesSpecUtils.rulesRuntimeClassName("EndpointAttributeProvider"), - TypeVariableName.get("T")), - "provider").build()) - .addParameter(Endpoint.Builder.class, "builder") - .addParameter(endpointRulesSpecUtils.rulesRuntimeClassName("Value"), "value") - .addStatement("builder.putAttribute(provider.attributeKey(), provider.attributeValue(value))") - .build(); - b.addMethod(singlePropertyMethod); - - String builderParamName = "builder"; - String propertiesParamName = "properties"; - MethodSpec.Builder methodBuilder = addKnowPropertiesSignature(builderParamName, propertiesParamName); - - TypeName wildcardEndpointAttrType = ParameterizedTypeName.get( - endpointRulesSpecUtils.rulesRuntimeClassName("EndpointAttributeProvider"), - WildcardTypeName.subtypeOf(Object.class)); - methodBuilder.addStatement("$T knownProperties = $N", - ParameterizedTypeName.get(ClassName.get(List.class), wildcardEndpointAttrType), - knowPropertyExpression); - methodBuilder.beginControlFlow("for ($T p: knownProperties)", wildcardEndpointAttrType); - methodBuilder.beginControlFlow("if ($N.containsKey(p.propertyName()))", propertiesParamName); - methodBuilder.addStatement("$N(p, $N, $N.get(p.propertyName()))", - singlePropertyMethod.name, - builderParamName, - propertiesParamName); - methodBuilder.endControlFlow(); - methodBuilder.endControlFlow(); - - b.addMethod(methodBuilder.build()); - } - - private MethodSpec.Builder addKnowPropertiesSignature(String builderParamName, String propertiesParamName) { - ParameterSpec builderParam = ParameterSpec.builder(ClassName.get(Endpoint.Builder.class), builderParamName).build(); - ParameterSpec propertiesParam = ParameterSpec - .builder(ParameterizedTypeName.get( - ClassName.get(Map.class), - ClassName.get(String.class), - endpointRulesSpecUtils.rulesRuntimeClassName("Value")), - propertiesParamName) - .build(); - return MethodSpec.methodBuilder("addKnownProperties") - .addModifiers(Modifier.PRIVATE) - .addParameter(builderParam) - .addParameter(propertiesParam); - } - - @Override - public ClassName className() { - Metadata md = intermediateModel.getMetadata(); - return ClassName.get(md.getFullInternalEndpointRulesPackageName(), - "Default" + endpointRulesSpecUtils.providerInterfaceName().simpleName()); - } - - private FieldSpec logger() { - return FieldSpec.builder(Logger.class, LOGGER_FIELD_NAME) - .addModifiers(Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL) - .initializer("$T.loggerFor($T.class)", Logger.class, className()) - .build(); - } - - private FieldSpec ruleSet() { - return FieldSpec.builder(endpointRulesSpecUtils.rulesRuntimeClassName("EndpointRuleset"), RULE_SET_FIELD_NAME) - .addModifiers(Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL) - .initializer("ruleSet()") - .build(); - } - - private MethodSpec toIdentifierValueMap() { - ParameterizedTypeName resultType = ParameterizedTypeName.get(ClassName.get(Map.class), - endpointRulesSpecUtils.rulesRuntimeClassName("Identifier"), - endpointRulesSpecUtils.rulesRuntimeClassName("Value")); - - String paramsName = "params"; - MethodSpec.Builder b = MethodSpec.methodBuilder("toIdentifierValueMap") - .addModifiers(Modifier.PRIVATE, Modifier.STATIC) - .addParameter(endpointRulesSpecUtils.parametersClassName(), paramsName) - .returns(resultType); - - Map params = intermediateModel.getEndpointRuleSetModel().getParameters(); - - String resultName = "paramsMap"; - b.addStatement("$T $N = new $T<>()", resultType, resultName, HashMap.class); - - params.forEach((name, model) -> { - String methodVarName = endpointRulesSpecUtils.paramMethodName(name); - - CodeBlock identifierExpr = - CodeBlock.of("$T.of($S)", endpointRulesSpecUtils.rulesRuntimeClassName("Identifier"), name); - - CodeBlock coerce; - // We treat region specially and generate it as the Region type, - // so we need to call id() to convert it back to string - if (model.getBuiltInEnum() == BuiltInParameter.AWS_REGION) { - coerce = CodeBlock.builder().add(".id()").build(); - } else { - coerce = CodeBlock.builder().build(); - } - - CodeBlock valueExpr = endpointRulesSpecUtils.valueCreationCode( - model.getType(), - CodeBlock.builder() - .add("$N.$N()$L", paramsName, methodVarName, coerce) - .build()); - - b.beginControlFlow("if ($N.$N() != null)", paramsName, methodVarName); - b.addStatement("$N.put($L, $L)", resultName, identifierExpr, valueExpr); - b.endControlFlow(); - }); - - b.addStatement("return $N", resultName); - - return b.build(); - } - - private MethodSpec resolveEndpointMethod() { - String paramsName = "endpointParams"; - - MethodSpec.Builder b = MethodSpec.methodBuilder("resolveEndpoint") - .addModifiers(Modifier.PUBLIC) - .returns(endpointRulesSpecUtils.resolverReturnType()) - .addAnnotation(Override.class) - .addParameter(endpointRulesSpecUtils.parametersClassName(), paramsName); - - b.addCode(validateRequiredParams()); - - b.addStatement("$T res = new $T().evaluate($N, toIdentifierValueMap($N))", - endpointRulesSpecUtils.rulesRuntimeClassName("Value"), - endpointRulesSpecUtils.rulesRuntimeClassName("DefaultRuleEngine"), - RULE_SET_FIELD_NAME, - paramsName); - - b.beginControlFlow("try"); - b.addStatement("return $T.completedFuture(valueAsEndpointOrThrow($N))", - CompletableFuture.class, - "res"); - b.endControlFlow(); - b.beginControlFlow("catch ($T error)", Exception.class); - b.addStatement("return $T.failedFuture(error)", CompletableFutureUtils.class); - b.endControlFlow(); - - return b.build(); - } - - private MethodSpec ruleSetBuildMethod(TypeSpec.Builder classBuilder) { - RuleSetCreationSpec ruleSetCreationSpec = new RuleSetCreationSpec(intermediateModel); - MethodSpec.Builder b = MethodSpec.methodBuilder("ruleSet") - .addModifiers(Modifier.PRIVATE, Modifier.STATIC) - .returns(endpointRulesSpecUtils.rulesRuntimeClassName("EndpointRuleset")) - .addStatement("return $L", ruleSetCreationSpec.ruleSetCreationExpr()); - - ruleSetCreationSpec.helperMethods().forEach(classBuilder::addMethod); - return b.build(); - } - - private CodeBlock validateRequiredParams() { - CodeBlock.Builder b = CodeBlock.builder(); - - Map parameters = intermediateModel.getEndpointRuleSetModel().getParameters(); - parameters.entrySet().stream() - .filter(e -> Boolean.TRUE.equals(e.getValue().isRequired())) - .forEach(e -> { - b.addStatement("$T.notNull($N.$N(), $S)", - Validate.class, - "endpointParams", - endpointRulesSpecUtils.paramMethodName(e.getKey()), - String.format("Parameter '%s' must not be null", e.getKey())); - }); - - return b.build(); - } } diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointRulesSpecUtils.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointRulesSpecUtils.java index 04cc97420d5e..bd4410f814b9 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointRulesSpecUtils.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointRulesSpecUtils.java @@ -275,18 +275,6 @@ public List rulesEngineFilesFromDirectory(URL location) { } } - public List rulesEngineResourceFiles2() { - URL currentJarUrl = EndpointRulesSpecUtils.class.getProtectionDomain().getCodeSource().getLocation(); - try (JarFile jarFile = new JarFile(currentJarUrl.getFile())) { - return jarFile.stream() - .map(ZipEntry::getName) - .filter(e -> e.startsWith("software/amazon/awssdk/codegen/rules2/")) - .collect(Collectors.toList()); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - public Map parameters() { return intermediateModel.getEndpointRuleSetModel().getParameters(); } diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/EndpointUrlCodeEmitter.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointUrlCodeEmitter.java similarity index 99% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/EndpointUrlCodeEmitter.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointUrlCodeEmitter.java index 957c0a72e933..3b77ecc6fc3e 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/EndpointUrlCodeEmitter.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/EndpointUrlCodeEmitter.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import com.squareup.javapoet.CodeBlock; import java.util.ArrayList; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/ErrorExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/ErrorExpression.java similarity index 97% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/ErrorExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/ErrorExpression.java index 7394adaf6637..8fe8aaddee81 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/ErrorExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/ErrorExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.Objects; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/ExpressionParser.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/ExpressionParser.java similarity index 99% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/ExpressionParser.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/ExpressionParser.java index 189a8bb63cf0..6c58d2150464 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/ExpressionParser.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/ExpressionParser.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.core.TreeNode; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/FunctionCallExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/FunctionCallExpression.java similarity index 98% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/FunctionCallExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/FunctionCallExpression.java index fba584cb68a9..e70d505cdc08 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/FunctionCallExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/FunctionCallExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.ArrayList; import java.util.Collections; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/HeadersExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/HeadersExpression.java similarity index 98% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/HeadersExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/HeadersExpression.java index 426d4137b726..d867832701d2 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/HeadersExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/HeadersExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.Collections; import java.util.LinkedHashMap; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/IndexedAccessExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/IndexedAccessExpression.java similarity index 98% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/IndexedAccessExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/IndexedAccessExpression.java index 6521f242658f..04d77a4baff3 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/IndexedAccessExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/IndexedAccessExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.Objects; import software.amazon.awssdk.utils.Validate; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/LetExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/LetExpression.java similarity index 98% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/LetExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/LetExpression.java index d812ce095681..571a79dcb826 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/LetExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/LetExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.Collections; import java.util.LinkedHashMap; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/ListExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/ListExpression.java similarity index 98% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/ListExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/ListExpression.java index 5d8bb9d87ef4..5284a9c784ec 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/ListExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/ListExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.ArrayList; import java.util.Collections; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/LiteralBooleanExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/LiteralBooleanExpression.java similarity index 97% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/LiteralBooleanExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/LiteralBooleanExpression.java index e87228a78445..9858a2b42ddc 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/LiteralBooleanExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/LiteralBooleanExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; /** * Represents a literal boolean value. E.g., {@code true} or {@code false}. diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/LiteralIntegerExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/LiteralIntegerExpression.java similarity index 97% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/LiteralIntegerExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/LiteralIntegerExpression.java index 439c4a1eaf69..a4a4969a43f9 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/LiteralIntegerExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/LiteralIntegerExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; /** * Represents a literal integer value. E.g., {@code 123}. diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/LiteralStringExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/LiteralStringExpression.java similarity index 97% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/LiteralStringExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/LiteralStringExpression.java index 253d79e3c18b..b8cd93389e74 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/LiteralStringExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/LiteralStringExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; /** * Represents a literal string value. E.g., {@code "accesspoint"}. diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/MemberAccessExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/MemberAccessExpression.java similarity index 98% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/MemberAccessExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/MemberAccessExpression.java index 0c14a2e99264..6192f0b22a33 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/MemberAccessExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/MemberAccessExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.Objects; import software.amazon.awssdk.utils.Validate; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/MethodCallExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/MethodCallExpression.java similarity index 98% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/MethodCallExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/MethodCallExpression.java index e54f6d7e509d..25c27a2a5241 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/MethodCallExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/MethodCallExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.ArrayList; import java.util.Collections; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/PrepareForCodegenVisitor.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/PrepareForCodegenVisitor.java similarity index 99% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/PrepareForCodegenVisitor.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/PrepareForCodegenVisitor.java index a453812bd5a0..ce90249b707e 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/PrepareForCodegenVisitor.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/PrepareForCodegenVisitor.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.List; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/PropertiesExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/PropertiesExpression.java similarity index 98% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/PropertiesExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/PropertiesExpression.java index a40882aa0322..1eb914d3416b 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/PropertiesExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/PropertiesExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.Collections; import java.util.LinkedHashMap; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RenameForCodegenVisitor.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RenameForCodegenVisitor.java similarity index 83% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RenameForCodegenVisitor.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RenameForCodegenVisitor.java index 1c09b51c398a..8561a766d31d 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RenameForCodegenVisitor.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RenameForCodegenVisitor.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import software.amazon.awssdk.codegen.internal.Utils; import software.amazon.awssdk.utils.internal.CodegenNamingUtils; @@ -35,9 +35,9 @@ public RenameForCodegenVisitor(SymbolTable symbolTable) { * Returns the new symbol table with the renamed symbols. */ public SymbolTable symbolTable() { - String regionParamName = symbolTable.regionParamName(); - if (regionParamName != null) { - renames.regionParamName(javaName(regionParamName)); + // Carry over region params with their renamed java names + for (String regionParam : symbolTable.regionParams()) { + renames.addRegionParam(javaName(regionParam)); } return renames.build(); } @@ -58,11 +58,14 @@ public RuleExpression visitVariableReferenceExpression(VariableReferenceExpressi RuleType type = symbolTable.paramType(name); String newName = javaName(name); renames.putParam(newName, type); + // Region params return a Region object in Java but the rules use it as a String. + // Access the "{name}Id" method which returns the region ID as a String (null-safe). + String accessorName = symbolTable.isRegionParam(name) ? newName + "Id" : newName; return MemberAccessExpression .builder() .type(e.type()) .source(VariableReferenceExpression.builder().variableName("params").build()) - .name(newName) + .name(accessorName) .build(); } return e; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RewriteRuleExpressionVisitor.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RewriteRuleExpressionVisitor.java similarity index 99% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RewriteRuleExpressionVisitor.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RewriteRuleExpressionVisitor.java index c43e295c471e..9f76cdda0701 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RewriteRuleExpressionVisitor.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RewriteRuleExpressionVisitor.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.ArrayList; import java.util.Collections; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleExpression.java similarity index 96% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleExpression.java index 475bbb366b6b..cae3f2b2f367 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; /** * Represents an expression within an endpoint rules set, either explicit or synthetically created for codegen. diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleExpressionVisitor.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleExpressionVisitor.java similarity index 97% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleExpressionVisitor.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleExpressionVisitor.java index 61d64ff4e647..907ddc800ec0 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleExpressionVisitor.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleExpressionVisitor.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; /** * Visitor for all the expressions defined in the endpoints rule sets. diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleFunctionMirror.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleFunctionMirror.java similarity index 98% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleFunctionMirror.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleFunctionMirror.java index 5578173275ee..2de2050e899f 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleFunctionMirror.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleFunctionMirror.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.Collections; import java.util.LinkedHashMap; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleRuntimeTypeMirror.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleRuntimeTypeMirror.java similarity index 99% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleRuntimeTypeMirror.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleRuntimeTypeMirror.java index ff42af43d8f4..252e78770b40 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleRuntimeTypeMirror.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleRuntimeTypeMirror.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.TypeName; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleSetCreationSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleSetCreationSpec.java deleted file mode 100644 index 9ba974d74b28..000000000000 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleSetCreationSpec.java +++ /dev/null @@ -1,431 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package software.amazon.awssdk.codegen.poet.rules; - -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.TreeNode; -import com.fasterxml.jackson.jr.stree.JrsArray; -import com.fasterxml.jackson.jr.stree.JrsBoolean; -import com.fasterxml.jackson.jr.stree.JrsNumber; -import com.fasterxml.jackson.jr.stree.JrsObject; -import com.fasterxml.jackson.jr.stree.JrsString; -import com.fasterxml.jackson.jr.stree.JrsValue; -import com.squareup.javapoet.CodeBlock; -import com.squareup.javapoet.MethodSpec; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import javax.lang.model.element.Modifier; -import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; -import software.amazon.awssdk.codegen.model.rules.endpoints.ConditionModel; -import software.amazon.awssdk.codegen.model.rules.endpoints.EndpointModel; -import software.amazon.awssdk.codegen.model.rules.endpoints.ParameterDeprecatedModel; -import software.amazon.awssdk.codegen.model.rules.endpoints.ParameterModel; -import software.amazon.awssdk.codegen.model.rules.endpoints.RuleModel; -import software.amazon.awssdk.codegen.model.service.EndpointRuleSetModel; -import software.amazon.awssdk.utils.MapUtils; - -public class RuleSetCreationSpec { - private static final String RULE_METHOD_PREFIX = "endpointRule_"; - - private final EndpointRulesSpecUtils endpointRulesSpecUtils; - private final EndpointRuleSetModel ruleSetModel; - - private int ruleCounter = 0; - - private final List helperMethods = new ArrayList<>(); - - public RuleSetCreationSpec(IntermediateModel intermediateModel) { - this.endpointRulesSpecUtils = new EndpointRulesSpecUtils(intermediateModel); - this.ruleSetModel = intermediateModel.getEndpointRuleSetModel(); - } - - public CodeBlock ruleSetCreationExpr() { - CodeBlock.Builder b = CodeBlock.builder(); - - b.add("$T.builder()", endpointRulesSpecUtils.rulesRuntimeClassName("EndpointRuleset")) - .add(".version($S)", ruleSetModel.getVersion()) - .add(".serviceId($S)", ruleSetModel.getServiceId()) - .add(".parameters($L)", parameters(ruleSetModel.getParameters())); - - ruleSetModel.getRules().stream() - .map(this::rule) - .forEach(m -> b.add(".addRule($N())", m.name)); - - b.add(".build()"); - return b.build(); - } - - public List helperMethods() { - return helperMethods; - } - - private CodeBlock parameters(Map params) { - CodeBlock.Builder b = CodeBlock.builder(); - - b.add("$T.builder()", endpointRulesSpecUtils.rulesRuntimeClassName("Parameters")); - - params.forEach((name, model) -> { - b.add(".addParameter($L)", parameter(name, model)); - }); - - b.add(".build()"); - - return b.build(); - } - - private CodeBlock parameter(String name, ParameterModel model) { - CodeBlock.Builder b = CodeBlock.builder(); - - b.add("$T.builder()", endpointRulesSpecUtils.rulesRuntimeClassName("Parameter")) - .add(".name($S)", name) - .add(".type($T.fromValue($S))", endpointRulesSpecUtils.rulesRuntimeClassName("ParameterType"), model.getType()) - .add(".required($L)", Boolean.TRUE.equals(model.isRequired())); - - if (model.getBuiltIn() != null) { - b.add(".builtIn($S)", model.getBuiltIn()); - } - - if (model.getDocumentation() != null) { - b.add(".documentation($S)", model.getDocumentation()); - } - - if (model.getDefault() != null) { - TreeNode defaultValue = model.getDefault(); - JsonToken token = defaultValue.asToken(); - CodeBlock value; - if (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE) { - value = endpointRulesSpecUtils.valueCreationCode("boolean", - CodeBlock.builder() - .add("$L", ((JrsBoolean) defaultValue).booleanValue()) - .build()); - } else if (token == JsonToken.VALUE_STRING) { - value = endpointRulesSpecUtils.valueCreationCode("string", - CodeBlock.builder() - .add("$S", ((JrsString) defaultValue).getValue()) - .build()); - } else if (token == JsonToken.START_ARRAY) { - validateStringArrayType(model); - value = endpointRulesSpecUtils.valueCreationCode("stringarray", - buildStringArrayDefaultValue((JrsArray) defaultValue)); - } else { - throw new RuntimeException("Can't set default value type " + token.name()); - } - b.add(".defaultValue($L)", value); - } - - if (model.getDeprecated() != null) { - ParameterDeprecatedModel deprecated = model.getDeprecated(); - b.add(".deprecated(new $T($S, $S))", - endpointRulesSpecUtils.rulesRuntimeClassName("Parameter.Deprecated"), - deprecated.getMessage(), - deprecated.getSince()); - } - - b.add(".build()"); - - return b.build(); - } - - private MethodSpec rule(RuleModel model) { - MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder(nextRuleMethodName()); - - methodBuilder.addModifiers(Modifier.PRIVATE, Modifier.STATIC); - methodBuilder.returns(endpointRulesSpecUtils.rulesRuntimeClassName("Rule")); - - CodeBlock.Builder b = CodeBlock.builder(); - - b.add("$T.builder()", endpointRulesSpecUtils.rulesRuntimeClassName("Rule")); - - model.getConditions().forEach(c -> b.add(".addCondition($L)", condition(c))); - - if ("error".equals(model.getType())) { - b.add(".error($S)", model.getError()); - } else if ("tree".equals(model.getType())) { - CodeBlock.Builder rulesArray = CodeBlock.builder() - .add("$T.asList(", Arrays.class); - - int nRules = model.getRules().size(); - for (int i = 0; i < nRules; ++i) { - MethodSpec childRule = rule(model.getRules().get(i)); - rulesArray.add("$N()", childRule.name); - if (i + 1 < nRules) { - rulesArray.add(", "); - } - } - rulesArray.add(")"); - - b.add(".treeRule($L)", rulesArray.build()); - } else if ("endpoint".equals(model.getType())) { - CodeBlock endpoint = endpoint(model.getEndpoint()); - b.add(".endpoint($L)", endpoint); - } - - MethodSpec m = methodBuilder.addStatement("return $L", b.build()).build(); - - helperMethods.add(m); - - return m; - } - - private CodeBlock endpoint(EndpointModel model) { - CodeBlock.Builder b = CodeBlock.builder(); - - b.add("$T.builder()", endpointRulesSpecUtils.rulesRuntimeClassName("EndpointResult")); - - TreeNode url = model.getUrl(); - b.add(".url($L)", expr(url)); - - if (model.getHeaders() != null) { - model.getHeaders().forEach((name, valueList) -> { - valueList.forEach(value -> b.add(".addHeaderValue($S, $L)", name, expr(value))); - }); - } - - if (model.getProperties() != null) { - // Explicitly only support known properties - model.getProperties().forEach((name, property) -> { - switch (name) { - case "authSchemes": - b.add(".addProperty($T.of($S), $T.fromTuple($T.asList(", - endpointRulesSpecUtils.rulesRuntimeClassName("Identifier"), - "authSchemes", - endpointRulesSpecUtils.rulesRuntimeClassName("Literal"), - Arrays.class); - - Iterator authSchemesIter = ((JrsArray) property).elements(); - - while (authSchemesIter.hasNext()) { - b.add("$T.fromRecord($T.of(", endpointRulesSpecUtils.rulesRuntimeClassName("Literal"), - MapUtils.class); - JrsObject authScheme = (JrsObject) authSchemesIter.next(); - - Iterator authSchemeFieldsIter = authScheme.fieldNames(); - while (authSchemeFieldsIter.hasNext()) { - String schemeProp = authSchemeFieldsIter.next(); - JrsValue propValue = authScheme.get(schemeProp); - b.add("$T.of($S), ", endpointRulesSpecUtils.rulesRuntimeClassName("Identifier"), schemeProp); - if ("signingRegionSet".equalsIgnoreCase(schemeProp)) { - b.add("$T.fromTuple($T.asList(", endpointRulesSpecUtils.rulesRuntimeClassName("Literal"), - Arrays.class); - Iterator signingRegions = ((JrsArray) propValue).elements(); - - while (signingRegions.hasNext()) { - JrsString region = (JrsString) signingRegions.next(); - b.add("$T.fromStr($S)", endpointRulesSpecUtils.rulesRuntimeClassName("Literal"), - region.getValue()); - - if (signingRegions.hasNext()) { - b.add(", "); - } - } - b.add("))"); - } else if ("disableDoubleEncoding".equalsIgnoreCase(schemeProp)) { - b.add("$T.fromBool($L)", endpointRulesSpecUtils.rulesRuntimeClassName("Literal"), - ((JrsBoolean) propValue).booleanValue()); - } else { - b.add("$T.fromStr($S)", endpointRulesSpecUtils.rulesRuntimeClassName("Literal"), - ((JrsString) propValue).getValue()); - } - - if (authSchemeFieldsIter.hasNext()) { - b.add(", "); - } - } - - b.add("))"); - - if (authSchemesIter.hasNext()) { - b.add(", "); - } - } - b.add(")))"); - - break; - case "bucketType": - b.add(".addProperty($T.of($S), $T.fromStr($S))", - endpointRulesSpecUtils.rulesRuntimeClassName("Identifier"), - "bucketType", - endpointRulesSpecUtils.rulesRuntimeClassName("Literal"), - ((JrsString) property).getValue()); - break; - case "useS3ExpressSessionAuth": - b.add(".addProperty($T.of($S), $T.fromBool($L))", - endpointRulesSpecUtils.rulesRuntimeClassName("Identifier"), - "useS3ExpressSessionAuth", - endpointRulesSpecUtils.rulesRuntimeClassName("Literal"), - ((JrsBoolean) property).booleanValue()); - break; - case "backend": - b.add(".addProperty($T.of($S), $T.fromStr($S))", - endpointRulesSpecUtils.rulesRuntimeClassName("Identifier"), - "backend", - endpointRulesSpecUtils.rulesRuntimeClassName("Literal"), - ((JrsString) property).getValue()); - break; - default: - break; - } - }); - } - - b.add(".build()"); - return b.build(); - } - - private CodeBlock condition(ConditionModel model) { - CodeBlock.Builder b = CodeBlock.builder(); - - b.add("$T.builder()", endpointRulesSpecUtils.rulesRuntimeClassName("Condition")) - .add(".fn($L.validate())", fnNode(model)); - - if (model.getAssign() != null) { - b.add(".result($S)", model.getAssign()); - } - - b.add(".build()"); - - return b.build(); - } - - private CodeBlock fnNode(ConditionModel model) { - CodeBlock.Builder b = CodeBlock.builder(); - - b.add("$T.builder()", endpointRulesSpecUtils.rulesRuntimeClassName("FnNode")) - .add(".fn($S)", model.getFn()) - .add(".argv($T.asList(", Arrays.class); - - List args = model.getArgv(); - for (int i = 0; i < args.size(); ++i) { - b.add("$L", expr(args.get(i))); - if (i + 1 < args.size()) { - b.add(","); - } - } - b.add("))"); - - b.add(".build()"); - - return b.build(); - } - - private CodeBlock expr(TreeNode n) { - if (n.isValueNode()) { - return valueExpr((JrsValue) n); - } - - if (n.isObject()) { - return objectExpr((JrsObject) n); - } - - throw new RuntimeException("Don't know how to create expression from " + n); - } - - private CodeBlock valueExpr(JrsValue n) { - CodeBlock.Builder b = CodeBlock.builder(); - - b.add("$T.of(", endpointRulesSpecUtils.rulesRuntimeClassName("Expr")); - JsonToken token = n.asToken(); - switch (token) { - case VALUE_STRING: - b.add("$S", ((JrsString) n).getValue()); - break; - case VALUE_NUMBER_INT: - b.add("$L", ((JrsNumber) n).getValue().intValue()); - break; - case VALUE_TRUE: - case VALUE_FALSE: - b.add("$L", ((JrsBoolean) n).booleanValue()); - break; - default: - throw new RuntimeException("Don't know how to create expression JSON type " + token); - } - - b.add(")"); - - return b.build(); - } - - private CodeBlock objectExpr(JrsObject n) { - CodeBlock.Builder b = CodeBlock.builder(); - - JrsValue ref = n.get("ref"); - JrsValue fn = n.get("fn"); - - if (ref != null) { - b.add("$T.ref($T.of($S))", - endpointRulesSpecUtils.rulesRuntimeClassName("Expr"), - endpointRulesSpecUtils.rulesRuntimeClassName("Identifier"), - ref.asText()); - } else if (fn != null) { - String name = fn.asText(); - CodeBlock.Builder fnNode = CodeBlock.builder(); - fnNode.add("$T.builder()", endpointRulesSpecUtils.rulesRuntimeClassName("FnNode")) - .add(".fn($S)", name); - - JrsArray argv = (JrsArray) n.get("argv"); - - fnNode.add(".argv($T.asList(", Arrays.class); - Iterator iter = argv.elements(); - - while (iter.hasNext()) { - fnNode.add(expr(iter.next())); - - if (iter.hasNext()) { - fnNode.add(","); - } - } - - fnNode.add(")).build().validate()"); - - b.add(fnNode.build()); - } - - return b.build(); - } - - private String nextRuleMethodName() { - String n = String.format("%s%d", RULE_METHOD_PREFIX, ruleCounter); - ruleCounter += 1; - return n; - } - - private static void validateStringArrayType(ParameterModel model) { - if (!"stringarray".equalsIgnoreCase(model.getType())) { - throw new RuntimeException(String.format("Only String array is supported but the type received is %s", - model.getType())); - } - } - - private CodeBlock buildStringArrayDefaultValue(JrsArray defaultValue) { - CodeBlock.Builder builder = CodeBlock.builder(); - Iterator elementValuesIter = defaultValue.elements(); - if (elementValuesIter.hasNext()) { - builder.add("$T.asList(", Arrays.class); - } - while (elementValuesIter.hasNext()) { - JrsValue v = elementValuesIter.next(); - builder.add("\"" + v.asText() + "\""); - if (elementValuesIter.hasNext()) { - builder.add(","); - } - } - builder.add(")"); - return builder.build(); - } -} diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleSetExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleSetExpression.java similarity index 99% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleSetExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleSetExpression.java index 13a3ccafc51b..22c5f541e21f 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleSetExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleSetExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.ArrayList; import java.util.Collections; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleType.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleType.java similarity index 99% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleType.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleType.java index fd86b78066d3..ed2344107e50 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/RuleType.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/RuleType.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.ParameterizedTypeName; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/StringConcatExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/StringConcatExpression.java similarity index 98% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/StringConcatExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/StringConcatExpression.java index 106f3cc0291a..72713c0c22f6 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/StringConcatExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/StringConcatExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.ArrayList; import java.util.Collections; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/SymbolTable.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/SymbolTable.java similarity index 72% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/SymbolTable.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/SymbolTable.java index 67176abfa146..a04c73f93d68 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/SymbolTable.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/SymbolTable.java @@ -13,22 +13,24 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.Collections; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Set; import software.amazon.awssdk.utils.Validate; public final class SymbolTable { private final Map params; private final Map locals; - private final String regionParamName; + private final Set regionParams; SymbolTable(Builder builder) { this.params = Collections.unmodifiableMap(new LinkedHashMap<>(builder.params)); this.locals = Collections.unmodifiableMap(new LinkedHashMap<>(builder.locals)); - this.regionParamName = builder.regionParamName; + this.regionParams = Collections.unmodifiableSet(new HashSet<>(builder.regionParams)); } public static Builder builder() { @@ -59,8 +61,20 @@ public Map params() { return params; } - public String regionParamName() { - return regionParamName; + /** + * Returns the set of parameter names that are Region-typed in Java (i.e., the Java getter returns {@code Region} + * rather than {@code String}). The codegen needs to append {@code .id()} when accessing these params to convert + * to the String value expected by the endpoint rules. + */ + public Set regionParams() { + return regionParams; + } + + /** + * Returns true if the given parameter name is a Region-typed param that needs {@code .id()} appended. + */ + public boolean isRegionParam(String name) { + return regionParams.contains(name); } public Builder toBuilder() { @@ -70,7 +84,7 @@ public Builder toBuilder() { public static class Builder { private final Map params = new LinkedHashMap<>(); private final Map locals = new LinkedHashMap<>(); - private String regionParamName; + private final Set regionParams = new HashSet<>(); public Builder() { } @@ -78,7 +92,7 @@ public Builder() { public Builder(SymbolTable table) { this.params.putAll(table.params); this.locals.putAll(table.locals); - this.regionParamName = table.regionParamName; + this.regionParams.addAll(table.regionParams); } public Builder putParam(String name, RuleType type) { @@ -99,8 +113,8 @@ public RuleType local(String name) { return locals.get(name); } - public Builder regionParamName(String regionParamName) { - this.regionParamName = regionParamName; + public Builder addRegionParam(String name) { + regionParams.add(Validate.paramNotNull(name, "name")); return this; } diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/Tokenizer.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/Tokenizer.java similarity index 99% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/Tokenizer.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/Tokenizer.java index c1f48710c816..2d43a356223a 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/Tokenizer.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/Tokenizer.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.ArrayList; import java.util.List; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/VariableReferenceExpression.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/VariableReferenceExpression.java similarity index 98% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/VariableReferenceExpression.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/VariableReferenceExpression.java index ab208ac88422..b0311aad0755 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/VariableReferenceExpression.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/VariableReferenceExpression.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.Objects; import software.amazon.awssdk.utils.Validate; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/WalkRuleExpressionVisitor.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/WalkRuleExpressionVisitor.java similarity index 98% rename from codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/WalkRuleExpressionVisitor.java rename to codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/WalkRuleExpressionVisitor.java index de952b6d67da..fb164de3fc3e 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/WalkRuleExpressionVisitor.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules/WalkRuleExpressionVisitor.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import java.util.Collection; import java.util.List; diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/EndpointProviderSpec2.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/EndpointProviderSpec2.java deleted file mode 100644 index 831b8d88af83..000000000000 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/EndpointProviderSpec2.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package software.amazon.awssdk.codegen.poet.rules2; - -import com.squareup.javapoet.ClassName; -import com.squareup.javapoet.CodeBlock; -import com.squareup.javapoet.MethodSpec; -import com.squareup.javapoet.TypeName; -import com.squareup.javapoet.TypeSpec; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.concurrent.CompletableFuture; -import javax.lang.model.element.Modifier; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.codegen.model.config.customization.EndpointAuthSchemeConfig; -import software.amazon.awssdk.codegen.model.config.customization.KeyTypePair; -import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; -import software.amazon.awssdk.codegen.model.intermediate.Metadata; -import software.amazon.awssdk.codegen.model.rules.endpoints.BuiltInParameter; -import software.amazon.awssdk.codegen.model.rules.endpoints.ParameterModel; -import software.amazon.awssdk.codegen.model.rules.endpoints.RuleModel; -import software.amazon.awssdk.codegen.model.service.EndpointRuleSetModel; -import software.amazon.awssdk.codegen.poet.ClassSpec; -import software.amazon.awssdk.codegen.poet.PoetUtils; -import software.amazon.awssdk.codegen.poet.rules.EndpointRulesSpecUtils; -import software.amazon.awssdk.core.exception.SdkClientException; -import software.amazon.awssdk.regions.Region; -import software.amazon.awssdk.utils.CompletableFutureUtils; -import software.amazon.awssdk.utils.Validate; - -public class EndpointProviderSpec2 implements ClassSpec { - private final IntermediateModel intermediateModel; - private final EndpointRulesSpecUtils endpointRulesSpecUtils; - private final Map knownEndpointAttributes; - private final CodegenExpressionBuidler utils; - private final RuleRuntimeTypeMirror typeMirror; - - public EndpointProviderSpec2(IntermediateModel intermediateModel) { - this.intermediateModel = intermediateModel; - this.endpointRulesSpecUtils = new EndpointRulesSpecUtils(intermediateModel); - String packageName = intermediateModel.getMetadata().getFullInternalEndpointRulesPackageName(); - this.typeMirror = new RuleRuntimeTypeMirror(packageName); - EndpointRuleSetModel model = intermediateModel.getEndpointRuleSetModel(); - this.utils = createCodegenRulesUtil(model.getRules(), model.getParameters(), typeMirror); - this.knownEndpointAttributes = knownEndpointAttributes(intermediateModel); - } - - private static RuleType fromParameterModel(ParameterModel model) { - switch (model.getType().toLowerCase(Locale.ENGLISH)) { - case "boolean": - return RuleRuntimeTypeMirror.BOOLEAN; - case "string": - return RuleRuntimeTypeMirror.STRING; - case "stringarray": - return RuleRuntimeTypeMirror.LIST_OF_STRING; - default: - throw new IllegalStateException("Cannot find rule type for: " + model.getType()); - } - } - - private static RuleModel createRootRule(List rules) { - RuleModel root = new RuleModel(); - root.setRules(rules); - root.setType("tree"); - root.setConditions(Collections.emptyList()); - return root; - } - - private static CodegenExpressionBuidler createCodegenRulesUtil(List rules, - Map parameters, - RuleRuntimeTypeMirror typeMirror) { - RuleSetExpression root = ExpressionParser.parseRuleSetExpression(createRootRule(rules)); - return CodegenExpressionBuidler.from(root, typeMirror, initSymbolTable(parameters)); - } - - private static SymbolTable initSymbolTable(Map parameters) { - SymbolTable.Builder builder = SymbolTable.builder(); - parameters.forEach((k, v) -> { - builder.putParam(k, fromParameterModel(v)); - if (v.getBuiltInEnum() == BuiltInParameter.AWS_REGION) { - // Region is a special case since it's already public API and uses an actual `Region` instance instead of - // `String`. We then introduce here a local with the same name but with String type such that we don't have - // to do the conversion everywhere a string represented region is used. - builder.regionParamName(k); - builder.putLocal(k, RuleRuntimeTypeMirror.STRING); - } - }); - return builder.build(); - } - - private static Map knownEndpointAttributes(IntermediateModel intermediateModel) { - Map knownEndpointAttributes = null; - EndpointAuthSchemeConfig config = intermediateModel.getCustomizationConfig().getEndpointAuthSchemeConfig(); - if (config != null) { - knownEndpointAttributes = config.getEndpointProviderTestKeys(); - } - if (knownEndpointAttributes == null) { - knownEndpointAttributes = Collections.emptyMap(); - } - return knownEndpointAttributes; - } - - @Override - public TypeSpec poetSpec() { - TypeSpec.Builder builder = PoetUtils.createClassBuilder(className()) - .addModifiers(Modifier.PUBLIC, Modifier.FINAL) - .addSuperinterface(endpointRulesSpecUtils.providerInterfaceName()) - .addAnnotation(SdkInternalApi.class); - - builder.addMethod(resolveEndpointMethod()); - List methods = new ArrayList<>(); - createRuleMethod(utils.root(), methods); - for (MethodSpec.Builder methodBuilder : methods) { - builder.addMethod(methodBuilder.build()); - } - builder.addMethod(equalsMethod()); - builder.addMethod(hashCodeMethod()); - return builder.build(); - } - - @Override - public ClassName className() { - Metadata md = intermediateModel.getMetadata(); - return ClassName.get(md.getFullInternalEndpointRulesPackageName(), - "Default" + endpointRulesSpecUtils.providerInterfaceName().simpleName()); - } - - private MethodSpec resolveEndpointMethod() { - MethodSpec.Builder builder = MethodSpec.methodBuilder("resolveEndpoint") - .addModifiers(Modifier.PUBLIC) - .returns(endpointRulesSpecUtils.resolverReturnType()) - .addAnnotation(Override.class) - .addParameter(endpointRulesSpecUtils.parametersClassName(), "params"); - - builder.addCode(validateRequiredParams()); - builder.beginControlFlow("try"); - String regionParamName = utils.regionParamName(); - if (regionParamName != null) { - builder.addStatement("$T region = params.$L()", Region.class, regionParamName); - builder.addStatement("$T regionId = region == null ? null : region.id()", String.class); - builder.addStatement("$T result = $L(params, regionId)", ruleResult(), utils.root().ruleId()); - } else { - builder.addStatement("$T result = $L(params)", ruleResult(), utils.root().ruleId()); - } - builder.beginControlFlow("if (result.canContinue())") - .addStatement("throw $T.create($S)", SdkClientException.class, "Rule engine did not reach an error or " - + "endpoint result") - .endControlFlow(); - - builder.beginControlFlow("if (result.isError())") - .addStatement("String errorMsg = result.error()") - .beginControlFlow("if (errorMsg.contains(\"Invalid ARN\") && errorMsg.contains(\":s3:::\"))") - .addStatement("errorMsg += $S", ". Use the bucket name instead of simple bucket ARNs in " - + "GetBucketLocationRequest.") - .endControlFlow() - .addStatement("throw $T.create(errorMsg)", SdkClientException.class) - .endControlFlow(); - - builder.addStatement("return $T.completedFuture(result.endpoint())", CompletableFuture.class); - builder.nextControlFlow("catch ($T error)", Exception.class); - builder.addStatement("return $T.failedFuture(error)", CompletableFutureUtils.class); - builder.endControlFlow(); - - return builder.build(); - } - - private CodeBlock validateRequiredParams() { - CodeBlock.Builder b = CodeBlock.builder(); - Map parameters = intermediateModel.getEndpointRuleSetModel().getParameters(); - parameters.entrySet().stream() - .filter(e -> Boolean.TRUE.equals(e.getValue().isRequired())) - .forEach(e -> { - b.addStatement("$T.notNull($N.$N(), $S)", - Validate.class, - "params", - endpointRulesSpecUtils.paramMethodName(e.getKey()), - String.format("Parameter '%s' must not be null", e.getKey())); - }); - - return b.build(); - } - - private void createRuleMethod(RuleSetExpression expr, List methods) { - MethodSpec.Builder builder = methodBuilderForRule(expr); - methods.add(builder); - CodeBlock.Builder block = CodeBlock.builder(); - codegenExpr(expr, block); - builder.addCode(block.build()); - if (expr.isTree()) { - for (RuleSetExpression child : expr.children()) { - if (child.isTree()) { - createRuleMethod(child, methods); - } - } - } - } - - private MethodSpec.Builder methodBuilderForRule(RuleSetExpression expr) { - MethodSpec.Builder builder = - MethodSpec.methodBuilder(expr.ruleId()) - .addModifiers(Modifier.PRIVATE, Modifier.STATIC) - .returns(ruleResult()); - ComputeScopeTree.Scope scope = utils.scopesByName().get(expr.ruleId()); - builder.addParameter(endpointRulesSpecUtils.parametersClassName(), "params"); - for (String param : scope.usesLocals()) { - if (scope.defines().contains(param)) { - continue; - } - RuleType type = utils.symbolTable().localType(param); - builder.addParameter(type.javaType(), param); - } - return builder; - } - - private void codegenExpr(RuleSetExpression expr, CodeBlock.Builder builder) { - CodeGeneratorVisitor visitor = new CodeGeneratorVisitor(typeMirror, - utils.symbolTable(), - knownEndpointAttributes, - utils.scopesByName(), - builder); - visitor.visitRuleSetExpression(expr); - } - - private TypeName ruleResult() { - return typeMirror.rulesResult().type(); - } - - private MethodSpec equalsMethod() { - return MethodSpec.methodBuilder("equals") - .addAnnotation(Override.class) - .addModifiers(Modifier.PUBLIC) - .returns(boolean.class) - .addParameter(Object.class, "rhs") - .addStatement("return rhs != null && getClass().equals(rhs.getClass())") - .build(); - } - - private MethodSpec hashCodeMethod() { - return MethodSpec.methodBuilder("hashCode") - .addAnnotation(Override.class) - .addModifiers(Modifier.PUBLIC) - .returns(int.class) - .addStatement("return getClass().hashCode()") - .build(); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Arn.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Arn.java.resource deleted file mode 100644 index cee045e523e3..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Arn.java.resource +++ /dev/null @@ -1,112 +0,0 @@ -import java.util.Arrays; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; -import software.amazon.awssdk.annotations.SdkInternalApi; - -/** - * An AWS Arn. - */ -@SdkInternalApi -public final class Arn { - private final String partition; - private final String service; - private final String region; - private final String accountId; - private final List resource; - - public Arn(String partition, String service, String region, String accountId, List resource) { - this.partition = partition; - this.service = service; - this.region = region; - this.accountId = accountId; - this.resource = resource; - } - - public static Optional parse(String arn) { - String[] base = arn.split(":", 6); - if (base.length != 6) { - return Optional.empty(); - } - // service, resource and `arn` may not be null - if (!base[0].equals("arn")) { - return Optional.empty(); - } - if (base[1].isEmpty() || base[2].isEmpty()) { - return Optional.empty(); - } - if (base[5].isEmpty()) { - return Optional.empty(); - } - return Optional.of(new Arn(base[1], base[2], base[3], base[4], - Arrays.stream(base[5].split("[:/]", -1)) - .collect(Collectors.toList()))); - } - - public String partition() { - return partition; - } - - public String service() { - return service; - } - - public String region() { - return region; - } - - public String accountId() { - return accountId; - } - - public List resource() { - return resource; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Arn arn = (Arn) o; - - if (partition != null ? !partition.equals(arn.partition) : arn.partition != null) { - return false; - } - if (service != null ? !service.equals(arn.service) : arn.service != null) { - return false; - } - if (region != null ? !region.equals(arn.region) : arn.region != null) { - return false; - } - if (accountId != null ? !accountId.equals(arn.accountId) : arn.accountId != null) { - return false; - } - return resource != null ? resource.equals(arn.resource) : arn.resource == null; - } - - @Override - public int hashCode() { - int result = partition != null ? partition.hashCode() : 0; - result = 31 * result + (service != null ? service.hashCode() : 0); - result = 31 * result + (region != null ? region.hashCode() : 0); - result = 31 * result + (accountId != null ? accountId.hashCode() : 0); - result = 31 * result + (resource != null ? resource.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "Arn[" + - "partition=" + partition + ", " + - "service=" + service + ", " + - "region=" + region + ", " + - "accountId=" + accountId + ", " + - "resource=" + resource + ']'; - } - -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/AwsEndpointProviderUtils.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/AwsEndpointProviderUtils.java.resource new file mode 100644 index 000000000000..2859989b3716 --- /dev/null +++ b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/AwsEndpointProviderUtils.java.resource @@ -0,0 +1,161 @@ +import static software.amazon.awssdk.utils.FunctionalUtils.invokeSafely; + +import java.net.URI; +import java.util.List; +import java.util.Map; +import software.amazon.awssdk.annotations.SdkInternalApi; +import software.amazon.awssdk.awscore.AwsExecutionAttribute; +import software.amazon.awssdk.awscore.endpoints.AwsEndpointAttribute; +import software.amazon.awssdk.core.exception.SdkClientException; +import software.amazon.awssdk.core.interceptor.ExecutionAttributes; +import software.amazon.awssdk.core.interceptor.SdkExecutionAttribute; +import software.amazon.awssdk.core.interceptor.SdkInternalExecutionAttribute; +import software.amazon.awssdk.endpoints.Endpoint; +import software.amazon.awssdk.http.SdkHttpRequest; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.utils.HostnameValidator; +import software.amazon.awssdk.utils.Logger; +import software.amazon.awssdk.utils.StringUtils; +import software.amazon.awssdk.utils.http.SdkHttpUtils; + +@SdkInternalApi +public final class AwsEndpointProviderUtils { + private static final Logger LOG = Logger.loggerFor(AwsEndpointProviderUtils.class); + + private AwsEndpointProviderUtils() { + } + + public static Region regionBuiltIn(ExecutionAttributes executionAttributes) { + return executionAttributes.getAttribute(AwsExecutionAttribute.AWS_REGION); + } + + public static Boolean dualStackEnabledBuiltIn(ExecutionAttributes executionAttributes) { + return executionAttributes.getAttribute(AwsExecutionAttribute.DUALSTACK_ENDPOINT_ENABLED); + } + + public static Boolean fipsEnabledBuiltIn(ExecutionAttributes executionAttributes) { + return executionAttributes.getAttribute(AwsExecutionAttribute.FIPS_ENDPOINT_ENABLED); + } + + /** + * Returns the endpoint set on the client. Note that this strips off the query part of the URI because the endpoint + * rules library, e.g. {@code ParseURL} will return an exception if the URI it parses has query parameters. + */ + public static String endpointBuiltIn(ExecutionAttributes executionAttributes) { + if (endpointIsOverridden(executionAttributes)) { + return invokeSafely(() -> { + URI endpointOverride = executionAttributes.getAttribute(SdkExecutionAttribute.CLIENT_ENDPOINT); + return new URI(endpointOverride.getScheme(), null, endpointOverride.getHost(), endpointOverride.getPort(), + endpointOverride.getPath(), null, endpointOverride.getFragment()).toString(); + }); + } + return null; + } + + /** + * True if the the {@link SdkExecutionAttribute#ENDPOINT_OVERRIDDEN} attribute is present and its value is + * {@code true}, {@code false} otherwise. + */ + public static boolean endpointIsOverridden(ExecutionAttributes attrs) { + return attrs.getOptionalAttribute(SdkExecutionAttribute.ENDPOINT_OVERRIDDEN).orElse(false); + } + + /** + * True if the the {@link SdkInternalExecutionAttribute#IS_DISCOVERED_ENDPOINT} attribute is present and its value + * is {@code true}, {@code false} otherwise. + */ + public static boolean endpointIsDiscovered(ExecutionAttributes attrs) { + return attrs.getOptionalAttribute(SdkInternalExecutionAttribute.IS_DISCOVERED_ENDPOINT).orElse(false); + } + + /** + * True if the the {@link SdkInternalExecutionAttribute#DISABLE_HOST_PREFIX_INJECTION} attribute is present and its + * value is {@code true}, {@code false} otherwise. + */ + public static boolean disableHostPrefixInjection(ExecutionAttributes attrs) { + return attrs.getOptionalAttribute(SdkInternalExecutionAttribute.DISABLE_HOST_PREFIX_INJECTION).orElse(false); + } + + /** + * Apply the given endpoint prefix to the endpoint. + */ + public static Endpoint addHostPrefix(Endpoint endpoint, String prefix) { + if (StringUtils.isBlank(prefix)) { + return endpoint; + } + + validatePrefixIsHostNameCompliant(prefix); + + URI originalUrl = endpoint.url(); + String newHost = prefix + endpoint.url().getHost(); + URI newUrl = invokeSafely(() -> new URI(originalUrl.getScheme(), null, newHost, originalUrl.getPort(), + originalUrl.getPath(), originalUrl.getQuery(), originalUrl.getFragment())); + + return endpoint.toBuilder().url(newUrl).build(); + } + + /** + * This sets the request URI to the resolved URI returned by the endpoint provider. There are some things to be + * careful about to make this work properly: + *

+ * If the client endpoint is an endpoint override, it may contain a path. In addition, the request marshaller itself + * may add components to the path if it's modeled for the operation. Unfortunately, + * {@link SdkHttpRequest#encodedPath()} returns the combined path from both the endpoint and the request. There is + * no way to know, just from the HTTP request object, where the override path ends (if it's even there) and where + * the request path starts. Additionally, the rule itself may also append other parts to the endpoint override path. + *

+ * To solve this issue, we pass in the endpoint set on the path, which allows us to the strip the path from the + * endpoint override from the request path, and then correctly combine the paths. + *

+ * For example, let's suppose the endpoint override on the client is {@code https://example.com/a}. Then we call an + * operation {@code Foo()}, that marshalls {@code /c} to the path. The resulting request path is {@code /a/c}. + * However, we also pass the endpoint to provider as a parameter, and the resolver returns + * {@code https://example.com/a/b}. This method takes care of combining the paths correctly so that the resulting + * path is {@code https://example.com/a/b/c}. + */ + public static SdkHttpRequest setUri(SdkHttpRequest request, URI clientEndpoint, URI resolvedUri) { + // [client endpoint path] + String clientEndpointPath = clientEndpoint.getRawPath(); + + // [client endpoint path]/[request path] + String requestPath = request.encodedPath(); + + // [client endpoint path]/[additional path added by resolver] + String resolvedUriPath = resolvedUri.getRawPath(); + + String finalPath = requestPath; + + // If there is an additional path added by resolver, i.e., [additional path added by resolver] not null, + // we need to combine the path + if (!resolvedUriPath.equals(clientEndpointPath)) { + finalPath = combinePath(clientEndpointPath, requestPath, resolvedUriPath); + } + + return request.toBuilder().protocol(resolvedUri.getScheme()).host(resolvedUri.getHost()).port(resolvedUri.getPort()) + .encodedPath(finalPath).build(); + } + + /** + * Our goal is to construct [client endpoint path]/[additional path added by resolver]/[request path], so we just + * need to strip the client endpoint path from the marshalled request path to isolate just the part added by the + * marshaller. Trailing slash is removed from client endpoint path before stripping because it could cause the + * leading slash to be removed from the request path: e.g., StringUtils.replaceOnce("/", "//test", "") generates + * "/test" and the expected result is "//test" + */ + private static String combinePath(String clientEndpointPath, String requestPath, String resolvedUriPath) { + String requestPathWithClientPathRemoved = StringUtils.replaceOnce(requestPath, clientEndpointPath, ""); + String finalPath = SdkHttpUtils.appendUri(resolvedUriPath, requestPathWithClientPathRemoved); + return finalPath; + } + + private static void validatePrefixIsHostNameCompliant(String prefix) { + String[] components = splitHostLabelOnDots(prefix); + for (String component : components) { + HostnameValidator.validateHostnameCompliant(component, component, "request"); + } + } + + private static String[] splitHostLabelOnDots(String label) { + return label.split("\\."); + } +} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/BooleanEqualsFn.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/BooleanEqualsFn.java.resource deleted file mode 100644 index 1efb616d2d0d..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/BooleanEqualsFn.java.resource +++ /dev/null @@ -1,39 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.utils.Pair; - -@SdkInternalApi -public class BooleanEqualsFn extends Fn { - public static final String ID = "booleanEquals"; - - public BooleanEqualsFn(FnNode fnNode) { - super(fnNode); - } - - @Override - public T acceptFnVisitor(FnVisitor visitor) { - return visitor.visitBoolEquals(this); - } - - public static BooleanEqualsFn ofExprs(Expr left, Expr right) { - return new BooleanEqualsFn(FnNode.ofExprs(ID, left, right)); - } - - public Expr getLeft() { - return expectTwoArgs().left(); - } - - public Expr getRight() { - return expectTwoArgs().right(); - } - - @Override - public Value eval(Scope scope) { - Pair args = expectTwoArgs(); - return RuleError.ctx("while evaluating booleanEquals", - () -> Value.fromBool(args.left().eval(scope).expectBool() == args.right().eval(scope).expectBool())); - } - - public static BooleanEqualsFn fromParam(Parameter param, Expr value) { - return ofExprs(param.expr(), value); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Condition.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Condition.java.resource deleted file mode 100644 index 711bc627cffb..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Condition.java.resource +++ /dev/null @@ -1,92 +0,0 @@ -import java.util.Map; -import java.util.Optional; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; - -@SdkInternalApi -public final class Condition implements Eval, IntoSelf { - public static final String ASSIGN = "assign"; - - private final Expr fn; - private final Identifier result; - - private Condition(Builder builder) { - this.fn = builder.fn; - this.result = builder.result; - } - - public Expr getFn() { - return fn; - } - - public Optional getResult() { - return Optional.ofNullable(result); - } - - public static Condition fromNode(JsonNode node) { - Map objNode = node.asObject(); - - Builder b = builder(); - - Fn fn = FnNode.fromNode(node).validate(); - - b.fn(fn); - - JsonNode assignNode = objNode.get(ASSIGN); - if (assignNode != null) { - b.result(assignNode.asString()); - } - - return b.build(); - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - this.getResult().ifPresent(res -> sb.append(res).append(" = ")); - sb.append(this.fn); - return sb.toString(); - } - - @Override - public Value eval(Scope scope) { - Value value = this.fn.eval(scope); - if (!value.isNone()) { - this.getResult().ifPresent(res -> scope.insert(res, value)); - } - return value; - } - - public Expr expr() { - if (this.getResult().isPresent()) { - return Expr.ref(this.getResult().get()); - } else { - throw new RuntimeException("Cannot generate expr from a condition without a result"); - } - } - - - public static class Builder { - private Fn fn; - private Identifier result; - - public Builder fn(Fn fn) { - this.fn = fn; - return this; - } - - public Builder result(String result) { - this.result = Identifier.of(result); - return this; - } - - public Condition build() { - return new Condition(this); - } - - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/DefaultEndpointAuthSchemeStrategy.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/DefaultEndpointAuthSchemeStrategy.java.resource deleted file mode 100644 index 6f2a22e1ce9b..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/DefaultEndpointAuthSchemeStrategy.java.resource +++ /dev/null @@ -1,45 +0,0 @@ -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import software.amazon.awssdk.awscore.endpoints.authscheme.EndpointAuthScheme; -import software.amazon.awssdk.core.exception.SdkClientException; -import software.amazon.awssdk.utils.Logger; -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public final class DefaultEndpointAuthSchemeStrategy implements EndpointAuthSchemeStrategy { - private static final Logger LOG = Logger.loggerFor(DefaultEndpointAuthSchemeStrategy.class); - - private final Map> knownAuthSchemesMapping; - - public DefaultEndpointAuthSchemeStrategy(Map> knownAuthSchemesMapping) { - this.knownAuthSchemesMapping = knownAuthSchemesMapping; - } - - @Override - public EndpointAuthScheme chooseAuthScheme(List authSchemes) { - return authSchemes.stream() - .filter(scheme -> knownAuthSchemesMapping.containsKey(scheme.name())) - .findFirst() - .orElseThrow(() -> SdkClientException.create("Endpoint did not contain any known auth schemes: " + authSchemes)); - } - - @Override - public List createAuthSchemes(Value authSchemesValue) { - Value.Array schemesArray = authSchemesValue.expectArray(); - List authSchemes = new ArrayList<>(); - for (int i = 0; i < schemesArray.size(); ++i) { - Value.Record scheme = schemesArray.get(i).expectRecord(); - String authSchemeName = scheme.get(Identifier.of("name")).expectString(); - Function mapper = knownAuthSchemesMapping.get(authSchemeName); - if (mapper == null) { - LOG.debug(() -> "Ignoring unknown auth scheme: " + authSchemeName); - continue; - } - authSchemes.add(mapper.apply(scheme)); - } - return authSchemes; - } -} - diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/DefaultEndpointAuthSchemeStrategyFactory.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/DefaultEndpointAuthSchemeStrategyFactory.java.resource deleted file mode 100644 index 2c819a232b8c..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/DefaultEndpointAuthSchemeStrategyFactory.java.resource +++ /dev/null @@ -1,63 +0,0 @@ -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; -import software.amazon.awssdk.awscore.endpoints.authscheme.EndpointAuthScheme; -import software.amazon.awssdk.awscore.endpoints.authscheme.SigV4AuthScheme; -import software.amazon.awssdk.awscore.endpoints.authscheme.SigV4aAuthScheme; - -public final class DefaultEndpointAuthSchemeStrategyFactory implements EndpointAuthSchemeStrategyFactory { - private static final String SIGV4_NAME = "sigv4"; - private static final String SIGV4A_NAME = "sigv4a"; - - public EndpointAuthSchemeStrategy endpointAuthSchemeStrategy() { - Map> knownAuthSchemesMapping = new HashMap<>(); - knownAuthSchemesMapping.put(SIGV4A_NAME, this::sigV4A); - knownAuthSchemesMapping.put(SIGV4_NAME, this::sigV4); - return new DefaultEndpointAuthSchemeStrategy(knownAuthSchemesMapping); - } - - private EndpointAuthScheme sigV4A(Value.Record scheme) { - SigV4aAuthScheme.Builder schemeBuilder = SigV4aAuthScheme.builder(); - - Value signingName = scheme.get(Identifier.of("signingName")); - if (signingName != null) { - schemeBuilder.signingName(signingName.expectString()); - } - - Value signingRegionSet = scheme.get(Identifier.of("signingRegionSet")); - if (signingRegionSet != null) { - Value.Array signingRegionSetArray = signingRegionSet.expectArray(); - for (int j = 0; j < signingRegionSetArray.size(); ++j) { - schemeBuilder.addSigningRegion(signingRegionSetArray.get(j).expectString()); - } - } - - Value disableDoubleEncoding = scheme.get(Identifier.of("disableDoubleEncoding")); - if (disableDoubleEncoding != null) { - schemeBuilder.disableDoubleEncoding(disableDoubleEncoding.expectBool()); - } - - return schemeBuilder.build(); - } - - private EndpointAuthScheme sigV4(Value.Record scheme) { - SigV4AuthScheme.Builder schemeBuilder = SigV4AuthScheme.builder(); - - Value signingName = scheme.get(Identifier.of("signingName")); - if (signingName != null) { - schemeBuilder.signingName(signingName.expectString()); - } - - Value signingRegion = scheme.get(Identifier.of("signingRegion")); - if (signingRegion != null) { - schemeBuilder.signingRegion(signingRegion.expectString()); - } - - Value disableDoubleEncoding = scheme.get(Identifier.of("disableDoubleEncoding")); - if (disableDoubleEncoding != null) { - schemeBuilder.disableDoubleEncoding(disableDoubleEncoding.expectBool()); - } - - return schemeBuilder.build(); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/DefaultRuleEngine.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/DefaultRuleEngine.java.resource deleted file mode 100644 index 70fc540c9013..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/DefaultRuleEngine.java.resource +++ /dev/null @@ -1,12 +0,0 @@ -import java.util.Map; -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public class DefaultRuleEngine implements RuleEngine { - private final RuleEvaluator evaluator = new RuleEvaluator(); - - @Override - public Value evaluate(EndpointRuleset ruleset, Map args) { - return evaluator.evaluateRuleset(ruleset, args); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointAttributeProvider.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointAttributeProvider.java.resource deleted file mode 100644 index 77e9645f46c9..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointAttributeProvider.java.resource +++ /dev/null @@ -1,14 +0,0 @@ -import software.amazon.awssdk.endpoints.EndpointAttributeKey; -import software.amazon.awssdk.annotations.SdkInternalApi; - -/** - * Link between an endpoint property and the {@link AwsEndpointAttribute} it represents. - * - @param the {@link AwsEndpointAttribute} type - */ -@SdkInternalApi -public interface EndpointAttributeProvider { - String propertyName(); - EndpointAttributeKey attributeKey(); - T attributeValue(Value value); -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointAuthSchemeStrategy.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointAuthSchemeStrategy.java.resource deleted file mode 100644 index 61217fb3c8e1..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointAuthSchemeStrategy.java.resource +++ /dev/null @@ -1,10 +0,0 @@ -import java.util.List; -import software.amazon.awssdk.awscore.endpoints.authscheme.EndpointAuthScheme; -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public interface EndpointAuthSchemeStrategy { - EndpointAuthScheme chooseAuthScheme(List authSchemes); - - List createAuthSchemes(Value authSchemesValue); -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointAuthSchemeStrategyFactory.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointAuthSchemeStrategyFactory.java.resource deleted file mode 100644 index 294ea10bad0b..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointAuthSchemeStrategyFactory.java.resource +++ /dev/null @@ -1,12 +0,0 @@ -import java.util.function.Supplier; -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public interface EndpointAuthSchemeStrategyFactory extends Supplier { - EndpointAuthSchemeStrategy endpointAuthSchemeStrategy(); - - @Override - default EndpointAuthSchemeStrategy get() { - return endpointAuthSchemeStrategy(); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointResult.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointResult.java.resource deleted file mode 100644 index 8c40f6fba3c9..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointResult.java.resource +++ /dev/null @@ -1,132 +0,0 @@ -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; - -@SdkInternalApi -public final class EndpointResult { - private static final String URL = "url"; - private static final String PROPERTIES = "properties"; - private static final String HEADERS = "headers"; - - private Expr url; - private Map properties; - private Map> headers; - - private EndpointResult(Builder builder) { - this.url = builder.url; - this.properties = builder.properties; - this.headers = builder.headers; - } - - public Expr getUrl() { - return url; - } - - public Map getProperties() { - return properties; - } - - public Map> getHeaders() { - return headers; - } - - public static EndpointResult fromNode(JsonNode node) { - Map objNode = node.asObject(); - - Builder b = builder(); - - b.url(Expr.fromNode(objNode.get(URL))); - - JsonNode propertiesNode = objNode.get(PROPERTIES); - if (propertiesNode != null) { - propertiesNode.asObject().forEach((k, v) -> { - b.addProperty(Identifier.of(k), Literal.fromNode(v)); - }); - } - - JsonNode headersNode = objNode.get(HEADERS); - if (headersNode != null) { - headersNode.asObject().forEach((k, v) -> { - b.addHeader(k, v.asArray().stream().map(Literal::fromNode).collect(Collectors.toList())); - }); - } - - return b.build(); - } - - @Override - public String toString() { - return "Endpoint{" + - "url=" + url + - ", properties=" + properties + - ", headers=" + headers + - '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - EndpointResult endpoint = (EndpointResult) o; - - if (url != null ? !url.equals(endpoint.url) : endpoint.url != null) { - return false; - } - if (properties != null ? !properties.equals(endpoint.properties) : endpoint.properties != null) { - return false; - } - return headers != null ? headers.equals(endpoint.headers) : endpoint.headers == null; - } - - @Override - public int hashCode() { - int result = url != null ? url.hashCode() : 0; - result = 31 * result + (properties != null ? properties.hashCode() : 0); - result = 31 * result + (headers != null ? headers.hashCode() : 0); - return result; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Expr url; - private final Map properties = new HashMap<>(); - private final Map> headers = new HashMap<>(); - - public Builder url(Expr url) { - this.url = url; - return this; - } - - public Builder addProperty(Identifier name, Expr value) { - properties.put(name, value); - return this; - } - - public Builder addHeader(String name, List value) { - this.headers.put(name, value); - return this; - } - - public Builder addHeaderValue(String name, Expr value) { - List values = this.headers.computeIfAbsent(name, n -> new ArrayList<>()); - values.add(value); - return this; - } - - public EndpointResult build() { - return new EndpointResult(this); - } - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointRule.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointRule.java.resource deleted file mode 100644 index c66b069a11ed..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointRule.java.resource +++ /dev/null @@ -1,29 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public final class EndpointRule extends Rule { - private final EndpointResult endpoint; - - protected EndpointRule(Builder builder, EndpointResult endpoint) { - super(builder); - this.endpoint = endpoint; - } - - public EndpointResult getEndpoint() { - return endpoint; - } - - @Override - public T accept(RuleValueVisitor visitor) { - return visitor.visitEndpointRule(this.getEndpoint()); - } - - @Override - public String toString() { - return "EndpointRule{" + - "endpoint=" + endpoint + - ", conditions=" + conditions + - ", documentation='" + documentation + '\'' + - '}'; - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointRuleset.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointRuleset.java.resource deleted file mode 100644 index 8a9b30c838fe..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/EndpointRuleset.java.resource +++ /dev/null @@ -1,117 +0,0 @@ -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; - -/** - * The set of rules that are used to compute the endpoint to use for a request. - */ -@SdkInternalApi -public final class EndpointRuleset { - private static final String SERVICE_ID = "serviceId"; - private static final String VERSION = "version"; - private static final String PARAMETERS = "parameters"; - private static final String RULES = "rules"; - - - private final String serviceId; - private final List rules; - private final String version; - private final Parameters parameters; - - private EndpointRuleset(Builder b) { - this.serviceId = b.serviceId; - this.rules = b.rules; - this.version = b.version; - this.parameters = b.parameters; - } - - public String getServiceId() { - return serviceId; - } - - public List getRules() { - return rules; - } - - public String getVersion() { - return version; - } - - public Parameters getParameters() { - return parameters; - } - - public static Builder builder() { - return new Builder(); - } - - public static EndpointRuleset fromNode(JsonNode node) { - Builder b = builder(); - - Map obj = node.asObject(); - - JsonNode serviceIdNode = obj.get(SERVICE_ID); - if (serviceIdNode != null) { - b.serviceId(serviceIdNode.asString()); - } - - JsonNode versionNode = obj.get(VERSION); - if (versionNode != null) { - b.version(versionNode.asString()); - } - - b.parameters(Parameters.fromNode(obj.get(PARAMETERS))); - - obj.get(RULES).asArray().forEach(rn -> b.addRule(Rule.fromNode(rn))); - - return b.build(); - } - - @Override - public String toString() { - return "EndpointRuleset{" + - "serviceId='" + serviceId + '\'' + - ", rules=" + rules + - ", version='" + version + '\'' + - ", parameters=" + parameters + - '}'; - } - - public static class Builder { - private String serviceId; - private final List rules = new ArrayList<>(); - private String version; - private Parameters parameters; - - public Builder serviceId(String serviceId) { - this.serviceId = serviceId; - return this; - } - - public Builder withDefaultVersion() { - this.version = "1.0"; - return this; - } - - public Builder version(String version) { - this.version = version; - return this; - } - - public Builder addRule(Rule rule) { - rules.add(rule); - return this; - } - - public Builder parameters(Parameters parameters) { - this.parameters = parameters; - return this; - } - - public EndpointRuleset build() { - return new EndpointRuleset(this); - } - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ErrorRule.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ErrorRule.java.resource deleted file mode 100644 index 9dd7d97026f3..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ErrorRule.java.resource +++ /dev/null @@ -1,25 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public class ErrorRule extends Rule { - private final Expr error; - - public ErrorRule(Builder builder, Expr error) { - super(builder); - this.error = error; - } - - @Override - public T accept(RuleValueVisitor v) { - return v.visitErrorRule(error); - } - - @Override - public String toString() { - return "ErrorRule{" + - "error=" + error + - ", conditions=" + conditions + - ", documentation='" + documentation + '\'' + - '}'; - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Eval.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Eval.java.resource deleted file mode 100644 index cd64069ac420..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Eval.java.resource +++ /dev/null @@ -1,6 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public interface Eval { - Value eval(Scope scope); -} \ No newline at end of file diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Expr.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Expr.java.resource deleted file mode 100644 index fdd6067db226..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Expr.java.resource +++ /dev/null @@ -1,78 +0,0 @@ -import java.util.Map; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; - -@SdkInternalApi -public abstract class Expr implements Eval { - - public abstract R accept(ExprVisitor visitor); - - public GetAttr getAttr(String path) { - return GetAttr.builder().target(this).path(path).build(); - } - - public GetAttr getAttr(Identifier path) { - return GetAttr.builder().target(this).path(path.asString()).build(); - } - - public static Expr fromNode(JsonNode node) { - if (node.isObject()) { - Map objNode = node.asObject(); - JsonNode ref = objNode.get("ref"); - JsonNode fn = objNode.get("fn"); - if ((ref != null ? 1 : 0) + (fn != null ? 1 : 0) != 1) { - throw SourceException.builder().message("expected exactly one of `ref` or `fn` to be set").build(); - } - if (ref != null) { - return ref(Identifier.of(ref.asString())); - } - return RuleError.ctx("while parsing fn", () -> FnNode.fromNode(node).validate()); - } else if (node.isString()) { - return Literal.fromStr(node.asString()); - } else { - return Literal.fromNode(node); - } - } - - /** - * Parse a value from a "short form" used within a template - * - * @param shortForm - * @return - */ - public static Expr parseShortform(String shortForm) { - return RuleError.ctx("while parsing `" + shortForm + "` within a template", () -> { - if (shortForm.contains("#")) { - String[] parts = shortForm.split("#", 2); - String base = parts[0]; - String pattern = parts[1]; - return GetAttr.builder() - .target(ref(Identifier.of(base))) - .path(pattern).build(); - } else { - return ref(Identifier.of(shortForm)); - } - }); - } - - public String template() { - throw new RuntimeException(String.format("cannot convert %s to a string template", this)); - } - - public static Ref ref(Identifier name) { - return new Ref(name); - } - - public static Expr of(boolean value) { - return Literal.fromBool(value); - } - - public static Expr of(int value) { - return Literal.fromInteger(value); - } - - public static Expr of(String value) { - return Literal.fromStr(value); - } - -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ExprVisitor.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ExprVisitor.java.resource deleted file mode 100644 index 2cb0325d36f2..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ExprVisitor.java.resource +++ /dev/null @@ -1,31 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public interface ExprVisitor { - - R visitLiteral(Literal literal); - - R visitRef(Ref ref); - - R visitFn(Fn fn); - - abstract class Default implements ExprVisitor { - - public abstract R getDefault(); - - @Override - public R visitLiteral(Literal literal) { - return getDefault(); - } - - @Override - public R visitRef(Ref ref) { - return getDefault(); - } - - @Override - public R visitFn(Fn fn) { - return getDefault(); - } - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/FatScope.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/FatScope.java.resource deleted file mode 100644 index 2da5c6d152ba..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/FatScope.java.resource +++ /dev/null @@ -1,57 +0,0 @@ -import java.util.HashMap; -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public final class FatScope { - private final HashMap types; - private final HashMap facts; - - public FatScope(HashMap types, HashMap facts) { - this.types = types; - this.facts = facts; - } - - public FatScope() { - this(new HashMap<>(), new HashMap<>()); - } - - public HashMap types() { - return types; - } - - public HashMap facts() { - return facts; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - FatScope fatScope = (FatScope) o; - - if (types != null ? !types.equals(fatScope.types) : fatScope.types != null) { - return false; - } - return facts != null ? facts.equals(fatScope.facts) : fatScope.facts == null; - } - - @Override - public int hashCode() { - int result = types != null ? types.hashCode() : 0; - result = 31 * result + (facts != null ? facts.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "FatScope[" + - "types=" + types + ", " + - "facts=" + facts + ']'; - } - -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Fn.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Fn.java.resource deleted file mode 100644 index f25fbdfc5d9e..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Fn.java.resource +++ /dev/null @@ -1,120 +0,0 @@ -import java.util.List; -import java.util.stream.Collectors; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.utils.Pair; - -@SdkInternalApi -public abstract class Fn extends Expr implements Into { - protected FnNode fnNode; - - public Fn(FnNode fnNode) { - this.fnNode = fnNode; - } - - /** - * Convert this fn into a condition - */ - public Condition condition() { - return new Condition.Builder().fn(this).build(); - } - - public Condition condition(String result) { - return new Condition.Builder().fn(this).result(result).build(); - } - - public abstract T acceptFnVisitor(FnVisitor visitor); - - public R accept(ExprVisitor visitor) { - return visitor.visitFn(this); - } - - /** - * Returns the name of this function, eg. {@code isSet}, {@code parseUrl} - * @return The name - */ - public String getName() { - return fnNode.getId(); - } - - /** - * @return The arguments to this function - */ - public List getArgv() { - return fnNode.getArgv(); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - if (!super.equals(o)) { - return false; - } - - Fn fn = (Fn) o; - - return fnNode != null ? fnNode.equals(fn.fnNode) : fn.fnNode == null; - } - - @Override - public int hashCode() { - return fnNode != null ? fnNode.hashCode() : 0; - } - - @Override - public String toString() { - return String.format("%s(%s)", fnNode.getId(), - fnNode.getArgv().stream().map(Expr::toString).collect(Collectors.joining(", "))); - } - - protected Expr expectOneArg() { - List argv = this.fnNode.getArgv(); - if (argv.size() == 1) { - return argv.get(0); - } else { - throw RuleError.builder() - .cause(SourceException.builder() - .message("expected 1 argument but found " + argv.size()) - .build()) - .build(); - } - } - - protected Pair expectTwoArgs() { - List argv = this.fnNode.getArgv(); - if (argv.size() == 2) { - return Pair.of(argv.get(0), argv.get(1)); - } else { - throw RuleError.builder() - .cause(SourceException.builder() - .message("expected 2 arguments but found " + argv.size()) - .build()) - .build(); - } - - } - - protected List expectVariableArgs(int expectedNumberArgs) { - List argv = this.fnNode.getArgv(); - if (argv.size() == expectedNumberArgs) { - return argv; - } else { - throw RuleError.builder() - .cause(SourceException.builder() - .message(String.format("expected %d arguments but found %d", - expectedNumberArgs, argv.size())) - .build()) - .build(); - } - - } - - @Override - public Condition into() { - return this.condition(); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/FnNode.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/FnNode.java.resource deleted file mode 100644 index 776bc53a93e5..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/FnNode.java.resource +++ /dev/null @@ -1,136 +0,0 @@ -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; - -/** - * Parsed but not validated function contents containing the `fn` name and `argv` - */ -@SdkInternalApi -public final class FnNode { - private static final String ARGV = "argv"; - private static final String FN = "fn"; - - private final String fn; - private final List argv; - - private FnNode(Builder builder) { - this.fn = builder.fn; - this.argv = builder.argv; - } - - public static FnNode ofExprs(String fn, Expr... expr) { - return builder() - .fn(fn) - .argv(Arrays.stream(expr).collect(Collectors.toList())) - .build(); - } - - public Fn validate() { - switch (fn) { - case BooleanEqualsFn.ID: - return new BooleanEqualsFn(this); - case PartitionFn.ID: - return new PartitionFn(this); - case StringEqualsFn.ID: - return new StringEqualsFn(this); - case IsSet.ID: - return new IsSet(this); - case IsValidHostLabel.ID: - return new IsValidHostLabel(this); - case GetAttr.ID: - return new GetAttr(this); - case ParseArn.ID: - return new ParseArn(this); - case Not.ID: - return new Not(this); - case ParseUrl.ID: - return new ParseUrl(this); - case Substring.ID: - return new Substring(this); - case UriEncodeFn.ID: - return new UriEncodeFn(this); - case IsVirtualHostableS3Bucket.ID: - return new IsVirtualHostableS3Bucket(this); - default: - throw RuleError.builder() - .cause(SourceException.builder() - .message(String.format("`%s` is not a valid function", fn)) - .build()) - .build(); - } - } - - public String getId() { - return fn; - } - - public List getArgv() { - return argv; - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - FnNode fnNode = (FnNode) o; - - if (fn != null ? !fn.equals(fnNode.fn) : fnNode.fn != null) { - return false; - } - return argv != null ? argv.equals(fnNode.argv) : fnNode.argv == null; - } - - @Override - public int hashCode() { - int result = fn != null ? fn.hashCode() : 0; - result = 31 * result + (argv != null ? argv.hashCode() : 0); - return result; - } - - public static FnNode fromNode(JsonNode node) { - Map objNode = node.asObject(); - - return builder() - .fn(objNode.get(FN).asString()) - .argv(objNode.get(ARGV).asArray() - .stream() - .map(Expr::fromNode) - .collect(Collectors.toList())) - .build(); - } - - public static class Builder { - private String fn; - private List argv; - - public Builder() { - } - - public Builder argv(List argv) { - this.argv = argv; - return this; - } - - public Builder fn(String fn) { - this.fn = fn; - return this; - } - - public FnNode build() { - return new FnNode(this); - } - } - -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/FnVisitor.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/FnVisitor.java.resource deleted file mode 100644 index e51c9c2b0684..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/FnVisitor.java.resource +++ /dev/null @@ -1,28 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public interface FnVisitor { - R visitPartition(PartitionFn fn); - - R visitParseArn(ParseArn fn); - - R visitIsValidHostLabel(IsValidHostLabel fn); - - R visitBoolEquals(BooleanEqualsFn fn); - - R visitStringEquals(StringEqualsFn fn); - - R visitIsSet(IsSet fn); - - R visitNot(Not not); - - R visitGetAttr(GetAttr getAttr); - - R visitParseUrl(ParseUrl parseUrl); - - R visitSubstring(Substring substring); - - R visitUriEncode(UriEncodeFn fn); - - R visitIsVirtualHostLabelsS3Bucket(IsVirtualHostableS3Bucket fn); -} \ No newline at end of file diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/GetAttr.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/GetAttr.java.resource deleted file mode 100644 index ea775a619841..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/GetAttr.java.resource +++ /dev/null @@ -1,240 +0,0 @@ -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public class GetAttr extends Fn { - public static final String ID = "getAttr"; - - public GetAttr(FnNode node) { - super(node); - } - - @Override - public Value eval(Scope scope) { - Value root = target().eval(scope); - List path; - try { - path = path(); - } catch (InnerParseError e) { - throw new RuntimeException(e); - } - for (Part part : path) { - root = part.eval(root); - } - return root; - } - - public interface Part { - - Value eval(Value container); - - final class Key implements Part { - private final Identifier key; - - public Key(Identifier key) { - this.key = key; - } - - @Override - public String toString() { - return key.asString(); - } - - public static Key of(String key) { - return new Key(Identifier.of(key)); - } - - @Override - public Value eval(Value container) { - return container.expectRecord().get(key); - } - - public Identifier key() { - return key; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (obj == null || obj.getClass() != this.getClass()) { - return false; - } - Key that = (Key) obj; - return Objects.equals(this.key, that.key); - } - - @Override - public int hashCode() { - return key != null ? key.hashCode() : 0; - } - } - - final class Index implements Part { - private final int index; - - public Index(int index) { - this.index = index; - } - - @Override - public Value eval(Value container) { - return container.expectArray().get(index); - } - - @Override - public String toString() { - return String.format("[%s]", index); - } - - public int index() { - return index; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (obj == null || obj.getClass() != this.getClass()) { - return false; - } - Index that = (Index) obj; - return this.index == that.index; - } - - @Override - public int hashCode() { - return index; - } - } - } - - - private static GetAttr fromBuilder(Builder builder) { - return new GetAttr(FnNode - .builder() - .fn("getAttr") - .argv( - Arrays.asList( - builder.target, - Literal.fromStr(String.join(".", builder.path)))) - .build()); - } - - public static Builder builder() { - return new Builder(); - } - - public Expr target() { - return expectTwoArgs().left(); - } - - public List path() throws InnerParseError { - Expr right = expectTwoArgs().right(); - if (right instanceof Literal) { - Literal path = (Literal) right; - return parse(path.expectLiteralString()); - } else { - throw SourceException.builder().message("second argument must be a string literal").build(); - } - } - - private static List parse(String path) throws InnerParseError { - String[] components = path.split("\\."); - List result = new ArrayList<>(); - for (String component : components) { - if (component.contains("[")) { - int slicePartIndex = component.indexOf("["); - String slicePart = component.substring(slicePartIndex); - if (!slicePart.endsWith("]")) { - throw new InnerParseError("Invalid path component: %s. Must end with `]`"); - } - try { - String number = slicePart.substring(1, slicePart.length() - 1); - int slice = Integer.parseInt(number); - if (slice < 0) { - throw new InnerParseError("Invalid path component: slice index must be >= 0"); - } - if (slicePartIndex > 0) { - result.add(Part.Key.of(component.substring(0, slicePartIndex))); - } - result.add(new Part.Index(slice)); - } catch (NumberFormatException ex) { - throw new InnerParseError(String.format("%s could not be parsed as a number", slicePart)); - } - } else { - result.add(Part.Key.of(component)); - } - } - if (result.isEmpty()) { - throw new InnerParseError("Invalid argument to GetAttr: path may not be empty"); - } - return result; - } - - @Override - public T acceptFnVisitor(FnVisitor visitor) { - return visitor.visitGetAttr(this); - } - - @Override - public String toString() { - StringBuilder out = new StringBuilder(); - out.append(target()); - try { - for (Part part : path()) { - out.append("."); - out.append(part); - } - } catch (InnerParseError e) { - throw new RuntimeException(e); - } - return out.toString(); - } - - @Override - public String template() { - String target = ((Ref) this.target()).getName().asString(); - StringBuilder pathPart = new StringBuilder(); - - List partList; - try { - partList = path(); - } catch (InnerParseError e) { - throw new RuntimeException(e); - } - for (int i = 0; i < partList.size(); i ++) { - if (i != 0) { - if (partList.get(i) instanceof Part.Key) { - pathPart.append("."); - } - } - pathPart.append(partList.get(i).toString()); - } - return "{" + target + "#" + pathPart + "}"; - } - - public static class Builder { - Expr target; - String path; - - public Builder target(Expr target) { - this.target = target; - return this; - } - - public Builder path(String path) { - this.path = path; - return this; - } - - public GetAttr build() { - return GetAttr.fromBuilder(this); - } - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Identifier.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Identifier.java.resource deleted file mode 100644 index 3e4160fd8118..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Identifier.java.resource +++ /dev/null @@ -1,48 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -/** - * Identifiers for variables declared within the rule engine, e.g. from an {@code assign} statement. - */ -@SdkInternalApi -public final class Identifier { - private String name; - - public Identifier(String name) { - this.name = name; - } - - public static Identifier fromString(String name) { - return new Identifier(name); - } - - public static Identifier of(String name) { - return new Identifier(name); - } - - public String asString() { - return name; - } - - public String toString() { - return name; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Identifier that = (Identifier) o; - - return name != null ? name.equals(that.name) : that.name == null; - } - - @Override - public int hashCode() { - return name != null ? name.hashCode() : 0; - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/InnerParseError.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/InnerParseError.java.resource deleted file mode 100644 index 005230e0e789..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/InnerParseError.java.resource +++ /dev/null @@ -1,10 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public class InnerParseError extends RuntimeException { - private static final long serialVersionUID = -7808901449079805477L; - - public InnerParseError(String message) { - super(message); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Into.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Into.java.resource deleted file mode 100644 index 88bbae20edc8..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Into.java.resource +++ /dev/null @@ -1,6 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public interface Into { - T into(); -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/IntoSelf.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/IntoSelf.java.resource deleted file mode 100644 index f58965e81098..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/IntoSelf.java.resource +++ /dev/null @@ -1,9 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public interface IntoSelf> extends Into { - @Override - default T into() { - return (T) this; - } -} \ No newline at end of file diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/IsSet.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/IsSet.java.resource deleted file mode 100644 index e537d4918135..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/IsSet.java.resource +++ /dev/null @@ -1,25 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public class IsSet extends SingleArgFn { - public static final String ID = "isSet"; - - public IsSet(FnNode fnNode) { - super(fnNode); - } - - @Override - public T acceptFnVisitor(FnVisitor visitor) { - return visitor.visitIsSet(this); - } - - public static IsSet ofExpr(Expr expr) { - return new IsSet(FnNode.ofExprs(ID, expr)); - } - - @Override - protected Value evalArg(Value arg) { - return Value.fromBool(!arg.isNone()); - } - -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/IsValidHostLabel.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/IsValidHostLabel.java.resource deleted file mode 100644 index 3dddcf1366fb..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/IsValidHostLabel.java.resource +++ /dev/null @@ -1,42 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public class IsValidHostLabel extends VarargFn { - public static final String ID = "isValidHostLabel"; - - public IsValidHostLabel(FnNode fnNode) { - super(fnNode); - } - - @Override - public T acceptFnVisitor(FnVisitor visitor) { - return visitor.visitIsValidHostLabel(this); - } - - public static IsValidHostLabel ofExprs(Expr expr, boolean allowDots) { - return new IsValidHostLabel(FnNode.ofExprs(ID, expr, Expr.of(allowDots))); - } - - public Expr hostLabel() { - return expectTwoArgs().left(); - } - - public Expr allowDots() { - return expectTwoArgs().right(); - } - - @Override - public Value eval(Scope scope) { - String hostLabel = expectTwoArgs().left().eval(scope).expectString(); - // TODO: use compiled Pattern - if (allowDots(scope)) { - return Value.fromBool(hostLabel.matches("[a-zA-Z\\d][a-zA-Z\\d\\-.]{0,62}")); - } else { - return Value.fromBool(hostLabel.matches("[a-zA-Z\\d][a-zA-Z\\d\\-]{0,62}")); - } - } - - private boolean allowDots(Scope scope) { - return allowDots().eval(scope).expectBool(); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/IsVirtualHostableS3Bucket.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/IsVirtualHostableS3Bucket.java.resource deleted file mode 100644 index 679fc1c6b4c6..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/IsVirtualHostableS3Bucket.java.resource +++ /dev/null @@ -1,46 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public class IsVirtualHostableS3Bucket extends VarargFn { - public static final String ID = "aws.isVirtualHostableS3Bucket"; - - public IsVirtualHostableS3Bucket(FnNode fnNode) { - super(fnNode); - } - - @Override - public T acceptFnVisitor(FnVisitor visitor) { - return visitor.visitIsVirtualHostLabelsS3Bucket(this); - } - - public static IsVirtualHostableS3Bucket ofExprs(Expr expr, boolean allowDots) { - return new IsVirtualHostableS3Bucket(FnNode.ofExprs(ID, expr, Expr.of(allowDots))); - } - - public Expr hostLabel() { - return expectTwoArgs().left(); - } - - public Expr allowDots() { - return expectTwoArgs().right(); - } - - @Override - public Value eval(Scope scope) { - String hostLabel = expectTwoArgs().left().eval(scope).expectString(); - if (allowDots(scope)) { - // TODO: use compiled Pattern - return Value.fromBool( - hostLabel.matches("[a-z\\d][a-z\\d\\-.]{1,61}[a-z\\d]") - && !hostLabel.matches("(\\d+\\.){3}\\d+") // don't allow ip address - && !hostLabel.matches(".*[.-]{2}.*") // don't allow names like bucket-.name or bucket.-name - ); - } else { - return Value.fromBool(hostLabel.matches("[a-z\\d][a-z\\d\\-]{1,61}[a-z\\d]")); - } - } - - private boolean allowDots(Scope scope) { - return allowDots().eval(scope).expectBool(); - } -} \ No newline at end of file diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Literal.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Literal.java.resource deleted file mode 100644 index 5e191fdc1136..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Literal.java.resource +++ /dev/null @@ -1,370 +0,0 @@ -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.core.exception.SdkClientException; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; - -@SdkInternalApi -public class Literal extends Expr { - public interface Visitor { - - T visitBool(boolean b); - - T visitStr(Template value); - - T visitObject(Map members); - - T visitTuple(List members); - - T visitInt(int value); - } - - private final Lit source; - - private Literal(Lit source) { - this.source = source; - } - - public T accept(Visitor visitor) { - return this.source.accept(visitor); - } - - public String expectLiteralString() { - if (source instanceof Str) { - Str s = (Str) source; - - return s.value.expectLiteral(); - } else { - throw RuleError.builder() - .cause(SourceException.builder() - .message("Expected a literal string, got " + source) - .build()) - .build(); - } - } - - @Override - public R accept(ExprVisitor visitor) { - return visitor.visitLiteral(this); - } - - @Override - public Value eval(Scope scope) { - return source.accept(new Visitor() { - @Override - public Value visitInt(int value) { - return Value.fromInteger(value); - } - - @Override - public Value visitBool(boolean b) { - return Value.fromBool(b); - } - - @Override - public Value visitStr(Template value) { - return value.eval(scope); - } - - @Override - public Value visitObject(Map members) { - Map tpe = new HashMap<>(); - members.forEach((k, v) -> { - tpe.put(k, v.eval(scope)); - }); - return Value.fromRecord(tpe); - } - - @Override - public Value visitTuple(List members) { - List tuples = new ArrayList<>(); - for (Literal el : ((Tuple) source).members) { - tuples.add(el.eval(scope)); - } - return Value.fromArray(tuples); - } - }); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - if (!super.equals(o)) { - return false; - } - - Literal literal = (Literal) o; - - return source != null ? source.equals(literal.source) : literal.source == null; - } - - @Override - public int hashCode() { - return source != null ? source.hashCode() : 0; - } - - public String toString() { - return source.toString(); - } - - public static Literal fromNode(JsonNode node) { - Lit lit; - if (node.isArray()) { - List array = node.asArray().stream().map(Literal::fromNode).collect(Collectors.toList()); - lit = new Tuple(array); - } else if (node.isBoolean()) { - lit = new Bool(node.asBoolean()); - } else if (node.isNull()) { - throw SdkClientException.create("null node not supported"); - } else if (node.isNumber()) { - lit = new Int(Integer.parseInt(node.asNumber())); - } else if (node.isObject()) { - Map obj = new HashMap<>(); - node.asObject().forEach((k, v) -> obj.put(Identifier.of(k), fromNode(v))); - lit = new Obj(obj); - } else if (node.isString()) { - lit = new Str(new Template(node.asString())); - } else { - throw SdkClientException.create("Unable to create literal from " + node); - } - return new Literal(lit); - } - - public static Literal fromTuple(List authSchemes) { - return new Literal(new Tuple(authSchemes)); - } - - public static Literal fromRecord(Map record) { - return new Literal(new Obj(record)); - } - - public static Literal fromStr(Template value) { - return new Literal(new Str(value)); - } - - public static Literal fromStr(String s) { - return fromStr(new Template(s)); - } - - public static Literal fromInteger(int value) { - return new Literal(new Int(value)); - } - - public static Literal fromBool(boolean value) { - return new Literal(new Bool(value)); - } - - private interface Lit { - T accept(Visitor visitor); - } - - static final class Int implements Lit { - private final Integer value; - - Int(Integer value) { - this.value = value; - } - - @Override - public T accept(Visitor visitor) { - return visitor.visitInt(value); - } - - @Override - public String toString() { - return Integer.toString(value); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Int anInt = (Int) o; - - return value != null ? value.equals(anInt.value) : anInt.value == null; - } - - @Override - public int hashCode() { - return value != null ? value.hashCode() : 0; - } - } - - static final class Tuple implements Lit { - private final List members; - - Tuple(List members) { - this.members = members; - } - - @Override - public T accept(Visitor visitor) { - return visitor.visitTuple(members); - } - - @Override - public String toString() { - return members.stream().map(Literal::toString).collect(Collectors.joining(", ", "[", "]")); - } - - public List members() { - return members; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Tuple tuple = (Tuple) o; - - return members != null ? members.equals(tuple.members) : tuple.members == null; - } - - @Override - public int hashCode() { - return members != null ? members.hashCode() : 0; - } - } - - static final class Obj implements Lit { - private final Map members; - - Obj(Map members) { - this.members = members; - } - - @Override - public T accept(Visitor visitor) { - return visitor.visitObject(members); - } - - @Override - public String toString() { - return members.toString(); - } - - public Map members() { - return members; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Obj obj = (Obj) o; - - return members != null ? members.equals(obj.members) : obj.members == null; - } - - @Override - public int hashCode() { - return members != null ? members.hashCode() : 0; - } - } - - static final class Bool implements Lit { - private final boolean value; - - Bool(boolean value) { - this.value = value; - } - - @Override - public T accept(Visitor visitor) { - return visitor.visitBool(value); - } - - @Override - public String toString() { - return Boolean.toString(value); - } - - public Boolean value() { - return value; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Bool bool = (Bool) o; - - return value == bool.value; - } - - @Override - public int hashCode() { - return value ? 1 : 0; - } - } - - - static final class Str implements Lit { - private final Template value; - - Str(Template value) { - this.value = value; - } - - @Override - public T accept(Visitor visitor) { - return visitor.visitStr(value); - } - - @Override - public String toString() { - return value.toString(); - } - - public Template value() { - return value; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Str str = (Str) o; - - return value != null ? value.equals(str.value) : str.value == null; - } - - @Override - public int hashCode() { - return value != null ? value.hashCode() : 0; - } - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Not.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Not.java.resource deleted file mode 100644 index 74b2f28acd77..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Not.java.resource +++ /dev/null @@ -1,33 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public class Not extends SingleArgFn { - - public static final String ID = "not"; - - public Not(FnNode fnNode) { - super(fnNode); - } - - public static Not ofExpr(Expr expr) { - return new Not(FnNode.ofExprs(ID, expr)); - } - - @Override - public T acceptFnVisitor(FnVisitor visitor) { - return visitor.visitNot(this); - } - - public static Not ofExprs(Expr expr) { - return new Not(FnNode.ofExprs(ID, expr)); - } - - @Override - protected Value evalArg(Value arg) { - return Value.fromBool(!arg.expectBool()); - } - - public Expr target() { - return expectOneArg(); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Parameter.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Parameter.java.resource deleted file mode 100644 index 436ca3aa9851..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Parameter.java.resource +++ /dev/null @@ -1,341 +0,0 @@ -import java.util.Map; -import java.util.Optional; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; - -@SdkInternalApi -public final class Parameter implements ToParameterReference { - public static final String TYPE = "type"; - public static final String DEPRECATED = "deprecated"; - public static final String DOCUMENTATION = "documentation"; - public static final String DEFAULT = "default"; - private static final String BUILT_IN = "builtIn"; - private static final String REQUIRED = "required"; - - private final ParameterType type; - private final Identifier name; - private final Value value; - private final String builtIn; - private final Value defaultValue; - private final Deprecated deprecated; - private final String documentation; - private final boolean required; - - public Parameter(Builder builder) { - if (builder.defaultValue != null && !builder.required) { - throw new RuntimeException("When a default value is set, the field must also be marked as required"); - } - this.type = builder.type; - this.name = builder.name; - this.builtIn = builder.builtIn; - this.value = builder.value; - this.required = builder.required; - this.deprecated = builder.deprecated; - this.documentation = builder.documentation; - this.defaultValue = builder.defaultValue; - } - - public Optional getBuiltIn() { - return Optional.ofNullable(builtIn); - } - - public Optional getDefaultValue() { - return Optional.ofNullable(defaultValue); - } - - public boolean isRequired() { - return required; - } - - public Optional getDeprecated() { - return Optional.ofNullable(deprecated); - } - - public static Parameter fromNode(String name, JsonNode node) throws RuleError { - Map objNode = node.asObject(); - - Builder b = builder(); - b.name(name); - b.type(ParameterType.fromNode(objNode.get(TYPE))); - - JsonNode builtIn = objNode.get(BUILT_IN); - if (builtIn != null) { - b.builtIn(builtIn.asString()); - } - - JsonNode documentation = objNode.get(DOCUMENTATION); - if (documentation != null) { - b.documentation(documentation.asString()); - } - - JsonNode defaultNode = objNode.get(DEFAULT); - if (defaultNode != null) { - b.defaultValue(Value.fromNode(defaultNode)); - } - - JsonNode required = objNode.get(REQUIRED); - if (required != null) { - b.required(required.asBoolean()); - } else { - b.required(false); - } - - JsonNode deprecated = objNode.get(DEPRECATED); - if (deprecated != null) { - b.deprecated(Deprecated.fromNode(deprecated)); - } - - return b.build(); - } - - public ParameterType getType() { - return type; - } - - public Identifier getName() { - return name; - } - - public boolean isBuiltIn() { - return builtIn != null; - } - - public Optional getValue() { - return Optional.ofNullable(value); - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(name).append(": ").append(type); - if (builtIn != null) { - sb.append("; builtIn(").append(builtIn).append(")"); - } - if (required) { - sb.append("; required"); - } - getDeprecated().ifPresent(dep -> sb.append("; ").append(deprecated).append("!")); - return sb.toString(); - } - - @Override - public ParameterReference toParameterReference() { - return ParameterReference.builder() - .name(getName().asString()) - .build(); - } - - public String template() { - return "{" + name + "}"; - } - - public Expr expr() { - return Expr.ref(this.name); - } - - public BooleanEqualsFn eq(boolean b) { - return BooleanEqualsFn.fromParam(this, Expr.of(b)); - } - - public BooleanEqualsFn eq(Expr e) { - return BooleanEqualsFn.fromParam(this, e); - } - - public Optional getDocumentation() { - return Optional.ofNullable(documentation); - } - - /** - * The default value for this Parameter - * @return The value. This value must match the type of this parameter. - */ - public Optional getDefault() { - return Optional.ofNullable(this.defaultValue); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Parameter parameter = (Parameter) o; - - if (required != parameter.required) { - return false; - } - if (type != parameter.type) { - return false; - } - if (name != null ? !name.equals(parameter.name) : parameter.name != null) { - return false; - } - if (value != null ? !value.equals(parameter.value) : parameter.value != null) { - return false; - } - if (builtIn != null ? !builtIn.equals(parameter.builtIn) : parameter.builtIn != null) { - return false; - } - if (defaultValue != null ? !defaultValue.equals(parameter.defaultValue) : parameter.defaultValue != null) { - return false; - } - if (deprecated != null ? !deprecated.equals(parameter.deprecated) : parameter.deprecated != null) { - return false; - } - return documentation != null ? documentation.equals(parameter.documentation) : parameter.documentation == null; - } - - @Override - public int hashCode() { - int result = type != null ? type.hashCode() : 0; - result = 31 * result + (name != null ? name.hashCode() : 0); - result = 31 * result + (value != null ? value.hashCode() : 0); - result = 31 * result + (builtIn != null ? builtIn.hashCode() : 0); - result = 31 * result + (defaultValue != null ? defaultValue.hashCode() : 0); - result = 31 * result + (required ? 1 : 0); - result = 31 * result + (deprecated != null ? deprecated.hashCode() : 0); - result = 31 * result + (documentation != null ? documentation.hashCode() : 0); - return result; - } - - public static final class Deprecated { - private static final String MESSAGE = "message"; - private static final String SINCE = "since"; - private final String message; - private final String since; - - public Deprecated(String message, String since) { - this.message = message; - this.since = since; - } - - public static Deprecated fromNode(JsonNode node) { - Map objNode = node.asObject(); - - String message = null; - String since = null; - - JsonNode messageNode = objNode.get(MESSAGE); - if (messageNode != null) { - message = messageNode.asString(); - } - - JsonNode sinceNode = objNode.get(SINCE); - if (sinceNode != null) { - since = sinceNode.asString(); - } - - return new Deprecated(message, since); - } - - public String message() { - return message; - } - - public String since() { - return since; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Deprecated that = (Deprecated) o; - - if (message != null ? !message.equals(that.message) : that.message != null) { - return false; - } - return since != null ? since.equals(that.since) : that.since == null; - } - - @Override - public int hashCode() { - int result = message != null ? message.hashCode() : 0; - result = 31 * result + (since != null ? since.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "Deprecated[" + - "message=" + message + ", " + - "since=" + since + ']'; - } - - } - - public static final class Builder { - private ParameterType type; - private Identifier name; - private String builtIn; - - private Deprecated deprecated; - - private Value value; - private boolean required; - private String documentation; - - private Value defaultValue; - - public Builder type(ParameterType type) { - this.type = type; - return this; - } - - public Builder deprecated(Deprecated deprecated) { - this.deprecated = deprecated; - return this; - } - - public Builder name(String name) { - this.name = Identifier.of(name); - return this; - } - - public Builder name(Identifier name) { - this.name = name; - return this; - } - - public Builder builtIn(String builtIn) { - this.builtIn = builtIn; - return this; - } - - public Builder value(Value value) { - this.value = value; - return this; - } - - public Builder defaultValue(Value defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - public Parameter build() { - return new Parameter(this); - } - - public Builder required(boolean required) { - this.required = required; - return this; - } - - public Builder documentation(String s) { - this.documentation = s; - return this; - } - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ParameterReference.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ParameterReference.java.resource deleted file mode 100644 index d94f999fac71..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ParameterReference.java.resource +++ /dev/null @@ -1,90 +0,0 @@ -import java.util.Objects; -import java.util.Optional; -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public final class ParameterReference implements ToParameterReference { - private final String name; - private final String context; - - private ParameterReference(Builder builder) { - this.name = builder.name; - this.context = builder.context; - } - - public String getName() { - return name; - } - - public Optional getContext() { - return Optional.ofNullable(context); - } - - public static ParameterReference from(String reference) { - String[] split = reference.split("\\.", 2); - return from(split[0], split.length == 2 ? split[1] : null); - } - - public static ParameterReference from(String name, String context) { - Builder builder = builder().name(name); - if (context != null) { - builder.context(context); - } - return builder.build(); - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public ParameterReference toParameterReference() { - return this; - } - - @Override - public String toString() { - if (context == null) { - return name; - } - return name + "." + context; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ParameterReference that = (ParameterReference) o; - return getName().equals(that.getName()) && Objects.equals(getContext(), that.getContext()); - } - - @Override - public int hashCode() { - int result = name != null ? name.hashCode() : 0; - result = 31 * result + (context != null ? context.hashCode() : 0); - return result; - } - - public static class Builder { - private String name; - private String context; - - public Builder name(String name) { - this.name = name; - return this; - } - - public Builder context(String context) { - this.context = context; - return this; - } - - public ParameterReference build() { - return new ParameterReference(this); - } - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ParameterType.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ParameterType.java.resource deleted file mode 100644 index 54a89bd124fb..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ParameterType.java.resource +++ /dev/null @@ -1,40 +0,0 @@ -import java.util.Locale; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.core.exception.SdkClientException; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; - -@SdkInternalApi -public enum ParameterType { - STRING("String"), - BOOLEAN("Boolean"), - STRING_ARRAY("StringArray"), - ; - - private final String name; - - ParameterType(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } - - public static ParameterType fromNode(JsonNode node) { - return fromValue(node.asString()); - } - - public static ParameterType fromValue(String value) { - switch (value.toLowerCase(Locale.ENGLISH)) { - case "string": - return STRING; - case "boolean": - return BOOLEAN; - case "stringarray": - return STRING_ARRAY; - default: - throw SdkClientException.create("Unknown parameter type: " + value); - } - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Parameters.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Parameters.java.resource deleted file mode 100644 index 0eb97572cd9b..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Parameters.java.resource +++ /dev/null @@ -1,79 +0,0 @@ -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; - -@SdkInternalApi -public class Parameters { - private final List parameters; - - private Parameters(Builder b) { - this.parameters = b.parameters; - } - - public List toList() { - return parameters; - } - - public Optional get(Identifier name) { - return parameters.stream().filter((param) -> param.getName().equals(name)).findFirst(); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Parameters that = (Parameters) o; - - return parameters != null ? parameters.equals(that.parameters) : that.parameters == null; - } - - @Override - public int hashCode() { - return parameters != null ? parameters.hashCode() : 0; - } - - @Override - public String toString() { - return "Parameters{" + - "parameters=" + parameters + - '}'; - } - - public static Parameters fromNode(JsonNode node) { - Map paramsObj = node.asObject(); - - Builder b = builder(); - - paramsObj.forEach((name, obj) -> { - b.addParameter(Parameter.fromNode(name, obj)); - }); - - return b.build(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private List parameters = new ArrayList<>(); - - public Builder addParameter(Parameter parameter) { - this.parameters.add(parameter); - return this; - } - - public Parameters build() { - return new Parameters(this); - } - } - -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ParseArn.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ParseArn.java.resource deleted file mode 100644 index a94ea0522b28..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ParseArn.java.resource +++ /dev/null @@ -1,44 +0,0 @@ -import java.util.Optional; -import java.util.stream.Collectors; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.utils.MapUtils; - -@SdkInternalApi -public class ParseArn extends SingleArgFn { - public static final String ID = "aws.parseArn"; - public static final Identifier PARTITION = Identifier.of("partition"); - public static final Identifier SERVICE = Identifier.of("service"); - public static final Identifier REGION = Identifier.of("region"); - public static final Identifier ACCOUNT_ID = Identifier.of("accountId"); - private static final Identifier RESOURCE_ID = Identifier.of("resourceId"); - - public ParseArn(FnNode fnNode) { - super(fnNode); - } - - @Override - public T acceptFnVisitor(FnVisitor visitor) { - return visitor.visitParseArn(this); - } - - public static ParseArn ofExprs(Expr expr) { - return new ParseArn(FnNode.ofExprs(ID, expr)); - } - - @Override - protected Value evalArg(Value arg) { - String value = arg.expectString(); - Optional arnOpt = Arn.parse(value); - return arnOpt.map(arn -> - (Value) Value.fromRecord(MapUtils.of( - PARTITION, Value.fromStr(arn.partition()), - SERVICE, Value.fromStr(arn.service()), - REGION, Value.fromStr(arn.region()), - ACCOUNT_ID, Value.fromStr(arn.accountId()), - RESOURCE_ID, Value.fromArray(arn.resource().stream() - .map(v -> (Value) Value.fromStr(v)) - .collect(Collectors.toList())) - )) - ).orElse(new Value.None()); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ParseUrl.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ParseUrl.java.resource deleted file mode 100644 index 6894cefb167c..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ParseUrl.java.resource +++ /dev/null @@ -1,87 +0,0 @@ -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Arrays; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.utils.MapUtils; -import software.amazon.awssdk.utils.StringUtils; - -/** - * Function to parse a URI from a string. - */ -@SdkInternalApi -public class ParseUrl extends SingleArgFn { - public static final String ID = "parseURL"; - - public static final Identifier SCHEME = Identifier.of("scheme"); - public static final Identifier AUTHORITY = Identifier.of("authority"); - public static final Identifier PATH = Identifier.of("path"); - public static final Identifier NORMALIZED_PATH = Identifier.of("normalizedPath"); - public static final Identifier IS_IP = Identifier.of("isIp"); - - public ParseUrl(FnNode fnNode) { - super(fnNode); - } - - public static ParseUrl ofExprs(Expr expr) { - return new ParseUrl(FnNode.ofExprs(ID, expr)); - } - - @Override - public T acceptFnVisitor(FnVisitor visitor) { - return visitor.visitParseUrl(this); - } - - @Override - protected Value evalArg(Value arg) { - String url = arg.expectString(); - try { - URL parsed = new URL(url); - String path = parsed.getPath(); - if (parsed.getQuery() != null) { - return Value.none(); - - } - boolean isIpAddr = false; - String host = parsed.getHost(); - if (host.startsWith("[") && host.endsWith("]")) { - isIpAddr = true; - } - String[] dottedParts = host.split("\\."); - if (dottedParts.length == 4) { - if (Arrays.stream(dottedParts).allMatch(part -> { - try { - int value = Integer.parseInt(part); - return value >= 0 && value <= 255; - } catch (NumberFormatException ex) { - return false; - } - })) { - isIpAddr = true; - } - } - String normalizedPath; - if (StringUtils.isBlank(path)) { - normalizedPath = "/"; - } else { - StringBuilder builder = new StringBuilder(); - if (!path.startsWith("/")) { - builder.append("/"); - } - builder.append(path); - if (!path.endsWith("/")) { - builder.append("/"); - } - normalizedPath = builder.toString(); - } - return Value.fromRecord(MapUtils.of( - SCHEME, Value.fromStr(parsed.getProtocol()), - AUTHORITY, Value.fromStr(parsed.getAuthority()), - PATH, Value.fromStr(path), - NORMALIZED_PATH, Value.fromStr(normalizedPath), - IS_IP, Value.fromBool(isIpAddr) - )); - } catch (MalformedURLException e) { - return Value.none(); - } - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/PartitionFn.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/PartitionFn.java.resource deleted file mode 100644 index eac93ca36887..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/PartitionFn.java.resource +++ /dev/null @@ -1,153 +0,0 @@ -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; -import java.util.regex.Pattern; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.utils.MapUtils; - -@SdkInternalApi -public class PartitionFn extends SingleArgFn { - public static final String ID = "aws.partition"; - - public static final Identifier NAME = Identifier.of("name"); - public static final Identifier DNS_SUFFIX = Identifier.of("dnsSuffix"); - public static final Identifier DUAL_STACK_DNS_SUFFIX = Identifier.of("dualStackDnsSuffix"); - public static final Identifier SUPPORTS_FIPS = Identifier.of("supportsFIPS"); - public static final Identifier SUPPORTS_DUAL_STACK = Identifier.of("supportsDualStack"); - public static final Identifier IMPLICIT_GLOBAL_REGION = Identifier.of("implicitGlobalRegion"); - public static final Identifier INFERRED = Identifier.of("inferred"); - - private final LazyValue partitionData = LazyValue.builder() - .initializer(this::loadPartitionData) - .build(); - - private final LazyValue awsPartition = LazyValue.builder() - .initializer(this::findAwsPartition) - .build(); - - public PartitionFn(FnNode node) { - super(node); - } - - public static PartitionFn ofExprs(Expr expr) { - return new PartitionFn(FnNode.ofExprs(ID, expr)); - } - - @Override - public T acceptFnVisitor(FnVisitor visitor) { - return visitor.visitPartition(this); - } - - public static PartitionFn fromParam(Parameter param) { - return PartitionFn.ofExprs(param.expr()); - } - - @Override - public Value evalArg(Value arg) { - String regionName = arg.expectString(); - - PartitionData data = partitionData.value(); - - Partition matchedPartition; - boolean inferred = false; - - // Known region - matchedPartition = data.regionMap.get(regionName); - if (matchedPartition == null) { - // try matching on region name pattern - for (Partition p : data.partitions) { - Pattern regex = Pattern.compile(p.regionRegex()); - if (regex.matcher(regionName).matches()) { - matchedPartition = p; - inferred = true; - break; - } - } - } - - // Couldn't find the region by name or pattern matching. Fallback to 'aws' partition. - if (matchedPartition == null) { - matchedPartition = awsPartition.value(); - } - - Outputs matchedOutputs = matchedPartition.outputs(); - return Value.fromRecord(MapUtils.of( - NAME, Value.fromStr(matchedPartition.id()), - DNS_SUFFIX, Value.fromStr(matchedOutputs.dnsSuffix()), - DUAL_STACK_DNS_SUFFIX, Value.fromStr(matchedOutputs.dualStackDnsSuffix()), - SUPPORTS_FIPS, Value.fromBool(matchedOutputs.supportsFips()), - SUPPORTS_DUAL_STACK, Value.fromBool(matchedOutputs.supportsDualStack()), - IMPLICIT_GLOBAL_REGION, Value.fromStr(matchedOutputs.implicitGlobalRegion()), - INFERRED, Value.fromBool(inferred))); - } - - private PartitionData loadPartitionData() { - PartitionDataProvider provider = new DefaultPartitionDataProvider(); - - // TODO: support custom partitions.json - Partitions partitions = provider.loadPartitions(); - - PartitionData partitionData = new PartitionData(); - - partitions.partitions().forEach(part -> { - partitionData.partitions.add(part); - part.regions().forEach((name, override) -> { - partitionData.regionMap.put(name, part); - }); - }); - - return partitionData; - } - - private Partition findAwsPartition() { - return partitionData.value() - .partitions - .stream() - .filter(p -> p.id().equalsIgnoreCase("aws")) - .findFirst().orElse(null); - } - - private static class PartitionData { - private final List partitions = new ArrayList<>(); - private final Map regionMap = new HashMap<>(); - } - - - private static final class LazyValue { - private final Supplier initializer; - private T value; - private boolean initialized; - - private LazyValue(Builder builder) { - this.initializer = builder.initializer; - } - - public T value() { - if (!initialized) { - value = initializer.get(); - initialized = true; - } - return value; - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder { - private Supplier initializer; - - public Builder initializer(Supplier initializer) { - this.initializer = initializer; - return this; - } - - public LazyValue build() { - return new LazyValue<>(this); - } - } - } - -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Ref.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Ref.java.resource deleted file mode 100644 index e2ef45422202..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Ref.java.resource +++ /dev/null @@ -1,54 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -/** - * A reference to a field. - */ -@SdkInternalApi -public class Ref extends Expr { - private final Identifier name; - - public Ref(Identifier name) { - this.name = name; - } - - @Override - public R accept(ExprVisitor visitor) { - return visitor.visitRef(this); - } - - public Identifier getName() { - return name; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Ref ref = (Ref) o; - return name.equals(ref.name); - } - - @Override - public String template() { - return String.format("{%s}", name); - } - - @Override - public String toString() { - return name.asString(); - } - - @Override - public int hashCode() { - return name != null ? name.hashCode() : 0; - } - - @Override - public Value eval(Scope scope) { - return scope.getValue(this.name).orElse(new Value.None()); - } -} \ No newline at end of file diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Rule.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Rule.java.resource deleted file mode 100644 index 4253316b2d98..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Rule.java.resource +++ /dev/null @@ -1,87 +0,0 @@ -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; - -@SdkInternalApi -public abstract class Rule { - public static final String CONDITIONS = "conditions"; - public static final String DOCUMENTATION = "documentation"; - public static final String ENDPOINT = "endpoint"; - public static final String ERROR = "error"; - - public static final String TREE = "tree"; - public static final String RULES = "rules"; - public static final String TYPE = "type"; - - protected final List conditions; - protected final String documentation; - - protected Rule(Builder builder) { - this.conditions = builder.conditions; - this.documentation = builder.documentation; - } - - public List getConditions() { - return conditions; - } - - public abstract T accept(RuleValueVisitor v); - - public static Rule fromNode(JsonNode node) { - Map objNode = node.asObject(); - - Builder builder = builder(); - - objNode.get(CONDITIONS).asArray().forEach(cn -> builder.addCondition(Condition.fromNode(cn))); - - JsonNode documentation = objNode.get(DOCUMENTATION); - if (documentation != null) { - builder.documentation(documentation.asString()); - } - - String type = objNode.get(TYPE).asString(); - switch (type) { - case ENDPOINT: return builder.endpoint(EndpointResult.fromNode(objNode.get(ENDPOINT))); - case ERROR: return builder.error(objNode.get(ERROR).asString()); - case TREE: return builder.treeRule(objNode.get(RULES).asArray() - .stream() - .map(Rule::fromNode) - .collect(Collectors.toList())); - default: throw new IllegalStateException("Unexpected rule type: " + type); - } - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String documentation; - private final List conditions = new ArrayList<>(); - - public Builder addCondition(Condition condition) { - this.conditions.add(condition); - return this; - } - - public Builder documentation(String documentation) { - this.documentation = documentation; - return this; - } - - public EndpointRule endpoint(EndpointResult endpoint) { - return new EndpointRule(this, endpoint); - } - - public ErrorRule error(String error) { - return new ErrorRule(this, Literal.fromStr(error)); - } - - public TreeRule treeRule(List rules) { - return new TreeRule(this, rules); - } - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules2/RuleArn.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleArn.java.resource similarity index 100% rename from codegen/src/main/resources/software/amazon/awssdk/codegen/rules2/RuleArn.java.resource rename to codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleArn.java.resource diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleEngine.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleEngine.java.resource deleted file mode 100644 index 20052f2d61b9..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleEngine.java.resource +++ /dev/null @@ -1,18 +0,0 @@ -import java.util.Map; -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public interface RuleEngine { - /** - * Evaluate the given {@link EndpointRuleset} using the named values in {@code args} as input into the rule set. - * - * @param ruleset The rule set to evaluate. - * @param args The arguments. - * @return The computed value. - */ - Value evaluate(EndpointRuleset ruleset, Map args); - - static RuleEngine defaultEngine() { - return new DefaultRuleEngine(); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleError.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleError.java.resource deleted file mode 100644 index dda246ab3680..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleError.java.resource +++ /dev/null @@ -1,42 +0,0 @@ -import java.util.function.Supplier; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.core.exception.SdkException; - -@SdkInternalApi -public class RuleError extends SdkException { - - protected RuleError(BuilderImpl builder) { - super(builder); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder extends SdkException.Builder { - @Override - RuleError build(); - } - - public static T ctx(String message, Supplier f) { - try { - return f.get(); - } catch (Exception e) { - throw builder().message(message).cause(e).build(); - } - } - - public static T ctx(String message, Runnable f) { - return ctx(message, () -> { - f.run(); - return null; - }); - } - - private static class BuilderImpl extends SdkException.BuilderImpl implements Builder { - @Override - public RuleError build() { - return new RuleError(this); - } - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleEvaluator.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleEvaluator.java.resource deleted file mode 100644 index 8ff203fa43ef..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleEvaluator.java.resource +++ /dev/null @@ -1,171 +0,0 @@ -import java.util.List; -import java.util.Map; -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public class RuleEvaluator implements FnVisitor, ExprVisitor { - private final Scope scope = new Scope<>(); - - public Value evaluateRuleset(EndpointRuleset ruleset, Map input) { - return scope.inScope( - () -> { - ruleset - .getParameters() - .toList() - .forEach( - param -> { - param.getDefault().ifPresent(value -> scope.insert(param.getName(), value)); - }); - input.forEach(scope::insert); - for (Rule rule : ruleset.getRules()) { - Value result = handleRule(rule); - if (!result.isNone()) { - return result; - } - } - throw new RuntimeException("No rules in ruleset matched"); - }); - } - - @Override - public Value visitLiteral(Literal literal) { - return literal.eval(scope); - } - - @Override - public Value visitRef(Ref ref) { - return scope - .getValue(ref.getName()) - .orElseThrow( - () -> new RuntimeException(String.format("Invalid ruleset: %s was not in scope", ref))); - } - - @Override - public Value visitFn(Fn fn) { - return fn.acceptFnVisitor(this); - } - - @Override - public Value visitPartition(PartitionFn fn) { - return fn.eval(scope); - } - - @Override - public Value visitParseArn(ParseArn fn) { - return fn.eval(scope); - } - - @Override - public Value visitIsValidHostLabel(IsValidHostLabel fn) { - return fn.eval(scope); - } - - @Override - public Value visitBoolEquals(BooleanEqualsFn fn) { - return fn.eval(scope); - } - - @Override - public Value visitStringEquals(StringEqualsFn fn) { - return fn.eval(scope); - } - - @Override - public Value visitIsSet(IsSet fn) { - return fn.eval(scope); - } - - @Override - public Value visitNot(Not not) { - return Value.fromBool(!not.target().accept(this).expectBool()); - } - - @Override - public Value visitGetAttr(GetAttr getAttr) { - return getAttr.eval(scope); - } - - @Override - public Value visitParseUrl(ParseUrl parseUrl) { - return parseUrl.eval(scope); - } - - @Override - public Value visitSubstring(Substring fn) { - return fn.eval(scope); - } - - @Override - public Value visitUriEncode(UriEncodeFn fn) { - return fn.eval(scope); - } - - @Override - public Value visitIsVirtualHostLabelsS3Bucket(IsVirtualHostableS3Bucket fn) { - return fn.eval(scope); - } - - private Value handleRule(Rule rule) { - RuleEvaluator self = this; - return scope.inScope( - () -> { - for (Condition condition : rule.getConditions()) { - Value value = evaluateCondition(condition); - if (value.isNone() || value.equals(Value.fromBool(false))) { - return Value.none(); - } - } - return rule.accept(new RuleValueVisitor() { - @Override - public Value visitTreeRule(List rules) { - for (Rule subrule : rules) { - Value result = handleRule(subrule); - if (!result.isNone()) { - return result; - } - } - throw new RuntimeException( - String.format("no rules inside of tree rule matched—invalid rules (%s)", this)); - } - - @Override - public Value visitErrorRule(Expr error) { - return error.accept(self); - } - - @Override - public Value visitEndpointRule(EndpointResult endpoint) { - return generateEndpoint(endpoint); - } - }); - }); - } - - public Value evaluateCondition(Condition condition) { - Value value = condition.getFn().accept(this); - if (!value.isNone()) { - condition.getResult().ifPresent(res -> scope.insert(res, value)); - } - return value; - } - - public Value generateEndpoint(EndpointResult endpoint) { - Value.Endpoint.Builder builder = Value.Endpoint.builder() - .url(endpoint.getUrl() - .accept(this) - .expectString()); - endpoint.getProperties() - .forEach( - (key, value) -> { - builder.property(key.toString(), value.accept(this)); - }); - endpoint - .getHeaders() - .forEach( - (name, exprs) -> { - exprs.forEach(expr -> builder.addHeader(name, expr.accept(this).expectString())); - }); - - return builder.build(); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules2/RulePartition.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RulePartition.java.resource similarity index 100% rename from codegen/src/main/resources/software/amazon/awssdk/codegen/rules2/RulePartition.java.resource rename to codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RulePartition.java.resource diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules2/RuleResult.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleResult.java.resource similarity index 100% rename from codegen/src/main/resources/software/amazon/awssdk/codegen/rules2/RuleResult.java.resource rename to codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleResult.java.resource diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules2/RuleUrl.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleUrl.java.resource similarity index 100% rename from codegen/src/main/resources/software/amazon/awssdk/codegen/rules2/RuleUrl.java.resource rename to codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleUrl.java.resource diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleValueVisitor.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleValueVisitor.java.resource deleted file mode 100644 index fdbd1823c9e0..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RuleValueVisitor.java.resource +++ /dev/null @@ -1,15 +0,0 @@ -import java.util.List; -import software.amazon.awssdk.annotations.SdkInternalApi; - -/** - * Visitor for the right-hand side of rules (tree, error, endpoint) - * @param The return type of the visitor - */ -@SdkInternalApi -public interface RuleValueVisitor { - R visitTreeRule(List rules); - - R visitErrorRule(Expr error); - - R visitEndpointRule(EndpointResult endpoint); -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules2/RulesFunctions.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RulesFunctions.java.resource similarity index 100% rename from codegen/src/main/resources/software/amazon/awssdk/codegen/rules2/RulesFunctions.java.resource rename to codegen/src/main/resources/software/amazon/awssdk/codegen/rules/RulesFunctions.java.resource diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Scope.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Scope.java.resource deleted file mode 100644 index 55ce7596b1e8..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Scope.java.resource +++ /dev/null @@ -1,90 +0,0 @@ -import java.util.ArrayDeque; -import java.util.Deque; -import java.util.HashMap; -import java.util.Optional; -import java.util.function.Supplier; -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public class Scope { - private final Deque> scope; - - public Scope() { - this.scope = new ArrayDeque<>(); - this.scope.push(new FatScope()); - } - - public void push() { - scope.push(new FatScope<>()); - } - - public void pop() { - scope.pop(); - } - - public void insert(String name, T value) { - this.insert(Identifier.of(name), value); - } - - public void insert(Identifier name, T value) { - this.scope.getFirst().types().put(name, value); - } - - public void insertFact(Expr name, T value) { - this.scope.getFirst().facts().put(name, value); - } - - public U inScope(Supplier func) { - this.push(); - try { - return func.get(); - } finally { - this.pop(); - } - } - - @Override - public String toString() { - HashMap toPrint = new HashMap<>(); - for (FatScope layer: scope) { - toPrint.putAll(layer.types()); - } - return toPrint.toString(); - } - - /** - * Search the fact stack for an explicitly calculated value for [expr] - *

- * Currently, this is only impacted by the `isSet` function which will record - * `T`, rather than {@code Option} for its arguments - * - * @param expr The expression to evaluate - * @return The value from the scope - */ - public Optional eval(Expr expr) { - for (FatScope layer : scope) { - if (layer.facts().containsKey(expr)) { - return Optional.of(layer.facts().get(expr)); - } - } - return Optional.empty(); - } - - public T expectValue(Identifier name) { - for (FatScope layer : scope) { - if (layer.types().containsKey(name)) { - return layer.types().get(name); - } - } - throw new InnerParseError(String.format("No field named %s", name)); - } - - public Optional getValue(Identifier name) { - for (FatScope layer : scope) { - if (layer.types().containsKey(name)) { - return Optional.of(layer.types().get(name)); - } - } - return Optional.empty(); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/SingleArgFn.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/SingleArgFn.java.resource deleted file mode 100644 index 5c65095bf654..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/SingleArgFn.java.resource +++ /dev/null @@ -1,20 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public abstract class SingleArgFn extends Fn { - - public SingleArgFn(FnNode fnNode) { - super(fnNode); - } - - public Expr target() { - return expectOneArg(); - } - - @Override - public Value eval(Scope scope) { - return evalArg(expectOneArg().eval(scope)); - } - - protected abstract Value evalArg(Value arg); -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/SourceException.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/SourceException.java.resource deleted file mode 100644 index 01c42c05a68e..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/SourceException.java.resource +++ /dev/null @@ -1,61 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.core.exception.SdkException; - -@SdkInternalApi -public class SourceException extends SdkException { - private SourceException(Builder b) { - super(b); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - interface Builder extends SdkException.Builder { - @Override - Builder cause(Throwable cause); - - @Override - Builder writableStackTrace(Boolean writableStackTrace); - - @Override - Builder message(String message); - - @Override - SourceException build(); - - @Override - Builder numAttempts(Integer numAttempts); - } - - public static class BuilderImpl extends SdkException.BuilderImpl implements Builder { - @Override - public Builder cause(Throwable cause) { - super.cause(cause); - return this; - } - - @Override - public Builder message(String message) { - super.message(message); - return this; - } - - @Override - public Builder writableStackTrace(Boolean writableStackTrace) { - super.writableStackTrace(writableStackTrace); - return this; - } - - @Override - public SourceException build() { - return new SourceException(this); - } - - @Override - public Builder numAttempts(Integer numAttempts) { - super.numAttempts(numAttempts); - return this; - } - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/StringEqualsFn.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/StringEqualsFn.java.resource deleted file mode 100644 index 9166e78826e6..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/StringEqualsFn.java.resource +++ /dev/null @@ -1,34 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.utils.Pair; - -@SdkInternalApi -public class StringEqualsFn extends Fn { - public static final String ID = "stringEquals"; - - public StringEqualsFn(FnNode fnNode) { - super(fnNode); - } - - @Override - public T acceptFnVisitor(FnVisitor visitor) { - return visitor.visitStringEquals(this); - } - - public static StringEqualsFn ofExprs(Expr expr, Expr of) { - return new StringEqualsFn(FnNode.ofExprs(ID, expr, of)); - } - - public Expr getLeft() { - return expectTwoArgs().left(); - } - - public Expr getRight() { - return expectTwoArgs().right(); - } - - @Override - public Value eval(Scope scope) { - Pair args = expectTwoArgs(); - return Value.fromBool(args.left().eval(scope).expectString().equals(args.right().eval(scope).expectString())); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Substring.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Substring.java.resource deleted file mode 100644 index 3c260388a0a8..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Substring.java.resource +++ /dev/null @@ -1,62 +0,0 @@ -import java.util.List; -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public class Substring extends VarargFn { - public static final String ID = "substring"; - public static final Identifier SUBSTRING = Identifier.of("substring"); - private static final int EXPECTED_NUMBER_ARGS = 4; - - public Substring(FnNode fnNode) { - super(fnNode); - } - - @Override - public T acceptFnVisitor(FnVisitor visitor) { - return visitor.visitSubstring(this); - } - - public static Substring ofExprs(Expr expr, int startIndex, int stopIndex, Boolean reverse) { - return new Substring(FnNode.ofExprs(ID, expr, Expr.of(startIndex), Expr.of(stopIndex), Expr.of(reverse))); - } - - public Expr stringToParse() { - return expectVariableArgs(EXPECTED_NUMBER_ARGS).get(0); - } - - public Expr startIndex() { - return expectVariableArgs(EXPECTED_NUMBER_ARGS).get(1); - } - - public Expr stopIndex() { - return expectVariableArgs(EXPECTED_NUMBER_ARGS).get(2); - } - - public Expr reverse() { - return expectVariableArgs(EXPECTED_NUMBER_ARGS).get(3); - } - - @Override - public Value eval(Scope scope) { - List args = expectVariableArgs(EXPECTED_NUMBER_ARGS); - String str = args.get(0).eval(scope).expectString(); - int startIndex = args.get(1).eval(scope).expectInt(); - int stopIndex = args.get(2).eval(scope).expectInt(); - boolean reverse = args.get(3).eval(scope).expectBool(); - - if (startIndex >= stopIndex || str.length() - 1 < stopIndex) { - return new Value.None(); - } - - String substr; - if (reverse) { - String reversedStr = new StringBuilder(str).reverse().toString(); - substr = new StringBuilder(reversedStr.substring(startIndex, stopIndex)).reverse().toString(); - } else { - substr = str.substring(startIndex, stopIndex); - } - - return Value.fromStr(substr); - - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Template.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Template.java.resource deleted file mode 100644 index fcf3799098d1..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Template.java.resource +++ /dev/null @@ -1,247 +0,0 @@ -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import software.amazon.awssdk.annotations.SdkInternalApi; - -/** - * Template represents a "Template Literal". This is a literal string within the rules language. A template can contain 0 or more - * dynamic sections. The dynamic sections use getAttr short-form: - *

- * `https://{Region}.{partition#dnsSuffix}` -------- ------------ | | Dynamic getAttr short - * form - */ -@SdkInternalApi -public class Template { - private final List parts; - - Template(String template) { - this.parts = RuleError.ctx("when parsing template", () -> parseTemplate(template)); - } - - public Stream accept(TemplateVisitor visitor) { - if (isStatic()) { - return Stream.of(visitor.visitStaticTemplate(expectLiteral())); - } - if (parts.size() == 1) { - // must be dynamic because previous branch handled single-element static template - return Stream.of(visitor.visitSingleDynamicTemplate(((Dynamic) parts.get(0)).expr)); - } - Stream start = Stream.of(visitor.startMultipartTemplate()); - Stream components = parts.stream().map(part -> part.accept(visitor)); - Stream end = Stream.of(visitor.finishMultipartTemplate()); - return Stream.concat(start, Stream.concat(components, end)); - } - - public List getParts() { - return parts; - } - - public boolean isStatic() { - return this.parts.stream().allMatch(it -> it instanceof Literal); - } - - public String expectLiteral() { - assert isStatic(); - return this.parts.stream().map(Part::toString).collect(Collectors.joining()); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Template template = (Template) o; - - return parts != null ? parts.equals(template.parts) : template.parts == null; - } - - @Override - public int hashCode() { - return parts != null ? parts.hashCode() : 0; - } - - public static Template fromString(String s) { - return new Template(s); - } - - @Override - public String toString() { - return String.format("\"%s\"", this.parts.stream().map(Part::toString).collect(Collectors.joining())); - } - - public Value eval(Scope scope) { - return Value.fromStr(parts.stream().map(part -> part.eval(scope)).collect(Collectors.joining())); - } - - private List parseTemplate(String template) { - List out = new ArrayList<>(); - Optional templateStart = Optional.empty(); - int depth = 0; - int templateEnd = 0; - for (int i = 0; i < template.length(); i++) { - if (template.substring(i).startsWith("{{")) { - i++; - continue; - } - if (template.substring(i).startsWith("}}")) { - i++; - continue; - } - if (template.charAt(i) == '{') { - if (depth == 0) { - if (templateEnd != i) { - out.add(Literal.unescape(template.substring(templateEnd, i))); - } - templateStart = Optional.of(i + 1); - } - depth++; - } - if (template.charAt(i) == '}') { - depth--; - if (depth < 0) { - throw new InnerParseError("unmatched `}` in template"); - } - if (depth == 0) { - out.add(Dynamic.parse(template.substring(templateStart.get(), i))); - templateStart = Optional.empty(); - } - templateEnd = i + 1; - } - } - if (depth != 0) { - throw new InnerParseError("unmatched `{` in template"); - } - if (templateEnd < template.length()) { - out.add(Literal.unescape(template.substring(templateEnd))); - } - return out; - } - - public abstract static class Part { - abstract String eval(Scope scope); - - abstract T accept(TemplateVisitor visitor); - } - - public static class Literal extends Part { - private final String value; - - public Literal(String value) { - if (value.isEmpty()) { - throw new RuntimeException("value cannot blank"); - } - this.value = value; - } - - public static Literal unescape(String value) { - return new Literal(value.replace("{{", "{").replace("}}", "}")); - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return this.value; - } - - @Override - String eval(Scope scope) { - return this.value; - } - - @Override - T accept(TemplateVisitor visitor) { - return visitor.visitStaticElement(this.value); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - if (!super.equals(o)) { - return false; - } - - Literal literal = (Literal) o; - - return value != null ? value.equals(literal.value) : literal.value == null; - } - - @Override - public int hashCode() { - return value != null ? value.hashCode() : 0; - } - } - - public static class Dynamic extends Part { - private final String raw; - private final Expr expr; - - private Dynamic(String raw, Expr expr) { - this.raw = raw; - this.expr = expr; - } - - @Override - public String toString() { - return String.format("{dyn %s}", this.raw); - } - - @Override - String eval(Scope scope) { - return RuleError.ctx("while evaluating " + this, () -> expr.eval(scope).expectString()); - } - - @Override - T accept(TemplateVisitor visitor) { - return visitor.visitDynamicElement(this.expr); - } - - public Expr getExpr() { - return expr; - } - - public static Dynamic parse(String value) { - return new Dynamic(value, Expr.parseShortform(value)); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - if (!super.equals(o)) { - return false; - } - - Dynamic dynamic = (Dynamic) o; - - if (raw != null ? !raw.equals(dynamic.raw) : dynamic.raw != null) { - return false; - } - return expr != null ? expr.equals(dynamic.expr) : dynamic.expr == null; - } - - @Override - public int hashCode() { - int result = raw != null ? raw.hashCode() : 0; - result = 31 * result + (expr != null ? expr.hashCode() : 0); - return result; - } - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/TemplateVisitor.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/TemplateVisitor.java.resource deleted file mode 100644 index a83584414a74..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/TemplateVisitor.java.resource +++ /dev/null @@ -1,55 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -/** - * For code generating from a template, use a `TemplateVisitor`. Template visitor is written to enable optimized - * behavior for static templates with no dynamic components. - * @param The return type of this visitor - */ -@SdkInternalApi -public interface TemplateVisitor { - /** - * The template contains a single static string, eg. `"https://mystaticendpoing.com"` - * @param value: The static value of the template. - * @return T - */ - T visitStaticTemplate(String value); - - /** - * The template contains a single dynamic element, eg. `{Region}`. In this case, string formatting is not required. - * The type of the value is guaranteed to be a string. - * @param value: The single expression that represents this template. - * @return T - */ - T visitSingleDynamicTemplate(Expr value); - - /** - * Visit a static element within a multipart template. This will only be called after - * {@link #startMultipartTemplate()} has been invoked. - * @param value A static element within a larger template - * @return T - */ - T visitStaticElement(String value); - - /** - * Visit a dynamic element within a multipart template. This will only be called after - * {@link #startMultipartTemplate()} has been invoked. - * @param value The dynamic template value - * @return T - */ - T visitDynamicElement(Expr value); - - /** - * Invoked prior to visiting a multipart template like `https://{Region}.{dnsSuffix}`. This function will - * be followed by invocations of {@link #visitStaticTemplate(String)} and - * {@link #visitDynamicElement(Expr)}. - * @return T - */ - T startMultipartTemplate(); - - /** - * Invoked at the conclusion of visiting a multipart template like `https://{Region}.{dnsSuffix}`. This allows - * implementations to do something like call `string.join()` or `stringbuilder.toString()`. - * @return T - */ - T finishMultipartTemplate(); -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ToParameterReference.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ToParameterReference.java.resource deleted file mode 100644 index 26049b384187..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/ToParameterReference.java.resource +++ /dev/null @@ -1,6 +0,0 @@ -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public interface ToParameterReference { - ParameterReference toParameterReference(); -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/TreeRule.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/TreeRule.java.resource deleted file mode 100644 index 63b6c9002825..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/TreeRule.java.resource +++ /dev/null @@ -1,26 +0,0 @@ -import java.util.List; -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -public class TreeRule extends Rule { - private final List rules; - - protected TreeRule(Builder builder, List rules) { - super(builder); - this.rules = rules; - } - - @Override - public T accept(RuleValueVisitor v) { - return v.visitTreeRule(rules); - } - - @Override - public String toString() { - return "TreeRule{" + - "conditions=" + conditions + - ", documentation='" + documentation + '\'' + - ", rules=" + rules + - '}'; - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/UriEncodeFn.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/UriEncodeFn.java.resource deleted file mode 100644 index cb5d4e8614ef..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/UriEncodeFn.java.resource +++ /dev/null @@ -1,34 +0,0 @@ -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.core.exception.SdkClientException; - -@SdkInternalApi -public class UriEncodeFn extends SingleArgFn { - public static final String ID = "uriEncode"; - private static final String[] ENCODED_CHARACTERS = new String[]{"+", "*", "%7E"}; - private static final String[] ENCODED_CHARACTERS_REPLACEMENTS = new String[]{"%20", "%2A", "~"}; - - public UriEncodeFn(FnNode fnNode) { - super(fnNode); - } - - @Override - protected Value evalArg(Value arg) { - String url = arg.expectString(); - try { - String encoded = URLEncoder.encode(url, "UTF-8"); - for (int i = 0; i < ENCODED_CHARACTERS.length; i++) { - encoded = encoded.replace(ENCODED_CHARACTERS[i], ENCODED_CHARACTERS_REPLACEMENTS[i]); - } - return Value.fromStr(encoded); - } catch (UnsupportedEncodingException e) { - throw SdkClientException.create("Unable to URI encode value: " + url, e); - } - } - - @Override - public T acceptFnVisitor(FnVisitor visitor) { - return visitor.visitUriEncode(this); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Value.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Value.java.resource deleted file mode 100644 index e32aa87ac5df..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/Value.java.resource +++ /dev/null @@ -1,448 +0,0 @@ -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.BiConsumer; -import java.util.stream.Collectors; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.core.exception.SdkClientException; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; - -/** - * Base class for the types of values computable by the {@link RuleEngine}. - */ -@SdkInternalApi -public abstract class Value { - - public boolean isNone() { - return false; - } - - public String expectString() { - throw new RuntimeException("Expected string but was: " + this); - } - - public boolean expectBool() { - throw new RuntimeException("Expected bool but was: " + this); - } - - public Record expectRecord() { - throw new RuntimeException("Expected object but was: " + this); - } - - public Endpoint expectEndpoint() { - throw new RuntimeException("Expected endpoint, found " + this); - } - - public Array expectArray() { - throw new RuntimeException("Expected array, found " + this); - } - - public int expectInt() { - throw new RuntimeException("Expected int, found " + this); - } - - public static Value fromNode(JsonNode node) { - if (node.isArray()) { - return new Array(node.asArray().stream().map(Value::fromNode).collect(Collectors.toList())); - } else if (node.isBoolean()) { - return fromBool(node.asBoolean()); - } else if (node.isNull()) { - throw SdkClientException.create("null cannot be used as a literal"); - } else if (node.isNumber()) { - return fromInteger(Integer.parseInt(node.asNumber())); - } else if (node.isObject()) { - HashMap out = new HashMap<>(); - node.asObject().forEach((k, v) -> out.put(Identifier.of(k), fromNode(v))); - return fromRecord(out); - } else if (node.isString()) { - return fromStr(node.asString()); - } - throw SdkClientException.create("Unable to create Value from " + node); - } - - public static Endpoint endpointFromNode(JsonNode source) { - return Endpoint.fromNode(source); - } - - /** - * A string value. - */ - public static class Str extends Value { - private final String value; - - private Str(String value) { - this.value = value; - } - - @Override - public String expectString() { - return value; - } - - @Override - public String toString() { - return "Str{" + - "value='" + value + '\'' + - '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Str str = (Str) o; - - return value != null ? value.equals(str.value) : str.value == null; - } - - @Override - public int hashCode() { - return value != null ? value.hashCode() : 0; - } - } - - /** - * An integer value. - */ - public static class Int extends Value { - private final int value; - - private Int(int value) { - this.value = value; - } - - @Override - public int expectInt() { - return value; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Int anInt = (Int) o; - - return value == anInt.value; - } - - @Override - public int hashCode() { - return value; - } - } - - /** - * A boolean value. - */ - public static class Bool extends Value { - private final boolean value; - - private Bool(boolean value) { - this.value = value; - } - - @Override - public boolean expectBool() { - return value; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Bool bool = (Bool) o; - - return value == bool.value; - } - - @Override - public int hashCode() { - return value ? 1 : 0; - } - } - - /** - * An array value. - */ - public static class Array extends Value { - private List inner; - - private Array(List inner) { - this.inner = inner; - } - - @Override - public Array expectArray() { - return this; - } - - public Value get(int idx) { - if (this.inner.size() > idx) { - return this.inner.get(idx); - } else { - return new Value.None(); - } - } - - public int size() { - return inner.size(); - } - - @Override - public String toString() { - return "Array{" + - "inner=" + inner + - '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Array array = (Array) o; - - return inner != null ? inner.equals(array.inner) : array.inner == null; - } - - @Override - public int hashCode() { - return inner != null ? inner.hashCode() : 0; - } - } - - /** - * A record (map) value. - */ - public static class Record extends Value { - private final Map value; - - private Record(Map value) { - this.value = value; - } - - public Value get(Identifier id) { - return value.get(id); - } - - public Map getValue() { - return value; - } - - public void forEach(BiConsumer fn) { - value.forEach(fn); - } - - @Override - public Record expectRecord() { - return this; - } - - @Override - public String toString() { - return "Record{" + - "value=" + value + - '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Record record = (Record) o; - - return value != null ? value.equals(record.value) : record.value == null; - } - - @Override - public int hashCode() { - return value != null ? value.hashCode() : 0; - } - } - - public static class Endpoint extends Value { - private static final String URL = "url"; - private static final String PROPERTIES = "properties"; - private static final String HEADERS = "headers"; - - private final String url; - private final Map properties; - private final Map> headers; - - private Endpoint(Builder b) { - this.url = b.url; - this.properties = b.properties; - this.headers = b.headers; - } - - public String getUrl() { - return url; - } - - public Map getProperties() { - return properties; - } - - public Map> getHeaders() { - return headers; - } - - @Override - public Endpoint expectEndpoint() { - return this; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Endpoint endpoint = (Endpoint) o; - - if (url != null ? !url.equals(endpoint.url) : endpoint.url != null) { - return false; - } - if (properties != null ? !properties.equals(endpoint.properties) : endpoint.properties != null) { - return false; - } - return headers != null ? headers.equals(endpoint.headers) : endpoint.headers == null; - } - - @Override - public int hashCode() { - int result = url != null ? url.hashCode() : 0; - result = 31 * result + (properties != null ? properties.hashCode() : 0); - result = 31 * result + (headers != null ? headers.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "Endpoint{" + - "url='" + url + '\'' + - ", properties=" + properties + - ", headers=" + headers + - '}'; - } - - public static Endpoint fromNode(JsonNode node) { - Builder b = builder(); - - Map objNode = node.asObject(); - - b.url(objNode.get(URL).asString()); - - JsonNode propertiesNode = objNode.get(PROPERTIES); - if (propertiesNode != null) { - propertiesNode.asObject() - .forEach((k, v) -> { - b.property(k, Value.fromNode(v)); - }); - } - - JsonNode headersNode = objNode.get(HEADERS); - if (headersNode != null) { - headersNode.asObject() - .forEach((k, v) -> v.asArray().forEach(e -> b.addHeader(k, e.asString()))); - } - - return b.build(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String url; - private final Map properties = new HashMap<>(); - private final Map> headers = new HashMap<>(); - - public Builder url(String url) { - this.url = url; - return this; - } - - public Builder properties(Map properties) { - this.properties.clear(); - this.properties.putAll(properties); - return this; - } - - public Builder property(String name, Value value) { - this.properties.put(name, value); - return this; - } - - public Builder addHeader(String name, String value) { - List values = this.headers.computeIfAbsent(name, (k) -> new ArrayList<>()); - values.add(value); - return this; - } - - public Endpoint build() { - return new Endpoint(this); - } - } - } - - public static class None extends Value { - @Override - public boolean isNone() { - return true; - } - } - - public static Str fromStr(String value) { - return new Str(value); - } - - public static Int fromInteger(int value) { - return new Int(value); - } - - public static Bool fromBool(boolean value) { - return new Bool(value); - } - - public static Array fromArray(List value) { - return new Array(value); - } - - public static Record fromRecord(Map value) { - return new Record(value); - } - - public static None none() { - return new None(); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/VarargFn.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/VarargFn.java.resource deleted file mode 100644 index e671494ea3ba..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules/VarargFn.java.resource +++ /dev/null @@ -1,16 +0,0 @@ -import java.util.List; -import software.amazon.awssdk.annotations.SdkInternalApi; - -@SdkInternalApi -abstract class VarargFn extends Fn { - - VarargFn(FnNode fnNode) { - super(fnNode); - } - - public abstract Value eval(Scope scope); - - protected List args() { - return this.fnNode.getArgv(); - } -} diff --git a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules2/Partitions.java.resource b/codegen/src/main/resources/software/amazon/awssdk/codegen/rules2/Partitions.java.resource deleted file mode 100644 index c53df6f93822..000000000000 --- a/codegen/src/main/resources/software/amazon/awssdk/codegen/rules2/Partitions.java.resource +++ /dev/null @@ -1,109 +0,0 @@ -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; -import software.amazon.awssdk.utils.ToString; - -@SdkInternalApi -public final class Partitions { - private static final String VERSION = "version"; - private static final String PARTITIONS = "partitions"; - - private final String version; - private final List partitions; - - private Partitions(Builder builder) { - this.version = builder.version; - this.partitions = new ArrayList<>(builder.partitions); - } - - public String version() { - return version; - } - - public List partitions() { - return partitions; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Partitions that = (Partitions) o; - - if (version != null ? !version.equals(that.version) : that.version != null) { - return false; - } - return partitions != null ? partitions.equals(that.partitions) : that.partitions == null; - } - - @Override - public int hashCode() { - int result = version != null ? version.hashCode() : 0; - result = 31 * result + (partitions != null ? partitions.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return ToString.builder("Partitions") - .add("version", version) - .add("partitions", partitions) - .build(); - } - - public static Partitions fromNode(JsonNode node) { - Map objNode = node.asObject(); - - Builder b = builder(); - - JsonNode version = objNode.get(VERSION); - if (version != null) { - b.version(version.asString()); - } - - JsonNode partitions = objNode.get(PARTITIONS); - if (partitions != null) { - partitions.asArray().forEach(partNode -> b.addPartition(Partition.fromNode(partNode))); - } - - return b.build(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String version; - private List partitions = new ArrayList<>(); - - public Builder version(String version) { - this.version = version; - return this; - } - - public Builder partitions(List partitions) { - this.partitions.clear(); - if (partitions != null) { - this.partitions.addAll(partitions); - } - return this; - } - - public Builder addPartition(Partition p) { - this.partitions.add(p); - return this; - } - - public Partitions build() { - return new Partitions(this); - } - } -} diff --git a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/EndpointProviderClassSpecTest.java b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/EndpointProviderClassSpecTest.java deleted file mode 100644 index e2f10b7fefab..000000000000 --- a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/EndpointProviderClassSpecTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package software.amazon.awssdk.codegen.poet.rules; - -import static org.hamcrest.MatcherAssert.assertThat; -import static software.amazon.awssdk.codegen.poet.PoetMatchers.generatesTo; - -import org.junit.jupiter.api.Test; -import software.amazon.awssdk.codegen.poet.ClassSpec; -import software.amazon.awssdk.codegen.poet.ClientTestModels; - -public class EndpointProviderClassSpecTest { - @Test - public void endpointProviderClass() { - ClassSpec endpointProviderSpec = new EndpointProviderSpec(ClientTestModels.queryServiceModels()); - assertThat(endpointProviderSpec, generatesTo("endpoint-provider-class.java")); - } - - @Test - void knowPropertiesOverride() { - ClassSpec endpointProviderSpec = new EndpointProviderSpec(ClientTestModels.queryServiceModelsWithOverrideKnowProperties()); - assertThat(endpointProviderSpec, generatesTo("endpoint-provider-know-prop-override-class.java")); - } -} diff --git a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/EndpointProviderCompiledRulesClassSpecTest.java b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/EndpointProviderCompiledRulesClassSpecTest.java index abf2ed3e3e22..d98884ab58b9 100644 --- a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/EndpointProviderCompiledRulesClassSpecTest.java +++ b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/EndpointProviderCompiledRulesClassSpecTest.java @@ -21,41 +21,41 @@ import org.junit.jupiter.api.Test; import software.amazon.awssdk.codegen.poet.ClassSpec; import software.amazon.awssdk.codegen.poet.ClientTestModels; -import software.amazon.awssdk.codegen.poet.rules2.EndpointProviderSpec2; +import software.amazon.awssdk.codegen.poet.rules.EndpointProviderSpec; class EndpointProviderCompiledRulesClassSpecTest { @Test public void endpointProviderClass() { - ClassSpec endpointProviderSpec = new EndpointProviderSpec2(ClientTestModels.queryServiceModels()); + ClassSpec endpointProviderSpec = new EndpointProviderSpec(ClientTestModels.queryServiceModels()); assertThat(endpointProviderSpec, generatesTo("endpoint-provider-class.java")); } @Test void knowPropertiesOverride() { ClassSpec endpointProviderSpec = - new EndpointProviderSpec2(ClientTestModels.queryServiceModelsWithOverrideKnowProperties()); + new EndpointProviderSpec(ClientTestModels.queryServiceModelsWithOverrideKnowProperties()); assertThat(endpointProviderSpec, generatesTo("endpoint-provider-know-prop-override-class.java")); } @Test void unknownEndpointProperties() { ClassSpec endpointProviderSpec = - new EndpointProviderSpec2(ClientTestModels.queryServiceModelsWithUnknownEndpointProperties()); + new EndpointProviderSpec(ClientTestModels.queryServiceModelsWithUnknownEndpointProperties()); assertThat(endpointProviderSpec, generatesTo("endpoint-provider-unknown-property-class.java")); } @Test void endpointProviderClassWithUriCache() { ClassSpec endpointProviderSpec = - new EndpointProviderSpec2(ClientTestModels.queryServiceModelsWithUriCache()); + new EndpointProviderSpec(ClientTestModels.queryServiceModelsWithUriCache()); assertThat(endpointProviderSpec, generatesTo("endpoint-provider-uri-cache-class.java")); } @Test void endpointProviderClassWithMetricValues() { ClassSpec endpointProviderSpec = - new EndpointProviderSpec2(ClientTestModels.queryServiceModelsWithUnknownEndpointMetricValues()); + new EndpointProviderSpec(ClientTestModels.queryServiceModelsWithUnknownEndpointMetricValues()); assertThat(endpointProviderSpec, generatesTo("endpoint-provider-metric-values-class.java")); } } diff --git a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules2/EndpointUrlCodeEmitterTest.java b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/EndpointUrlCodeEmitterTest.java similarity index 99% rename from codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules2/EndpointUrlCodeEmitterTest.java rename to codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/EndpointUrlCodeEmitterTest.java index c95c81ac3416..c52eff82764f 100644 --- a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules2/EndpointUrlCodeEmitterTest.java +++ b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/EndpointUrlCodeEmitterTest.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import static org.assertj.core.api.Assertions.assertThat; diff --git a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules2/ExpressionParserTest.java b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/ExpressionParserTest.java similarity index 98% rename from codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules2/ExpressionParserTest.java rename to codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/ExpressionParserTest.java index 18138ba69a0f..31c1834a9cd3 100644 --- a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules2/ExpressionParserTest.java +++ b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/ExpressionParserTest.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; diff --git a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules2/TokenizerTest.java b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/TokenizerTest.java similarity index 97% rename from codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules2/TokenizerTest.java rename to codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/TokenizerTest.java index f9d14eb3076d..61a1a620d147 100644 --- a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules2/TokenizerTest.java +++ b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/TokenizerTest.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package software.amazon.awssdk.codegen.poet.rules2; +package software.amazon.awssdk.codegen.poet.rules; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/ops-auth-sigv4a-value-auth-scheme-default-params.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/ops-auth-sigv4a-value-auth-scheme-default-params.java index 8fc91e2069fe..a39463292122 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/ops-auth-sigv4a-value-auth-scheme-default-params.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/ops-auth-sigv4a-value-auth-scheme-default-params.java @@ -36,6 +36,11 @@ public Region region() { return region; } + @Override + public String regionId() { + return region == null ? null : region.id(); + } + @Override public RegionSet regionSet() { return regionSet; diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/ops-auth-sigv4a-value-auth-scheme-params.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/ops-auth-sigv4a-value-auth-scheme-params.java index 37a202d5ee3a..96769a75478d 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/ops-auth-sigv4a-value-auth-scheme-params.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/ops-auth-sigv4a-value-auth-scheme-params.java @@ -31,6 +31,14 @@ static Builder builder() { */ Region region(); + /** + * Returns the region ID as a string. Returns null if region is not set. + */ + default String regionId() { + Region region = region(); + return region == null ? null : region.id(); + } + /** * Returns the RegionSet. The regionSet parameter may be used with the "aws.auth#sigv4a" auth scheme. */ diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-auth-scheme-default-params.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-auth-scheme-default-params.java index 8d4589400e62..a982a71d8324 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-auth-scheme-default-params.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-auth-scheme-default-params.java @@ -1,18 +1,3 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - package software.amazon.awssdk.services.query.auth.scheme.internal; import software.amazon.awssdk.annotations.Generated; @@ -47,6 +32,11 @@ public Region region() { return region; } + @Override + public String regionId() { + return region == null ? null : region.id(); + } + @Override public QueryAuthSchemeParams.Builder toBuilder() { return new Builder(this); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-auth-scheme-params.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-auth-scheme-params.java index b726c4a81e09..38292c835849 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-auth-scheme-params.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-auth-scheme-params.java @@ -1,18 +1,3 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - package software.amazon.awssdk.services.query.auth.scheme; import software.amazon.awssdk.annotations.Generated; @@ -45,6 +30,14 @@ static Builder builder() { */ Region region(); + /** + * Returns the region ID as a string. Returns null if region is not set. + */ + default String regionId() { + Region region = region(); + return region == null ? null : region.id(); + } + /** * Returns a {@link Builder} to customize the parameters. */ diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-default-params-with-allowlist.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-default-params-with-allowlist.java index 87eaf93e4db4..90787b2a7359 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-default-params-with-allowlist.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-default-params-with-allowlist.java @@ -73,6 +73,11 @@ public Region region() { return region; } + @Override + public String regionId() { + return region == null ? null : region.id(); + } + @Override public RegionSet regionSet() { return regionSet; diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-default-params-without-allowlist.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-default-params-without-allowlist.java index ee65f8d60da4..dc56b5a01cae 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-default-params-without-allowlist.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-default-params-without-allowlist.java @@ -81,6 +81,11 @@ public Region region() { return region; } + @Override + public String regionId() { + return region == null ? null : region.id(); + } + @Override public RegionSet regionSet() { return regionSet; diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-params-with-allowlist.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-params-with-allowlist.java index 4ac1f03ed9e3..65d1a0eccbcc 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-params-with-allowlist.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-params-with-allowlist.java @@ -1,18 +1,3 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - package software.amazon.awssdk.services.query.auth.scheme; import software.amazon.awssdk.annotations.Generated; @@ -39,7 +24,7 @@ static Builder builder() { /** * Create a builder pre-populated with endpoint parameters. - * + * * @param endpointParams * the endpoint parameters to copy * @return a builder with values from the endpoint parameters @@ -66,6 +51,14 @@ static Builder fromEndpointParams(QueryEndpointParams endpointParams) { */ Region region(); + /** + * Returns the region ID as a string. Returns null if region is not set. + */ + default String regionId() { + Region region = region(); + return region == null ? null : region.id(); + } + /** * Returns the RegionSet. The regionSet parameter may be used with the "aws.auth#sigv4a" auth scheme. */ diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-params-without-allowlist.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-params-without-allowlist.java index b583bd4c120d..1d6de970b976 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-params-without-allowlist.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-auth-scheme-params-without-allowlist.java @@ -25,7 +25,7 @@ static Builder builder() { /** * Create a builder pre-populated with endpoint parameters. - * + * * @param endpointParams * the endpoint parameters to copy * @return a builder with values from the endpoint parameters @@ -59,6 +59,14 @@ static Builder fromEndpointParams(QueryEndpointParams endpointParams) { */ Region region(); + /** + * Returns the region ID as a string. Returns null if region is not set. + */ + default String regionId() { + Region region = region(); + return region == null ? null : region.id(); + } + /** * Returns the RegionSet. The regionSet parameter may be used with the "aws.auth#sigv4a" auth scheme. */ diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-with-allowlist-auth-scheme-default-params.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-with-allowlist-auth-scheme-default-params.java new file mode 100644 index 000000000000..32c966facd4d --- /dev/null +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-with-allowlist-auth-scheme-default-params.java @@ -0,0 +1,221 @@ +package software.amazon.awssdk.services.query.auth.scheme.internal; + +import software.amazon.awssdk.annotations.Generated; +import software.amazon.awssdk.annotations.SdkInternalApi; +import software.amazon.awssdk.http.auth.aws.signer.RegionSet; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.query.auth.scheme.QueryAuthSchemeParams; +import software.amazon.awssdk.services.query.endpoints.QueryEndpointProvider; +import software.amazon.awssdk.utils.Validate; + +@Generated("software.amazon.awssdk:codegen") +@SdkInternalApi +public final class DefaultQueryAuthSchemeParams implements QueryAuthSchemeParams, QueryEndpointResolverAware { + private final String operation; + + private final Region region; + + private final RegionSet regionSet; + + private final Boolean defaultTrueParam; + + private final String defaultStringParam; + + private final String deprecatedParam; + + private final Boolean booleanContextParam; + + private final String stringContextParam; + + private final String operationContextParam; + + private final QueryEndpointProvider endpointProvider; + + private DefaultQueryAuthSchemeParams(Builder builder) { + this.operation = Validate.paramNotNull(builder.operation, "operation"); + this.region = builder.region; + this.regionSet = builder.regionSet; + this.defaultTrueParam = Validate.paramNotNull(builder.defaultTrueParam, "defaultTrueParam"); + this.defaultStringParam = Validate.paramNotNull(builder.defaultStringParam, "defaultStringParam"); + this.deprecatedParam = builder.deprecatedParam; + this.booleanContextParam = builder.booleanContextParam; + this.stringContextParam = builder.stringContextParam; + this.operationContextParam = builder.operationContextParam; + this.endpointProvider = builder.endpointProvider; + } + + public static QueryAuthSchemeParams.Builder builder() { + return new Builder(); + } + + @Override + public String operation() { + return operation; + } + + @Override + public Region region() { + return region; + } + + @Override + public String regionId() { + return region == null ? null : region.id(); + } + + @Override + public RegionSet regionSet() { + return regionSet; + } + + @Override + public Boolean defaultTrueParam() { + return defaultTrueParam; + } + + @Override + public String defaultStringParam() { + return defaultStringParam; + } + + @Deprecated + @Override + public String deprecatedParam() { + return deprecatedParam; + } + + @Override + public Boolean booleanContextParam() { + return booleanContextParam; + } + + @Override + public String stringContextParam() { + return stringContextParam; + } + + @Override + public String operationContextParam() { + return operationContextParam; + } + + @Override + public QueryEndpointProvider endpointProvider() { + return endpointProvider; + } + + @Override + public QueryAuthSchemeParams.Builder toBuilder() { + return new Builder(this); + } + + private static final class Builder implements QueryAuthSchemeParams.Builder, QueryEndpointResolverAware.Builder { + private String operation; + + private Region region; + + private RegionSet regionSet; + + private Boolean defaultTrueParam = true; + + private String defaultStringParam = "hello endpoints"; + + private String deprecatedParam; + + private Boolean booleanContextParam; + + private String stringContextParam; + + private String operationContextParam; + + private QueryEndpointProvider endpointProvider; + + Builder() { + } + + Builder(DefaultQueryAuthSchemeParams params) { + this.operation = params.operation; + this.region = params.region; + this.regionSet = params.regionSet; + this.defaultTrueParam = params.defaultTrueParam; + this.defaultStringParam = params.defaultStringParam; + this.deprecatedParam = params.deprecatedParam; + this.booleanContextParam = params.booleanContextParam; + this.stringContextParam = params.stringContextParam; + this.operationContextParam = params.operationContextParam; + this.endpointProvider = params.endpointProvider; + } + + @Override + public Builder operation(String operation) { + this.operation = operation; + return this; + } + + @Override + public Builder region(Region region) { + this.region = region; + return this; + } + + @Override + public Builder regionSet(RegionSet regionSet) { + this.regionSet = regionSet; + return this; + } + + @Override + public Builder defaultTrueParam(Boolean defaultTrueParam) { + this.defaultTrueParam = defaultTrueParam; + if (this.defaultTrueParam == null) { + this.defaultTrueParam = true; + } + return this; + } + + @Override + public Builder defaultStringParam(String defaultStringParam) { + this.defaultStringParam = defaultStringParam; + if (this.defaultStringParam == null) { + this.defaultStringParam = "hello endpoints"; + } + return this; + } + + @Deprecated + @Override + public Builder deprecatedParam(String deprecatedParam) { + this.deprecatedParam = deprecatedParam; + return this; + } + + @Override + public Builder booleanContextParam(Boolean booleanContextParam) { + this.booleanContextParam = booleanContextParam; + return this; + } + + @Override + public Builder stringContextParam(String stringContextParam) { + this.stringContextParam = stringContextParam; + return this; + } + + @Override + public Builder operationContextParam(String operationContextParam) { + this.operationContextParam = operationContextParam; + return this; + } + + @Override + public Builder endpointProvider(QueryEndpointProvider endpointProvider) { + this.endpointProvider = endpointProvider; + return this; + } + + @Override + public QueryAuthSchemeParams build() { + return new DefaultQueryAuthSchemeParams(this); + } + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-with-allowlist-auth-scheme-params.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-with-allowlist-auth-scheme-params.java new file mode 100644 index 000000000000..65d1a0eccbcc --- /dev/null +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-with-allowlist-auth-scheme-params.java @@ -0,0 +1,129 @@ +package software.amazon.awssdk.services.query.auth.scheme; + +import software.amazon.awssdk.annotations.Generated; +import software.amazon.awssdk.annotations.SdkPublicApi; +import software.amazon.awssdk.http.auth.aws.signer.RegionSet; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.query.auth.scheme.internal.DefaultQueryAuthSchemeParams; +import software.amazon.awssdk.services.query.endpoints.QueryEndpointParams; +import software.amazon.awssdk.utils.builder.CopyableBuilder; +import software.amazon.awssdk.utils.builder.ToCopyableBuilder; + +/** + * The parameters object used to resolve the auth schemes for the Query service. + */ +@Generated("software.amazon.awssdk:codegen") +@SdkPublicApi +public interface QueryAuthSchemeParams extends ToCopyableBuilder { + /** + * Get a new builder for creating a {@link QueryAuthSchemeParams}. + */ + static Builder builder() { + return DefaultQueryAuthSchemeParams.builder(); + } + + /** + * Create a builder pre-populated with endpoint parameters. + * + * @param endpointParams + * the endpoint parameters to copy + * @return a builder with values from the endpoint parameters + */ + static Builder fromEndpointParams(QueryEndpointParams endpointParams) { + Builder builder = builder(); + builder.region(endpointParams.region()); + builder.defaultTrueParam(endpointParams.defaultTrueParam()); + builder.defaultStringParam(endpointParams.defaultStringParam()); + builder.deprecatedParam(endpointParams.deprecatedParam()); + builder.booleanContextParam(endpointParams.booleanContextParam()); + builder.stringContextParam(endpointParams.stringContextParam()); + builder.operationContextParam(endpointParams.operationContextParam()); + return builder; + } + + /** + * Returns the operation for which to resolve the auth scheme. + */ + String operation(); + + /** + * Returns the region. The region parameter may be used with the "aws.auth#sigv4" auth scheme. + */ + Region region(); + + /** + * Returns the region ID as a string. Returns null if region is not set. + */ + default String regionId() { + Region region = region(); + return region == null ? null : region.id(); + } + + /** + * Returns the RegionSet. The regionSet parameter may be used with the "aws.auth#sigv4a" auth scheme. + */ + RegionSet regionSet(); + + /** + * A param that defauls to true + */ + Boolean defaultTrueParam(); + + String defaultStringParam(); + + @Deprecated + String deprecatedParam(); + + Boolean booleanContextParam(); + + String stringContextParam(); + + String operationContextParam(); + + /** + * Returns a {@link Builder} to customize the parameters. + */ + Builder toBuilder(); + + /** + * A builder for a {@link QueryAuthSchemeParams}. + */ + interface Builder extends CopyableBuilder { + /** + * Set the operation for which to resolve the auth scheme. + */ + Builder operation(String operation); + + /** + * Set the region. The region parameter may be used with the "aws.auth#sigv4" auth scheme. + */ + Builder region(Region region); + + /** + * Set the RegionSet. The regionSet parameter may be used with the "aws.auth#sigv4a" auth scheme. + */ + Builder regionSet(RegionSet regionSet); + + /** + * A param that defauls to true + */ + Builder defaultTrueParam(Boolean defaultTrueParam); + + Builder defaultStringParam(String defaultStringParam); + + @Deprecated + Builder deprecatedParam(String deprecatedParam); + + Builder booleanContextParam(Boolean booleanContextParam); + + Builder stringContextParam(String stringContextParam); + + Builder operationContextParam(String operationContextParam); + + /** + * Returns a {@link QueryAuthSchemeParams} object that is created from the properties that have been set on the + * builder. + */ + QueryAuthSchemeParams build(); + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-without-allowlist-auth-scheme-default-params.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-without-allowlist-auth-scheme-default-params.java new file mode 100644 index 000000000000..dc56b5a01cae --- /dev/null +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-without-allowlist-auth-scheme-default-params.java @@ -0,0 +1,345 @@ +package software.amazon.awssdk.services.query.auth.scheme.internal; + +import java.util.Arrays; +import java.util.List; +import software.amazon.awssdk.annotations.Generated; +import software.amazon.awssdk.annotations.SdkInternalApi; +import software.amazon.awssdk.http.auth.aws.signer.RegionSet; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.query.auth.scheme.QueryAuthSchemeParams; +import software.amazon.awssdk.services.query.endpoints.QueryEndpointProvider; +import software.amazon.awssdk.utils.Validate; + +@Generated("software.amazon.awssdk:codegen") +@SdkInternalApi +public final class DefaultQueryAuthSchemeParams implements QueryAuthSchemeParams, QueryEndpointResolverAware { + private final String operation; + + private final Region region; + + private final RegionSet regionSet; + + private final Boolean useDualStackEndpoint; + + private final Boolean useFIPSEndpoint; + + private final String accountId; + + private final String accountIdEndpointMode; + + private final List listOfStrings; + + private final List defaultListOfStrings; + + private final String endpointId; + + private final Boolean defaultTrueParam; + + private final String defaultStringParam; + + private final String deprecatedParam; + + private final Boolean booleanContextParam; + + private final String stringContextParam; + + private final String operationContextParam; + + private final QueryEndpointProvider endpointProvider; + + private DefaultQueryAuthSchemeParams(Builder builder) { + this.operation = Validate.paramNotNull(builder.operation, "operation"); + this.region = builder.region; + this.regionSet = builder.regionSet; + this.useDualStackEndpoint = builder.useDualStackEndpoint; + this.useFIPSEndpoint = builder.useFIPSEndpoint; + this.accountId = builder.accountId; + this.accountIdEndpointMode = builder.accountIdEndpointMode; + this.listOfStrings = builder.listOfStrings; + this.defaultListOfStrings = Validate.paramNotNull(builder.defaultListOfStrings, "defaultListOfStrings"); + this.endpointId = builder.endpointId; + this.defaultTrueParam = Validate.paramNotNull(builder.defaultTrueParam, "defaultTrueParam"); + this.defaultStringParam = Validate.paramNotNull(builder.defaultStringParam, "defaultStringParam"); + this.deprecatedParam = builder.deprecatedParam; + this.booleanContextParam = builder.booleanContextParam; + this.stringContextParam = builder.stringContextParam; + this.operationContextParam = builder.operationContextParam; + this.endpointProvider = builder.endpointProvider; + } + + public static QueryAuthSchemeParams.Builder builder() { + return new Builder(); + } + + @Override + public String operation() { + return operation; + } + + @Override + public Region region() { + return region; + } + + @Override + public String regionId() { + return region == null ? null : region.id(); + } + + @Override + public RegionSet regionSet() { + return regionSet; + } + + @Override + public Boolean useDualStackEndpoint() { + return useDualStackEndpoint; + } + + @Override + public Boolean useFipsEndpoint() { + return useFIPSEndpoint; + } + + @Override + public String accountId() { + return accountId; + } + + @Override + public String accountIdEndpointMode() { + return accountIdEndpointMode; + } + + @Override + public List listOfStrings() { + return listOfStrings; + } + + @Override + public List defaultListOfStrings() { + return defaultListOfStrings; + } + + @Override + public String endpointId() { + return endpointId; + } + + @Override + public Boolean defaultTrueParam() { + return defaultTrueParam; + } + + @Override + public String defaultStringParam() { + return defaultStringParam; + } + + @Deprecated + @Override + public String deprecatedParam() { + return deprecatedParam; + } + + @Override + public Boolean booleanContextParam() { + return booleanContextParam; + } + + @Override + public String stringContextParam() { + return stringContextParam; + } + + @Override + public String operationContextParam() { + return operationContextParam; + } + + @Override + public QueryEndpointProvider endpointProvider() { + return endpointProvider; + } + + @Override + public QueryAuthSchemeParams.Builder toBuilder() { + return new Builder(this); + } + + private static final class Builder implements QueryAuthSchemeParams.Builder, QueryEndpointResolverAware.Builder { + private String operation; + + private Region region; + + private RegionSet regionSet; + + private Boolean useDualStackEndpoint; + + private Boolean useFIPSEndpoint; + + private String accountId; + + private String accountIdEndpointMode; + + private List listOfStrings; + + private List defaultListOfStrings = Arrays.asList("item1", "item2", "item3"); + + private String endpointId; + + private Boolean defaultTrueParam = true; + + private String defaultStringParam = "hello endpoints"; + + private String deprecatedParam; + + private Boolean booleanContextParam; + + private String stringContextParam; + + private String operationContextParam; + + private QueryEndpointProvider endpointProvider; + + Builder() { + } + + Builder(DefaultQueryAuthSchemeParams params) { + this.operation = params.operation; + this.region = params.region; + this.regionSet = params.regionSet; + this.useDualStackEndpoint = params.useDualStackEndpoint; + this.useFIPSEndpoint = params.useFIPSEndpoint; + this.accountId = params.accountId; + this.accountIdEndpointMode = params.accountIdEndpointMode; + this.listOfStrings = params.listOfStrings; + this.defaultListOfStrings = params.defaultListOfStrings; + this.endpointId = params.endpointId; + this.defaultTrueParam = params.defaultTrueParam; + this.defaultStringParam = params.defaultStringParam; + this.deprecatedParam = params.deprecatedParam; + this.booleanContextParam = params.booleanContextParam; + this.stringContextParam = params.stringContextParam; + this.operationContextParam = params.operationContextParam; + this.endpointProvider = params.endpointProvider; + } + + @Override + public Builder operation(String operation) { + this.operation = operation; + return this; + } + + @Override + public Builder region(Region region) { + this.region = region; + return this; + } + + @Override + public Builder regionSet(RegionSet regionSet) { + this.regionSet = regionSet; + return this; + } + + @Override + public Builder useDualStackEndpoint(Boolean useDualStackEndpoint) { + this.useDualStackEndpoint = useDualStackEndpoint; + return this; + } + + @Override + public Builder useFipsEndpoint(Boolean useFIPSEndpoint) { + this.useFIPSEndpoint = useFIPSEndpoint; + return this; + } + + @Override + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + @Override + public Builder accountIdEndpointMode(String accountIdEndpointMode) { + this.accountIdEndpointMode = accountIdEndpointMode; + return this; + } + + @Override + public Builder listOfStrings(List listOfStrings) { + this.listOfStrings = listOfStrings; + return this; + } + + @Override + public Builder defaultListOfStrings(List defaultListOfStrings) { + this.defaultListOfStrings = defaultListOfStrings; + if (this.defaultListOfStrings == null) { + this.defaultListOfStrings = Arrays.asList("item1", "item2", "item3"); + } + return this; + } + + @Override + public Builder endpointId(String endpointId) { + this.endpointId = endpointId; + return this; + } + + @Override + public Builder defaultTrueParam(Boolean defaultTrueParam) { + this.defaultTrueParam = defaultTrueParam; + if (this.defaultTrueParam == null) { + this.defaultTrueParam = true; + } + return this; + } + + @Override + public Builder defaultStringParam(String defaultStringParam) { + this.defaultStringParam = defaultStringParam; + if (this.defaultStringParam == null) { + this.defaultStringParam = "hello endpoints"; + } + return this; + } + + @Deprecated + @Override + public Builder deprecatedParam(String deprecatedParam) { + this.deprecatedParam = deprecatedParam; + return this; + } + + @Override + public Builder booleanContextParam(Boolean booleanContextParam) { + this.booleanContextParam = booleanContextParam; + return this; + } + + @Override + public Builder stringContextParam(String stringContextParam) { + this.stringContextParam = stringContextParam; + return this; + } + + @Override + public Builder operationContextParam(String operationContextParam) { + this.operationContextParam = operationContextParam; + return this; + } + + @Override + public Builder endpointProvider(QueryEndpointProvider endpointProvider) { + this.endpointProvider = endpointProvider; + return this; + } + + @Override + public QueryAuthSchemeParams build() { + return new DefaultQueryAuthSchemeParams(this); + } + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-without-allowlist-auth-scheme-params.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-without-allowlist-auth-scheme-params.java new file mode 100644 index 000000000000..1d6de970b976 --- /dev/null +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/auth/scheme/query-endpoint-auth-params-without-allowlist-auth-scheme-params.java @@ -0,0 +1,165 @@ +package software.amazon.awssdk.services.query.auth.scheme; + +import java.util.List; +import software.amazon.awssdk.annotations.Generated; +import software.amazon.awssdk.annotations.SdkPublicApi; +import software.amazon.awssdk.http.auth.aws.signer.RegionSet; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.query.auth.scheme.internal.DefaultQueryAuthSchemeParams; +import software.amazon.awssdk.services.query.endpoints.QueryEndpointParams; +import software.amazon.awssdk.utils.builder.CopyableBuilder; +import software.amazon.awssdk.utils.builder.ToCopyableBuilder; + +/** + * The parameters object used to resolve the auth schemes for the Query service. + */ +@Generated("software.amazon.awssdk:codegen") +@SdkPublicApi +public interface QueryAuthSchemeParams extends ToCopyableBuilder { + /** + * Get a new builder for creating a {@link QueryAuthSchemeParams}. + */ + static Builder builder() { + return DefaultQueryAuthSchemeParams.builder(); + } + + /** + * Create a builder pre-populated with endpoint parameters. + * + * @param endpointParams + * the endpoint parameters to copy + * @return a builder with values from the endpoint parameters + */ + static Builder fromEndpointParams(QueryEndpointParams endpointParams) { + Builder builder = builder(); + builder.region(endpointParams.region()); + builder.useDualStackEndpoint(endpointParams.useDualStackEndpoint()); + builder.useFipsEndpoint(endpointParams.useFipsEndpoint()); + builder.accountId(endpointParams.accountId()); + builder.accountIdEndpointMode(endpointParams.accountIdEndpointMode()); + builder.listOfStrings(endpointParams.listOfStrings()); + builder.defaultListOfStrings(endpointParams.defaultListOfStrings()); + builder.endpointId(endpointParams.endpointId()); + builder.defaultTrueParam(endpointParams.defaultTrueParam()); + builder.defaultStringParam(endpointParams.defaultStringParam()); + builder.deprecatedParam(endpointParams.deprecatedParam()); + builder.booleanContextParam(endpointParams.booleanContextParam()); + builder.stringContextParam(endpointParams.stringContextParam()); + builder.operationContextParam(endpointParams.operationContextParam()); + return builder; + } + + /** + * Returns the operation for which to resolve the auth scheme. + */ + String operation(); + + /** + * Returns the region. The region parameter may be used with the "aws.auth#sigv4" auth scheme. + */ + Region region(); + + /** + * Returns the region ID as a string. Returns null if region is not set. + */ + default String regionId() { + Region region = region(); + return region == null ? null : region.id(); + } + + /** + * Returns the RegionSet. The regionSet parameter may be used with the "aws.auth#sigv4a" auth scheme. + */ + RegionSet regionSet(); + + Boolean useDualStackEndpoint(); + + Boolean useFipsEndpoint(); + + String accountId(); + + String accountIdEndpointMode(); + + List listOfStrings(); + + List defaultListOfStrings(); + + String endpointId(); + + /** + * A param that defauls to true + */ + Boolean defaultTrueParam(); + + String defaultStringParam(); + + @Deprecated + String deprecatedParam(); + + Boolean booleanContextParam(); + + String stringContextParam(); + + String operationContextParam(); + + /** + * Returns a {@link Builder} to customize the parameters. + */ + Builder toBuilder(); + + /** + * A builder for a {@link QueryAuthSchemeParams}. + */ + interface Builder extends CopyableBuilder { + /** + * Set the operation for which to resolve the auth scheme. + */ + Builder operation(String operation); + + /** + * Set the region. The region parameter may be used with the "aws.auth#sigv4" auth scheme. + */ + Builder region(Region region); + + /** + * Set the RegionSet. The regionSet parameter may be used with the "aws.auth#sigv4a" auth scheme. + */ + Builder regionSet(RegionSet regionSet); + + Builder useDualStackEndpoint(Boolean useDualStackEndpoint); + + Builder useFipsEndpoint(Boolean useFIPSEndpoint); + + Builder accountId(String accountId); + + Builder accountIdEndpointMode(String accountIdEndpointMode); + + Builder listOfStrings(List listOfStrings); + + Builder defaultListOfStrings(List defaultListOfStrings); + + Builder endpointId(String endpointId); + + /** + * A param that defauls to true + */ + Builder defaultTrueParam(Boolean defaultTrueParam); + + Builder defaultStringParam(String defaultStringParam); + + @Deprecated + Builder deprecatedParam(String deprecatedParam); + + Builder booleanContextParam(Boolean booleanContextParam); + + Builder stringContextParam(String stringContextParam); + + Builder operationContextParam(String operationContextParam); + + /** + * Returns a {@link QueryAuthSchemeParams} object that is created from the properties that have been set on the + * builder. + */ + QueryAuthSchemeParams build(); + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/s3-test/customization.config b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/s3-test/customization.config index 4dee2d9e88d9..3ac6b7ec1ea6 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/s3-test/customization.config +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/s3-test/customization.config @@ -331,7 +331,6 @@ } }, - "enableGenerateCompiledEndpointRules": true, "endpointParameters": { "DeleteObjectKeys": { "required": false, diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/s3control-test/customization.config b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/s3control-test/customization.config index abf7c5633797..53aa741058be 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/s3control-test/customization.config +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/s3control-test/customization.config @@ -1,6 +1,5 @@ { - "enableGenerateCompiledEndpointRules": true, "serviceConfig": { "className": "S3ControlConfiguration", "hasDualstackProperty": true, diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-parameters.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-parameters.java index 232b9fe14236..e7558d3e4ff4 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-parameters.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-parameters.java @@ -73,6 +73,10 @@ public Region region() { return region; } + public String regionId() { + return region == null ? null : region.id(); + } + public Boolean useDualStackEndpoint() { return useDualStackEndpoint; } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-class.java index ebfa49bad424..d533d71b5784 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-class.java @@ -1,474 +1,159 @@ package software.amazon.awssdk.services.query.endpoints.internal; import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import java.util.concurrent.CompletableFuture; -import java.util.stream.Collectors; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.endpoints.AwsEndpointAttribute; +import software.amazon.awssdk.awscore.endpoints.authscheme.SigV4AuthScheme; +import software.amazon.awssdk.awscore.endpoints.authscheme.SigV4aAuthScheme; import software.amazon.awssdk.core.exception.SdkClientException; import software.amazon.awssdk.endpoints.Endpoint; import software.amazon.awssdk.endpoints.EndpointUrl; import software.amazon.awssdk.services.query.endpoints.QueryEndpointParams; import software.amazon.awssdk.services.query.endpoints.QueryEndpointProvider; import software.amazon.awssdk.utils.CompletableFutureUtils; -import software.amazon.awssdk.utils.Logger; -import software.amazon.awssdk.utils.MapUtils; import software.amazon.awssdk.utils.Validate; @Generated("software.amazon.awssdk:codegen") @SdkInternalApi public final class DefaultQueryEndpointProvider implements QueryEndpointProvider { - private static final Logger LOG = Logger.loggerFor(DefaultQueryEndpointProvider.class); - - private static final EndpointRuleset ENDPOINT_RULE_SET = ruleSet(); - - private final EndpointAuthSchemeStrategy endpointAuthSchemeStrategy; - - public DefaultQueryEndpointProvider() { - EndpointAuthSchemeStrategyFactory endpointAuthSchemeStrategyFactory = new DefaultEndpointAuthSchemeStrategyFactory(); - this.endpointAuthSchemeStrategy = endpointAuthSchemeStrategyFactory.endpointAuthSchemeStrategy(); - } - @Override - public CompletableFuture resolveEndpoint(QueryEndpointParams endpointParams) { - Validate.notNull(endpointParams.region(), "Parameter 'region' must not be null"); - Value res = new DefaultRuleEngine().evaluate(ENDPOINT_RULE_SET, toIdentifierValueMap(endpointParams)); + public CompletableFuture resolveEndpoint(QueryEndpointParams params) { + Validate.notNull(params.region(), "Parameter 'region' must not be null"); try { - return CompletableFuture.completedFuture(valueAsEndpointOrThrow(res)); + RuleResult result = endpointRule0(params); + if (result.canContinue()) { + throw SdkClientException.create("Rule engine did not reach an error or endpoint result"); + } + if (result.isError()) { + String errorMsg = result.error(); + if (errorMsg.contains("Invalid ARN") && errorMsg.contains(":s3:::")) { + errorMsg += ". Use the bucket name instead of simple bucket ARNs in GetBucketLocationRequest."; + } + throw SdkClientException.create(errorMsg); + } + return CompletableFuture.completedFuture(result.endpoint()); } catch (Exception error) { return CompletableFutureUtils.failedFuture(error); } } - private static Map toIdentifierValueMap(QueryEndpointParams params) { - Map paramsMap = new HashMap<>(); - if (params.region() != null) { - paramsMap.put(Identifier.of("region"), Value.fromStr(params.region().id())); - } - if (params.useDualStackEndpoint() != null) { - paramsMap.put(Identifier.of("useDualStackEndpoint"), Value.fromBool(params.useDualStackEndpoint())); - } - if (params.useFipsEndpoint() != null) { - paramsMap.put(Identifier.of("useFIPSEndpoint"), Value.fromBool(params.useFipsEndpoint())); - } - if (params.accountId() != null) { - paramsMap.put(Identifier.of("AccountId"), Value.fromStr(params.accountId())); - } - if (params.accountIdEndpointMode() != null) { - paramsMap.put(Identifier.of("AccountIdEndpointMode"), Value.fromStr(params.accountIdEndpointMode())); - } - if (params.listOfStrings() != null) { - paramsMap.put(Identifier.of("listOfStrings"), - Value.fromArray(params.listOfStrings().stream().map(Value::fromStr).collect(Collectors.toList()))); - } - if (params.defaultListOfStrings() != null) { - paramsMap.put(Identifier.of("defaultListOfStrings"), - Value.fromArray(params.defaultListOfStrings().stream().map(Value::fromStr).collect(Collectors.toList()))); - } - if (params.endpointId() != null) { - paramsMap.put(Identifier.of("endpointId"), Value.fromStr(params.endpointId())); - } - if (params.defaultTrueParam() != null) { - paramsMap.put(Identifier.of("defaultTrueParam"), Value.fromBool(params.defaultTrueParam())); - } - if (params.defaultStringParam() != null) { - paramsMap.put(Identifier.of("defaultStringParam"), Value.fromStr(params.defaultStringParam())); - } - if (params.deprecatedParam() != null) { - paramsMap.put(Identifier.of("deprecatedParam"), Value.fromStr(params.deprecatedParam())); - } - if (params.booleanContextParam() != null) { - paramsMap.put(Identifier.of("booleanContextParam"), Value.fromBool(params.booleanContextParam())); - } - if (params.stringContextParam() != null) { - paramsMap.put(Identifier.of("stringContextParam"), Value.fromStr(params.stringContextParam())); - } - if (params.operationContextParam() != null) { - paramsMap.put(Identifier.of("operationContextParam"), Value.fromStr(params.operationContextParam())); - } - if (params.customEndpointArray() != null) { - paramsMap.put(Identifier.of("CustomEndpointArray"), - Value.fromArray(params.customEndpointArray().stream().map(Value::fromStr).collect(Collectors.toList()))); - } - if (params.arnList() != null) { - paramsMap.put(Identifier.of("ArnList"), - Value.fromArray(params.arnList().stream().map(Value::fromStr).collect(Collectors.toList()))); - } - return paramsMap; + private static RuleResult endpointRule0(QueryEndpointParams params) { + return endpointRule1(params); } - Endpoint valueAsEndpointOrThrow(Value value) { - if (value instanceof Value.Endpoint) { - Value.Endpoint endpoint = value.expectEndpoint(); - Endpoint.Builder builder = Endpoint.builder(); - builder.endpointUrl(EndpointUrl.fromString(endpoint.getUrl())); - Map> headers = endpoint.getHeaders(); - if (headers != null) { - headers.forEach((name, values) -> values.forEach(v -> builder.putHeader(name, v))); + private static RuleResult endpointRule1(QueryEndpointParams params) { + RulePartition partitionResult = RulesFunctions.awsPartition(params.regionId()); + if (partitionResult != null) { + RuleResult result = endpointRule2(params, partitionResult); + if (result.isResolved()) { + return result; + } + result = endpointRule6(params, partitionResult); + if (result.isResolved()) { + return result; } - addKnownProperties(builder, endpoint.getProperties()); - return builder.build(); - } else if (value instanceof Value.Str) { - String errorMsg = value.expectString(); - if (errorMsg.contains("Invalid ARN") && errorMsg.contains(":s3:::")) { - errorMsg += ". Use the bucket name instead of simple bucket ARNs in GetBucketLocationRequest."; + return RuleResult.error(params.regionId() + " is not a valid HTTP host-label"); + if (params.useFipsEndpoint() == null && params.useDualStackEndpoint() != null && params.useDualStackEndpoint() + && params.arnList() != null) { + String firstArn = RulesFunctions.listAccess(params.arnList(), 0); + if (firstArn != null) { + RuleArn parsedArn = RulesFunctions.awsParseArn(firstArn); + if (parsedArn != null) { + String arnResourceId = RulesFunctions.listAccess(parsedArn.resourceId(), 0); + if (arnResourceId != null) { + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", arnResourceId + "." + params.endpointId() + + ".query." + partitionResult.dualStackDnsSuffix(), -1, "")) + .putAttribute( + AwsEndpointAttribute.AUTH_SCHEMES, + Arrays.asList(SigV4aAuthScheme.builder().signingName("query") + .signingRegionSet(Arrays.asList("*")).build())).build()); + } + } + } } - throw SdkClientException.create(errorMsg); - } else { - throw SdkClientException.create("Rule engine return neither an endpoint result or error value. Returned value was: " - + value); } + return RuleResult.carryOn(); } - private static Rule endpointRule_2() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet").argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")))) - .build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("booleanEquals") - .argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")), Expr.of(true))).build() - .validate()).build()).error("FIPS endpoints not supported with multi-region endpoints"); - } - - private static Rule endpointRule_3() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode - .builder() - .fn("not") - .argv(Arrays.asList(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")))).build() - .validate())).build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")))).build().validate()) - .build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("booleanEquals") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")), Expr.of(true))) - .build().validate()).build()) - .endpoint( - EndpointResult - .builder() - .url(Expr.of("https://{endpointId}.query.{partitionResult#dualStackDnsSuffix}")) - .addProperty( - Identifier.of("authSchemes"), - Literal.fromTuple(Arrays.asList(Literal.fromRecord(MapUtils.of(Identifier.of("name"), - Literal.fromStr("sigv4a"), Identifier.of("signingName"), - Literal.fromStr("query"), Identifier.of("signingRegionSet"), - Literal.fromTuple(Arrays.asList(Literal.fromStr("*")))))))).build()); - } - - private static Rule endpointRule_4() { - return Rule.builder() - .endpoint( - EndpointResult - .builder() - .url(Expr.of("https://{endpointId}.query.{partitionResult#dnsSuffix}")) - .addProperty( - Identifier.of("authSchemes"), - Literal.fromTuple(Arrays.asList(Literal.fromRecord(MapUtils.of(Identifier.of("name"), - Literal.fromStr("sigv4a"), Identifier.of("signingName"), - Literal.fromStr("query"), Identifier.of("signingRegionSet"), - Literal.fromTuple(Arrays.asList(Literal.fromStr("*")))))))).build()); - } - - private static Rule endpointRule_1() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet").argv(Arrays.asList(Expr.ref(Identifier.of("endpointId")))) - .build().validate()).build()) - .treeRule(Arrays.asList(endpointRule_2(), endpointRule_3(), endpointRule_4())); - } - - private static Rule endpointRule_6() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet").argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")))) - .build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("booleanEquals") - .argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")), Expr.of(true))).build() - .validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode - .builder() - .fn("not") - .argv(Arrays.asList(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")))).build() - .validate())).build().validate()).build()) - .endpoint( - EndpointResult - .builder() - .url(Expr.of("https://query-fips.{region}.{partitionResult#dnsSuffix}")) - .addProperty( - Identifier.of("authSchemes"), - Literal.fromTuple(Arrays.asList(Literal.fromRecord(MapUtils.of(Identifier.of("name"), - Literal.fromStr("sigv4a"), Identifier.of("signingName"), - Literal.fromStr("query"), Identifier.of("signingRegionSet"), - Literal.fromTuple(Arrays.asList(Literal.fromStr("*")))))))).build()); - } - - private static Rule endpointRule_7() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")))).build().validate()) - .build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("booleanEquals") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")), Expr.of(true))) - .build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode - .builder() - .fn("not") - .argv(Arrays.asList(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")))).build() - .validate())).build().validate()).build()) - .endpoint( - EndpointResult - .builder() - .url(Expr.of("https://query.{region}.{partitionResult#dualStackDnsSuffix}")) - .addProperty( - Identifier.of("authSchemes"), - Literal.fromTuple(Arrays.asList(Literal.fromRecord(MapUtils.of(Identifier.of("name"), - Literal.fromStr("sigv4a"), Identifier.of("signingName"), - Literal.fromStr("query"), Identifier.of("signingRegionSet"), - Literal.fromTuple(Arrays.asList(Literal.fromStr("*"))))), Literal - .fromRecord(MapUtils.of(Identifier.of("name"), Literal.fromStr("sigv4"), - Identifier.of("signingName"), Literal.fromStr("query"), - Identifier.of("signingRegion"), Literal.fromStr("{region}")))))).build()); - } - - private static Rule endpointRule_8() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")))).build().validate()) - .build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet").argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")))) - .build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("booleanEquals") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")), Expr.of(true))) - .build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("booleanEquals") - .argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")), Expr.of(true))).build() - .validate()).build()) - .endpoint( - EndpointResult - .builder() - .url(Expr.of("https://query-fips.{region}.{partitionResult#dualStackDnsSuffix}")) - .addProperty( - Identifier.of("authSchemes"), - Literal.fromTuple(Arrays.asList(Literal.fromRecord(MapUtils.of(Identifier.of("name"), - Literal.fromStr("sigv4a"), Identifier.of("signingName"), - Literal.fromStr("query"), Identifier.of("signingRegionSet"), - Literal.fromTuple(Arrays.asList(Literal.fromStr("*")))))))).build()); - } - - private static Rule endpointRule_9() { - return Rule.builder().endpoint( - EndpointResult.builder().url(Expr.of("https://query.{region}.{partitionResult#dnsSuffix}")).build()); - } - - private static Rule endpointRule_5() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isValidHostLabel") - .argv(Arrays.asList(Expr.ref(Identifier.of("region")), Expr.of(false))).build() - .validate()).build()) - .treeRule(Arrays.asList(endpointRule_6(), endpointRule_7(), endpointRule_8(), endpointRule_9())); - } - - private static Rule endpointRule_10() { - return Rule.builder().error("{region} is not a valid HTTP host-label"); - } - - private static Rule endpointRule_11() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode - .builder() - .fn("not") - .argv(Arrays.asList(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")))).build() - .validate())).build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")))).build().validate()) - .build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("booleanEquals") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")), Expr.of(true))) - .build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet").argv(Arrays.asList(Expr.ref(Identifier.of("ArnList")))).build() - .validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("getAttr") - .argv(Arrays.asList(Expr.ref(Identifier.of("ArnList")), Expr.of("[0]"))).build() - .validate()).result("FirstArn").build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("aws.parseArn").argv(Arrays.asList(Expr.ref(Identifier.of("FirstArn")))) - .build().validate()).result("ParsedArn").build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("getAttr") - .argv(Arrays.asList(Expr.ref(Identifier.of("ParsedArn")), Expr.of("resourceId[0]"))) - .build().validate()).result("ArnResourceId").build()) - .endpoint( - EndpointResult - .builder() - .url(Expr.of("https://{ArnResourceId}.{endpointId}.query.{partitionResult#dualStackDnsSuffix}")) - .addProperty( - Identifier.of("authSchemes"), - Literal.fromTuple(Arrays.asList(Literal.fromRecord(MapUtils.of(Identifier.of("name"), - Literal.fromStr("sigv4a"), Identifier.of("signingName"), - Literal.fromStr("query"), Identifier.of("signingRegionSet"), - Literal.fromTuple(Arrays.asList(Literal.fromStr("*")))))))).build()); - } - - private static Rule endpointRule_0() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("aws.partition").argv(Arrays.asList(Expr.ref(Identifier.of("region")))) - .build().validate()).result("partitionResult").build()) - .treeRule(Arrays.asList(endpointRule_1(), endpointRule_5(), endpointRule_10(), endpointRule_11())); - } - - private static EndpointRuleset ruleSet() { - return EndpointRuleset - .builder() - .version("1.2") - .serviceId("query") - .parameters( - Parameters - .builder() - .addParameter( - Parameter.builder().name("region").type(ParameterType.fromValue("string")).required(true) - .builtIn("AWS::Region").documentation("The region to send requests to").build()) - .addParameter( - Parameter.builder().name("useDualStackEndpoint").type(ParameterType.fromValue("boolean")) - .required(false).builtIn("AWS::UseDualStack").build()) - .addParameter( - Parameter.builder().name("useFIPSEndpoint").type(ParameterType.fromValue("boolean")) - .required(false).builtIn("AWS::UseFIPS").build()) - .addParameter( - Parameter.builder().name("AccountId").type(ParameterType.fromValue("String")) - .required(false).builtIn("AWS::Auth::AccountId").build()) - .addParameter( - Parameter.builder().name("AccountIdEndpointMode").type(ParameterType.fromValue("String")) - .required(false).builtIn("AWS::Auth::AccountIdEndpointMode").build()) - .addParameter( - Parameter.builder().name("listOfStrings").type(ParameterType.fromValue("StringArray")) - .required(false).build()) - .addParameter( - Parameter - .builder() - .name("defaultListOfStrings") - .type(ParameterType.fromValue("stringarray")) - .required(false) - .defaultValue( - Value.fromArray(Arrays.asList("item1", "item2", "item3").stream() - .map(Value::fromStr).collect(Collectors.toList()))).build()) - .addParameter( - Parameter.builder().name("endpointId").type(ParameterType.fromValue("string")) - .required(false).build()) - .addParameter( - Parameter.builder().name("defaultTrueParam").type(ParameterType.fromValue("boolean")) - .required(false).documentation("A param that defauls to true") - .defaultValue(Value.fromBool(true)).build()) - .addParameter( - Parameter.builder().name("defaultStringParam").type(ParameterType.fromValue("string")) - .required(false).defaultValue(Value.fromStr("hello endpoints")).build()) - .addParameter( - Parameter.builder().name("deprecatedParam").type(ParameterType.fromValue("string")) - .required(false).deprecated(new Parameter.Deprecated("Don't use!", "2021-01-01")) - .build()) - .addParameter( - Parameter.builder().name("booleanContextParam").type(ParameterType.fromValue("boolean")) - .required(false).build()) - .addParameter( - Parameter.builder().name("stringContextParam").type(ParameterType.fromValue("string")) - .required(false).build()) - .addParameter( - Parameter.builder().name("operationContextParam").type(ParameterType.fromValue("string")) - .required(false).build()) - .addParameter( - Parameter.builder().name("CustomEndpointArray") - .type(ParameterType.fromValue("StringArray")).required(false) - .documentation("Parameter from the customization config").build()) - .addParameter( - Parameter.builder().name("ArnList").type(ParameterType.fromValue("StringArray")) - .required(false).documentation("Parameter from the customization config").build()) - .build()).addRule(endpointRule_0()).build(); + private static RuleResult endpointRule2(QueryEndpointParams params, RulePartition partitionResult) { + if (params.endpointId() != null) { + if (params.useFipsEndpoint() != null && params.useFipsEndpoint()) { + return RuleResult.error("FIPS endpoints not supported with multi-region endpoints"); + } + if (params.useFipsEndpoint() == null && params.useDualStackEndpoint() != null && params.useDualStackEndpoint()) { + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", + params.endpointId() + ".query." + partitionResult.dualStackDnsSuffix(), -1, "")) + .putAttribute( + AwsEndpointAttribute.AUTH_SCHEMES, + Arrays.asList(SigV4aAuthScheme.builder().signingName("query") + .signingRegionSet(Arrays.asList("*")).build())).build()); + } + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", params.endpointId() + ".query." + partitionResult.dnsSuffix(), + -1, "")) + .putAttribute( + AwsEndpointAttribute.AUTH_SCHEMES, + Arrays.asList(SigV4aAuthScheme.builder().signingName("query").signingRegionSet(Arrays.asList("*")) + .build())).build()); + } + return RuleResult.carryOn(); + } + + private static RuleResult endpointRule6(QueryEndpointParams params, RulePartition partitionResult) { + if (RulesFunctions.isValidHostLabel(params.regionId(), false)) { + if (params.useFipsEndpoint() != null && params.useFipsEndpoint() && params.useDualStackEndpoint() == null) { + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", + "query-fips." + params.regionId() + "." + partitionResult.dnsSuffix(), -1, "")) + .putAttribute( + AwsEndpointAttribute.AUTH_SCHEMES, + Arrays.asList(SigV4aAuthScheme.builder().signingName("query") + .signingRegionSet(Arrays.asList("*")).build())).build()); + } + if (params.useDualStackEndpoint() != null && params.useDualStackEndpoint() && params.useFipsEndpoint() == null) { + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", + "query." + params.regionId() + "." + partitionResult.dualStackDnsSuffix(), -1, "")) + .putAttribute( + AwsEndpointAttribute.AUTH_SCHEMES, + Arrays.asList(SigV4aAuthScheme.builder().signingName("query") + .signingRegionSet(Arrays.asList("*")).build(), + SigV4AuthScheme.builder().signingName("query").signingRegion(params.regionId()).build())) + .build()); + } + if (params.useDualStackEndpoint() != null && params.useFipsEndpoint() != null && params.useDualStackEndpoint() + && params.useFipsEndpoint()) { + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", + "query-fips." + params.regionId() + "." + partitionResult.dualStackDnsSuffix(), -1, "")) + .putAttribute( + AwsEndpointAttribute.AUTH_SCHEMES, + Arrays.asList(SigV4aAuthScheme.builder().signingName("query") + .signingRegionSet(Arrays.asList("*")).build())).build()); + } + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", "query." + params.regionId() + "." + partitionResult.dnsSuffix(), + -1, "")).build()); + } + return RuleResult.carryOn(); } @Override @@ -480,17 +165,4 @@ public boolean equals(Object rhs) { public int hashCode() { return getClass().hashCode(); } - - private void addKnownProperties(Endpoint.Builder builder, Map properties) { - properties.forEach((n, v) -> { - switch (n) { - case "authSchemes": - builder.putAttribute(AwsEndpointAttribute.AUTH_SCHEMES, endpointAuthSchemeStrategy.createAuthSchemes(v)); - break; - default: - LOG.debug(() -> "Ignoring unknown endpoint property: " + n); - break; - } - }); - } } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-know-prop-override-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-know-prop-override-class.java index 800cd3da6498..d533d71b5784 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-know-prop-override-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-know-prop-override-class.java @@ -1,465 +1,159 @@ package software.amazon.awssdk.services.query.endpoints.internal; import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import java.util.concurrent.CompletableFuture; -import java.util.stream.Collectors; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; +import software.amazon.awssdk.awscore.endpoints.AwsEndpointAttribute; +import software.amazon.awssdk.awscore.endpoints.authscheme.SigV4AuthScheme; +import software.amazon.awssdk.awscore.endpoints.authscheme.SigV4aAuthScheme; import software.amazon.awssdk.core.exception.SdkClientException; import software.amazon.awssdk.endpoints.Endpoint; import software.amazon.awssdk.endpoints.EndpointUrl; import software.amazon.awssdk.services.query.endpoints.QueryEndpointParams; import software.amazon.awssdk.services.query.endpoints.QueryEndpointProvider; import software.amazon.awssdk.utils.CompletableFutureUtils; -import software.amazon.awssdk.utils.Logger; -import software.amazon.awssdk.utils.MapUtils; import software.amazon.awssdk.utils.Validate; @Generated("software.amazon.awssdk:codegen") @SdkInternalApi public final class DefaultQueryEndpointProvider implements QueryEndpointProvider { - private static final Logger LOG = Logger.loggerFor(DefaultQueryEndpointProvider.class); - - private static final EndpointRuleset ENDPOINT_RULE_SET = ruleSet(); - - private final EndpointAuthSchemeStrategy endpointAuthSchemeStrategy; - - public DefaultQueryEndpointProvider() { - EndpointAuthSchemeStrategyFactory endpointAuthSchemeStrategyFactory = new DefaultEndpointAuthSchemeStrategyFactory(); - this.endpointAuthSchemeStrategy = endpointAuthSchemeStrategyFactory.endpointAuthSchemeStrategy(); - } - @Override - public CompletableFuture resolveEndpoint(QueryEndpointParams endpointParams) { - Validate.notNull(endpointParams.region(), "Parameter 'region' must not be null"); - Value res = new DefaultRuleEngine().evaluate(ENDPOINT_RULE_SET, toIdentifierValueMap(endpointParams)); + public CompletableFuture resolveEndpoint(QueryEndpointParams params) { + Validate.notNull(params.region(), "Parameter 'region' must not be null"); try { - return CompletableFuture.completedFuture(valueAsEndpointOrThrow(res)); + RuleResult result = endpointRule0(params); + if (result.canContinue()) { + throw SdkClientException.create("Rule engine did not reach an error or endpoint result"); + } + if (result.isError()) { + String errorMsg = result.error(); + if (errorMsg.contains("Invalid ARN") && errorMsg.contains(":s3:::")) { + errorMsg += ". Use the bucket name instead of simple bucket ARNs in GetBucketLocationRequest."; + } + throw SdkClientException.create(errorMsg); + } + return CompletableFuture.completedFuture(result.endpoint()); } catch (Exception error) { return CompletableFutureUtils.failedFuture(error); } } - private static Map toIdentifierValueMap(QueryEndpointParams params) { - Map paramsMap = new HashMap<>(); - if (params.region() != null) { - paramsMap.put(Identifier.of("region"), Value.fromStr(params.region().id())); - } - if (params.useDualStackEndpoint() != null) { - paramsMap.put(Identifier.of("useDualStackEndpoint"), Value.fromBool(params.useDualStackEndpoint())); - } - if (params.useFipsEndpoint() != null) { - paramsMap.put(Identifier.of("useFIPSEndpoint"), Value.fromBool(params.useFipsEndpoint())); - } - if (params.accountId() != null) { - paramsMap.put(Identifier.of("AccountId"), Value.fromStr(params.accountId())); - } - if (params.accountIdEndpointMode() != null) { - paramsMap.put(Identifier.of("AccountIdEndpointMode"), Value.fromStr(params.accountIdEndpointMode())); - } - if (params.listOfStrings() != null) { - paramsMap.put(Identifier.of("listOfStrings"), - Value.fromArray(params.listOfStrings().stream().map(Value::fromStr).collect(Collectors.toList()))); - } - if (params.defaultListOfStrings() != null) { - paramsMap.put(Identifier.of("defaultListOfStrings"), - Value.fromArray(params.defaultListOfStrings().stream().map(Value::fromStr).collect(Collectors.toList()))); - } - if (params.endpointId() != null) { - paramsMap.put(Identifier.of("endpointId"), Value.fromStr(params.endpointId())); - } - if (params.defaultTrueParam() != null) { - paramsMap.put(Identifier.of("defaultTrueParam"), Value.fromBool(params.defaultTrueParam())); - } - if (params.defaultStringParam() != null) { - paramsMap.put(Identifier.of("defaultStringParam"), Value.fromStr(params.defaultStringParam())); - } - if (params.deprecatedParam() != null) { - paramsMap.put(Identifier.of("deprecatedParam"), Value.fromStr(params.deprecatedParam())); - } - if (params.booleanContextParam() != null) { - paramsMap.put(Identifier.of("booleanContextParam"), Value.fromBool(params.booleanContextParam())); - } - if (params.stringContextParam() != null) { - paramsMap.put(Identifier.of("stringContextParam"), Value.fromStr(params.stringContextParam())); - } - if (params.operationContextParam() != null) { - paramsMap.put(Identifier.of("operationContextParam"), Value.fromStr(params.operationContextParam())); - } - if (params.arnList() != null) { - paramsMap.put(Identifier.of("ArnList"), - Value.fromArray(params.arnList().stream().map(Value::fromStr).collect(Collectors.toList()))); - } - return paramsMap; + private static RuleResult endpointRule0(QueryEndpointParams params) { + return endpointRule1(params); } - Endpoint valueAsEndpointOrThrow(Value value) { - if (value instanceof Value.Endpoint) { - Value.Endpoint endpoint = value.expectEndpoint(); - Endpoint.Builder builder = Endpoint.builder(); - builder.endpointUrl(EndpointUrl.fromString(endpoint.getUrl())); - Map> headers = endpoint.getHeaders(); - if (headers != null) { - headers.forEach((name, values) -> values.forEach(v -> builder.putHeader(name, v))); + private static RuleResult endpointRule1(QueryEndpointParams params) { + RulePartition partitionResult = RulesFunctions.awsPartition(params.regionId()); + if (partitionResult != null) { + RuleResult result = endpointRule2(params, partitionResult); + if (result.isResolved()) { + return result; + } + result = endpointRule6(params, partitionResult); + if (result.isResolved()) { + return result; } - addKnownProperties(builder, endpoint.getProperties()); - return builder.build(); - } else if (value instanceof Value.Str) { - String errorMsg = value.expectString(); - if (errorMsg.contains("Invalid ARN") && errorMsg.contains(":s3:::")) { - errorMsg += ". Use the bucket name instead of simple bucket ARNs in GetBucketLocationRequest."; + return RuleResult.error(params.regionId() + " is not a valid HTTP host-label"); + if (params.useFipsEndpoint() == null && params.useDualStackEndpoint() != null && params.useDualStackEndpoint() + && params.arnList() != null) { + String firstArn = RulesFunctions.listAccess(params.arnList(), 0); + if (firstArn != null) { + RuleArn parsedArn = RulesFunctions.awsParseArn(firstArn); + if (parsedArn != null) { + String arnResourceId = RulesFunctions.listAccess(parsedArn.resourceId(), 0); + if (arnResourceId != null) { + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", arnResourceId + "." + params.endpointId() + + ".query." + partitionResult.dualStackDnsSuffix(), -1, "")) + .putAttribute( + AwsEndpointAttribute.AUTH_SCHEMES, + Arrays.asList(SigV4aAuthScheme.builder().signingName("query") + .signingRegionSet(Arrays.asList("*")).build())).build()); + } + } + } } - throw SdkClientException.create(errorMsg); - } else { - throw SdkClientException.create("Rule engine return neither an endpoint result or error value. Returned value was: " - + value); } + return RuleResult.carryOn(); } - private static Rule endpointRule_2() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet").argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")))) - .build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("booleanEquals") - .argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")), Expr.of(true))).build() - .validate()).build()).error("FIPS endpoints not supported with multi-region endpoints"); - } - - private static Rule endpointRule_3() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode - .builder() - .fn("not") - .argv(Arrays.asList(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")))).build() - .validate())).build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")))).build().validate()) - .build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("booleanEquals") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")), Expr.of(true))) - .build().validate()).build()) - .endpoint( - EndpointResult - .builder() - .url(Expr.of("https://{endpointId}.query.{partitionResult#dualStackDnsSuffix}")) - .addProperty( - Identifier.of("authSchemes"), - Literal.fromTuple(Arrays.asList(Literal.fromRecord(MapUtils.of(Identifier.of("name"), - Literal.fromStr("sigv4a"), Identifier.of("signingName"), - Literal.fromStr("query"), Identifier.of("signingRegionSet"), - Literal.fromTuple(Arrays.asList(Literal.fromStr("*")))))))).build()); - } - - private static Rule endpointRule_4() { - return Rule.builder() - .endpoint( - EndpointResult - .builder() - .url(Expr.of("https://{endpointId}.query.{partitionResult#dnsSuffix}")) - .addProperty( - Identifier.of("authSchemes"), - Literal.fromTuple(Arrays.asList(Literal.fromRecord(MapUtils.of(Identifier.of("name"), - Literal.fromStr("sigv4a"), Identifier.of("signingName"), - Literal.fromStr("query"), Identifier.of("signingRegionSet"), - Literal.fromTuple(Arrays.asList(Literal.fromStr("*")))))))).build()); - } - - private static Rule endpointRule_1() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet").argv(Arrays.asList(Expr.ref(Identifier.of("endpointId")))) - .build().validate()).build()) - .treeRule(Arrays.asList(endpointRule_2(), endpointRule_3(), endpointRule_4())); - } - - private static Rule endpointRule_6() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet").argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")))) - .build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("booleanEquals") - .argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")), Expr.of(true))).build() - .validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode - .builder() - .fn("not") - .argv(Arrays.asList(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")))).build() - .validate())).build().validate()).build()) - .endpoint( - EndpointResult - .builder() - .url(Expr.of("https://query-fips.{region}.{partitionResult#dnsSuffix}")) - .addProperty( - Identifier.of("authSchemes"), - Literal.fromTuple(Arrays.asList(Literal.fromRecord(MapUtils.of(Identifier.of("name"), - Literal.fromStr("sigv4a"), Identifier.of("signingName"), - Literal.fromStr("query"), Identifier.of("signingRegionSet"), - Literal.fromTuple(Arrays.asList(Literal.fromStr("*")))))))).build()); - } - - private static Rule endpointRule_7() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")))).build().validate()) - .build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("booleanEquals") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")), Expr.of(true))) - .build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode - .builder() - .fn("not") - .argv(Arrays.asList(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")))).build() - .validate())).build().validate()).build()) - .endpoint( - EndpointResult - .builder() - .url(Expr.of("https://query.{region}.{partitionResult#dualStackDnsSuffix}")) - .addProperty( - Identifier.of("authSchemes"), - Literal.fromTuple(Arrays.asList(Literal.fromRecord(MapUtils.of(Identifier.of("name"), - Literal.fromStr("sigv4a"), Identifier.of("signingName"), - Literal.fromStr("query"), Identifier.of("signingRegionSet"), - Literal.fromTuple(Arrays.asList(Literal.fromStr("*"))))), Literal - .fromRecord(MapUtils.of(Identifier.of("name"), Literal.fromStr("sigv4"), - Identifier.of("signingName"), Literal.fromStr("query"), - Identifier.of("signingRegion"), Literal.fromStr("{region}")))))).build()); - } - - private static Rule endpointRule_8() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")))).build().validate()) - .build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet").argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")))) - .build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("booleanEquals") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")), Expr.of(true))) - .build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("booleanEquals") - .argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")), Expr.of(true))).build() - .validate()).build()) - .endpoint( - EndpointResult - .builder() - .url(Expr.of("https://query-fips.{region}.{partitionResult#dualStackDnsSuffix}")) - .addProperty( - Identifier.of("authSchemes"), - Literal.fromTuple(Arrays.asList(Literal.fromRecord(MapUtils.of(Identifier.of("name"), - Literal.fromStr("sigv4a"), Identifier.of("signingName"), - Literal.fromStr("query"), Identifier.of("signingRegionSet"), - Literal.fromTuple(Arrays.asList(Literal.fromStr("*")))))))).build()); - } - - private static Rule endpointRule_9() { - return Rule.builder().endpoint( - EndpointResult.builder().url(Expr.of("https://query.{region}.{partitionResult#dnsSuffix}")).build()); - } - - private static Rule endpointRule_5() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isValidHostLabel") - .argv(Arrays.asList(Expr.ref(Identifier.of("region")), Expr.of(false))).build() - .validate()).build()) - .treeRule(Arrays.asList(endpointRule_6(), endpointRule_7(), endpointRule_8(), endpointRule_9())); - } - - private static Rule endpointRule_10() { - return Rule.builder().error("{region} is not a valid HTTP host-label"); - } - - private static Rule endpointRule_11() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode - .builder() - .fn("not") - .argv(Arrays.asList(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useFIPSEndpoint")))).build() - .validate())).build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")))).build().validate()) - .build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("booleanEquals") - .argv(Arrays.asList(Expr.ref(Identifier.of("useDualStackEndpoint")), Expr.of(true))) - .build().validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("isSet").argv(Arrays.asList(Expr.ref(Identifier.of("ArnList")))).build() - .validate()).build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("getAttr") - .argv(Arrays.asList(Expr.ref(Identifier.of("ArnList")), Expr.of("[0]"))).build() - .validate()).result("FirstArn").build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("aws.parseArn").argv(Arrays.asList(Expr.ref(Identifier.of("FirstArn")))) - .build().validate()).result("ParsedArn").build()) - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("getAttr") - .argv(Arrays.asList(Expr.ref(Identifier.of("ParsedArn")), Expr.of("resourceId[0]"))) - .build().validate()).result("ArnResourceId").build()) - .endpoint( - EndpointResult - .builder() - .url(Expr.of("https://{ArnResourceId}.{endpointId}.query.{partitionResult#dualStackDnsSuffix}")) - .addProperty( - Identifier.of("authSchemes"), - Literal.fromTuple(Arrays.asList(Literal.fromRecord(MapUtils.of(Identifier.of("name"), - Literal.fromStr("sigv4a"), Identifier.of("signingName"), - Literal.fromStr("query"), Identifier.of("signingRegionSet"), - Literal.fromTuple(Arrays.asList(Literal.fromStr("*")))))))).build()); - } - - private static Rule endpointRule_0() { - return Rule - .builder() - .addCondition( - Condition - .builder() - .fn(FnNode.builder().fn("aws.partition").argv(Arrays.asList(Expr.ref(Identifier.of("region")))) - .build().validate()).result("partitionResult").build()) - .treeRule(Arrays.asList(endpointRule_1(), endpointRule_5(), endpointRule_10(), endpointRule_11())); - } - - private static EndpointRuleset ruleSet() { - return EndpointRuleset - .builder() - .version("1.2") - .serviceId("query") - .parameters( - Parameters - .builder() - .addParameter( - Parameter.builder().name("region").type(ParameterType.fromValue("string")).required(true) - .builtIn("AWS::Region").documentation("The region to send requests to").build()) - .addParameter( - Parameter.builder().name("useDualStackEndpoint").type(ParameterType.fromValue("boolean")) - .required(false).builtIn("AWS::UseDualStack").build()) - .addParameter( - Parameter.builder().name("useFIPSEndpoint").type(ParameterType.fromValue("boolean")) - .required(false).builtIn("AWS::UseFIPS").build()) - .addParameter( - Parameter.builder().name("AccountId").type(ParameterType.fromValue("String")) - .required(false).builtIn("AWS::Auth::AccountId").build()) - .addParameter( - Parameter.builder().name("AccountIdEndpointMode").type(ParameterType.fromValue("String")) - .required(false).builtIn("AWS::Auth::AccountIdEndpointMode").build()) - .addParameter( - Parameter.builder().name("listOfStrings").type(ParameterType.fromValue("StringArray")) - .required(false).build()) - .addParameter( - Parameter - .builder() - .name("defaultListOfStrings") - .type(ParameterType.fromValue("stringarray")) - .required(false) - .defaultValue( - Value.fromArray(Arrays.asList("item1", "item2", "item3").stream() - .map(Value::fromStr).collect(Collectors.toList()))).build()) - .addParameter( - Parameter.builder().name("endpointId").type(ParameterType.fromValue("string")) - .required(false).build()) - .addParameter( - Parameter.builder().name("defaultTrueParam").type(ParameterType.fromValue("boolean")) - .required(false).documentation("A param that defauls to true") - .defaultValue(Value.fromBool(true)).build()) - .addParameter( - Parameter.builder().name("defaultStringParam").type(ParameterType.fromValue("string")) - .required(false).defaultValue(Value.fromStr("hello endpoints")).build()) - .addParameter( - Parameter.builder().name("deprecatedParam").type(ParameterType.fromValue("string")) - .required(false).deprecated(new Parameter.Deprecated("Don't use!", "2021-01-01")) - .build()) - .addParameter( - Parameter.builder().name("booleanContextParam").type(ParameterType.fromValue("boolean")) - .required(false).build()) - .addParameter( - Parameter.builder().name("stringContextParam").type(ParameterType.fromValue("string")) - .required(false).build()) - .addParameter( - Parameter.builder().name("operationContextParam").type(ParameterType.fromValue("string")) - .required(false).build()) - .addParameter( - Parameter.builder().name("ArnList").type(ParameterType.fromValue("StringArray")) - .required(false).documentation("Parameter from the customization config").build()) - .build()).addRule(endpointRule_0()).build(); + private static RuleResult endpointRule2(QueryEndpointParams params, RulePartition partitionResult) { + if (params.endpointId() != null) { + if (params.useFipsEndpoint() != null && params.useFipsEndpoint()) { + return RuleResult.error("FIPS endpoints not supported with multi-region endpoints"); + } + if (params.useFipsEndpoint() == null && params.useDualStackEndpoint() != null && params.useDualStackEndpoint()) { + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", + params.endpointId() + ".query." + partitionResult.dualStackDnsSuffix(), -1, "")) + .putAttribute( + AwsEndpointAttribute.AUTH_SCHEMES, + Arrays.asList(SigV4aAuthScheme.builder().signingName("query") + .signingRegionSet(Arrays.asList("*")).build())).build()); + } + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", params.endpointId() + ".query." + partitionResult.dnsSuffix(), + -1, "")) + .putAttribute( + AwsEndpointAttribute.AUTH_SCHEMES, + Arrays.asList(SigV4aAuthScheme.builder().signingName("query").signingRegionSet(Arrays.asList("*")) + .build())).build()); + } + return RuleResult.carryOn(); + } + + private static RuleResult endpointRule6(QueryEndpointParams params, RulePartition partitionResult) { + if (RulesFunctions.isValidHostLabel(params.regionId(), false)) { + if (params.useFipsEndpoint() != null && params.useFipsEndpoint() && params.useDualStackEndpoint() == null) { + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", + "query-fips." + params.regionId() + "." + partitionResult.dnsSuffix(), -1, "")) + .putAttribute( + AwsEndpointAttribute.AUTH_SCHEMES, + Arrays.asList(SigV4aAuthScheme.builder().signingName("query") + .signingRegionSet(Arrays.asList("*")).build())).build()); + } + if (params.useDualStackEndpoint() != null && params.useDualStackEndpoint() && params.useFipsEndpoint() == null) { + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", + "query." + params.regionId() + "." + partitionResult.dualStackDnsSuffix(), -1, "")) + .putAttribute( + AwsEndpointAttribute.AUTH_SCHEMES, + Arrays.asList(SigV4aAuthScheme.builder().signingName("query") + .signingRegionSet(Arrays.asList("*")).build(), + SigV4AuthScheme.builder().signingName("query").signingRegion(params.regionId()).build())) + .build()); + } + if (params.useDualStackEndpoint() != null && params.useFipsEndpoint() != null && params.useDualStackEndpoint() + && params.useFipsEndpoint()) { + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", + "query-fips." + params.regionId() + "." + partitionResult.dualStackDnsSuffix(), -1, "")) + .putAttribute( + AwsEndpointAttribute.AUTH_SCHEMES, + Arrays.asList(SigV4aAuthScheme.builder().signingName("query") + .signingRegionSet(Arrays.asList("*")).build())).build()); + } + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", "query." + params.regionId() + "." + partitionResult.dnsSuffix(), + -1, "")).build()); + } + return RuleResult.carryOn(); } @Override @@ -471,17 +165,4 @@ public boolean equals(Object rhs) { public int hashCode() { return getClass().hashCode(); } - - private void addKnownProperty(EndpointAttributeProvider provider, Endpoint.Builder builder, Value value) { - builder.putAttribute(provider.attributeKey(), provider.attributeValue(value)); - } - - private void addKnownProperties(Endpoint.Builder builder, Map properties) { - List> knownProperties = software.module.test.KNOWN_PROPS; - for (EndpointAttributeProvider p : knownProperties) { - if (properties.containsKey(p.propertyName())) { - addKnownProperty(p, builder, properties.get(p.propertyName())); - } - } - } } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules2/endpoint-provider-metric-values-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-metric-values-class.java similarity index 79% rename from codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules2/endpoint-provider-metric-values-class.java rename to codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-metric-values-class.java index cadeb0b86890..fde716375b74 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules2/endpoint-provider-metric-values-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-metric-values-class.java @@ -10,7 +10,6 @@ import software.amazon.awssdk.core.exception.SdkClientException; import software.amazon.awssdk.endpoints.Endpoint; import software.amazon.awssdk.endpoints.EndpointUrl; -import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.query.endpoints.QueryEndpointParams; import software.amazon.awssdk.services.query.endpoints.QueryEndpointProvider; import software.amazon.awssdk.utils.CompletableFutureUtils; @@ -23,9 +22,7 @@ public final class DefaultQueryEndpointProvider implements QueryEndpointProvider public CompletableFuture resolveEndpoint(QueryEndpointParams params) { Validate.notNull(params.region(), "Parameter 'region' must not be null"); try { - Region region = params.region(); - String regionId = region == null ? null : region.id(); - RuleResult result = endpointRule0(params, regionId); + RuleResult result = endpointRule0(params); if (result.canContinue()) { throw SdkClientException.create("Rule engine did not reach an error or endpoint result"); } @@ -42,22 +39,22 @@ public CompletableFuture resolveEndpoint(QueryEndpointParams params) { } } - private static RuleResult endpointRule0(QueryEndpointParams params, String region) { - return endpointRule1(params, region); + private static RuleResult endpointRule0(QueryEndpointParams params) { + return endpointRule1(params); } - private static RuleResult endpointRule1(QueryEndpointParams params, String region) { - RulePartition partitionResult = RulesFunctions.awsPartition(region); + private static RuleResult endpointRule1(QueryEndpointParams params) { + RulePartition partitionResult = RulesFunctions.awsPartition(params.regionId()); if (partitionResult != null) { RuleResult result = endpointRule2(params, partitionResult); if (result.isResolved()) { return result; } - result = endpointRule6(params, region, partitionResult); + result = endpointRule6(params, partitionResult); if (result.isResolved()) { return result; } - return RuleResult.error(region + " is not a valid HTTP host-label"); + return RuleResult.error(params.regionId() + " is not a valid HTTP host-label"); } return RuleResult.carryOn(); } @@ -71,8 +68,8 @@ private static RuleResult endpointRule2(QueryEndpointParams params, RulePartitio return RuleResult.endpoint(Endpoint .builder() .endpointUrl( - EndpointUrl.fromComponents("https", params.endpointId() + ".query." + partitionResult.dualStackDnsSuffix(), - -1, "")) + EndpointUrl.fromComponents("https", + params.endpointId() + ".query." + partitionResult.dualStackDnsSuffix(), -1, "")) .putAttribute( AwsEndpointAttribute.AUTH_SCHEMES, Arrays.asList(SigV4aAuthScheme.builder().signingName("query") @@ -80,7 +77,9 @@ private static RuleResult endpointRule2(QueryEndpointParams params, RulePartitio } return RuleResult.endpoint(Endpoint .builder() - .endpointUrl(EndpointUrl.fromComponents("https", params.endpointId() + ".query." + partitionResult.dnsSuffix(), -1, "")) + .endpointUrl( + EndpointUrl.fromComponents("https", params.endpointId() + ".query." + partitionResult.dnsSuffix(), + -1, "")) .putAttribute( AwsEndpointAttribute.AUTH_SCHEMES, Arrays.asList(SigV4aAuthScheme.builder().signingName("query").signingRegionSet(Arrays.asList("*")) @@ -89,12 +88,14 @@ private static RuleResult endpointRule2(QueryEndpointParams params, RulePartitio return RuleResult.carryOn(); } - private static RuleResult endpointRule6(QueryEndpointParams params, String region, RulePartition partitionResult) { - if (RulesFunctions.isValidHostLabel(region, false)) { + private static RuleResult endpointRule6(QueryEndpointParams params, RulePartition partitionResult) { + if (RulesFunctions.isValidHostLabel(params.regionId(), false)) { if (params.useFipsEndpoint() != null && params.useFipsEndpoint() && params.useDualStackEndpoint() == null) { return RuleResult.endpoint(Endpoint .builder() - .endpointUrl(EndpointUrl.fromComponents("https", "query-fips." + region + "." + partitionResult.dnsSuffix(), -1, "")) + .endpointUrl( + EndpointUrl.fromComponents("https", + "query-fips." + params.regionId() + "." + partitionResult.dnsSuffix(), -1, "")) .putAttribute( AwsEndpointAttribute.AUTH_SCHEMES, Arrays.asList(SigV4aAuthScheme.builder().signingName("query") @@ -104,27 +105,32 @@ private static RuleResult endpointRule6(QueryEndpointParams params, String regio return RuleResult.endpoint(Endpoint .builder() .endpointUrl( - EndpointUrl.fromComponents("https", "query." + region + "." + partitionResult.dualStackDnsSuffix(), -1, "")) + EndpointUrl.fromComponents("https", + "query." + params.regionId() + "." + partitionResult.dualStackDnsSuffix(), -1, "")) .putAttribute( AwsEndpointAttribute.AUTH_SCHEMES, Arrays.asList(SigV4aAuthScheme.builder().signingName("query") .signingRegionSet(Arrays.asList("*")).build(), - SigV4AuthScheme.builder().signingName("query").signingRegion(region).build())).build()); + SigV4AuthScheme.builder().signingName("query").signingRegion(params.regionId()).build())) + .build()); } if (params.useDualStackEndpoint() != null && params.useFipsEndpoint() != null && params.useDualStackEndpoint() && params.useFipsEndpoint()) { return RuleResult.endpoint(Endpoint .builder() .endpointUrl( - EndpointUrl.fromComponents("https", "query-fips." + region + "." + partitionResult.dualStackDnsSuffix(), -1, - "")) + EndpointUrl.fromComponents("https", + "query-fips." + params.regionId() + "." + partitionResult.dualStackDnsSuffix(), -1, "")) .putAttribute( AwsEndpointAttribute.AUTH_SCHEMES, Arrays.asList(SigV4aAuthScheme.builder().signingName("query") .signingRegionSet(Arrays.asList("*")).build())).build()); } - return RuleResult.endpoint(Endpoint.builder() - .endpointUrl(EndpointUrl.fromComponents("https", "query." + region + "." + partitionResult.dnsSuffix(), -1, "")).build()); + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", "query." + params.regionId() + "." + partitionResult.dnsSuffix(), + -1, "")).build()); } return RuleResult.carryOn(); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules2/endpoint-provider-unknown-property-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-unknown-property-class.java similarity index 100% rename from codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules2/endpoint-provider-unknown-property-class.java rename to codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-unknown-property-class.java diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules2/endpoint-provider-uri-cache-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-uri-cache-class.java similarity index 82% rename from codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules2/endpoint-provider-uri-cache-class.java rename to codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-uri-cache-class.java index 7810a21ca78e..d533d71b5784 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules2/endpoint-provider-uri-cache-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules/endpoint-provider-uri-cache-class.java @@ -10,7 +10,6 @@ import software.amazon.awssdk.core.exception.SdkClientException; import software.amazon.awssdk.endpoints.Endpoint; import software.amazon.awssdk.endpoints.EndpointUrl; -import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.query.endpoints.QueryEndpointParams; import software.amazon.awssdk.services.query.endpoints.QueryEndpointProvider; import software.amazon.awssdk.utils.CompletableFutureUtils; @@ -23,9 +22,7 @@ public final class DefaultQueryEndpointProvider implements QueryEndpointProvider public CompletableFuture resolveEndpoint(QueryEndpointParams params) { Validate.notNull(params.region(), "Parameter 'region' must not be null"); try { - Region region = params.region(); - String regionId = region == null ? null : region.id(); - RuleResult result = endpointRule0(params, regionId); + RuleResult result = endpointRule0(params); if (result.canContinue()) { throw SdkClientException.create("Rule engine did not reach an error or endpoint result"); } @@ -42,22 +39,22 @@ public CompletableFuture resolveEndpoint(QueryEndpointParams params) { } } - private static RuleResult endpointRule0(QueryEndpointParams params, String region) { - return endpointRule1(params, region); + private static RuleResult endpointRule0(QueryEndpointParams params) { + return endpointRule1(params); } - private static RuleResult endpointRule1(QueryEndpointParams params, String region) { - RulePartition partitionResult = RulesFunctions.awsPartition(region); + private static RuleResult endpointRule1(QueryEndpointParams params) { + RulePartition partitionResult = RulesFunctions.awsPartition(params.regionId()); if (partitionResult != null) { RuleResult result = endpointRule2(params, partitionResult); if (result.isResolved()) { return result; } - result = endpointRule6(params, region, partitionResult); + result = endpointRule6(params, partitionResult); if (result.isResolved()) { return result; } - return RuleResult.error(region + " is not a valid HTTP host-label"); + return RuleResult.error(params.regionId() + " is not a valid HTTP host-label"); if (params.useFipsEndpoint() == null && params.useDualStackEndpoint() != null && params.useDualStackEndpoint() && params.arnList() != null) { String firstArn = RulesFunctions.listAccess(params.arnList(), 0); @@ -92,8 +89,8 @@ private static RuleResult endpointRule2(QueryEndpointParams params, RulePartitio return RuleResult.endpoint(Endpoint .builder() .endpointUrl( - EndpointUrl.fromComponents("https", params.endpointId() + ".query." + partitionResult.dualStackDnsSuffix(), - -1, "")) + EndpointUrl.fromComponents("https", + params.endpointId() + ".query." + partitionResult.dualStackDnsSuffix(), -1, "")) .putAttribute( AwsEndpointAttribute.AUTH_SCHEMES, Arrays.asList(SigV4aAuthScheme.builder().signingName("query") @@ -101,7 +98,9 @@ private static RuleResult endpointRule2(QueryEndpointParams params, RulePartitio } return RuleResult.endpoint(Endpoint .builder() - .endpointUrl(EndpointUrl.fromComponents("https", params.endpointId() + ".query." + partitionResult.dnsSuffix(), -1, "")) + .endpointUrl( + EndpointUrl.fromComponents("https", params.endpointId() + ".query." + partitionResult.dnsSuffix(), + -1, "")) .putAttribute( AwsEndpointAttribute.AUTH_SCHEMES, Arrays.asList(SigV4aAuthScheme.builder().signingName("query").signingRegionSet(Arrays.asList("*")) @@ -110,12 +109,14 @@ private static RuleResult endpointRule2(QueryEndpointParams params, RulePartitio return RuleResult.carryOn(); } - private static RuleResult endpointRule6(QueryEndpointParams params, String region, RulePartition partitionResult) { - if (RulesFunctions.isValidHostLabel(region, false)) { + private static RuleResult endpointRule6(QueryEndpointParams params, RulePartition partitionResult) { + if (RulesFunctions.isValidHostLabel(params.regionId(), false)) { if (params.useFipsEndpoint() != null && params.useFipsEndpoint() && params.useDualStackEndpoint() == null) { return RuleResult.endpoint(Endpoint .builder() - .endpointUrl(EndpointUrl.fromComponents("https", "query-fips." + region + "." + partitionResult.dnsSuffix(), -1, "")) + .endpointUrl( + EndpointUrl.fromComponents("https", + "query-fips." + params.regionId() + "." + partitionResult.dnsSuffix(), -1, "")) .putAttribute( AwsEndpointAttribute.AUTH_SCHEMES, Arrays.asList(SigV4aAuthScheme.builder().signingName("query") @@ -125,27 +126,32 @@ private static RuleResult endpointRule6(QueryEndpointParams params, String regio return RuleResult.endpoint(Endpoint .builder() .endpointUrl( - EndpointUrl.fromComponents("https", "query." + region + "." + partitionResult.dualStackDnsSuffix(), -1, "")) + EndpointUrl.fromComponents("https", + "query." + params.regionId() + "." + partitionResult.dualStackDnsSuffix(), -1, "")) .putAttribute( AwsEndpointAttribute.AUTH_SCHEMES, Arrays.asList(SigV4aAuthScheme.builder().signingName("query") .signingRegionSet(Arrays.asList("*")).build(), - SigV4AuthScheme.builder().signingName("query").signingRegion(region).build())).build()); + SigV4AuthScheme.builder().signingName("query").signingRegion(params.regionId()).build())) + .build()); } if (params.useDualStackEndpoint() != null && params.useFipsEndpoint() != null && params.useDualStackEndpoint() && params.useFipsEndpoint()) { return RuleResult.endpoint(Endpoint .builder() .endpointUrl( - EndpointUrl.fromComponents("https", "query-fips." + region + "." + partitionResult.dualStackDnsSuffix(), -1, - "")) + EndpointUrl.fromComponents("https", + "query-fips." + params.regionId() + "." + partitionResult.dualStackDnsSuffix(), -1, "")) .putAttribute( AwsEndpointAttribute.AUTH_SCHEMES, Arrays.asList(SigV4aAuthScheme.builder().signingName("query") .signingRegionSet(Arrays.asList("*")).build())).build()); } - return RuleResult.endpoint(Endpoint.builder() - .endpointUrl(EndpointUrl.fromComponents("https", "query." + region + "." + partitionResult.dnsSuffix(), -1, "")).build()); + return RuleResult.endpoint(Endpoint + .builder() + .endpointUrl( + EndpointUrl.fromComponents("https", "query." + params.regionId() + "." + partitionResult.dnsSuffix(), + -1, "")).build()); } return RuleResult.carryOn(); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules2/endpoint-provider-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules2/endpoint-provider-class.java deleted file mode 100644 index 7810a21ca78e..000000000000 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules2/endpoint-provider-class.java +++ /dev/null @@ -1,162 +0,0 @@ -package software.amazon.awssdk.services.query.endpoints.internal; - -import java.util.Arrays; -import java.util.concurrent.CompletableFuture; -import software.amazon.awssdk.annotations.Generated; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.awscore.endpoints.AwsEndpointAttribute; -import software.amazon.awssdk.awscore.endpoints.authscheme.SigV4AuthScheme; -import software.amazon.awssdk.awscore.endpoints.authscheme.SigV4aAuthScheme; -import software.amazon.awssdk.core.exception.SdkClientException; -import software.amazon.awssdk.endpoints.Endpoint; -import software.amazon.awssdk.endpoints.EndpointUrl; -import software.amazon.awssdk.regions.Region; -import software.amazon.awssdk.services.query.endpoints.QueryEndpointParams; -import software.amazon.awssdk.services.query.endpoints.QueryEndpointProvider; -import software.amazon.awssdk.utils.CompletableFutureUtils; -import software.amazon.awssdk.utils.Validate; - -@Generated("software.amazon.awssdk:codegen") -@SdkInternalApi -public final class DefaultQueryEndpointProvider implements QueryEndpointProvider { - @Override - public CompletableFuture resolveEndpoint(QueryEndpointParams params) { - Validate.notNull(params.region(), "Parameter 'region' must not be null"); - try { - Region region = params.region(); - String regionId = region == null ? null : region.id(); - RuleResult result = endpointRule0(params, regionId); - if (result.canContinue()) { - throw SdkClientException.create("Rule engine did not reach an error or endpoint result"); - } - if (result.isError()) { - String errorMsg = result.error(); - if (errorMsg.contains("Invalid ARN") && errorMsg.contains(":s3:::")) { - errorMsg += ". Use the bucket name instead of simple bucket ARNs in GetBucketLocationRequest."; - } - throw SdkClientException.create(errorMsg); - } - return CompletableFuture.completedFuture(result.endpoint()); - } catch (Exception error) { - return CompletableFutureUtils.failedFuture(error); - } - } - - private static RuleResult endpointRule0(QueryEndpointParams params, String region) { - return endpointRule1(params, region); - } - - private static RuleResult endpointRule1(QueryEndpointParams params, String region) { - RulePartition partitionResult = RulesFunctions.awsPartition(region); - if (partitionResult != null) { - RuleResult result = endpointRule2(params, partitionResult); - if (result.isResolved()) { - return result; - } - result = endpointRule6(params, region, partitionResult); - if (result.isResolved()) { - return result; - } - return RuleResult.error(region + " is not a valid HTTP host-label"); - if (params.useFipsEndpoint() == null && params.useDualStackEndpoint() != null && params.useDualStackEndpoint() - && params.arnList() != null) { - String firstArn = RulesFunctions.listAccess(params.arnList(), 0); - if (firstArn != null) { - RuleArn parsedArn = RulesFunctions.awsParseArn(firstArn); - if (parsedArn != null) { - String arnResourceId = RulesFunctions.listAccess(parsedArn.resourceId(), 0); - if (arnResourceId != null) { - return RuleResult.endpoint(Endpoint - .builder() - .endpointUrl( - EndpointUrl.fromComponents("https", arnResourceId + "." + params.endpointId() - + ".query." + partitionResult.dualStackDnsSuffix(), -1, "")) - .putAttribute( - AwsEndpointAttribute.AUTH_SCHEMES, - Arrays.asList(SigV4aAuthScheme.builder().signingName("query") - .signingRegionSet(Arrays.asList("*")).build())).build()); - } - } - } - } - } - return RuleResult.carryOn(); - } - - private static RuleResult endpointRule2(QueryEndpointParams params, RulePartition partitionResult) { - if (params.endpointId() != null) { - if (params.useFipsEndpoint() != null && params.useFipsEndpoint()) { - return RuleResult.error("FIPS endpoints not supported with multi-region endpoints"); - } - if (params.useFipsEndpoint() == null && params.useDualStackEndpoint() != null && params.useDualStackEndpoint()) { - return RuleResult.endpoint(Endpoint - .builder() - .endpointUrl( - EndpointUrl.fromComponents("https", params.endpointId() + ".query." + partitionResult.dualStackDnsSuffix(), - -1, "")) - .putAttribute( - AwsEndpointAttribute.AUTH_SCHEMES, - Arrays.asList(SigV4aAuthScheme.builder().signingName("query") - .signingRegionSet(Arrays.asList("*")).build())).build()); - } - return RuleResult.endpoint(Endpoint - .builder() - .endpointUrl(EndpointUrl.fromComponents("https", params.endpointId() + ".query." + partitionResult.dnsSuffix(), -1, "")) - .putAttribute( - AwsEndpointAttribute.AUTH_SCHEMES, - Arrays.asList(SigV4aAuthScheme.builder().signingName("query").signingRegionSet(Arrays.asList("*")) - .build())).build()); - } - return RuleResult.carryOn(); - } - - private static RuleResult endpointRule6(QueryEndpointParams params, String region, RulePartition partitionResult) { - if (RulesFunctions.isValidHostLabel(region, false)) { - if (params.useFipsEndpoint() != null && params.useFipsEndpoint() && params.useDualStackEndpoint() == null) { - return RuleResult.endpoint(Endpoint - .builder() - .endpointUrl(EndpointUrl.fromComponents("https", "query-fips." + region + "." + partitionResult.dnsSuffix(), -1, "")) - .putAttribute( - AwsEndpointAttribute.AUTH_SCHEMES, - Arrays.asList(SigV4aAuthScheme.builder().signingName("query") - .signingRegionSet(Arrays.asList("*")).build())).build()); - } - if (params.useDualStackEndpoint() != null && params.useDualStackEndpoint() && params.useFipsEndpoint() == null) { - return RuleResult.endpoint(Endpoint - .builder() - .endpointUrl( - EndpointUrl.fromComponents("https", "query." + region + "." + partitionResult.dualStackDnsSuffix(), -1, "")) - .putAttribute( - AwsEndpointAttribute.AUTH_SCHEMES, - Arrays.asList(SigV4aAuthScheme.builder().signingName("query") - .signingRegionSet(Arrays.asList("*")).build(), - SigV4AuthScheme.builder().signingName("query").signingRegion(region).build())).build()); - } - if (params.useDualStackEndpoint() != null && params.useFipsEndpoint() != null && params.useDualStackEndpoint() - && params.useFipsEndpoint()) { - return RuleResult.endpoint(Endpoint - .builder() - .endpointUrl( - EndpointUrl.fromComponents("https", "query-fips." + region + "." + partitionResult.dualStackDnsSuffix(), -1, - "")) - .putAttribute( - AwsEndpointAttribute.AUTH_SCHEMES, - Arrays.asList(SigV4aAuthScheme.builder().signingName("query") - .signingRegionSet(Arrays.asList("*")).build())).build()); - } - return RuleResult.endpoint(Endpoint.builder() - .endpointUrl(EndpointUrl.fromComponents("https", "query." + region + "." + partitionResult.dnsSuffix(), -1, "")).build()); - } - return RuleResult.carryOn(); - } - - @Override - public boolean equals(Object rhs) { - return rhs != null && getClass().equals(rhs.getClass()); - } - - @Override - public int hashCode() { - return getClass().hashCode(); - } -} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules2/endpoint-provider-know-prop-override-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules2/endpoint-provider-know-prop-override-class.java deleted file mode 100644 index 7810a21ca78e..000000000000 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/rules2/endpoint-provider-know-prop-override-class.java +++ /dev/null @@ -1,162 +0,0 @@ -package software.amazon.awssdk.services.query.endpoints.internal; - -import java.util.Arrays; -import java.util.concurrent.CompletableFuture; -import software.amazon.awssdk.annotations.Generated; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.awscore.endpoints.AwsEndpointAttribute; -import software.amazon.awssdk.awscore.endpoints.authscheme.SigV4AuthScheme; -import software.amazon.awssdk.awscore.endpoints.authscheme.SigV4aAuthScheme; -import software.amazon.awssdk.core.exception.SdkClientException; -import software.amazon.awssdk.endpoints.Endpoint; -import software.amazon.awssdk.endpoints.EndpointUrl; -import software.amazon.awssdk.regions.Region; -import software.amazon.awssdk.services.query.endpoints.QueryEndpointParams; -import software.amazon.awssdk.services.query.endpoints.QueryEndpointProvider; -import software.amazon.awssdk.utils.CompletableFutureUtils; -import software.amazon.awssdk.utils.Validate; - -@Generated("software.amazon.awssdk:codegen") -@SdkInternalApi -public final class DefaultQueryEndpointProvider implements QueryEndpointProvider { - @Override - public CompletableFuture resolveEndpoint(QueryEndpointParams params) { - Validate.notNull(params.region(), "Parameter 'region' must not be null"); - try { - Region region = params.region(); - String regionId = region == null ? null : region.id(); - RuleResult result = endpointRule0(params, regionId); - if (result.canContinue()) { - throw SdkClientException.create("Rule engine did not reach an error or endpoint result"); - } - if (result.isError()) { - String errorMsg = result.error(); - if (errorMsg.contains("Invalid ARN") && errorMsg.contains(":s3:::")) { - errorMsg += ". Use the bucket name instead of simple bucket ARNs in GetBucketLocationRequest."; - } - throw SdkClientException.create(errorMsg); - } - return CompletableFuture.completedFuture(result.endpoint()); - } catch (Exception error) { - return CompletableFutureUtils.failedFuture(error); - } - } - - private static RuleResult endpointRule0(QueryEndpointParams params, String region) { - return endpointRule1(params, region); - } - - private static RuleResult endpointRule1(QueryEndpointParams params, String region) { - RulePartition partitionResult = RulesFunctions.awsPartition(region); - if (partitionResult != null) { - RuleResult result = endpointRule2(params, partitionResult); - if (result.isResolved()) { - return result; - } - result = endpointRule6(params, region, partitionResult); - if (result.isResolved()) { - return result; - } - return RuleResult.error(region + " is not a valid HTTP host-label"); - if (params.useFipsEndpoint() == null && params.useDualStackEndpoint() != null && params.useDualStackEndpoint() - && params.arnList() != null) { - String firstArn = RulesFunctions.listAccess(params.arnList(), 0); - if (firstArn != null) { - RuleArn parsedArn = RulesFunctions.awsParseArn(firstArn); - if (parsedArn != null) { - String arnResourceId = RulesFunctions.listAccess(parsedArn.resourceId(), 0); - if (arnResourceId != null) { - return RuleResult.endpoint(Endpoint - .builder() - .endpointUrl( - EndpointUrl.fromComponents("https", arnResourceId + "." + params.endpointId() - + ".query." + partitionResult.dualStackDnsSuffix(), -1, "")) - .putAttribute( - AwsEndpointAttribute.AUTH_SCHEMES, - Arrays.asList(SigV4aAuthScheme.builder().signingName("query") - .signingRegionSet(Arrays.asList("*")).build())).build()); - } - } - } - } - } - return RuleResult.carryOn(); - } - - private static RuleResult endpointRule2(QueryEndpointParams params, RulePartition partitionResult) { - if (params.endpointId() != null) { - if (params.useFipsEndpoint() != null && params.useFipsEndpoint()) { - return RuleResult.error("FIPS endpoints not supported with multi-region endpoints"); - } - if (params.useFipsEndpoint() == null && params.useDualStackEndpoint() != null && params.useDualStackEndpoint()) { - return RuleResult.endpoint(Endpoint - .builder() - .endpointUrl( - EndpointUrl.fromComponents("https", params.endpointId() + ".query." + partitionResult.dualStackDnsSuffix(), - -1, "")) - .putAttribute( - AwsEndpointAttribute.AUTH_SCHEMES, - Arrays.asList(SigV4aAuthScheme.builder().signingName("query") - .signingRegionSet(Arrays.asList("*")).build())).build()); - } - return RuleResult.endpoint(Endpoint - .builder() - .endpointUrl(EndpointUrl.fromComponents("https", params.endpointId() + ".query." + partitionResult.dnsSuffix(), -1, "")) - .putAttribute( - AwsEndpointAttribute.AUTH_SCHEMES, - Arrays.asList(SigV4aAuthScheme.builder().signingName("query").signingRegionSet(Arrays.asList("*")) - .build())).build()); - } - return RuleResult.carryOn(); - } - - private static RuleResult endpointRule6(QueryEndpointParams params, String region, RulePartition partitionResult) { - if (RulesFunctions.isValidHostLabel(region, false)) { - if (params.useFipsEndpoint() != null && params.useFipsEndpoint() && params.useDualStackEndpoint() == null) { - return RuleResult.endpoint(Endpoint - .builder() - .endpointUrl(EndpointUrl.fromComponents("https", "query-fips." + region + "." + partitionResult.dnsSuffix(), -1, "")) - .putAttribute( - AwsEndpointAttribute.AUTH_SCHEMES, - Arrays.asList(SigV4aAuthScheme.builder().signingName("query") - .signingRegionSet(Arrays.asList("*")).build())).build()); - } - if (params.useDualStackEndpoint() != null && params.useDualStackEndpoint() && params.useFipsEndpoint() == null) { - return RuleResult.endpoint(Endpoint - .builder() - .endpointUrl( - EndpointUrl.fromComponents("https", "query." + region + "." + partitionResult.dualStackDnsSuffix(), -1, "")) - .putAttribute( - AwsEndpointAttribute.AUTH_SCHEMES, - Arrays.asList(SigV4aAuthScheme.builder().signingName("query") - .signingRegionSet(Arrays.asList("*")).build(), - SigV4AuthScheme.builder().signingName("query").signingRegion(region).build())).build()); - } - if (params.useDualStackEndpoint() != null && params.useFipsEndpoint() != null && params.useDualStackEndpoint() - && params.useFipsEndpoint()) { - return RuleResult.endpoint(Endpoint - .builder() - .endpointUrl( - EndpointUrl.fromComponents("https", "query-fips." + region + "." + partitionResult.dualStackDnsSuffix(), -1, - "")) - .putAttribute( - AwsEndpointAttribute.AUTH_SCHEMES, - Arrays.asList(SigV4aAuthScheme.builder().signingName("query") - .signingRegionSet(Arrays.asList("*")).build())).build()); - } - return RuleResult.endpoint(Endpoint.builder() - .endpointUrl(EndpointUrl.fromComponents("https", "query." + region + "." + partitionResult.dnsSuffix(), -1, "")).build()); - } - return RuleResult.carryOn(); - } - - @Override - public boolean equals(Object rhs) { - return rhs != null && getClass().equals(rhs.getClass()); - } - - @Override - public int hashCode() { - return getClass().hashCode(); - } -} diff --git a/services/accessanalyzer/src/main/resources/codegen-resources/customization.config b/services/accessanalyzer/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/accessanalyzer/src/main/resources/codegen-resources/customization.config +++ b/services/accessanalyzer/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/account/src/main/resources/codegen-resources/customization.config b/services/account/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/account/src/main/resources/codegen-resources/customization.config +++ b/services/account/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/acm/src/main/resources/codegen-resources/customization.config b/services/acm/src/main/resources/codegen-resources/customization.config index 0d45746d8f8a..a4de213ec307 100644 --- a/services/acm/src/main/resources/codegen-resources/customization.config +++ b/services/acm/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listCertificates" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/acmpca/src/main/resources/codegen-resources/customization.config b/services/acmpca/src/main/resources/codegen-resources/customization.config index 866842bc7215..db9b82cfd1ce 100644 --- a/services/acmpca/src/main/resources/codegen-resources/customization.config +++ b/services/acmpca/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listCertificateAuthorities" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/amp/src/main/resources/codegen-resources/customization.config b/services/amp/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/amp/src/main/resources/codegen-resources/customization.config +++ b/services/amp/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/amplify/src/main/resources/codegen-resources/customization.config b/services/amplify/src/main/resources/codegen-resources/customization.config index 1a37c2370c98..cd8f1c2140be 100644 --- a/services/amplify/src/main/resources/codegen-resources/customization.config +++ b/services/amplify/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listApps" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/amplifybackend/src/main/resources/codegen-resources/customization.config b/services/amplifybackend/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/amplifybackend/src/main/resources/codegen-resources/customization.config +++ b/services/amplifybackend/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/amplifyuibuilder/src/main/resources/codegen-resources/customization.config b/services/amplifyuibuilder/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/amplifyuibuilder/src/main/resources/codegen-resources/customization.config +++ b/services/amplifyuibuilder/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/apigateway/src/main/resources/codegen-resources/customization.config b/services/apigateway/src/main/resources/codegen-resources/customization.config index 082dea59b374..520761d7df21 100644 --- a/services/apigateway/src/main/resources/codegen-resources/customization.config +++ b/services/apigateway/src/main/resources/codegen-resources/customization.config @@ -23,6 +23,5 @@ ], "interceptors": [ "software.amazon.awssdk.services.apigateway.internal.AcceptJsonInterceptor" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/apigatewaymanagementapi/src/main/resources/codegen-resources/customization.config b/services/apigatewaymanagementapi/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/apigatewaymanagementapi/src/main/resources/codegen-resources/customization.config +++ b/services/apigatewaymanagementapi/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/apigatewayv2/src/main/resources/codegen-resources/customization.config b/services/apigatewayv2/src/main/resources/codegen-resources/customization.config index 11eb6b271d1f..1474ea0d5c3e 100644 --- a/services/apigatewayv2/src/main/resources/codegen-resources/customization.config +++ b/services/apigatewayv2/src/main/resources/codegen-resources/customization.config @@ -2,6 +2,5 @@ "verifiedSimpleMethods": [ "getApis", "getDomainNames" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/appconfig/src/main/resources/codegen-resources/customization.config b/services/appconfig/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/appconfig/src/main/resources/codegen-resources/customization.config +++ b/services/appconfig/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/appconfigdata/src/main/resources/codegen-resources/customization.config b/services/appconfigdata/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/appconfigdata/src/main/resources/codegen-resources/customization.config +++ b/services/appconfigdata/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/appfabric/src/main/resources/codegen-resources/customization.config b/services/appfabric/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/appfabric/src/main/resources/codegen-resources/customization.config +++ b/services/appfabric/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/appflow/src/main/resources/codegen-resources/customization.config b/services/appflow/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/appflow/src/main/resources/codegen-resources/customization.config +++ b/services/appflow/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/appintegrations/src/main/resources/codegen-resources/customization.config b/services/appintegrations/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/appintegrations/src/main/resources/codegen-resources/customization.config +++ b/services/appintegrations/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/applicationautoscaling/src/main/resources/codegen-resources/customization.config b/services/applicationautoscaling/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/applicationautoscaling/src/main/resources/codegen-resources/customization.config +++ b/services/applicationautoscaling/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/applicationcostprofiler/src/main/resources/codegen-resources/customization.config b/services/applicationcostprofiler/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/applicationcostprofiler/src/main/resources/codegen-resources/customization.config +++ b/services/applicationcostprofiler/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/applicationdiscovery/src/main/resources/codegen-resources/customization.config b/services/applicationdiscovery/src/main/resources/codegen-resources/customization.config index dfddca8bbd59..d344cbdbcb95 100644 --- a/services/applicationdiscovery/src/main/resources/codegen-resources/customization.config +++ b/services/applicationdiscovery/src/main/resources/codegen-resources/customization.config @@ -16,6 +16,5 @@ "deprecatedOperations": [ "DescribeExportConfigurations", "ExportConfigurations" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/applicationinsights/src/main/resources/codegen-resources/customization.config b/services/applicationinsights/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/applicationinsights/src/main/resources/codegen-resources/customization.config +++ b/services/applicationinsights/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/appmesh/src/main/resources/codegen-resources/customization.config b/services/appmesh/src/main/resources/codegen-resources/customization.config index e7aad41e84d7..ef03b85518cc 100644 --- a/services/appmesh/src/main/resources/codegen-resources/customization.config +++ b/services/appmesh/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listMeshes" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/apprunner/src/main/resources/codegen-resources/customization.config b/services/apprunner/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/apprunner/src/main/resources/codegen-resources/customization.config +++ b/services/apprunner/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/appstream/src/main/resources/codegen-resources/customization.config b/services/appstream/src/main/resources/codegen-resources/customization.config index 8f6624671cda..1c8d014e4ede 100644 --- a/services/appstream/src/main/resources/codegen-resources/customization.config +++ b/services/appstream/src/main/resources/codegen-resources/customization.config @@ -9,6 +9,5 @@ "describeImageBuilders", "describeImages", "describeStacks" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/appsync/src/main/resources/codegen-resources/customization.config b/services/appsync/src/main/resources/codegen-resources/customization.config index 1ab9852214b6..80acbbb56853 100644 --- a/services/appsync/src/main/resources/codegen-resources/customization.config +++ b/services/appsync/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listGraphqlApis" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/arczonalshift/src/main/resources/codegen-resources/customization.config b/services/arczonalshift/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/arczonalshift/src/main/resources/codegen-resources/customization.config +++ b/services/arczonalshift/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/artifact/src/main/resources/codegen-resources/customization.config b/services/artifact/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/artifact/src/main/resources/codegen-resources/customization.config +++ b/services/artifact/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/athena/src/main/resources/codegen-resources/customization.config b/services/athena/src/main/resources/codegen-resources/customization.config index a9daa25042de..3d64415e323b 100644 --- a/services/athena/src/main/resources/codegen-resources/customization.config +++ b/services/athena/src/main/resources/codegen-resources/customization.config @@ -2,6 +2,5 @@ "verifiedSimpleMethods": [ "listNamedQueries", "listQueryExecutions" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/auditmanager/src/main/resources/codegen-resources/customization.config b/services/auditmanager/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/auditmanager/src/main/resources/codegen-resources/customization.config +++ b/services/auditmanager/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/autoscaling/src/main/resources/codegen-resources/customization.config b/services/autoscaling/src/main/resources/codegen-resources/customization.config index 43e909112803..05f02f1115ce 100644 --- a/services/autoscaling/src/main/resources/codegen-resources/customization.config +++ b/services/autoscaling/src/main/resources/codegen-resources/customization.config @@ -15,8 +15,7 @@ "describeScheduledActions", "describeTags", "describeTerminationPolicyTypes" - ], + ] - "enableGenerateCompiledEndpointRules": true } diff --git a/services/autoscalingplans/src/main/resources/codegen-resources/customization.config b/services/autoscalingplans/src/main/resources/codegen-resources/customization.config index eada5dbbe962..46cf450eb96e 100644 --- a/services/autoscalingplans/src/main/resources/codegen-resources/customization.config +++ b/services/autoscalingplans/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "describeScalingPlans" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/b2bi/src/main/resources/codegen-resources/customization.config b/services/b2bi/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/b2bi/src/main/resources/codegen-resources/customization.config +++ b/services/b2bi/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/backup/src/main/resources/codegen-resources/customization.config b/services/backup/src/main/resources/codegen-resources/customization.config index d259e73cd1ec..6b4840597fb3 100644 --- a/services/backup/src/main/resources/codegen-resources/customization.config +++ b/services/backup/src/main/resources/codegen-resources/customization.config @@ -9,6 +9,5 @@ "listBackupVaults", "listProtectedResources", "listRestoreJobs" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/backupgateway/src/main/resources/codegen-resources/customization.config b/services/backupgateway/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/backupgateway/src/main/resources/codegen-resources/customization.config +++ b/services/backupgateway/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/batch/src/main/resources/codegen-resources/customization.config b/services/batch/src/main/resources/codegen-resources/customization.config index 2a5ae03cf740..505c1cefc6be 100644 --- a/services/batch/src/main/resources/codegen-resources/customization.config +++ b/services/batch/src/main/resources/codegen-resources/customization.config @@ -6,6 +6,5 @@ ], "excludedSimpleMethods": [ "listJobs" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/bcmdataexports/src/main/resources/codegen-resources/customization.config b/services/bcmdataexports/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/bcmdataexports/src/main/resources/codegen-resources/customization.config +++ b/services/bcmdataexports/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/bedrock/src/main/resources/codegen-resources/customization.config b/services/bedrock/src/main/resources/codegen-resources/customization.config index 42aa381cf2ea..2edb12c857bc 100644 --- a/services/bedrock/src/main/resources/codegen-resources/customization.config +++ b/services/bedrock/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "enableGenerateCompiledEndpointRules": true, "enableEnvironmentBearerToken": true } diff --git a/services/bedrockagent/src/main/resources/codegen-resources/customization.config b/services/bedrockagent/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/bedrockagent/src/main/resources/codegen-resources/customization.config +++ b/services/bedrockagent/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/bedrockagentruntime/src/main/resources/codegen-resources/customization.config b/services/bedrockagentruntime/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/bedrockagentruntime/src/main/resources/codegen-resources/customization.config +++ b/services/bedrockagentruntime/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/bedrockruntime/src/main/resources/codegen-resources/customization.config b/services/bedrockruntime/src/main/resources/codegen-resources/customization.config index 42aa381cf2ea..2edb12c857bc 100644 --- a/services/bedrockruntime/src/main/resources/codegen-resources/customization.config +++ b/services/bedrockruntime/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "enableGenerateCompiledEndpointRules": true, "enableEnvironmentBearerToken": true } diff --git a/services/billingconductor/src/main/resources/codegen-resources/customization.config b/services/billingconductor/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/billingconductor/src/main/resources/codegen-resources/customization.config +++ b/services/billingconductor/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/braket/src/main/resources/codegen-resources/customization.config b/services/braket/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/braket/src/main/resources/codegen-resources/customization.config +++ b/services/braket/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/budgets/src/main/resources/codegen-resources/customization.config b/services/budgets/src/main/resources/codegen-resources/customization.config index 6afa5b2bbf61..98db9ee2f344 100644 --- a/services/budgets/src/main/resources/codegen-resources/customization.config +++ b/services/budgets/src/main/resources/codegen-resources/customization.config @@ -9,6 +9,5 @@ } ] } - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/services/chatbot/src/main/resources/codegen-resources/customization.config b/services/chatbot/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/chatbot/src/main/resources/codegen-resources/customization.config +++ b/services/chatbot/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/chime/src/main/resources/codegen-resources/customization.config b/services/chime/src/main/resources/codegen-resources/customization.config index 0e77f570c68a..4be2534ecac2 100644 --- a/services/chime/src/main/resources/codegen-resources/customization.config +++ b/services/chime/src/main/resources/codegen-resources/customization.config @@ -2,6 +2,5 @@ "verifiedSimpleMethods": [ "listAccounts" ], - "generateEndpointClientTests": true, - "enableGenerateCompiledEndpointRules": true + "generateEndpointClientTests": true } diff --git a/services/chimesdkidentity/src/main/resources/codegen-resources/customization.config b/services/chimesdkidentity/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/chimesdkidentity/src/main/resources/codegen-resources/customization.config +++ b/services/chimesdkidentity/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/chimesdkmediapipelines/src/main/resources/codegen-resources/customization.config b/services/chimesdkmediapipelines/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/chimesdkmediapipelines/src/main/resources/codegen-resources/customization.config +++ b/services/chimesdkmediapipelines/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/chimesdkmeetings/src/main/resources/codegen-resources/customization.config b/services/chimesdkmeetings/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/chimesdkmeetings/src/main/resources/codegen-resources/customization.config +++ b/services/chimesdkmeetings/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/chimesdkmessaging/src/main/resources/codegen-resources/customization.config b/services/chimesdkmessaging/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/chimesdkmessaging/src/main/resources/codegen-resources/customization.config +++ b/services/chimesdkmessaging/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/chimesdkvoice/src/main/resources/codegen-resources/customization.config b/services/chimesdkvoice/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/chimesdkvoice/src/main/resources/codegen-resources/customization.config +++ b/services/chimesdkvoice/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/cleanrooms/src/main/resources/codegen-resources/customization.config b/services/cleanrooms/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/cleanrooms/src/main/resources/codegen-resources/customization.config +++ b/services/cleanrooms/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/cleanroomsml/src/main/resources/codegen-resources/customization.config b/services/cleanroomsml/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/cleanroomsml/src/main/resources/codegen-resources/customization.config +++ b/services/cleanroomsml/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/cloud9/src/main/resources/codegen-resources/customization.config b/services/cloud9/src/main/resources/codegen-resources/customization.config index 8255336b5f6b..ff8d543ed75c 100644 --- a/services/cloud9/src/main/resources/codegen-resources/customization.config +++ b/services/cloud9/src/main/resources/codegen-resources/customization.config @@ -2,6 +2,5 @@ "verifiedSimpleMethods": [ "describeEnvironmentMemberships", "listEnvironments" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/cloudcontrol/src/main/resources/codegen-resources/customization.config b/services/cloudcontrol/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/cloudcontrol/src/main/resources/codegen-resources/customization.config +++ b/services/cloudcontrol/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/clouddirectory/src/main/resources/codegen-resources/customization.config b/services/clouddirectory/src/main/resources/codegen-resources/customization.config index 45b9f344391b..82734c9532b0 100644 --- a/services/clouddirectory/src/main/resources/codegen-resources/customization.config +++ b/services/clouddirectory/src/main/resources/codegen-resources/customization.config @@ -9,6 +9,5 @@ "TypedAttributeValue": { "union": true } - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/services/cloudformation/src/main/resources/codegen-resources/customization.config b/services/cloudformation/src/main/resources/codegen-resources/customization.config index 9705395f0d1c..1686ce0b0490 100644 --- a/services/cloudformation/src/main/resources/codegen-resources/customization.config +++ b/services/cloudformation/src/main/resources/codegen-resources/customization.config @@ -24,8 +24,7 @@ "describeStackResources", "describeStackEvents", "getTemplateSummary" - ], + ] - "enableGenerateCompiledEndpointRules": true } diff --git a/services/cloudfront/src/main/resources/codegen-resources/customization.config b/services/cloudfront/src/main/resources/codegen-resources/customization.config index 9a89481aed0a..576eebc58864 100644 --- a/services/cloudfront/src/main/resources/codegen-resources/customization.config +++ b/services/cloudfront/src/main/resources/codegen-resources/customization.config @@ -10,8 +10,7 @@ "utilitiesMethod": { "returnType": "software.amazon.awssdk.services.cloudfront.CloudFrontUtilities", "createMethodParams": [] - }, + } - "enableGenerateCompiledEndpointRules": true } diff --git a/services/cloudfrontkeyvaluestore/src/main/resources/codegen-resources/customization.config b/services/cloudfrontkeyvaluestore/src/main/resources/codegen-resources/customization.config index 3388694e6427..7ad0bbabcc1f 100644 --- a/services/cloudfrontkeyvaluestore/src/main/resources/codegen-resources/customization.config +++ b/services/cloudfrontkeyvaluestore/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "enableGenerateCompiledEndpointRules": true, "enableEndpointAuthSchemeParams": true } diff --git a/services/cloudhsm/src/main/resources/codegen-resources/customization.config b/services/cloudhsm/src/main/resources/codegen-resources/customization.config index 6652e711eac8..187b67c0492a 100644 --- a/services/cloudhsm/src/main/resources/codegen-resources/customization.config +++ b/services/cloudhsm/src/main/resources/codegen-resources/customization.config @@ -29,6 +29,5 @@ "listHapgs", "listHsms", "listLunaClients" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/cloudhsmv2/src/main/resources/codegen-resources/customization.config b/services/cloudhsmv2/src/main/resources/codegen-resources/customization.config index 945a45b4b737..520d4370a713 100644 --- a/services/cloudhsmv2/src/main/resources/codegen-resources/customization.config +++ b/services/cloudhsmv2/src/main/resources/codegen-resources/customization.config @@ -2,6 +2,5 @@ "verifiedSimpleMethods": [ "describeBackups", "describeClusters" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/cloudsearch/src/main/resources/codegen-resources/customization.config b/services/cloudsearch/src/main/resources/codegen-resources/customization.config index 4401302928b5..59864f485f1f 100644 --- a/services/cloudsearch/src/main/resources/codegen-resources/customization.config +++ b/services/cloudsearch/src/main/resources/codegen-resources/customization.config @@ -2,8 +2,7 @@ "verifiedSimpleMethods": [ "describeDomains", "listDomainNames" - ], + ] - "enableGenerateCompiledEndpointRules": true } diff --git a/services/cloudsearchdomain/src/main/resources/codegen-resources/customization.config b/services/cloudsearchdomain/src/main/resources/codegen-resources/customization.config index 1636188d7d29..46273cc3325c 100644 --- a/services/cloudsearchdomain/src/main/resources/codegen-resources/customization.config +++ b/services/cloudsearchdomain/src/main/resources/codegen-resources/customization.config @@ -23,6 +23,5 @@ }, "interceptors": [ "software.amazon.awssdk.services.cloudsearchdomain.internal.SwitchToPostInterceptor" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/cloudtrail/src/main/resources/codegen-resources/customization.config b/services/cloudtrail/src/main/resources/codegen-resources/customization.config index 2608a329c80e..50cea27f118f 100644 --- a/services/cloudtrail/src/main/resources/codegen-resources/customization.config +++ b/services/cloudtrail/src/main/resources/codegen-resources/customization.config @@ -6,6 +6,5 @@ "describeTrails", "listPublicKeys", "lookupEvents" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/cloudtraildata/src/main/resources/codegen-resources/customization.config b/services/cloudtraildata/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/cloudtraildata/src/main/resources/codegen-resources/customization.config +++ b/services/cloudtraildata/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/cloudwatch/src/main/resources/codegen-resources/customization.config b/services/cloudwatch/src/main/resources/codegen-resources/customization.config index 7bd64efb5af9..cca5700173d0 100644 --- a/services/cloudwatch/src/main/resources/codegen-resources/customization.config +++ b/services/cloudwatch/src/main/resources/codegen-resources/customization.config @@ -9,8 +9,7 @@ "deleteDashboards", "putDashboard", "getDashboard" - ], + ] - "enableGenerateCompiledEndpointRules": true } diff --git a/services/cloudwatchevents/src/main/resources/codegen-resources/customization.config b/services/cloudwatchevents/src/main/resources/codegen-resources/customization.config index fbfefb027d8e..6c893ecd4525 100644 --- a/services/cloudwatchevents/src/main/resources/codegen-resources/customization.config +++ b/services/cloudwatchevents/src/main/resources/codegen-resources/customization.config @@ -2,6 +2,5 @@ "verifiedSimpleMethods": [ "describeEventBus", "listRules" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/cloudwatchlogs/src/main/resources/codegen-resources/customization.config b/services/cloudwatchlogs/src/main/resources/codegen-resources/customization.config index beec95efc1d2..b4f9db4aacfc 100644 --- a/services/cloudwatchlogs/src/main/resources/codegen-resources/customization.config +++ b/services/cloudwatchlogs/src/main/resources/codegen-resources/customization.config @@ -13,6 +13,5 @@ ], "paginationCustomization": { "GetLogEvents": "LastPageHasPreviousToken" - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/services/codeartifact/src/main/resources/codegen-resources/customization.config b/services/codeartifact/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/codeartifact/src/main/resources/codegen-resources/customization.config +++ b/services/codeartifact/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/codebuild/src/main/resources/codegen-resources/customization.config b/services/codebuild/src/main/resources/codegen-resources/customization.config index 14d6f6ce48c2..d08272ebe3a6 100644 --- a/services/codebuild/src/main/resources/codegen-resources/customization.config +++ b/services/codebuild/src/main/resources/codegen-resources/customization.config @@ -4,6 +4,5 @@ "listCuratedEnvironmentImages", "listProjects", "listSourceCredentials" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/codecatalyst/src/main/resources/codegen-resources/customization.config b/services/codecatalyst/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/codecatalyst/src/main/resources/codegen-resources/customization.config +++ b/services/codecatalyst/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/codecommit/src/main/resources/codegen-resources/customization.config b/services/codecommit/src/main/resources/codegen-resources/customization.config index 05c43b1144ac..5e0619c65a63 100644 --- a/services/codecommit/src/main/resources/codegen-resources/customization.config +++ b/services/codecommit/src/main/resources/codegen-resources/customization.config @@ -4,6 +4,5 @@ ], "excludedSimpleMethods": [ "getBranch" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/codedeploy/src/main/resources/codegen-resources/customization.config b/services/codedeploy/src/main/resources/codegen-resources/customization.config index 5fc15ca47f6f..9d1a857a011c 100644 --- a/services/codedeploy/src/main/resources/codegen-resources/customization.config +++ b/services/codedeploy/src/main/resources/codegen-resources/customization.config @@ -30,6 +30,5 @@ "InstanceIdRequiredException", "InstanceStatus", "InstanceSummary" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/codeguruprofiler/src/main/resources/codegen-resources/customization.config b/services/codeguruprofiler/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/codeguruprofiler/src/main/resources/codegen-resources/customization.config +++ b/services/codeguruprofiler/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/codegurureviewer/src/main/resources/codegen-resources/customization.config b/services/codegurureviewer/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/codegurureviewer/src/main/resources/codegen-resources/customization.config +++ b/services/codegurureviewer/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/codegurusecurity/src/main/resources/codegen-resources/customization.config b/services/codegurusecurity/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/codegurusecurity/src/main/resources/codegen-resources/customization.config +++ b/services/codegurusecurity/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/codepipeline/src/main/resources/codegen-resources/customization.config b/services/codepipeline/src/main/resources/codegen-resources/customization.config index 2c0df19be840..d8c129b542e1 100644 --- a/services/codepipeline/src/main/resources/codegen-resources/customization.config +++ b/services/codepipeline/src/main/resources/codegen-resources/customization.config @@ -7,6 +7,5 @@ "excludedSimpleMethods": [ "deregisterWebhookWithThirdParty", "registerWebhookWithThirdParty" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/codestarconnections/src/main/resources/codegen-resources/customization.config b/services/codestarconnections/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/codestarconnections/src/main/resources/codegen-resources/customization.config +++ b/services/codestarconnections/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/codestarnotifications/src/main/resources/codegen-resources/customization.config b/services/codestarnotifications/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/codestarnotifications/src/main/resources/codegen-resources/customization.config +++ b/services/codestarnotifications/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/cognitoidentity/src/main/resources/codegen-resources/customization.config b/services/cognitoidentity/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/cognitoidentity/src/main/resources/codegen-resources/customization.config +++ b/services/cognitoidentity/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/cognitoidentityprovider/src/main/resources/codegen-resources/customization.config b/services/cognitoidentityprovider/src/main/resources/codegen-resources/customization.config index da9f806be319..4b9b86a42001 100644 --- a/services/cognitoidentityprovider/src/main/resources/codegen-resources/customization.config +++ b/services/cognitoidentityprovider/src/main/resources/codegen-resources/customization.config @@ -1,5 +1,4 @@ { - "enableGenerateCompiledEndpointRules": true, "excludedSimpleMethods" : [ "associateSoftwareToken" ], diff --git a/services/cognitosync/src/main/resources/codegen-resources/customization.config b/services/cognitosync/src/main/resources/codegen-resources/customization.config index ac7b0e0410a2..595d43ca94aa 100644 --- a/services/cognitosync/src/main/resources/codegen-resources/customization.config +++ b/services/cognitosync/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listIdentityPoolUsage" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/comprehend/src/main/resources/codegen-resources/customization.config b/services/comprehend/src/main/resources/codegen-resources/customization.config index eba942663a0a..9ffd764631c0 100644 --- a/services/comprehend/src/main/resources/codegen-resources/customization.config +++ b/services/comprehend/src/main/resources/codegen-resources/customization.config @@ -8,6 +8,5 @@ "listKeyPhrasesDetectionJobs", "listSentimentDetectionJobs", "listTopicsDetectionJobs" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/comprehendmedical/src/main/resources/codegen-resources/customization.config b/services/comprehendmedical/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/comprehendmedical/src/main/resources/codegen-resources/customization.config +++ b/services/comprehendmedical/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/computeoptimizer/src/main/resources/codegen-resources/customization.config b/services/computeoptimizer/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/computeoptimizer/src/main/resources/codegen-resources/customization.config +++ b/services/computeoptimizer/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/config/src/main/resources/codegen-resources/customization.config b/services/config/src/main/resources/codegen-resources/customization.config index f126840772d3..be1c14aa1401 100644 --- a/services/config/src/main/resources/codegen-resources/customization.config +++ b/services/config/src/main/resources/codegen-resources/customization.config @@ -18,6 +18,5 @@ ], "excludedSimpleMethods": [ "startConfigRulesEvaluation" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/connect/src/main/resources/codegen-resources/customization.config b/services/connect/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/connect/src/main/resources/codegen-resources/customization.config +++ b/services/connect/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/connectcampaigns/src/main/resources/codegen-resources/customization.config b/services/connectcampaigns/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/connectcampaigns/src/main/resources/codegen-resources/customization.config +++ b/services/connectcampaigns/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/connectcases/src/main/resources/codegen-resources/customization.config b/services/connectcases/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/connectcases/src/main/resources/codegen-resources/customization.config +++ b/services/connectcases/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/connectcontactlens/src/main/resources/codegen-resources/customization.config b/services/connectcontactlens/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/connectcontactlens/src/main/resources/codegen-resources/customization.config +++ b/services/connectcontactlens/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/connectparticipant/src/main/resources/codegen-resources/customization.config b/services/connectparticipant/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/connectparticipant/src/main/resources/codegen-resources/customization.config +++ b/services/connectparticipant/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/controltower/src/main/resources/codegen-resources/customization.config b/services/controltower/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/controltower/src/main/resources/codegen-resources/customization.config +++ b/services/controltower/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/costandusagereport/src/main/resources/codegen-resources/customization.config b/services/costandusagereport/src/main/resources/codegen-resources/customization.config index c45786626403..d40537c05f2d 100644 --- a/services/costandusagereport/src/main/resources/codegen-resources/customization.config +++ b/services/costandusagereport/src/main/resources/codegen-resources/customization.config @@ -4,6 +4,5 @@ ], "excludedSimpleMethods": [ "deleteReportDefinition" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/costexplorer/src/main/resources/codegen-resources/customization.config b/services/costexplorer/src/main/resources/codegen-resources/customization.config index 604d181bf4fe..761ec4700390 100644 --- a/services/costexplorer/src/main/resources/codegen-resources/customization.config +++ b/services/costexplorer/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "excludedSimpleMethods": [ "getCostAndUsage" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/costoptimizationhub/src/main/resources/codegen-resources/customization.config b/services/costoptimizationhub/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/costoptimizationhub/src/main/resources/codegen-resources/customization.config +++ b/services/costoptimizationhub/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/customerprofiles/src/main/resources/codegen-resources/customization.config b/services/customerprofiles/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/customerprofiles/src/main/resources/codegen-resources/customization.config +++ b/services/customerprofiles/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/databasemigration/src/main/resources/codegen-resources/customization.config b/services/databasemigration/src/main/resources/codegen-resources/customization.config index a2efe702958d..e2a5e3eb68a2 100644 --- a/services/databasemigration/src/main/resources/codegen-resources/customization.config +++ b/services/databasemigration/src/main/resources/codegen-resources/customization.config @@ -15,6 +15,5 @@ ], "excludedSimpleMethods": [ "describeReplicationTaskAssessmentResults" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/databrew/src/main/resources/codegen-resources/customization.config b/services/databrew/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/databrew/src/main/resources/codegen-resources/customization.config +++ b/services/databrew/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/dataexchange/src/main/resources/codegen-resources/customization.config b/services/dataexchange/src/main/resources/codegen-resources/customization.config index cdf857bdc287..e8d9faf606f5 100644 --- a/services/dataexchange/src/main/resources/codegen-resources/customization.config +++ b/services/dataexchange/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "generateEndpointClientTests": true, - "enableGenerateCompiledEndpointRules": true + "generateEndpointClientTests": true } diff --git a/services/datapipeline/src/main/resources/codegen-resources/customization.config b/services/datapipeline/src/main/resources/codegen-resources/customization.config index 291756f11dd3..6e046d2a7d0d 100644 --- a/services/datapipeline/src/main/resources/codegen-resources/customization.config +++ b/services/datapipeline/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listPipelines" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/datasync/src/main/resources/codegen-resources/customization.config b/services/datasync/src/main/resources/codegen-resources/customization.config index fadc149e092b..65bee9195b12 100644 --- a/services/datasync/src/main/resources/codegen-resources/customization.config +++ b/services/datasync/src/main/resources/codegen-resources/customization.config @@ -5,6 +5,5 @@ "listTaskExecutions", "listTasks" ], - "generateEndpointClientTests": true, - "enableGenerateCompiledEndpointRules": true + "generateEndpointClientTests": true } diff --git a/services/datazone/src/main/resources/codegen-resources/customization.config b/services/datazone/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/datazone/src/main/resources/codegen-resources/customization.config +++ b/services/datazone/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/dax/src/main/resources/codegen-resources/customization.config b/services/dax/src/main/resources/codegen-resources/customization.config index 4f0fb398e0e7..e63b58e10ec2 100644 --- a/services/dax/src/main/resources/codegen-resources/customization.config +++ b/services/dax/src/main/resources/codegen-resources/customization.config @@ -5,6 +5,5 @@ "describeEvents", "describeParameterGroups", "describeSubnetGroups" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/detective/src/main/resources/codegen-resources/customization.config b/services/detective/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/detective/src/main/resources/codegen-resources/customization.config +++ b/services/detective/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/devicefarm/src/main/resources/codegen-resources/customization.config b/services/devicefarm/src/main/resources/codegen-resources/customization.config index 34218832ad4b..689d56e2c251 100644 --- a/services/devicefarm/src/main/resources/codegen-resources/customization.config +++ b/services/devicefarm/src/main/resources/codegen-resources/customization.config @@ -14,6 +14,5 @@ "purchaseOffering", "renewOffering", "listVPCEConfigurations" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/devopsguru/src/main/resources/codegen-resources/customization.config b/services/devopsguru/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/devopsguru/src/main/resources/codegen-resources/customization.config +++ b/services/devopsguru/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/directconnect/src/main/resources/codegen-resources/customization.config b/services/directconnect/src/main/resources/codegen-resources/customization.config index 747a898ef2d7..8b6d304ea12a 100644 --- a/services/directconnect/src/main/resources/codegen-resources/customization.config +++ b/services/directconnect/src/main/resources/codegen-resources/customization.config @@ -19,6 +19,5 @@ "DescribeConnectionLoa", "DescribeConnectionsOnInterconnect", "DescribeInterconnectLoa" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/directory/src/main/resources/codegen-resources/customization.config b/services/directory/src/main/resources/codegen-resources/customization.config index 4136b1085a58..c37d98d79126 100644 --- a/services/directory/src/main/resources/codegen-resources/customization.config +++ b/services/directory/src/main/resources/codegen-resources/customization.config @@ -215,6 +215,5 @@ } ] } - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/services/dlm/src/main/resources/codegen-resources/customization.config b/services/dlm/src/main/resources/codegen-resources/customization.config index 108e3431d2ec..a6f7fab65273 100644 --- a/services/dlm/src/main/resources/codegen-resources/customization.config +++ b/services/dlm/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "getLifecyclePolicies" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/docdb/src/main/resources/codegen-resources/customization.config b/services/docdb/src/main/resources/codegen-resources/customization.config index b087eccac9d3..fcaf860a4b62 100644 --- a/services/docdb/src/main/resources/codegen-resources/customization.config +++ b/services/docdb/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { - "enableGenerateCompiledEndpointRules": true, "verifiedSimpleMethods" : [ "describeDBClusterParameterGroups", "describeDBClusterSnapshots", diff --git a/services/docdbelastic/src/main/resources/codegen-resources/customization.config b/services/docdbelastic/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/docdbelastic/src/main/resources/codegen-resources/customization.config +++ b/services/docdbelastic/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/drs/src/main/resources/codegen-resources/customization.config b/services/drs/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/drs/src/main/resources/codegen-resources/customization.config +++ b/services/drs/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/dynamodb/src/main/resources/codegen-resources/dynamodb/customization.config b/services/dynamodb/src/main/resources/codegen-resources/dynamodb/customization.config index 22bdb5244ee6..01363ce0186e 100644 --- a/services/dynamodb/src/main/resources/codegen-resources/dynamodb/customization.config +++ b/services/dynamodb/src/main/resources/codegen-resources/dynamodb/customization.config @@ -37,6 +37,5 @@ ], "customRetryStrategy" : "software.amazon.awssdk.services.dynamodb.DynamoDbRetryPolicy", "enableEndpointDiscoveryMethodRequired": true, - "enableGenerateCompiledEndpointRules": true, "enableEndpointProviderUriCaching": true } diff --git a/services/dynamodb/src/main/resources/codegen-resources/dynamodbstreams/customization.config b/services/dynamodb/src/main/resources/codegen-resources/dynamodbstreams/customization.config index bb7121a9fd10..41101d3f9ff3 100644 --- a/services/dynamodb/src/main/resources/codegen-resources/dynamodbstreams/customization.config +++ b/services/dynamodb/src/main/resources/codegen-resources/dynamodbstreams/customization.config @@ -21,6 +21,5 @@ }, "verifiedSimpleMethods" : [ "listStreams" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/ebs/src/main/resources/codegen-resources/customization.config b/services/ebs/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/ebs/src/main/resources/codegen-resources/customization.config +++ b/services/ebs/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/ec2/src/main/resources/codegen-resources/customization.config b/services/ec2/src/main/resources/codegen-resources/customization.config index 0fa0ad4afc2d..119f7318912e 100644 --- a/services/ec2/src/main/resources/codegen-resources/customization.config +++ b/services/ec2/src/main/resources/codegen-resources/customization.config @@ -348,8 +348,7 @@ "interceptors": [ "software.amazon.awssdk.services.ec2.transform.internal.GeneratePreSignUrlInterceptor", "software.amazon.awssdk.services.ec2.transform.internal.TimestampFormatInterceptor" - ], + ] - "enableGenerateCompiledEndpointRules": true } diff --git a/services/ec2instanceconnect/src/main/resources/codegen-resources/customization.config b/services/ec2instanceconnect/src/main/resources/codegen-resources/customization.config index c2457f7c37ab..09dcdc034de9 100644 --- a/services/ec2instanceconnect/src/main/resources/codegen-resources/customization.config +++ b/services/ec2instanceconnect/src/main/resources/codegen-resources/customization.config @@ -1,5 +1,4 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/ecr/src/main/resources/codegen-resources/customization.config b/services/ecr/src/main/resources/codegen-resources/customization.config index 7bc9d5f27c4e..36000c58599a 100644 --- a/services/ecr/src/main/resources/codegen-resources/customization.config +++ b/services/ecr/src/main/resources/codegen-resources/customization.config @@ -2,6 +2,5 @@ "verifiedSimpleMethods": [ "describeRepositories", "getAuthorizationToken" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/ecrpublic/src/main/resources/codegen-resources/customization.config b/services/ecrpublic/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/ecrpublic/src/main/resources/codegen-resources/customization.config +++ b/services/ecrpublic/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/ecs/src/main/resources/codegen-resources/customization.config b/services/ecs/src/main/resources/codegen-resources/customization.config index bd024bf3aca1..ccbc51ea8f1b 100644 --- a/services/ecs/src/main/resources/codegen-resources/customization.config +++ b/services/ecs/src/main/resources/codegen-resources/customization.config @@ -15,6 +15,5 @@ "registerContainerInstance", "submitContainerStateChange", "submitTaskStateChange" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/efs/src/main/resources/codegen-resources/customization.config b/services/efs/src/main/resources/codegen-resources/customization.config index ddfc00a7e632..735bd9dbc777 100644 --- a/services/efs/src/main/resources/codegen-resources/customization.config +++ b/services/efs/src/main/resources/codegen-resources/customization.config @@ -4,6 +4,5 @@ ], "excludedSimpleMethods": [ "describeMountTargets" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/eks/src/main/resources/codegen-resources/customization.config b/services/eks/src/main/resources/codegen-resources/customization.config index 9ebe291adc93..ee26fa7f9350 100644 --- a/services/eks/src/main/resources/codegen-resources/customization.config +++ b/services/eks/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listClusters" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/eksauth/src/main/resources/codegen-resources/customization.config b/services/eksauth/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/eksauth/src/main/resources/codegen-resources/customization.config +++ b/services/eksauth/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/elasticache/src/main/resources/codegen-resources/customization.config b/services/elasticache/src/main/resources/codegen-resources/customization.config index 058279f29fbc..20fd20a801e0 100644 --- a/services/elasticache/src/main/resources/codegen-resources/customization.config +++ b/services/elasticache/src/main/resources/codegen-resources/customization.config @@ -13,8 +13,7 @@ "excludedSimpleMethods": [ "describeCacheSecurityGroups", "listAllowedNodeTypeModifications" - ], + ] - "enableGenerateCompiledEndpointRules": true } diff --git a/services/elasticbeanstalk/src/main/resources/codegen-resources/customization.config b/services/elasticbeanstalk/src/main/resources/codegen-resources/customization.config index 28d4e91910df..8a9469c766f8 100644 --- a/services/elasticbeanstalk/src/main/resources/codegen-resources/customization.config +++ b/services/elasticbeanstalk/src/main/resources/codegen-resources/customization.config @@ -42,8 +42,7 @@ "describeEvents", "listAvailableSolutionStacks", "listPlatformVersions" - ], + ] - "enableGenerateCompiledEndpointRules": true } diff --git a/services/elasticloadbalancing/src/main/resources/codegen-resources/customization.config b/services/elasticloadbalancing/src/main/resources/codegen-resources/customization.config index c3bc83768d54..8d7d599c6da8 100644 --- a/services/elasticloadbalancing/src/main/resources/codegen-resources/customization.config +++ b/services/elasticloadbalancing/src/main/resources/codegen-resources/customization.config @@ -10,8 +10,7 @@ "DuplicateAccessPointNameException": "DuplicateLoadBalancerNameException", "TooManyAccessPointsException": "TooManyLoadBalancersException", "InvalidEndPointException": "InvalidInstanceException" - }, + } - "enableGenerateCompiledEndpointRules": true } diff --git a/services/elasticloadbalancingv2/src/main/resources/codegen-resources/customization.config b/services/elasticloadbalancingv2/src/main/resources/codegen-resources/customization.config index 00bad1ae0c5f..e4677660fff3 100644 --- a/services/elasticloadbalancingv2/src/main/resources/codegen-resources/customization.config +++ b/services/elasticloadbalancingv2/src/main/resources/codegen-resources/customization.config @@ -8,8 +8,7 @@ "excludedSimpleMethods": [ "describeRules", "describeListeners" - ], + ] - "enableGenerateCompiledEndpointRules": true } diff --git a/services/elasticsearch/src/main/resources/codegen-resources/customization.config b/services/elasticsearch/src/main/resources/codegen-resources/customization.config index a2bee164c24e..a0272e6eb4d2 100644 --- a/services/elasticsearch/src/main/resources/codegen-resources/customization.config +++ b/services/elasticsearch/src/main/resources/codegen-resources/customization.config @@ -6,6 +6,5 @@ "getCompatibleElasticsearchVersions", "listDomainNames", "listElasticsearchVersions" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/emr/src/main/resources/codegen-resources/customization.config b/services/emr/src/main/resources/codegen-resources/customization.config index cf2c695c9123..710938e69f05 100644 --- a/services/emr/src/main/resources/codegen-resources/customization.config +++ b/services/emr/src/main/resources/codegen-resources/customization.config @@ -21,6 +21,5 @@ ], "deprecatedOperations": [ "DescribeJobFlows" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/emrcontainers/src/main/resources/codegen-resources/customization.config b/services/emrcontainers/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/emrcontainers/src/main/resources/codegen-resources/customization.config +++ b/services/emrcontainers/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/emrserverless/src/main/resources/codegen-resources/customization.config b/services/emrserverless/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/emrserverless/src/main/resources/codegen-resources/customization.config +++ b/services/emrserverless/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/entityresolution/src/main/resources/codegen-resources/customization.config b/services/entityresolution/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/entityresolution/src/main/resources/codegen-resources/customization.config +++ b/services/entityresolution/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/eventbridge/src/main/resources/codegen-resources/customization.config b/services/eventbridge/src/main/resources/codegen-resources/customization.config index 4aa0caa705ce..19369e8d87f4 100644 --- a/services/eventbridge/src/main/resources/codegen-resources/customization.config +++ b/services/eventbridge/src/main/resources/codegen-resources/customization.config @@ -2,6 +2,5 @@ "enableEndpointAuthSchemeParams": true, "allowedEndpointAuthSchemeParams": [ "EndpointId" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/finspace/src/main/resources/codegen-resources/customization.config b/services/finspace/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/finspace/src/main/resources/codegen-resources/customization.config +++ b/services/finspace/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/finspacedata/src/main/resources/codegen-resources/customization.config b/services/finspacedata/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/finspacedata/src/main/resources/codegen-resources/customization.config +++ b/services/finspacedata/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/firehose/src/main/resources/codegen-resources/customization.config b/services/firehose/src/main/resources/codegen-resources/customization.config index 85aba7197c80..3fc91f70a397 100644 --- a/services/firehose/src/main/resources/codegen-resources/customization.config +++ b/services/firehose/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listDeliveryStreams" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/fis/src/main/resources/codegen-resources/customization.config b/services/fis/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/fis/src/main/resources/codegen-resources/customization.config +++ b/services/fis/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/fms/src/main/resources/codegen-resources/customization.config b/services/fms/src/main/resources/codegen-resources/customization.config index b394eea2b025..834626df3f78 100644 --- a/services/fms/src/main/resources/codegen-resources/customization.config +++ b/services/fms/src/main/resources/codegen-resources/customization.config @@ -4,6 +4,5 @@ "getNotificationChannel", "listMemberAccounts", "listPolicies" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/forecast/src/main/resources/codegen-resources/customization.config b/services/forecast/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/forecast/src/main/resources/codegen-resources/customization.config +++ b/services/forecast/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/forecastquery/src/main/resources/codegen-resources/customization.config b/services/forecastquery/src/main/resources/codegen-resources/customization.config index c2457f7c37ab..09dcdc034de9 100644 --- a/services/forecastquery/src/main/resources/codegen-resources/customization.config +++ b/services/forecastquery/src/main/resources/codegen-resources/customization.config @@ -1,5 +1,4 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/frauddetector/src/main/resources/codegen-resources/customization.config b/services/frauddetector/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/frauddetector/src/main/resources/codegen-resources/customization.config +++ b/services/frauddetector/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/freetier/src/main/resources/codegen-resources/customization.config b/services/freetier/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/freetier/src/main/resources/codegen-resources/customization.config +++ b/services/freetier/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/fsx/src/main/resources/codegen-resources/customization.config b/services/fsx/src/main/resources/codegen-resources/customization.config index 43360d6a47fa..3d6f14e169f6 100644 --- a/services/fsx/src/main/resources/codegen-resources/customization.config +++ b/services/fsx/src/main/resources/codegen-resources/customization.config @@ -2,6 +2,5 @@ "verifiedSimpleMethods": [ "describeBackups", "describeFileSystems" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/glacier/src/main/resources/codegen-resources/customization.config b/services/glacier/src/main/resources/codegen-resources/customization.config index 599e24d4dcc5..3a7a549e4270 100644 --- a/services/glacier/src/main/resources/codegen-resources/customization.config +++ b/services/glacier/src/main/resources/codegen-resources/customization.config @@ -1,5 +1,4 @@ { - "enableGenerateCompiledEndpointRules": true, "customErrorCodeFieldName": "code", "shapeModifiers" : { "UploadArchiveInput" : { diff --git a/services/globalaccelerator/src/main/resources/codegen-resources/customization.config b/services/globalaccelerator/src/main/resources/codegen-resources/customization.config index 980868643100..97ee95353214 100644 --- a/services/globalaccelerator/src/main/resources/codegen-resources/customization.config +++ b/services/globalaccelerator/src/main/resources/codegen-resources/customization.config @@ -5,6 +5,5 @@ "defaultSimpleMethodTestRegion": "US_WEST_2", "excludedSimpleMethods": [ "describeAcceleratorAttributes" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/glue/src/main/resources/codegen-resources/customization.config b/services/glue/src/main/resources/codegen-resources/customization.config index da22aaad9103..9a6245c00e53 100644 --- a/services/glue/src/main/resources/codegen-resources/customization.config +++ b/services/glue/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "excludedSimpleMethods": [ "*" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/grafana/src/main/resources/codegen-resources/customization.config b/services/grafana/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/grafana/src/main/resources/codegen-resources/customization.config +++ b/services/grafana/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/greengrass/src/main/resources/codegen-resources/customization.config b/services/greengrass/src/main/resources/codegen-resources/customization.config index 96ee6ad2eca2..3bfe9fa9ed42 100644 --- a/services/greengrass/src/main/resources/codegen-resources/customization.config +++ b/services/greengrass/src/main/resources/codegen-resources/customization.config @@ -23,6 +23,5 @@ "createSubscriptionDefinition", "createResourceDefinition", "createSoftwareUpdateJob" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/greengrassv2/src/main/resources/codegen-resources/customization.config b/services/greengrassv2/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/greengrassv2/src/main/resources/codegen-resources/customization.config +++ b/services/greengrassv2/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/groundstation/src/main/resources/codegen-resources/customization.config b/services/groundstation/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/groundstation/src/main/resources/codegen-resources/customization.config +++ b/services/groundstation/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/guardduty/src/main/resources/codegen-resources/customization.config b/services/guardduty/src/main/resources/codegen-resources/customization.config index eddcd509d138..2a0f8b4cc9ac 100644 --- a/services/guardduty/src/main/resources/codegen-resources/customization.config +++ b/services/guardduty/src/main/resources/codegen-resources/customization.config @@ -8,6 +8,5 @@ "createDetector", "declineInvitations", "deleteInvitations" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/health/src/main/resources/codegen-resources/customization.config b/services/health/src/main/resources/codegen-resources/customization.config index dbff7768d1f9..168cf96cb232 100644 --- a/services/health/src/main/resources/codegen-resources/customization.config +++ b/services/health/src/main/resources/codegen-resources/customization.config @@ -3,6 +3,5 @@ "describeEvents", "describeEntityAggregates", "describeEventTypes" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/healthlake/src/main/resources/codegen-resources/customization.config b/services/healthlake/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/healthlake/src/main/resources/codegen-resources/customization.config +++ b/services/healthlake/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/iam/src/main/resources/codegen-resources/customization.config b/services/iam/src/main/resources/codegen-resources/customization.config index 5e7617844693..c806d70bb621 100644 --- a/services/iam/src/main/resources/codegen-resources/customization.config +++ b/services/iam/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { - "enableGenerateCompiledEndpointRules": true, "verifiedSimpleMethods": [ "createAccessKey", "deleteAccountPasswordPolicy", diff --git a/services/identitystore/src/main/resources/codegen-resources/customization.config b/services/identitystore/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/identitystore/src/main/resources/codegen-resources/customization.config +++ b/services/identitystore/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/imagebuilder/src/main/resources/codegen-resources/customization.config b/services/imagebuilder/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/imagebuilder/src/main/resources/codegen-resources/customization.config +++ b/services/imagebuilder/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/inspector/src/main/resources/codegen-resources/customization.config b/services/inspector/src/main/resources/codegen-resources/customization.config index a709750374d8..0dc602cddc19 100644 --- a/services/inspector/src/main/resources/codegen-resources/customization.config +++ b/services/inspector/src/main/resources/codegen-resources/customization.config @@ -54,6 +54,5 @@ } ] } - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/services/inspector2/src/main/resources/codegen-resources/customization.config b/services/inspector2/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/inspector2/src/main/resources/codegen-resources/customization.config +++ b/services/inspector2/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/inspectorscan/src/main/resources/codegen-resources/customization.config b/services/inspectorscan/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/inspectorscan/src/main/resources/codegen-resources/customization.config +++ b/services/inspectorscan/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/internetmonitor/src/main/resources/codegen-resources/customization.config b/services/internetmonitor/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/internetmonitor/src/main/resources/codegen-resources/customization.config +++ b/services/internetmonitor/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/iot/src/main/resources/codegen-resources/customization.config b/services/iot/src/main/resources/codegen-resources/customization.config index c26c974f03b0..bb14e64d5230 100644 --- a/services/iot/src/main/resources/codegen-resources/customization.config +++ b/services/iot/src/main/resources/codegen-resources/customization.config @@ -48,6 +48,5 @@ "AssetPropertyVariant": { "union": true } - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/services/iotdataplane/src/main/resources/codegen-resources/customization.config b/services/iotdataplane/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/iotdataplane/src/main/resources/codegen-resources/customization.config +++ b/services/iotdataplane/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/iotdeviceadvisor/src/main/resources/codegen-resources/customization.config b/services/iotdeviceadvisor/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/iotdeviceadvisor/src/main/resources/codegen-resources/customization.config +++ b/services/iotdeviceadvisor/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/iotfleetwise/src/main/resources/codegen-resources/customization.config b/services/iotfleetwise/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/iotfleetwise/src/main/resources/codegen-resources/customization.config +++ b/services/iotfleetwise/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/iotjobsdataplane/src/main/resources/codegen-resources/customization.config b/services/iotjobsdataplane/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/iotjobsdataplane/src/main/resources/codegen-resources/customization.config +++ b/services/iotjobsdataplane/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/iotsecuretunneling/src/main/resources/codegen-resources/customization.config b/services/iotsecuretunneling/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/iotsecuretunneling/src/main/resources/codegen-resources/customization.config +++ b/services/iotsecuretunneling/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/iotsitewise/src/main/resources/codegen-resources/customization.config b/services/iotsitewise/src/main/resources/codegen-resources/customization.config index cdf857bdc287..e8d9faf606f5 100644 --- a/services/iotsitewise/src/main/resources/codegen-resources/customization.config +++ b/services/iotsitewise/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "generateEndpointClientTests": true, - "enableGenerateCompiledEndpointRules": true + "generateEndpointClientTests": true } diff --git a/services/iotthingsgraph/src/main/resources/codegen-resources/customization.config b/services/iotthingsgraph/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/iotthingsgraph/src/main/resources/codegen-resources/customization.config +++ b/services/iotthingsgraph/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/iottwinmaker/src/main/resources/codegen-resources/customization.config b/services/iottwinmaker/src/main/resources/codegen-resources/customization.config index cdf857bdc287..e8d9faf606f5 100644 --- a/services/iottwinmaker/src/main/resources/codegen-resources/customization.config +++ b/services/iottwinmaker/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "generateEndpointClientTests": true, - "enableGenerateCompiledEndpointRules": true + "generateEndpointClientTests": true } diff --git a/services/iotwireless/src/main/resources/codegen-resources/customization.config b/services/iotwireless/src/main/resources/codegen-resources/customization.config index 8c7263446a5a..21b15d9542cb 100644 --- a/services/iotwireless/src/main/resources/codegen-resources/customization.config +++ b/services/iotwireless/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "underscoresInNameBehavior": "ALLOW", - "enableGenerateCompiledEndpointRules": true + "underscoresInNameBehavior": "ALLOW" } diff --git a/services/ivs/src/main/resources/codegen-resources/customization.config b/services/ivs/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/ivs/src/main/resources/codegen-resources/customization.config +++ b/services/ivs/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/ivschat/src/main/resources/codegen-resources/customization.config b/services/ivschat/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/ivschat/src/main/resources/codegen-resources/customization.config +++ b/services/ivschat/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/ivsrealtime/src/main/resources/codegen-resources/customization.config b/services/ivsrealtime/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/ivsrealtime/src/main/resources/codegen-resources/customization.config +++ b/services/ivsrealtime/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/kafka/src/main/resources/codegen-resources/customization.config b/services/kafka/src/main/resources/codegen-resources/customization.config index 9ebe291adc93..ee26fa7f9350 100644 --- a/services/kafka/src/main/resources/codegen-resources/customization.config +++ b/services/kafka/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listClusters" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/kafkaconnect/src/main/resources/codegen-resources/customization.config b/services/kafkaconnect/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/kafkaconnect/src/main/resources/codegen-resources/customization.config +++ b/services/kafkaconnect/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/kendra/src/main/resources/codegen-resources/customization.config b/services/kendra/src/main/resources/codegen-resources/customization.config index d5dea02b2d47..8a5b385a97e4 100644 --- a/services/kendra/src/main/resources/codegen-resources/customization.config +++ b/services/kendra/src/main/resources/codegen-resources/customization.config @@ -3,6 +3,5 @@ "DocumentAttributeValue": { "union": true } - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/services/kendraranking/src/main/resources/codegen-resources/customization.config b/services/kendraranking/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/kendraranking/src/main/resources/codegen-resources/customization.config +++ b/services/kendraranking/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/keyspaces/src/main/resources/codegen-resources/customization.config b/services/keyspaces/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/keyspaces/src/main/resources/codegen-resources/customization.config +++ b/services/keyspaces/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/kinesis/src/main/resources/codegen-resources/customization.config b/services/kinesis/src/main/resources/codegen-resources/customization.config index df57fdb8aefb..dfdcec2369ad 100644 --- a/services/kinesis/src/main/resources/codegen-resources/customization.config +++ b/services/kinesis/src/main/resources/codegen-resources/customization.config @@ -1,5 +1,4 @@ { - "enableGenerateCompiledEndpointRules": true, "verifiedSimpleMethods": [ "describeLimits", "listStreams" diff --git a/services/kinesisanalytics/src/main/resources/codegen-resources/customization.config b/services/kinesisanalytics/src/main/resources/codegen-resources/customization.config index 2faadebcd541..00cf44abda98 100644 --- a/services/kinesisanalytics/src/main/resources/codegen-resources/customization.config +++ b/services/kinesisanalytics/src/main/resources/codegen-resources/customization.config @@ -4,6 +4,5 @@ ], "excludedSimpleMethods": [ "discoverInputSchema" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/kinesisanalyticsv2/src/main/resources/codegen-resources/customization.config b/services/kinesisanalyticsv2/src/main/resources/codegen-resources/customization.config index e5f468b10579..81981a072d5e 100644 --- a/services/kinesisanalyticsv2/src/main/resources/codegen-resources/customization.config +++ b/services/kinesisanalyticsv2/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listApplications" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/kinesisvideo/src/main/resources/codegen-resources/customization.config b/services/kinesisvideo/src/main/resources/codegen-resources/customization.config index c501ccd5d7ac..31d46c600f43 100644 --- a/services/kinesisvideo/src/main/resources/codegen-resources/customization.config +++ b/services/kinesisvideo/src/main/resources/codegen-resources/customization.config @@ -5,6 +5,5 @@ "excludedSimpleMethods": [ "listTagsForStream", "describeStream" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/kinesisvideoarchivedmedia/src/main/resources/codegen-resources/customization.config b/services/kinesisvideoarchivedmedia/src/main/resources/codegen-resources/customization.config index 9a222fcf67a0..2f8167885e99 100644 --- a/services/kinesisvideoarchivedmedia/src/main/resources/codegen-resources/customization.config +++ b/services/kinesisvideoarchivedmedia/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "excludedSimpleMethods": [ "getHLSStreamingSessionURL" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/kinesisvideomedia/src/main/resources/codegen-resources/customization.config b/services/kinesisvideomedia/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/kinesisvideomedia/src/main/resources/codegen-resources/customization.config +++ b/services/kinesisvideomedia/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/kinesisvideosignaling/src/main/resources/codegen-resources/customization.config b/services/kinesisvideosignaling/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/kinesisvideosignaling/src/main/resources/codegen-resources/customization.config +++ b/services/kinesisvideosignaling/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/kinesisvideowebrtcstorage/src/main/resources/codegen-resources/customization.config b/services/kinesisvideowebrtcstorage/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/kinesisvideowebrtcstorage/src/main/resources/codegen-resources/customization.config +++ b/services/kinesisvideowebrtcstorage/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/kms/src/main/resources/codegen-resources/customization.config b/services/kms/src/main/resources/codegen-resources/customization.config index 5ad7080232ca..f319c25d9faa 100644 --- a/services/kms/src/main/resources/codegen-resources/customization.config +++ b/services/kms/src/main/resources/codegen-resources/customization.config @@ -6,6 +6,5 @@ "describeCustomKeyStores", "listAliases", "listKeys" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/lakeformation/src/main/resources/codegen-resources/customization.config b/services/lakeformation/src/main/resources/codegen-resources/customization.config index cdf857bdc287..e8d9faf606f5 100644 --- a/services/lakeformation/src/main/resources/codegen-resources/customization.config +++ b/services/lakeformation/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "generateEndpointClientTests": true, - "enableGenerateCompiledEndpointRules": true + "generateEndpointClientTests": true } diff --git a/services/lambda/src/main/resources/codegen-resources/customization.config b/services/lambda/src/main/resources/codegen-resources/customization.config index 952021ded000..1eb09419bc58 100644 --- a/services/lambda/src/main/resources/codegen-resources/customization.config +++ b/services/lambda/src/main/resources/codegen-resources/customization.config @@ -7,6 +7,5 @@ ], "deprecatedOperations": [ "InvokeAsync" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/launchwizard/src/main/resources/codegen-resources/customization.config b/services/launchwizard/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/launchwizard/src/main/resources/codegen-resources/customization.config +++ b/services/launchwizard/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/lexmodelbuilding/src/main/resources/codegen-resources/customization.config b/services/lexmodelbuilding/src/main/resources/codegen-resources/customization.config index dd5c901b0edb..b809e235553a 100644 --- a/services/lexmodelbuilding/src/main/resources/codegen-resources/customization.config +++ b/services/lexmodelbuilding/src/main/resources/codegen-resources/customization.config @@ -5,6 +5,5 @@ "getBuiltinSlotTypes", "getIntents", "getSlotTypes" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/lexmodelsv2/src/main/resources/codegen-resources/customization.config b/services/lexmodelsv2/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/lexmodelsv2/src/main/resources/codegen-resources/customization.config +++ b/services/lexmodelsv2/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/lexruntime/src/main/resources/codegen-resources/customization.config b/services/lexruntime/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/lexruntime/src/main/resources/codegen-resources/customization.config +++ b/services/lexruntime/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/lexruntimev2/src/main/resources/codegen-resources/customization.config b/services/lexruntimev2/src/main/resources/codegen-resources/customization.config index a10b6cbcf23a..903b59d94b56 100644 --- a/services/lexruntimev2/src/main/resources/codegen-resources/customization.config +++ b/services/lexruntimev2/src/main/resources/codegen-resources/customization.config @@ -2,6 +2,5 @@ "customServiceMetadata": { "contentType": "application/json" }, - "enableGenerateCompiledEndpointRules": true, "usePriorKnowledgeForH2": true } diff --git a/services/licensemanager/src/main/resources/codegen-resources/customization.config b/services/licensemanager/src/main/resources/codegen-resources/customization.config index d8c559db863a..16be78f108b4 100644 --- a/services/licensemanager/src/main/resources/codegen-resources/customization.config +++ b/services/licensemanager/src/main/resources/codegen-resources/customization.config @@ -7,6 +7,5 @@ "getServiceSettings", "listLicenseConfigurations", "listResourceInventory" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/licensemanagerlinuxsubscriptions/src/main/resources/codegen-resources/customization.config b/services/licensemanagerlinuxsubscriptions/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/licensemanagerlinuxsubscriptions/src/main/resources/codegen-resources/customization.config +++ b/services/licensemanagerlinuxsubscriptions/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/licensemanagerusersubscriptions/src/main/resources/codegen-resources/customization.config b/services/licensemanagerusersubscriptions/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/licensemanagerusersubscriptions/src/main/resources/codegen-resources/customization.config +++ b/services/licensemanagerusersubscriptions/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/lightsail/src/main/resources/codegen-resources/customization.config b/services/lightsail/src/main/resources/codegen-resources/customization.config index 229655a6c433..1ad24a1daaea 100644 --- a/services/lightsail/src/main/resources/codegen-resources/customization.config +++ b/services/lightsail/src/main/resources/codegen-resources/customization.config @@ -23,6 +23,5 @@ "getRelationalDatabaseSnapshots", "getRelationalDatabases", "getStaticIps" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/location/src/main/resources/codegen-resources/customization.config b/services/location/src/main/resources/codegen-resources/customization.config index cdf857bdc287..e8d9faf606f5 100644 --- a/services/location/src/main/resources/codegen-resources/customization.config +++ b/services/location/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "generateEndpointClientTests": true, - "enableGenerateCompiledEndpointRules": true + "generateEndpointClientTests": true } diff --git a/services/lookoutequipment/src/main/resources/codegen-resources/customization.config b/services/lookoutequipment/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/lookoutequipment/src/main/resources/codegen-resources/customization.config +++ b/services/lookoutequipment/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/m2/src/main/resources/codegen-resources/customization.config b/services/m2/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/m2/src/main/resources/codegen-resources/customization.config +++ b/services/m2/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/machinelearning/src/main/resources/codegen-resources/customization.config b/services/machinelearning/src/main/resources/codegen-resources/customization.config index 4798c2627d0c..e3c6e5f92019 100644 --- a/services/machinelearning/src/main/resources/codegen-resources/customization.config +++ b/services/machinelearning/src/main/resources/codegen-resources/customization.config @@ -8,6 +8,5 @@ "interceptors": [ "software.amazon.awssdk.services.machinelearning.internal.PredictEndpointInterceptor", "software.amazon.awssdk.services.machinelearning.internal.RandomIdInterceptor" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/macie2/src/main/resources/codegen-resources/customization.config b/services/macie2/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/macie2/src/main/resources/codegen-resources/customization.config +++ b/services/macie2/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/managedblockchain/src/main/resources/codegen-resources/customization.config b/services/managedblockchain/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/managedblockchain/src/main/resources/codegen-resources/customization.config +++ b/services/managedblockchain/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/managedblockchainquery/src/main/resources/codegen-resources/customization.config b/services/managedblockchainquery/src/main/resources/codegen-resources/customization.config index c2457f7c37ab..09dcdc034de9 100644 --- a/services/managedblockchainquery/src/main/resources/codegen-resources/customization.config +++ b/services/managedblockchainquery/src/main/resources/codegen-resources/customization.config @@ -1,5 +1,4 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/marketplaceagreement/src/main/resources/codegen-resources/customization.config b/services/marketplaceagreement/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/marketplaceagreement/src/main/resources/codegen-resources/customization.config +++ b/services/marketplaceagreement/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/marketplacecatalog/src/main/resources/codegen-resources/customization.config b/services/marketplacecatalog/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/marketplacecatalog/src/main/resources/codegen-resources/customization.config +++ b/services/marketplacecatalog/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/marketplacecommerceanalytics/src/main/resources/codegen-resources/customization.config b/services/marketplacecommerceanalytics/src/main/resources/codegen-resources/customization.config index af7a1033611e..de632ba92f3e 100644 --- a/services/marketplacecommerceanalytics/src/main/resources/codegen-resources/customization.config +++ b/services/marketplacecommerceanalytics/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "renameShapes": { "MarketplaceCommerceAnalyticsException": "MarketplaceCommerceAnalyticsServiceException" - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/services/marketplacedeployment/src/main/resources/codegen-resources/customization.config b/services/marketplacedeployment/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/marketplacedeployment/src/main/resources/codegen-resources/customization.config +++ b/services/marketplacedeployment/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/marketplaceentitlement/src/main/resources/codegen-resources/customization.config b/services/marketplaceentitlement/src/main/resources/codegen-resources/customization.config index 6d810faea5bc..30af78fe47a3 100644 --- a/services/marketplaceentitlement/src/main/resources/codegen-resources/customization.config +++ b/services/marketplaceentitlement/src/main/resources/codegen-resources/customization.config @@ -3,6 +3,5 @@ "EntitlementValue": { "union": true } - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/services/marketplacemetering/src/main/resources/codegen-resources/customization.config b/services/marketplacemetering/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/marketplacemetering/src/main/resources/codegen-resources/customization.config +++ b/services/marketplacemetering/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/mediaconnect/src/main/resources/codegen-resources/customization.config b/services/mediaconnect/src/main/resources/codegen-resources/customization.config index cf0eeb89dc03..b0fa95744f2e 100644 --- a/services/mediaconnect/src/main/resources/codegen-resources/customization.config +++ b/services/mediaconnect/src/main/resources/codegen-resources/customization.config @@ -2,6 +2,5 @@ "verifiedSimpleMethods": [ "listEntitlements", "listFlows" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/mediaconvert/src/main/resources/codegen-resources/customization.config b/services/mediaconvert/src/main/resources/codegen-resources/customization.config index da22aaad9103..9a6245c00e53 100644 --- a/services/mediaconvert/src/main/resources/codegen-resources/customization.config +++ b/services/mediaconvert/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "excludedSimpleMethods": [ "*" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/medialive/src/main/resources/codegen-resources/customization.config b/services/medialive/src/main/resources/codegen-resources/customization.config index 34826c5c0209..93e2131d4ce1 100644 --- a/services/medialive/src/main/resources/codegen-resources/customization.config +++ b/services/medialive/src/main/resources/codegen-resources/customization.config @@ -10,6 +10,5 @@ "createChannel", "createInput", "createInputSecurityGroup" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/mediapackage/src/main/resources/codegen-resources/customization.config b/services/mediapackage/src/main/resources/codegen-resources/customization.config index 37a289229927..ee587bd61c35 100644 --- a/services/mediapackage/src/main/resources/codegen-resources/customization.config +++ b/services/mediapackage/src/main/resources/codegen-resources/customization.config @@ -10,6 +10,5 @@ // Do not keep adding to this list. Require the service team to name enums like they're naming their shapes. "__AdTriggersElement": "AdTriggersElement", "__PeriodTriggersElement": "PeriodTriggersElement" - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/services/mediapackagev2/src/main/resources/codegen-resources/customization.config b/services/mediapackagev2/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/mediapackagev2/src/main/resources/codegen-resources/customization.config +++ b/services/mediapackagev2/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/mediastore/src/main/resources/codegen-resources/customization.config b/services/mediastore/src/main/resources/codegen-resources/customization.config index 1d165fcb810b..228615d70078 100644 --- a/services/mediastore/src/main/resources/codegen-resources/customization.config +++ b/services/mediastore/src/main/resources/codegen-resources/customization.config @@ -4,6 +4,5 @@ ], "excludedSimpleMethods": [ "describeContainer" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/mediastoredata/src/main/resources/codegen-resources/customization.config b/services/mediastoredata/src/main/resources/codegen-resources/customization.config index 32a48c48174d..a5746334a293 100644 --- a/services/mediastoredata/src/main/resources/codegen-resources/customization.config +++ b/services/mediastoredata/src/main/resources/codegen-resources/customization.config @@ -1,5 +1,4 @@ { - "enableGenerateCompiledEndpointRules": true, "excludedSimpleMethods" : [ "listItems" ] diff --git a/services/mediatailor/src/main/resources/codegen-resources/customization.config b/services/mediatailor/src/main/resources/codegen-resources/customization.config index df53e3257979..fed460fcf047 100644 --- a/services/mediatailor/src/main/resources/codegen-resources/customization.config +++ b/services/mediatailor/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listPlaybackConfigurations" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/medicalimaging/src/main/resources/codegen-resources/customization.config b/services/medicalimaging/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/medicalimaging/src/main/resources/codegen-resources/customization.config +++ b/services/medicalimaging/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/memorydb/src/main/resources/codegen-resources/customization.config b/services/memorydb/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/memorydb/src/main/resources/codegen-resources/customization.config +++ b/services/memorydb/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/mgn/src/main/resources/codegen-resources/customization.config b/services/mgn/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/mgn/src/main/resources/codegen-resources/customization.config +++ b/services/mgn/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/migrationhub/src/main/resources/codegen-resources/customization.config b/services/migrationhub/src/main/resources/codegen-resources/customization.config index da22aaad9103..9a6245c00e53 100644 --- a/services/migrationhub/src/main/resources/codegen-resources/customization.config +++ b/services/migrationhub/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "excludedSimpleMethods": [ "*" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/migrationhubconfig/src/main/resources/codegen-resources/customization.config b/services/migrationhubconfig/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/migrationhubconfig/src/main/resources/codegen-resources/customization.config +++ b/services/migrationhubconfig/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/migrationhuborchestrator/src/main/resources/codegen-resources/customization.config b/services/migrationhuborchestrator/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/migrationhuborchestrator/src/main/resources/codegen-resources/customization.config +++ b/services/migrationhuborchestrator/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/migrationhubrefactorspaces/src/main/resources/codegen-resources/customization.config b/services/migrationhubrefactorspaces/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/migrationhubrefactorspaces/src/main/resources/codegen-resources/customization.config +++ b/services/migrationhubrefactorspaces/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/migrationhubstrategy/src/main/resources/codegen-resources/customization.config b/services/migrationhubstrategy/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/migrationhubstrategy/src/main/resources/codegen-resources/customization.config +++ b/services/migrationhubstrategy/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/mq/src/main/resources/codegen-resources/customization.config b/services/mq/src/main/resources/codegen-resources/customization.config index f2a240391567..2fb6426d19d5 100644 --- a/services/mq/src/main/resources/codegen-resources/customization.config +++ b/services/mq/src/main/resources/codegen-resources/customization.config @@ -6,6 +6,5 @@ "excludedSimpleMethods": [ "createBroker", "createConfiguration" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/mturk/src/main/resources/codegen-resources/customization.config b/services/mturk/src/main/resources/codegen-resources/customization.config index ce10323d7ce7..dccf427b7cae 100644 --- a/services/mturk/src/main/resources/codegen-resources/customization.config +++ b/services/mturk/src/main/resources/codegen-resources/customization.config @@ -8,6 +8,5 @@ "getAccountBalance", "listQualificationRequests", "listHITs" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/mwaa/src/main/resources/codegen-resources/customization.config b/services/mwaa/src/main/resources/codegen-resources/customization.config index cdf857bdc287..e8d9faf606f5 100644 --- a/services/mwaa/src/main/resources/codegen-resources/customization.config +++ b/services/mwaa/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "generateEndpointClientTests": true, - "enableGenerateCompiledEndpointRules": true + "generateEndpointClientTests": true } diff --git a/services/neptune/src/main/resources/codegen-resources/customization.config b/services/neptune/src/main/resources/codegen-resources/customization.config index c0859e026214..bbe1cd2bdb2c 100644 --- a/services/neptune/src/main/resources/codegen-resources/customization.config +++ b/services/neptune/src/main/resources/codegen-resources/customization.config @@ -39,8 +39,7 @@ "interceptors": [ "software.amazon.awssdk.services.neptune.internal.CopyDbClusterSnapshotPresignInterceptor", "software.amazon.awssdk.services.neptune.internal.CreateDbClusterPresignInterceptor" - ], + ] - "enableGenerateCompiledEndpointRules": true } diff --git a/services/neptunedata/src/main/resources/codegen-resources/customization.config b/services/neptunedata/src/main/resources/codegen-resources/customization.config index e16c687a7da2..1afec6c42d9f 100644 --- a/services/neptunedata/src/main/resources/codegen-resources/customization.config +++ b/services/neptunedata/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "customErrorCodeFieldName": "code", - "enableGenerateCompiledEndpointRules": true + "customErrorCodeFieldName": "code" } diff --git a/services/neptunegraph/src/main/resources/codegen-resources/customization.config b/services/neptunegraph/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/neptunegraph/src/main/resources/codegen-resources/customization.config +++ b/services/neptunegraph/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/networkfirewall/src/main/resources/codegen-resources/customization.config b/services/networkfirewall/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/networkfirewall/src/main/resources/codegen-resources/customization.config +++ b/services/networkfirewall/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/networkmanager/src/main/resources/codegen-resources/customization.config b/services/networkmanager/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/networkmanager/src/main/resources/codegen-resources/customization.config +++ b/services/networkmanager/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/networkmonitor/src/main/resources/codegen-resources/customization.config b/services/networkmonitor/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/networkmonitor/src/main/resources/codegen-resources/customization.config +++ b/services/networkmonitor/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/oam/src/main/resources/codegen-resources/customization.config b/services/oam/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/oam/src/main/resources/codegen-resources/customization.config +++ b/services/oam/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/omics/src/main/resources/codegen-resources/customization.config b/services/omics/src/main/resources/codegen-resources/customization.config index cdf857bdc287..e8d9faf606f5 100644 --- a/services/omics/src/main/resources/codegen-resources/customization.config +++ b/services/omics/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "generateEndpointClientTests": true, - "enableGenerateCompiledEndpointRules": true + "generateEndpointClientTests": true } diff --git a/services/opensearch/src/main/resources/codegen-resources/customization.config b/services/opensearch/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/opensearch/src/main/resources/codegen-resources/customization.config +++ b/services/opensearch/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/opensearchserverless/src/main/resources/codegen-resources/customization.config b/services/opensearchserverless/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/opensearchserverless/src/main/resources/codegen-resources/customization.config +++ b/services/opensearchserverless/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/organizations/src/main/resources/codegen-resources/customization.config b/services/organizations/src/main/resources/codegen-resources/customization.config index cf0472a9f85f..c2122a67f377 100644 --- a/services/organizations/src/main/resources/codegen-resources/customization.config +++ b/services/organizations/src/main/resources/codegen-resources/customization.config @@ -11,6 +11,5 @@ "listHandshakesForAccount", "listRoots", "listAWSServiceAccessForOrganization" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/osis/src/main/resources/codegen-resources/customization.config b/services/osis/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/osis/src/main/resources/codegen-resources/customization.config +++ b/services/osis/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/outposts/src/main/resources/codegen-resources/customization.config b/services/outposts/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/outposts/src/main/resources/codegen-resources/customization.config +++ b/services/outposts/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/paymentcryptography/src/main/resources/codegen-resources/customization.config b/services/paymentcryptography/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/paymentcryptography/src/main/resources/codegen-resources/customization.config +++ b/services/paymentcryptography/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/paymentcryptographydata/src/main/resources/codegen-resources/customization.config b/services/paymentcryptographydata/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/paymentcryptographydata/src/main/resources/codegen-resources/customization.config +++ b/services/paymentcryptographydata/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/pcaconnectorad/src/main/resources/codegen-resources/customization.config b/services/pcaconnectorad/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/pcaconnectorad/src/main/resources/codegen-resources/customization.config +++ b/services/pcaconnectorad/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/personalize/src/main/resources/codegen-resources/customization.config b/services/personalize/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/personalize/src/main/resources/codegen-resources/customization.config +++ b/services/personalize/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/personalizeevents/src/main/resources/codegen-resources/customization.config b/services/personalizeevents/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/personalizeevents/src/main/resources/codegen-resources/customization.config +++ b/services/personalizeevents/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/personalizeruntime/src/main/resources/codegen-resources/customization.config b/services/personalizeruntime/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/personalizeruntime/src/main/resources/codegen-resources/customization.config +++ b/services/personalizeruntime/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/pi/src/main/resources/codegen-resources/customization.config b/services/pi/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/pi/src/main/resources/codegen-resources/customization.config +++ b/services/pi/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/pinpoint/src/main/resources/codegen-resources/customization.config b/services/pinpoint/src/main/resources/codegen-resources/customization.config index b62371178863..e0ed7172b767 100644 --- a/services/pinpoint/src/main/resources/codegen-resources/customization.config +++ b/services/pinpoint/src/main/resources/codegen-resources/customization.config @@ -5,6 +5,5 @@ "renameShapes": { "__EndpointTypesElement": "EndpointTypesElement" }, - "underscoresInNameBehavior": "ALLOW", - "enableGenerateCompiledEndpointRules": true + "underscoresInNameBehavior": "ALLOW" } diff --git a/services/pinpointemail/src/main/resources/codegen-resources/customization.config b/services/pinpointemail/src/main/resources/codegen-resources/customization.config index 3324fc23dfb2..e5b907464f12 100644 --- a/services/pinpointemail/src/main/resources/codegen-resources/customization.config +++ b/services/pinpointemail/src/main/resources/codegen-resources/customization.config @@ -9,6 +9,5 @@ "listDedicatedIpPools", "listDeliverabilityTestReports", "listEmailIdentities" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/pinpointsmsvoice/src/main/resources/codegen-resources/customization.config b/services/pinpointsmsvoice/src/main/resources/codegen-resources/customization.config index ba02b96b8737..1250a7bd114d 100644 --- a/services/pinpointsmsvoice/src/main/resources/codegen-resources/customization.config +++ b/services/pinpointsmsvoice/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "excludedSimpleMethods": [ "listConfigurationSets" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/pinpointsmsvoicev2/src/main/resources/codegen-resources/customization.config b/services/pinpointsmsvoicev2/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/pinpointsmsvoicev2/src/main/resources/codegen-resources/customization.config +++ b/services/pinpointsmsvoicev2/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/pipes/src/main/resources/codegen-resources/customization.config b/services/pipes/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/pipes/src/main/resources/codegen-resources/customization.config +++ b/services/pipes/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/polly/src/main/resources/codegen-resources/customization.config b/services/polly/src/main/resources/codegen-resources/customization.config index a32ecb08f66a..ff2beaa7b510 100644 --- a/services/polly/src/main/resources/codegen-resources/customization.config +++ b/services/polly/src/main/resources/codegen-resources/customization.config @@ -3,6 +3,5 @@ "describeVoices", "listLexicons", "listSpeechSynthesisTasks" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/pricing/src/main/resources/codegen-resources/customization.config b/services/pricing/src/main/resources/codegen-resources/customization.config index 9cf3a85600aa..3ea4709a4549 100644 --- a/services/pricing/src/main/resources/codegen-resources/customization.config +++ b/services/pricing/src/main/resources/codegen-resources/customization.config @@ -4,6 +4,5 @@ ], "excludedSimpleMethods": [ "getProducts" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/proton/src/main/resources/codegen-resources/customization.config b/services/proton/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/proton/src/main/resources/codegen-resources/customization.config +++ b/services/proton/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/qbusiness/src/main/resources/codegen-resources/customization.config b/services/qbusiness/src/main/resources/codegen-resources/customization.config index f754ccb8740d..4598243f17a8 100644 --- a/services/qbusiness/src/main/resources/codegen-resources/customization.config +++ b/services/qbusiness/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "enableGenerateCompiledEndpointRules": true, "usePriorKnowledgeForH2": true } diff --git a/services/qconnect/src/main/resources/codegen-resources/customization.config b/services/qconnect/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/qconnect/src/main/resources/codegen-resources/customization.config +++ b/services/qconnect/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/quicksight/src/main/resources/codegen-resources/customization.config b/services/quicksight/src/main/resources/codegen-resources/customization.config index 788e9cb8d991..cadacf8d10b0 100644 --- a/services/quicksight/src/main/resources/codegen-resources/customization.config +++ b/services/quicksight/src/main/resources/codegen-resources/customization.config @@ -144,6 +144,5 @@ "DataSourceParameters": { "union": true } - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/services/ram/src/main/resources/codegen-resources/customization.config b/services/ram/src/main/resources/codegen-resources/customization.config index 0aab6ae18cac..962559b5c74c 100644 --- a/services/ram/src/main/resources/codegen-resources/customization.config +++ b/services/ram/src/main/resources/codegen-resources/customization.config @@ -2,6 +2,5 @@ "verifiedSimpleMethods": [ "getResourceShareInvitations", "enableSharingWithAwsOrganization" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/rbin/src/main/resources/codegen-resources/customization.config b/services/rbin/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/rbin/src/main/resources/codegen-resources/customization.config +++ b/services/rbin/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/rds/src/main/resources/codegen-resources/customization.config b/services/rds/src/main/resources/codegen-resources/customization.config index b51679336614..c7ccf3e50397 100644 --- a/services/rds/src/main/resources/codegen-resources/customization.config +++ b/services/rds/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { - "enableGenerateCompiledEndpointRules": true, "shapeModifiers" : { "CopyDBSnapshotMessage" : { "inject" : [ diff --git a/services/rdsdata/src/main/resources/codegen-resources/customization.config b/services/rdsdata/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/rdsdata/src/main/resources/codegen-resources/customization.config +++ b/services/rdsdata/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/redshift/src/main/resources/codegen-resources/customization.config b/services/redshift/src/main/resources/codegen-resources/customization.config index 2c9b5b0e6292..420c075d2035 100644 --- a/services/redshift/src/main/resources/codegen-resources/customization.config +++ b/services/redshift/src/main/resources/codegen-resources/customization.config @@ -24,8 +24,7 @@ "excludedSimpleMethods": [ "describeTableRestoreStatus", "describeClusterSecurityGroups" - ], + ] - "enableGenerateCompiledEndpointRules": true } diff --git a/services/redshiftdata/src/main/resources/codegen-resources/customization.config b/services/redshiftdata/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/redshiftdata/src/main/resources/codegen-resources/customization.config +++ b/services/redshiftdata/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/redshiftserverless/src/main/resources/codegen-resources/customization.config b/services/redshiftserverless/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/redshiftserverless/src/main/resources/codegen-resources/customization.config +++ b/services/redshiftserverless/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/rekognition/src/main/resources/codegen-resources/customization.config b/services/rekognition/src/main/resources/codegen-resources/customization.config index 284e705d144f..2c703da2ab1e 100644 --- a/services/rekognition/src/main/resources/codegen-resources/customization.config +++ b/services/rekognition/src/main/resources/codegen-resources/customization.config @@ -6,6 +6,5 @@ "excludedSimpleMethods": [ "describeTableRestoreStatus", "describeClusterSecurityGroups" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/repostspace/src/main/resources/codegen-resources/customization.config b/services/repostspace/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/repostspace/src/main/resources/codegen-resources/customization.config +++ b/services/repostspace/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/resiliencehub/src/main/resources/codegen-resources/customization.config b/services/resiliencehub/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/resiliencehub/src/main/resources/codegen-resources/customization.config +++ b/services/resiliencehub/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/resourceexplorer2/src/main/resources/codegen-resources/customization.config b/services/resourceexplorer2/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/resourceexplorer2/src/main/resources/codegen-resources/customization.config +++ b/services/resourceexplorer2/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/resourcegroups/src/main/resources/codegen-resources/customization.config b/services/resourcegroups/src/main/resources/codegen-resources/customization.config index f5f6e2d56258..cc94b90656a0 100644 --- a/services/resourcegroups/src/main/resources/codegen-resources/customization.config +++ b/services/resourcegroups/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listGroups" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/resourcegroupstaggingapi/src/main/resources/codegen-resources/customization.config b/services/resourcegroupstaggingapi/src/main/resources/codegen-resources/customization.config index c93cb9be664c..6e999de4f630 100644 --- a/services/resourcegroupstaggingapi/src/main/resources/codegen-resources/customization.config +++ b/services/resourcegroupstaggingapi/src/main/resources/codegen-resources/customization.config @@ -2,6 +2,5 @@ "verifiedSimpleMethods": [ "getResources", "getTagKeys" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/rolesanywhere/src/main/resources/codegen-resources/customization.config b/services/rolesanywhere/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/rolesanywhere/src/main/resources/codegen-resources/customization.config +++ b/services/rolesanywhere/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/route53/src/main/resources/codegen-resources/customization.config b/services/route53/src/main/resources/codegen-resources/customization.config index c25907200ffd..3b472ea39820 100644 --- a/services/route53/src/main/resources/codegen-resources/customization.config +++ b/services/route53/src/main/resources/codegen-resources/customization.config @@ -19,8 +19,7 @@ ], "interceptors": [ "software.amazon.awssdk.services.route53.internal.Route53IdInterceptor" - ], + ] - "enableGenerateCompiledEndpointRules": true } diff --git a/services/route53domains/src/main/resources/codegen-resources/customization.config b/services/route53domains/src/main/resources/codegen-resources/customization.config index f0538c37cbb6..476aefd61bb5 100644 --- a/services/route53domains/src/main/resources/codegen-resources/customization.config +++ b/services/route53domains/src/main/resources/codegen-resources/customization.config @@ -7,6 +7,5 @@ "excludedSimpleMethods": [ "viewBilling", "getContactReachabilityStatus" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/route53recoverycluster/src/main/resources/codegen-resources/customization.config b/services/route53recoverycluster/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/route53recoverycluster/src/main/resources/codegen-resources/customization.config +++ b/services/route53recoverycluster/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/route53recoverycontrolconfig/src/main/resources/codegen-resources/customization.config b/services/route53recoverycontrolconfig/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/route53recoverycontrolconfig/src/main/resources/codegen-resources/customization.config +++ b/services/route53recoverycontrolconfig/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/route53recoveryreadiness/src/main/resources/codegen-resources/customization.config b/services/route53recoveryreadiness/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/route53recoveryreadiness/src/main/resources/codegen-resources/customization.config +++ b/services/route53recoveryreadiness/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/route53resolver/src/main/resources/codegen-resources/customization.config b/services/route53resolver/src/main/resources/codegen-resources/customization.config index f7a32e6808c0..c9e00f244c0a 100644 --- a/services/route53resolver/src/main/resources/codegen-resources/customization.config +++ b/services/route53resolver/src/main/resources/codegen-resources/customization.config @@ -8,6 +8,5 @@ "listResolverEndpoints", "listResolverRuleAssociations", "listResolverRules" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/rum/src/main/resources/codegen-resources/customization.config b/services/rum/src/main/resources/codegen-resources/customization.config index cdf857bdc287..e8d9faf606f5 100644 --- a/services/rum/src/main/resources/codegen-resources/customization.config +++ b/services/rum/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "generateEndpointClientTests": true, - "enableGenerateCompiledEndpointRules": true + "generateEndpointClientTests": true } diff --git a/services/s3/src/main/java/software/amazon/awssdk/services/s3/endpoints/internal/KnownS3ExpressEndpointProperty.java b/services/s3/src/main/java/software/amazon/awssdk/services/s3/endpoints/internal/KnownS3ExpressEndpointProperty.java index 0bb694100826..c87b9aef20b8 100644 --- a/services/s3/src/main/java/software/amazon/awssdk/services/s3/endpoints/internal/KnownS3ExpressEndpointProperty.java +++ b/services/s3/src/main/java/software/amazon/awssdk/services/s3/endpoints/internal/KnownS3ExpressEndpointProperty.java @@ -15,12 +15,7 @@ package software.amazon.awssdk.services.s3.endpoints.internal; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.awscore.endpoints.AwsEndpointAttribute; -import software.amazon.awssdk.awscore.endpoints.authscheme.EndpointAuthScheme; import software.amazon.awssdk.endpoints.EndpointAttributeKey; @SdkInternalApi @@ -32,49 +27,6 @@ public final class KnownS3ExpressEndpointProperty { public static final EndpointAttributeKey BACKEND = new EndpointAttributeKey<>("Backend", String.class); - public static final List> KNOWN_S3_ENDPOINT_PROPERTIES = Collections.unmodifiableList( - Arrays.asList( - new AuthSchemesProperty(), - new BackendProperty() - ) - ); - private KnownS3ExpressEndpointProperty() { } - - private static class AuthSchemesProperty implements EndpointAttributeProvider> { - @Override - public String propertyName() { - return "authSchemes"; - } - - @Override - public EndpointAttributeKey> attributeKey() { - return AwsEndpointAttribute.AUTH_SCHEMES; - } - - @Override - public List attributeValue(Value value) { - EndpointAuthSchemeStrategyFactory endpointAuthSchemeStrategyFactory = new S3EndpointAuthSchemeStrategyFactory(); - EndpointAuthSchemeStrategy strategy = endpointAuthSchemeStrategyFactory.endpointAuthSchemeStrategy(); - return strategy.createAuthSchemes(value); - } - } - - private static class BackendProperty implements EndpointAttributeProvider { - @Override - public String propertyName() { - return "backend"; - } - - @Override - public EndpointAttributeKey attributeKey() { - return BACKEND; - } - - @Override - public String attributeValue(Value value) { - return value.expectString(); - } - } } diff --git a/services/s3/src/main/java/software/amazon/awssdk/services/s3/endpoints/internal/S3EndpointAuthSchemeStrategyFactory.java b/services/s3/src/main/java/software/amazon/awssdk/services/s3/endpoints/internal/S3EndpointAuthSchemeStrategyFactory.java deleted file mode 100644 index 57555d45843d..000000000000 --- a/services/s3/src/main/java/software/amazon/awssdk/services/s3/endpoints/internal/S3EndpointAuthSchemeStrategyFactory.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package software.amazon.awssdk.services.s3.endpoints.internal; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.awscore.endpoints.authscheme.EndpointAuthScheme; -import software.amazon.awssdk.awscore.endpoints.authscheme.SigV4AuthScheme; -import software.amazon.awssdk.awscore.endpoints.authscheme.SigV4aAuthScheme; -import software.amazon.awssdk.services.s3.endpoints.authscheme.S3ExpressEndpointAuthScheme; - -@SdkInternalApi -public final class S3EndpointAuthSchemeStrategyFactory implements EndpointAuthSchemeStrategyFactory { - - public static final String SIGNING_NAME_ID = "signingName"; - public static final String SIGNING_REGION_SET_ID = "signingRegionSet"; - public static final String DISABLE_DOUBLE_ENCODING_ID = "disableDoubleEncoding"; - public static final String SIGNING_REGION_ID = "signingRegion"; - - private static final String SIGV4_NAME = "sigv4"; - private static final String SIGV4A_NAME = "sigv4a"; - private static final String S3EXPRESS_NAME = "sigv4-s3express"; - - @Override - public EndpointAuthSchemeStrategy endpointAuthSchemeStrategy() { - Map> knownAuthSchemesMapping = new HashMap<>(); - knownAuthSchemesMapping.put(SIGV4A_NAME, this::sigV4A); - knownAuthSchemesMapping.put(SIGV4_NAME, this::sigV4); - knownAuthSchemesMapping.put(S3EXPRESS_NAME, this::s3Express); - return new DefaultEndpointAuthSchemeStrategy(knownAuthSchemesMapping); - } - - private EndpointAuthScheme sigV4A(Value.Record scheme) { - SigV4aAuthScheme.Builder schemeBuilder = SigV4aAuthScheme.builder(); - - Value signingName = scheme.get(Identifier.of(SIGNING_NAME_ID)); - if (signingName != null) { - schemeBuilder.signingName(signingName.expectString()); - } - - Value signingRegionSet = scheme.get(Identifier.of(SIGNING_REGION_SET_ID)); - if (signingRegionSet != null) { - Value.Array signingRegionSetArray = signingRegionSet.expectArray(); - for (int j = 0; j < signingRegionSetArray.size(); ++j) { - schemeBuilder.addSigningRegion(signingRegionSetArray.get(j).expectString()); - } - } - - Value disableDoubleEncoding = scheme.get(Identifier.of(DISABLE_DOUBLE_ENCODING_ID)); - if (disableDoubleEncoding != null) { - schemeBuilder.disableDoubleEncoding(disableDoubleEncoding.expectBool()); - } - - return schemeBuilder.build(); - } - - private EndpointAuthScheme sigV4(Value.Record scheme) { - SigV4AuthScheme.Builder schemeBuilder = SigV4AuthScheme.builder(); - - Value signingName = scheme.get(Identifier.of(SIGNING_NAME_ID)); - if (signingName != null) { - schemeBuilder.signingName(signingName.expectString()); - } - - Value signingRegion = scheme.get(Identifier.of(SIGNING_REGION_ID)); - if (signingRegion != null) { - schemeBuilder.signingRegion(signingRegion.expectString()); - } - - Value disableDoubleEncoding = scheme.get(Identifier.of(DISABLE_DOUBLE_ENCODING_ID)); - if (disableDoubleEncoding != null) { - schemeBuilder.disableDoubleEncoding(disableDoubleEncoding.expectBool()); - } - - return schemeBuilder.build(); - } - - private EndpointAuthScheme s3Express(Value.Record scheme) { - S3ExpressEndpointAuthScheme.Builder schemeBuilder = S3ExpressEndpointAuthScheme.builder(); - - Value signingName = scheme.get(Identifier.of(SIGNING_NAME_ID)); - if (signingName != null) { - schemeBuilder.signingName(signingName.expectString()); - } - - Value signingRegion = scheme.get(Identifier.of(SIGNING_REGION_ID)); - if (signingRegion != null) { - schemeBuilder.signingRegion(signingRegion.expectString()); - } - - Value disableDoubleEncoding = scheme.get(Identifier.of(DISABLE_DOUBLE_ENCODING_ID)); - if (disableDoubleEncoding != null) { - schemeBuilder.disableDoubleEncoding(disableDoubleEncoding.expectBool()); - } - - return schemeBuilder.build(); - } -} diff --git a/services/s3/src/main/resources/codegen-resources/customization.config b/services/s3/src/main/resources/codegen-resources/customization.config index b02db0b1c09a..2e952e3a59ef 100644 --- a/services/s3/src/main/resources/codegen-resources/customization.config +++ b/services/s3/src/main/resources/codegen-resources/customization.config @@ -332,7 +332,6 @@ } }, - "enableGenerateCompiledEndpointRules": true, "endpointParameters": { "DeleteObjectKeys": { "required": false, diff --git a/services/s3/src/test/java/software/amazon/awssdk/services/s3/internal/crossregion/S3CrossRegionSyncClientTest.java b/services/s3/src/test/java/software/amazon/awssdk/services/s3/internal/crossregion/S3CrossRegionSyncClientTest.java index fdec8f328aca..f7e78567b1d9 100644 --- a/services/s3/src/test/java/software/amazon/awssdk/services/s3/internal/crossregion/S3CrossRegionSyncClientTest.java +++ b/services/s3/src/test/java/software/amazon/awssdk/services/s3/internal/crossregion/S3CrossRegionSyncClientTest.java @@ -43,7 +43,6 @@ import org.junit.jupiter.params.provider.ValueSource; import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; -import org.mockito.Mock; import org.mockito.Mockito; import software.amazon.awssdk.core.interceptor.Context; import software.amazon.awssdk.core.interceptor.ExecutionAttributes; diff --git a/services/s3control/src/main/resources/codegen-resources/customization.config b/services/s3control/src/main/resources/codegen-resources/customization.config index 195563e9149e..44fa62c92b76 100644 --- a/services/s3control/src/main/resources/codegen-resources/customization.config +++ b/services/s3control/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { - "enableGenerateCompiledEndpointRules": true, "serviceConfig": { "className": "S3ControlConfiguration", "hasDualstackProperty": true, diff --git a/services/s3outposts/src/main/resources/codegen-resources/customization.config b/services/s3outposts/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/s3outposts/src/main/resources/codegen-resources/customization.config +++ b/services/s3outposts/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/sagemaker/src/main/resources/codegen-resources/customization.config b/services/sagemaker/src/main/resources/codegen-resources/customization.config index 5d63887a8f3e..bcf7d119479b 100644 --- a/services/sagemaker/src/main/resources/codegen-resources/customization.config +++ b/services/sagemaker/src/main/resources/codegen-resources/customization.config @@ -20,6 +20,5 @@ "TrialComponentParameterValue": { "union": true } - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/services/sagemakera2iruntime/src/main/resources/codegen-resources/customization.config b/services/sagemakera2iruntime/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/sagemakera2iruntime/src/main/resources/codegen-resources/customization.config +++ b/services/sagemakera2iruntime/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/sagemakeredge/src/main/resources/codegen-resources/customization.config b/services/sagemakeredge/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/sagemakeredge/src/main/resources/codegen-resources/customization.config +++ b/services/sagemakeredge/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/sagemakerfeaturestoreruntime/src/main/resources/codegen-resources/customization.config b/services/sagemakerfeaturestoreruntime/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/sagemakerfeaturestoreruntime/src/main/resources/codegen-resources/customization.config +++ b/services/sagemakerfeaturestoreruntime/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/sagemakergeospatial/src/main/resources/codegen-resources/customization.config b/services/sagemakergeospatial/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/sagemakergeospatial/src/main/resources/codegen-resources/customization.config +++ b/services/sagemakergeospatial/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/sagemakermetrics/src/main/resources/codegen-resources/customization.config b/services/sagemakermetrics/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/sagemakermetrics/src/main/resources/codegen-resources/customization.config +++ b/services/sagemakermetrics/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/sagemakerruntime/src/main/resources/codegen-resources/customization.config b/services/sagemakerruntime/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/sagemakerruntime/src/main/resources/codegen-resources/customization.config +++ b/services/sagemakerruntime/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/savingsplans/src/main/resources/codegen-resources/customization.config b/services/savingsplans/src/main/resources/codegen-resources/customization.config index d7ed49e2a984..c07d1f98a7e6 100644 --- a/services/savingsplans/src/main/resources/codegen-resources/customization.config +++ b/services/savingsplans/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "customServiceMetadata": { "contentType": "application/json" - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/services/scheduler/src/main/resources/codegen-resources/customization.config b/services/scheduler/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/scheduler/src/main/resources/codegen-resources/customization.config +++ b/services/scheduler/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/schemas/src/main/resources/codegen-resources/customization.config b/services/schemas/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/schemas/src/main/resources/codegen-resources/customization.config +++ b/services/schemas/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/secretsmanager/src/main/resources/codegen-resources/customization.config b/services/secretsmanager/src/main/resources/codegen-resources/customization.config index 55141f588dc7..23b6cfba9fda 100644 --- a/services/secretsmanager/src/main/resources/codegen-resources/customization.config +++ b/services/secretsmanager/src/main/resources/codegen-resources/customization.config @@ -2,6 +2,5 @@ "verifiedSimpleMethods": [ "getRandomPassword", "listSecrets" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/securityhub/src/main/resources/codegen-resources/customization.config b/services/securityhub/src/main/resources/codegen-resources/customization.config index fdcbc9df329a..d0e45589b9cf 100644 --- a/services/securityhub/src/main/resources/codegen-resources/customization.config +++ b/services/securityhub/src/main/resources/codegen-resources/customization.config @@ -12,6 +12,5 @@ "excludedSimpleMethods": [ "getEnabledStandards", "getInsights" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/securitylake/src/main/resources/codegen-resources/customization.config b/services/securitylake/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/securitylake/src/main/resources/codegen-resources/customization.config +++ b/services/securitylake/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/serverlessapplicationrepository/src/main/resources/codegen-resources/customization.config b/services/serverlessapplicationrepository/src/main/resources/codegen-resources/customization.config index f75675b7698b..fe8bc698abde 100644 --- a/services/serverlessapplicationrepository/src/main/resources/codegen-resources/customization.config +++ b/services/serverlessapplicationrepository/src/main/resources/codegen-resources/customization.config @@ -4,6 +4,5 @@ ], "verifiedSimpleMethods": [ "listApplications" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/servicecatalog/src/main/resources/codegen-resources/customization.config b/services/servicecatalog/src/main/resources/codegen-resources/customization.config index 7f77782fc298..0d56acb0896e 100644 --- a/services/servicecatalog/src/main/resources/codegen-resources/customization.config +++ b/services/servicecatalog/src/main/resources/codegen-resources/customization.config @@ -11,6 +11,5 @@ "listTagOptions", "searchProvisionedProducts", "getAWSOrganizationsAccessStatus" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/servicecatalogappregistry/src/main/resources/codegen-resources/customization.config b/services/servicecatalogappregistry/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/servicecatalogappregistry/src/main/resources/codegen-resources/customization.config +++ b/services/servicecatalogappregistry/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/servicediscovery/src/main/resources/codegen-resources/customization.config b/services/servicediscovery/src/main/resources/codegen-resources/customization.config index e62d340b16a3..5315549520de 100644 --- a/services/servicediscovery/src/main/resources/codegen-resources/customization.config +++ b/services/servicediscovery/src/main/resources/codegen-resources/customization.config @@ -4,6 +4,5 @@ "listOperations", "listServices" ], - "generateEndpointClientTests": true, - "enableGenerateCompiledEndpointRules": true + "generateEndpointClientTests": true } diff --git a/services/servicequotas/src/main/resources/codegen-resources/customization.config b/services/servicequotas/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/servicequotas/src/main/resources/codegen-resources/customization.config +++ b/services/servicequotas/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/ses/src/main/resources/codegen-resources/customization.config b/services/ses/src/main/resources/codegen-resources/customization.config index 0de5557533d5..8b6138ecefda 100644 --- a/services/ses/src/main/resources/codegen-resources/customization.config +++ b/services/ses/src/main/resources/codegen-resources/customization.config @@ -15,8 +15,7 @@ ], "excludedSimpleMethods": [ "updateAccountSendingEnabled" - ], + ] - "enableGenerateCompiledEndpointRules": true } diff --git a/services/sesv2/src/main/resources/codegen-resources/customization.config b/services/sesv2/src/main/resources/codegen-resources/customization.config index 3388694e6427..7ad0bbabcc1f 100644 --- a/services/sesv2/src/main/resources/codegen-resources/customization.config +++ b/services/sesv2/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "enableGenerateCompiledEndpointRules": true, "enableEndpointAuthSchemeParams": true } diff --git a/services/sfn/src/main/resources/codegen-resources/customization.config b/services/sfn/src/main/resources/codegen-resources/customization.config index 0df33f6080a1..99b2a1a03599 100644 --- a/services/sfn/src/main/resources/codegen-resources/customization.config +++ b/services/sfn/src/main/resources/codegen-resources/customization.config @@ -4,6 +4,5 @@ "listStateMachines" ], "serviceSpecificHttpConfig": "software.amazon.awssdk.services.sfn.internal.SfnHttpConfigurationOptions", - "generateEndpointClientTests": true, - "enableGenerateCompiledEndpointRules": true + "generateEndpointClientTests": true } diff --git a/services/shield/src/main/resources/codegen-resources/customization.config b/services/shield/src/main/resources/codegen-resources/customization.config index 7746e3896c44..7d2323feedfa 100644 --- a/services/shield/src/main/resources/codegen-resources/customization.config +++ b/services/shield/src/main/resources/codegen-resources/customization.config @@ -16,6 +16,5 @@ ], "deprecatedOperations": [ "DeleteSubscription" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/signer/src/main/resources/codegen-resources/customization.config b/services/signer/src/main/resources/codegen-resources/customization.config index 5c2bd87be192..6e174ea988f2 100644 --- a/services/signer/src/main/resources/codegen-resources/customization.config +++ b/services/signer/src/main/resources/codegen-resources/customization.config @@ -3,6 +3,5 @@ "listSigningJobs", "listSigningPlatforms", "listSigningProfiles" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/snowball/src/main/resources/codegen-resources/customization.config b/services/snowball/src/main/resources/codegen-resources/customization.config index 54b6acdf321e..a19b2b5e7261 100644 --- a/services/snowball/src/main/resources/codegen-resources/customization.config +++ b/services/snowball/src/main/resources/codegen-resources/customization.config @@ -19,6 +19,5 @@ }, "excludedSimpleMethods": [ "createJob" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/snowdevicemanagement/src/main/resources/codegen-resources/customization.config b/services/snowdevicemanagement/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/snowdevicemanagement/src/main/resources/codegen-resources/customization.config +++ b/services/snowdevicemanagement/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/sns/src/main/resources/codegen-resources/customization.config b/services/sns/src/main/resources/codegen-resources/customization.config index fa152e531c44..4fcdf0415562 100644 --- a/services/sns/src/main/resources/codegen-resources/customization.config +++ b/services/sns/src/main/resources/codegen-resources/customization.config @@ -19,8 +19,7 @@ } ] } - }, + } - "enableGenerateCompiledEndpointRules": true } diff --git a/services/sqs/src/main/resources/codegen-resources/customization.config b/services/sqs/src/main/resources/codegen-resources/customization.config index 1e0dd0cada26..44848a1e3b7a 100644 --- a/services/sqs/src/main/resources/codegen-resources/customization.config +++ b/services/sqs/src/main/resources/codegen-resources/customization.config @@ -11,6 +11,5 @@ "type": "boolean" } }, - "enableGenerateCompiledEndpointRules": true, "batchManagerSupported": true } diff --git a/services/ssm/src/main/resources/codegen-resources/customization.config b/services/ssm/src/main/resources/codegen-resources/customization.config index 926c0be479ff..00fcb960d059 100644 --- a/services/ssm/src/main/resources/codegen-resources/customization.config +++ b/services/ssm/src/main/resources/codegen-resources/customization.config @@ -25,6 +25,5 @@ "describeAssociation", "listComplianceItems", "describeMaintenanceWindowSchedule" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/ssmcontacts/src/main/resources/codegen-resources/customization.config b/services/ssmcontacts/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/ssmcontacts/src/main/resources/codegen-resources/customization.config +++ b/services/ssmcontacts/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/ssmincidents/src/main/resources/codegen-resources/customization.config b/services/ssmincidents/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/ssmincidents/src/main/resources/codegen-resources/customization.config +++ b/services/ssmincidents/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/ssmsap/src/main/resources/codegen-resources/customization.config b/services/ssmsap/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/ssmsap/src/main/resources/codegen-resources/customization.config +++ b/services/ssmsap/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/sso/src/main/resources/codegen-resources/customization.config b/services/sso/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/sso/src/main/resources/codegen-resources/customization.config +++ b/services/sso/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/ssoadmin/src/main/resources/codegen-resources/customization.config b/services/ssoadmin/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/ssoadmin/src/main/resources/codegen-resources/customization.config +++ b/services/ssoadmin/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/storagegateway/src/main/resources/codegen-resources/customization.config b/services/storagegateway/src/main/resources/codegen-resources/customization.config index 2383d1862b10..d354924e1729 100644 --- a/services/storagegateway/src/main/resources/codegen-resources/customization.config +++ b/services/storagegateway/src/main/resources/codegen-resources/customization.config @@ -17,6 +17,5 @@ "error" ] } - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/services/sts/src/main/java/software/amazon/awssdk/services/sts/auth/StsGetFederationTokenCredentialsProvider.java b/services/sts/src/main/java/software/amazon/awssdk/services/sts/auth/StsGetFederationTokenCredentialsProvider.java index 7fb6a33e9cba..e096d66eceb3 100644 --- a/services/sts/src/main/java/software/amazon/awssdk/services/sts/auth/StsGetFederationTokenCredentialsProvider.java +++ b/services/sts/src/main/java/software/amazon/awssdk/services/sts/auth/StsGetFederationTokenCredentialsProvider.java @@ -25,7 +25,7 @@ import software.amazon.awssdk.auth.credentials.AwsSessionCredentials; import software.amazon.awssdk.core.useragent.BusinessMetricFeatureId; import software.amazon.awssdk.services.sts.StsClient; -import software.amazon.awssdk.services.sts.endpoints.internal.Arn; +import software.amazon.awssdk.services.sts.endpoints.internal.RuleArn; import software.amazon.awssdk.services.sts.model.FederatedUser; import software.amazon.awssdk.services.sts.model.GetFederationTokenRequest; import software.amazon.awssdk.services.sts.model.GetFederationTokenResponse; @@ -89,9 +89,11 @@ private String accountIdFromArn(FederatedUser federatedUser) { if (federatedUser == null) { return null; } - return Arn.parse(federatedUser.arn()) - .map(Arn::accountId) - .orElse(null); + RuleArn arn = RuleArn.parse(federatedUser.arn()); + if (arn == null) { + return null; + } + return arn.accountId(); } @Override diff --git a/services/sts/src/main/java/software/amazon/awssdk/services/sts/internal/StsAuthUtils.java b/services/sts/src/main/java/software/amazon/awssdk/services/sts/internal/StsAuthUtils.java index e854495e0124..fb84fbb2f1cf 100644 --- a/services/sts/src/main/java/software/amazon/awssdk/services/sts/internal/StsAuthUtils.java +++ b/services/sts/src/main/java/software/amazon/awssdk/services/sts/internal/StsAuthUtils.java @@ -17,7 +17,7 @@ import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.auth.credentials.AwsSessionCredentials; -import software.amazon.awssdk.services.sts.endpoints.internal.Arn; +import software.amazon.awssdk.services.sts.endpoints.internal.RuleArn; import software.amazon.awssdk.services.sts.model.AssumedRoleUser; import software.amazon.awssdk.services.sts.model.Credentials; @@ -31,9 +31,11 @@ public static String accountIdFromArn(AssumedRoleUser assumedRoleUser) { if (assumedRoleUser == null) { return null; } - return Arn.parse(assumedRoleUser.arn()) - .map(Arn::accountId) - .orElse(null); + RuleArn arn = RuleArn.parse(assumedRoleUser.arn()); + if (arn == null) { + return null; + } + return arn.accountId(); } public static AwsSessionCredentials fromStsCredentials(Credentials credentials, String provider) { diff --git a/services/sts/src/main/resources/codegen-resources/customization.config b/services/sts/src/main/resources/codegen-resources/customization.config index 26879092eaa6..320740074fe5 100644 --- a/services/sts/src/main/resources/codegen-resources/customization.config +++ b/services/sts/src/main/resources/codegen-resources/customization.config @@ -21,6 +21,5 @@ "UseGlobalEndpoint with legacy region `us-west-2`": "V2 does not support setting UseGlobalEndpoint. It's regional only/by default" }, - "enableGenerateCompiledEndpointRules": true, "customRetryStrategy" : "software.amazon.awssdk.services.sts.internal.StsRetryStrategy" } diff --git a/services/sts/src/test/java/software/amazon/awssdk/services/sts/auth/StsCredentialsProviderTestBase.java b/services/sts/src/test/java/software/amazon/awssdk/services/sts/auth/StsCredentialsProviderTestBase.java index 8c054aa97e1a..e7bce1105295 100644 --- a/services/sts/src/test/java/software/amazon/awssdk/services/sts/auth/StsCredentialsProviderTestBase.java +++ b/services/sts/src/test/java/software/amazon/awssdk/services/sts/auth/StsCredentialsProviderTestBase.java @@ -29,7 +29,6 @@ import org.mockito.junit.jupiter.MockitoExtension; import software.amazon.awssdk.auth.credentials.AwsSessionCredentials; import software.amazon.awssdk.services.sts.StsClient; -import software.amazon.awssdk.services.sts.endpoints.internal.Arn; import software.amazon.awssdk.services.sts.model.Credentials; /** diff --git a/services/supplychain/src/main/resources/codegen-resources/customization.config b/services/supplychain/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/supplychain/src/main/resources/codegen-resources/customization.config +++ b/services/supplychain/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/support/src/main/resources/codegen-resources/customization.config b/services/support/src/main/resources/codegen-resources/customization.config index 8376e307ce94..14581b7ee319 100644 --- a/services/support/src/main/resources/codegen-resources/customization.config +++ b/services/support/src/main/resources/codegen-resources/customization.config @@ -4,6 +4,5 @@ "describeSeverityLevels", "describeCases", "describeServices" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/supportapp/src/main/resources/codegen-resources/customization.config b/services/supportapp/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/supportapp/src/main/resources/codegen-resources/customization.config +++ b/services/supportapp/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/swf/src/main/resources/codegen-resources/customization.config b/services/swf/src/main/resources/codegen-resources/customization.config index 704ac68ddeb8..f2b99d866f9c 100644 --- a/services/swf/src/main/resources/codegen-resources/customization.config +++ b/services/swf/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "serviceSpecificHttpConfig": "software.amazon.awssdk.services.swf.internal.SwfHttpConfigurationOptions", - "enableGenerateCompiledEndpointRules": true + "serviceSpecificHttpConfig": "software.amazon.awssdk.services.swf.internal.SwfHttpConfigurationOptions" } diff --git a/services/synthetics/src/main/resources/codegen-resources/customization.config b/services/synthetics/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/synthetics/src/main/resources/codegen-resources/customization.config +++ b/services/synthetics/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/textract/src/main/resources/codegen-resources/customization.config b/services/textract/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/textract/src/main/resources/codegen-resources/customization.config +++ b/services/textract/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/timestreamquery/src/main/resources/codegen-resources/customization.config b/services/timestreamquery/src/main/resources/codegen-resources/customization.config index 75948b49c354..f777b577fbe8 100644 --- a/services/timestreamquery/src/main/resources/codegen-resources/customization.config +++ b/services/timestreamquery/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { - "allowEndpointOverrideForEndpointDiscoveryRequiredOperations": true, + "allowEndpointOverrideForEndpointDiscoveryRequiredOperations": true - "enableGenerateCompiledEndpointRules": true } diff --git a/services/timestreamwrite/src/main/resources/codegen-resources/customization.config b/services/timestreamwrite/src/main/resources/codegen-resources/customization.config index bca9c08d17ec..f5001ab47fc6 100644 --- a/services/timestreamwrite/src/main/resources/codegen-resources/customization.config +++ b/services/timestreamwrite/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,3 @@ { - "allowEndpointOverrideForEndpointDiscoveryRequiredOperations": true, - "enableGenerateCompiledEndpointRules": true + "allowEndpointOverrideForEndpointDiscoveryRequiredOperations": true } diff --git a/services/tnb/src/main/resources/codegen-resources/customization.config b/services/tnb/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/tnb/src/main/resources/codegen-resources/customization.config +++ b/services/tnb/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/transcribe/src/main/resources/codegen-resources/customization.config b/services/transcribe/src/main/resources/codegen-resources/customization.config index 7d4a6e0d6c5b..ff06be57a475 100644 --- a/services/transcribe/src/main/resources/codegen-resources/customization.config +++ b/services/transcribe/src/main/resources/codegen-resources/customization.config @@ -1,5 +1,4 @@ { - "enableGenerateCompiledEndpointRules": true, "verifiedSimpleMethods" : [ "listTranscriptionJobs", "listVocabularies" diff --git a/services/transcribestreaming/src/main/resources/codegen-resources/customization.config b/services/transcribestreaming/src/main/resources/codegen-resources/customization.config index 93624870594f..fde78a855326 100644 --- a/services/transcribestreaming/src/main/resources/codegen-resources/customization.config +++ b/services/transcribestreaming/src/main/resources/codegen-resources/customization.config @@ -1,5 +1,4 @@ { - "enableGenerateCompiledEndpointRules": true, "serviceSpecificHttpConfig": "software.amazon.awssdk.services.transcribestreaming.internal.DefaultHttpConfigurationOptions", "skipSyncClientGeneration": true, "useLegacyEventGenerationScheme": { diff --git a/services/transfer/src/main/resources/codegen-resources/customization.config b/services/transfer/src/main/resources/codegen-resources/customization.config index 74e0cba3a8db..6634ed4039cc 100644 --- a/services/transfer/src/main/resources/codegen-resources/customization.config +++ b/services/transfer/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listServers" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/translate/src/main/resources/codegen-resources/customization.config b/services/translate/src/main/resources/codegen-resources/customization.config index f927886f4077..9cdac486bf17 100644 --- a/services/translate/src/main/resources/codegen-resources/customization.config +++ b/services/translate/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listTerminologies" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/trustedadvisor/src/main/resources/codegen-resources/customization.config b/services/trustedadvisor/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/trustedadvisor/src/main/resources/codegen-resources/customization.config +++ b/services/trustedadvisor/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/verifiedpermissions/src/main/resources/codegen-resources/customization.config b/services/verifiedpermissions/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/verifiedpermissions/src/main/resources/codegen-resources/customization.config +++ b/services/verifiedpermissions/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/voiceid/src/main/resources/codegen-resources/customization.config b/services/voiceid/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/voiceid/src/main/resources/codegen-resources/customization.config +++ b/services/voiceid/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/vpclattice/src/main/resources/codegen-resources/customization.config b/services/vpclattice/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/vpclattice/src/main/resources/codegen-resources/customization.config +++ b/services/vpclattice/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/waf/src/main/resources/codegen-resources/customization.config b/services/waf/src/main/resources/codegen-resources/customization.config index c2457f7c37ab..09dcdc034de9 100644 --- a/services/waf/src/main/resources/codegen-resources/customization.config +++ b/services/waf/src/main/resources/codegen-resources/customization.config @@ -1,5 +1,4 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/wafv2/src/main/resources/codegen-resources/customization.config b/services/wafv2/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/wafv2/src/main/resources/codegen-resources/customization.config +++ b/services/wafv2/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/wellarchitected/src/main/resources/codegen-resources/customization.config b/services/wellarchitected/src/main/resources/codegen-resources/customization.config index d7ed49e2a984..c07d1f98a7e6 100644 --- a/services/wellarchitected/src/main/resources/codegen-resources/customization.config +++ b/services/wellarchitected/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "customServiceMetadata": { "contentType": "application/json" - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/services/wisdom/src/main/resources/codegen-resources/customization.config b/services/wisdom/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/wisdom/src/main/resources/codegen-resources/customization.config +++ b/services/wisdom/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/workdocs/src/main/resources/codegen-resources/customization.config b/services/workdocs/src/main/resources/codegen-resources/customization.config index c89f8010e088..d259cf264e11 100644 --- a/services/workdocs/src/main/resources/codegen-resources/customization.config +++ b/services/workdocs/src/main/resources/codegen-resources/customization.config @@ -3,6 +3,5 @@ "describeUsers", "describeActivities", "getResources" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/workmail/src/main/resources/codegen-resources/customization.config b/services/workmail/src/main/resources/codegen-resources/customization.config index cade6d8f3851..e1478802b59d 100644 --- a/services/workmail/src/main/resources/codegen-resources/customization.config +++ b/services/workmail/src/main/resources/codegen-resources/customization.config @@ -1,6 +1,5 @@ { "verifiedSimpleMethods": [ "listOrganizations" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/workmailmessageflow/src/main/resources/codegen-resources/customization.config b/services/workmailmessageflow/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/workmailmessageflow/src/main/resources/codegen-resources/customization.config +++ b/services/workmailmessageflow/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/workspaces/src/main/resources/codegen-resources/customization.config b/services/workspaces/src/main/resources/codegen-resources/customization.config index fd0fde6fe6ff..4494f73266ff 100644 --- a/services/workspaces/src/main/resources/codegen-resources/customization.config +++ b/services/workspaces/src/main/resources/codegen-resources/customization.config @@ -10,6 +10,5 @@ "excludedSimpleMethods": [ "describeAccountModifications", "describeAccount" - ], - "enableGenerateCompiledEndpointRules": true + ] } diff --git a/services/workspacesthinclient/src/main/resources/codegen-resources/customization.config b/services/workspacesthinclient/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/workspacesthinclient/src/main/resources/codegen-resources/customization.config +++ b/services/workspacesthinclient/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/workspacesweb/src/main/resources/codegen-resources/customization.config b/services/workspacesweb/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/services/workspacesweb/src/main/resources/codegen-resources/customization.config +++ b/services/workspacesweb/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/services/xray/src/main/resources/codegen-resources/customization.config b/services/xray/src/main/resources/codegen-resources/customization.config index e30f4faf438f..ecb184d32a62 100644 --- a/services/xray/src/main/resources/codegen-resources/customization.config +++ b/services/xray/src/main/resources/codegen-resources/customization.config @@ -13,6 +13,5 @@ "AnnotationValue": { "union": true } - }, - "enableGenerateCompiledEndpointRules": true + } } diff --git a/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/NamingConventionWithSuppressionTest.java b/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/NamingConventionWithSuppressionTest.java index 75277418c19a..65f6eb4e8ab1 100644 --- a/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/NamingConventionWithSuppressionTest.java +++ b/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/NamingConventionWithSuppressionTest.java @@ -23,12 +23,12 @@ import com.tngtech.archunit.junit.ArchTest; import com.tngtech.archunit.lang.ArchRule; import java.util.Arrays; +import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.util.function.Supplier; import java.util.regex.Pattern; import org.junit.jupiter.api.Test; -import software.amazon.awssdk.services.s3.endpoints.internal.S3EndpointAuthSchemeStrategyFactory; /** * This test class diffs from {@link NamingConventionTest}; it doesn't use archunit annotations such as {@link ArchTest} @@ -45,8 +45,7 @@ public class NamingConventionWithSuppressionTest { * DO NOT ADD NEW EXCEPTIONS */ private static final Set ALLOWED_SUPPLIER_SUPPRESSION = new HashSet<>( - Arrays.asList(Pattern.compile(".*/DefaultEndpointAuthSchemeStrategyFactory.class"), - ArchUtils.classNameToPattern(S3EndpointAuthSchemeStrategyFactory.class))); + Collections.singletonList(Pattern.compile(".*/DefaultEndpointAuthSchemeStrategyFactory.class"))); @Test void supplierImpl_shouldHaveSupplierSuffix() { diff --git a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/compiledrules/customization.config b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/compiledrules/customization.config index e824e95e8fbd..2c63c0851048 100644 --- a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/compiledrules/customization.config +++ b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/compiledrules/customization.config @@ -1,3 +1,2 @@ { - "enableGenerateCompiledEndpointRules": true } diff --git a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/defaultretrymode/customization.config b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/defaultretrymode/customization.config index f0057184b8e0..365f086ad0f9 100644 --- a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/defaultretrymode/customization.config +++ b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/defaultretrymode/customization.config @@ -1,6 +1,4 @@ { - "defaultRetryMode": "STANDARD", + "defaultRetryMode": "STANDARD" - - "enableGenerateCompiledEndpointRules": true } \ No newline at end of file diff --git a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/endpointproviders/customization.config b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/endpointproviders/customization.config index 341d2bca3aa5..41d9edb67337 100644 --- a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/endpointproviders/customization.config +++ b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/endpointproviders/customization.config @@ -1,7 +1,6 @@ { "skipEndpointTestGeneration": true, - "enableGenerateCompiledEndpointRules": false, "endpointParameters": { "PojoString": { "required": false, diff --git a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/sdkrpcv2/customization.config b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/sdkrpcv2/customization.config index 4a57cda840dd..f137036979c6 100644 --- a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/sdkrpcv2/customization.config +++ b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/sdkrpcv2/customization.config @@ -1,4 +1,3 @@ { - "enableGenerateCompiledEndpointRules": true, "skipEndpointTestGeneration": true } diff --git a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/stringarray/customization.config b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/stringarray/customization.config index bb763afd276b..ec7c8d355d50 100644 --- a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/stringarray/customization.config +++ b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/stringarray/customization.config @@ -1,4 +1,3 @@ { - "skipEndpointTestGeneration": true, - "enableGenerateCompiledEndpointRules": true + "skipEndpointTestGeneration": true } diff --git a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/restjsonendpointproviders/endpoints/internal/RestJsonEndpointProvidersEndpointProviderTest.java b/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/restjsonendpointproviders/endpoints/internal/RestJsonEndpointProvidersEndpointProviderTest.java deleted file mode 100644 index 755828a7871b..000000000000 --- a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/restjsonendpointproviders/endpoints/internal/RestJsonEndpointProvidersEndpointProviderTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -import java.net.URI; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import software.amazon.awssdk.awscore.endpoints.AwsEndpointAttribute; -import software.amazon.awssdk.awscore.endpoints.authscheme.EndpointAuthScheme; -import software.amazon.awssdk.awscore.endpoints.authscheme.SigV4AuthScheme; -import software.amazon.awssdk.awscore.endpoints.authscheme.SigV4aAuthScheme; -import software.amazon.awssdk.core.exception.SdkClientException; -import software.amazon.awssdk.endpoints.Endpoint; -import software.amazon.awssdk.utils.MapUtils; - -class RestJsonEndpointProvidersEndpointProviderTest { - - private DefaultRestJsonEndpointProvidersEndpointProvider provider; - - @BeforeEach - void init() { - this.provider = new DefaultRestJsonEndpointProvidersEndpointProvider(); - } - - @Test - public void valueAsEndpoint_isNone_throws() { - assertThatThrownBy(() -> provider.valueAsEndpointOrThrow(Value.none())) - .isInstanceOf(SdkClientException.class); - } - - @Test - public void valueAsEndpoint_isString_throwsAsMsg() { - assertThatThrownBy(() -> provider.valueAsEndpointOrThrow(Value.fromStr("oops!"))) - .isInstanceOf(SdkClientException.class) - .hasMessageContaining("oops!"); - } - - @Test - public void valueAsEndpoint_isEndpoint_returnsEndpoint() { - Value.Endpoint endpointVal = Value.Endpoint.builder() - .url("https://myservice.aws") - .build(); - - Endpoint expected = Endpoint.builder() - .url(URI.create("https://myservice.aws")) - .build(); - - assertThat(expected.url()).isEqualTo(provider.valueAsEndpointOrThrow(endpointVal).url()); - } - - @Test - public void valueAsEndpoint_endpointHasAuthSchemes_includesAuthSchemes() { - List authSchemes = Arrays.asList( - Value.fromRecord(MapUtils.of(Identifier.of("name"), Value.fromStr("sigv4"), - Identifier.of("signingRegion"), Value.fromStr("us-west-2"), - Identifier.of("signingName"), Value.fromStr("myservice"), - Identifier.of("disableDoubleEncoding"), Value.fromBool(false))), - - Value.fromRecord(MapUtils.of(Identifier.of("name"), Value.fromStr("sigv4a"), - Identifier.of("signingRegionSet"), - Value.fromArray(Collections.singletonList(Value.fromStr("*"))), - Identifier.of("signingName"), Value.fromStr("myservice"), - Identifier.of("disableDoubleEncoding"), Value.fromBool(false))), - - // Unknown scheme name, should ignore - Value.fromRecord(MapUtils.of(Identifier.of("name"), Value.fromStr("sigv5"))) - ); - - - Value.Endpoint endpointVal = Value.Endpoint.builder() - .url("https://myservice.aws") - .property("authSchemes", Value.fromArray(authSchemes)) - .build(); - - - EndpointAuthScheme sigv4 = SigV4AuthScheme.builder() - .signingName("myservice") - .signingRegion("us-west-2") - .disableDoubleEncoding(false) - .build(); - - EndpointAuthScheme sigv4a = SigV4aAuthScheme.builder() - .signingName("myservice") - .addSigningRegion("*") - .disableDoubleEncoding(false) - .build(); - - assertThat(provider.valueAsEndpointOrThrow(endpointVal).attribute(AwsEndpointAttribute.AUTH_SCHEMES)) - .containsExactly(sigv4, sigv4a); - } - - @Test - public void valueAsEndpoint_endpointHasUnknownProperty_ignores() { - Value.Endpoint endpointVal = Value.Endpoint.builder() - .url("https://myservice.aws") - .property("foo", Value.fromStr("baz")) - .build(); - - assertThat(provider.valueAsEndpointOrThrow(endpointVal).attribute(AwsEndpointAttribute.AUTH_SCHEMES)).isNull(); - } - - @Test - public void valueAsEndpoint_endpointHasHeaders_includesHeaders() { - Value.Endpoint endpointVal = Value.Endpoint.builder() - .url("https://myservice.aws") - .addHeader("foo1", "bar1") - .addHeader("foo1", "bar2") - .addHeader("foo2", "baz") - .build(); - - Map> expectedHeaders = MapUtils.of("foo1", Arrays.asList("bar1", "bar2"), - "foo2", Arrays.asList("baz")); - - assertThat(provider.valueAsEndpointOrThrow(endpointVal).headers()).isEqualTo(expectedHeaders); - } - -} \ No newline at end of file diff --git a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/DefaultVisitor.java b/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/DefaultVisitor.java deleted file mode 100644 index b805994d098c..000000000000 --- a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/DefaultVisitor.java +++ /dev/null @@ -1,117 +0,0 @@ -package software.amazon.awssdk.services.rules; - -import java.util.List; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.BooleanEqualsFn; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.EndpointResult; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Expr; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.ExprVisitor; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Fn; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.FnVisitor; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.GetAttr; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.IsSet; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.IsValidHostLabel; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.IsVirtualHostableS3Bucket; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Literal; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Not; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.ParseArn; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.ParseUrl; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.PartitionFn; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Ref; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Rule; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.RuleValueVisitor; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.StringEqualsFn; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Substring; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.UriEncodeFn; - -public abstract class DefaultVisitor implements RuleValueVisitor, ExprVisitor, FnVisitor { - public abstract R getDefault(); - - @Override - public R visitLiteral(Literal literal) { - return getDefault(); - } - - @Override - public R visitRef(Ref ref) { - return getDefault(); - } - - @Override - public R visitFn(Fn fn) { - return getDefault(); - } - - @Override - public R visitPartition(PartitionFn fn) { - return getDefault(); - } - - @Override - public R visitParseArn(ParseArn fn) { - return getDefault(); - } - - - @Override - public R visitIsValidHostLabel(IsValidHostLabel fn) { - return getDefault(); - } - - @Override - public R visitBoolEquals(BooleanEqualsFn fn) { - return getDefault(); - } - - @Override - public R visitStringEquals(StringEqualsFn fn) { - return getDefault(); - } - - @Override - public R visitIsSet(IsSet fn) { - return getDefault(); - } - - @Override - public R visitNot(Not not) { - return getDefault(); - } - - @Override - public R visitGetAttr(GetAttr getAttr) { - return getDefault(); - } - - @Override - public R visitParseUrl(ParseUrl parseUrl) { - return getDefault(); - } - - @Override - public R visitSubstring(Substring substring) { return getDefault(); } - - @Override - public R visitTreeRule(List rules) { - return getDefault(); - } - - @Override - public R visitErrorRule(Expr error) { - return getDefault(); - } - - @Override - public R visitEndpointRule(EndpointResult endpoint) { - return getDefault(); - } - - @Override - public R visitUriEncode(UriEncodeFn fn) { - return getDefault(); - } - - @Override - public R visitIsVirtualHostLabelsS3Bucket(IsVirtualHostableS3Bucket fn) { - return getDefault(); - } -} diff --git a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/EndpointTest.java b/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/EndpointTest.java deleted file mode 100644 index 4636966756a2..000000000000 --- a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/EndpointTest.java +++ /dev/null @@ -1,241 +0,0 @@ -package software.amazon.awssdk.services.rules; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Optional; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.EndpointRuleset; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Identifier; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Parameter; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.ParameterType; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.RuleEngine; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.RuleError; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Value; -import software.amazon.awssdk.utils.Pair; - -public class EndpointTest { - public static final String EXPECT = "expect"; - public static final String PARAMS = "params"; - public static final String DOCUMENTATION = "documentation"; - - private final String documentation; - - public Expectation getExpectation() { - return expectation; - } - - private final Expectation expectation; - - private final Value.Record params; - - private EndpointTest(Builder builder) { - this.documentation = builder.documentation; - this.expectation = Optional.ofNullable(builder.expectation).orElseThrow(NoSuchElementException::new); - this.params = Optional.ofNullable(builder.params).orElseThrow(NoSuchElementException::new);; - } - - public String getDocumentation() { - return documentation; - } - - public List> getParams() { - ArrayList> out = new ArrayList<>(); - params.forEach((name, value) -> { - out.add(Pair.of(name, value)); - }); - return out; - } - - public List getParameters() { - ArrayList result = new ArrayList(); - params.forEach((name, value) -> { - - Parameter.Builder pb = Parameter.builder().name(name); - - if (value instanceof Value.Str) { - pb.type(ParameterType.STRING); - result.add(pb.build()); - } else if (value instanceof Value.Bool) { - pb.type(ParameterType.BOOLEAN); - result.add(pb.build()); - } - }); - return result; - } - - public void execute(EndpointRuleset ruleset) { - Value actual = RuleEngine.defaultEngine().evaluate(ruleset, this.params.getValue()); - RuleError.ctx( - String.format("while executing test case%s", Optional - .ofNullable(documentation) - .map(d -> " " + d) - .orElse("")), - () -> expectation.check(actual) - ); - } - - public static EndpointTest fromNode(JsonNode node) { - Map objNode = node.asObject(); - - Builder b = builder(); - - JsonNode documentationNode = objNode.get(DOCUMENTATION); - if (documentationNode != null) { - b.documentation(documentationNode.asString()); - } - - b.params(Value.fromNode(objNode.get(PARAMS)).expectRecord()); - b.expectation(Expectation.fromNode(objNode.get(EXPECT))); - - return b.build(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - EndpointTest that = (EndpointTest) o; - - if (documentation != null ? !documentation.equals(that.documentation) : that.documentation != null) - return false; - if (!expectation.equals(that.expectation)) return false; - return params.equals(that.params); - } - - @Override - public int hashCode() { - int result = documentation != null ? documentation.hashCode() : 0; - result = 31 * result + expectation.hashCode(); - result = 31 * result + params.hashCode(); - return result; - } - - public static Builder builder() { - return new Builder(); - } - - public static abstract class Expectation { - public static final String ERROR = "error"; - - public static Expectation fromNode(JsonNode node) { - Map objNode = node.asObject(); - - Expectation result; - JsonNode errorNode = objNode.get(ERROR); - if (errorNode != null) { - result = new Error(errorNode.asString()); - } else { - result = new Endpoint(Value.endpointFromNode(node)); - } - return result; - } - - abstract void check(Value value); - - public static Error error(String message) { - return new Error(message); - } - - public static class Error extends Expectation { - public String getMessage() { - return message; - } - - private final String message; - - public Error(String message) { - this.message = message; - } - - @Override - void check(Value value) { - RuleError.ctx("While checking endpoint test (expecting an error)", () -> { - if (!value.expectString().equals(this.message)) { - throw new AssertionError(String.format("Expected error %s but got %s", this.message, value)); - } - }); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Error error = (Error) o; - - return message.equals(error.message); - } - - @Override - public int hashCode() { - return message.hashCode(); - } - } - - public static class Endpoint extends Expectation { - public Value.Endpoint getEndpoint() { - return endpoint; - } - - private final Value.Endpoint endpoint; - - public Endpoint(Value.Endpoint endpoint) { - this.endpoint = endpoint; - } - - @Override - void check(Value value) { - Value.Endpoint actual = value.expectEndpoint(); - if (!actual.equals(this.endpoint)) { - throw new AssertionError( - String.format("Expected endpoint:\n%s but got:\n%s", - this.endpoint.toString(), - actual)); - } - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Endpoint endpoint1 = (Endpoint) o; - - return endpoint != null ? endpoint.equals(endpoint1.endpoint) : endpoint1.endpoint == null; - } - - @Override - public int hashCode() { - return endpoint != null ? endpoint.hashCode() : 0; - } - } - } - - public static class Builder { - private String documentation; - private Expectation expectation; - private Value.Record params; - - public Builder documentation(String documentation) { - this.documentation = documentation; - return this; - } - - public Builder expectation(Expectation expectation) { - this.expectation = expectation; - return this; - } - - public Builder params(Value.Record params) { - this.params = params; - return this; - } - - public EndpointTest build() { - return new EndpointTest(this); - } - } -} diff --git a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/EndpointTestSuite.java b/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/EndpointTestSuite.java deleted file mode 100644 index 5ff9365cedec..000000000000 --- a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/EndpointTestSuite.java +++ /dev/null @@ -1,94 +0,0 @@ -package software.amazon.awssdk.services.rules; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.EndpointRuleset; - -public class EndpointTestSuite { - public static final String SERVICE = "service"; - public static final String TEST_CASES = "testCases"; - - private final List testCases; - private final String service; - - - public EndpointTestSuite(String service, List testCases) { - this.service = service; - this.testCases = testCases; - } - - private EndpointTestSuite(Builder b) { - this(b.service, b.testCases); - } - - public void execute(EndpointRuleset ruleset) { - for (EndpointTest test : this.getTestCases()) { - test.execute(ruleset); - } - } - - public static EndpointTestSuite fromNode(JsonNode node) { - Map objNode = node.asObject(); - - Builder b = builder(); - - b.service(objNode.get(SERVICE).asString()); - objNode.get(TEST_CASES).asArray() - .stream().map(EndpointTest::fromNode) - .forEach(b::addTestCase); - - return b.build(); - } - - public String getService() { - return service; - } - - public List getTestCases() { - return testCases; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - EndpointTestSuite that = (EndpointTestSuite) o; - - if (!testCases.equals(that.testCases)) return false; - return service.equals(that.service); - } - - @Override - public int hashCode() { - int result = testCases.hashCode(); - result = 31 * result + service.hashCode(); - return result; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String service; - private final List testCases = new ArrayList<>(); - - public Builder service(String service) { - this.service = service; - return this; - } - - public Builder addTestCase(EndpointTest testCase) { - this.testCases.add(testCase); - return this; - } - - public EndpointTestSuite build() { - return new EndpointTestSuite(this); - } - } - -} diff --git a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/IntegrationTest.java b/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/IntegrationTest.java deleted file mode 100644 index bde0c8728ed1..000000000000 --- a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/IntegrationTest.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package software.amazon.awssdk.services.rules; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.io.IOException; -import java.io.UncheckedIOException; -import java.net.URL; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.junit.jupiter.api.TestInstance; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.EndpointRuleset; -import software.amazon.awssdk.services.rules.testutil.TestDiscovery; - -@TestInstance(TestInstance.Lifecycle.PER_CLASS) -public class IntegrationTest { - private static final TestDiscovery TEST_DISCOVERY = new TestDiscovery(); - - @ParameterizedTest - @MethodSource("validTestcases") - void checkValidRules(ValidationTestCase validationTestCase) { - EndpointRuleset ruleset = EndpointRuleset.fromNode(validationTestCase.contents()); - List errors = new ValidateUriScheme().visitRuleset(ruleset) - .collect(Collectors.toList()); - assertEquals(errors, Collections.emptyList()); - } - - @ParameterizedTest - @MethodSource("checkableTestCases") - void executeTestSuite(TestDiscovery.RulesTestcase testcase) { - testcase.testcase().execute(testcase.ruleset()); - } - - private Stream validTestcases() { - return TEST_DISCOVERY.getValidRules() - .stream() - .map(name -> new ValidationTestCase(name, TEST_DISCOVERY.validRulesetUrl(name), TEST_DISCOVERY.testCaseUrl(name))); - } - - private Stream checkableTestCases() { - return TEST_DISCOVERY.testSuites() - .flatMap( - suite -> suite.testSuites() - .stream() - .flatMap(ts -> ts.getTestCases() - .stream() - .map(tc -> new TestDiscovery.RulesTestcase(suite.ruleset(), tc)))); - } - - public static final class ValidationTestCase { - private final String name; - private final URL ruleSet; - private final URL testCase; - - public ValidationTestCase(String name, URL ruleSet, URL testCase) { - this.name = name; - this.ruleSet = ruleSet; - this.testCase = testCase; - } - - JsonNode contents() { - try { - return JsonNode.parser().parse(ruleSet.openStream()); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - public URL ruleSet() { - return ruleSet; - } - - public URL testCase() { - return testCase; - } - - @Override - public String toString() { - return name; - } - } -} diff --git a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/RuleEngineTest.java b/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/RuleEngineTest.java deleted file mode 100644 index b97688fbaf17..000000000000 --- a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/RuleEngineTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package software.amazon.awssdk.services.rules; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.InputStream; -import java.util.Collections; -import org.junit.jupiter.api.Test; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; -import software.amazon.awssdk.protocols.jsoncore.JsonNodeParser; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.EndpointRuleset; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Identifier; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.RuleEngine; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Value; -import software.amazon.awssdk.utils.MapUtils; - -public class RuleEngineTest { - private EndpointRuleset parse(String resource) { - InputStream is = getClass().getClassLoader().getResourceAsStream(resource); - JsonNode node = JsonNodeParser.create().parse(is); - return EndpointRuleset.fromNode(node); - } - - @Test - void testRuleEval() { - EndpointRuleset actual = parse("rules/valid-rules/minimal-ruleset.json"); - Value result = RuleEngine.defaultEngine().evaluate(actual, MapUtils.of(Identifier.of("Region"), Value.fromStr("us-east-1"))); - Value.Endpoint expected = Value.Endpoint.builder() - .url("https://us-east-1.amazonaws.com") - .property("authSchemes", Value.fromArray(Collections.singletonList( - Value.fromRecord(MapUtils.of( - Identifier.of("name"), Value.fromStr("v4"), - Identifier.of("signingScope"), Value.fromStr("us-east-1"), - Identifier.of("signingName"), Value.fromStr("serviceName") - )) - ))) - .build(); - - assertThat(result.expectEndpoint()).isEqualTo(expected); - } -} diff --git a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/TraversingVisitor.java b/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/TraversingVisitor.java deleted file mode 100644 index d5124a6dbc46..000000000000 --- a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/TraversingVisitor.java +++ /dev/null @@ -1,63 +0,0 @@ -package software.amazon.awssdk.services.rules; - -import java.util.List; -import java.util.stream.Stream; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Condition; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.EndpointResult; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.EndpointRuleset; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Expr; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Fn; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Rule; - -public abstract class TraversingVisitor extends DefaultVisitor> { - public Stream visitRuleset(EndpointRuleset ruleset) { - return ruleset.getRules() - .stream() - .flatMap(this::handleRule); - } - - private Stream handleRule(Rule rule) { - Stream fromConditions = visitConditions(rule.getConditions()); - return Stream.concat(fromConditions, rule.accept(this)); - } - - @Override - public Stream visitFn(Fn fn) { - return fn.acceptFnVisitor(this); - } - - @Override - public Stream getDefault() { - return Stream.empty(); - } - - @Override - public Stream visitEndpointRule(EndpointResult endpoint) { - return visitEndpoint(endpoint); - } - - @Override - public Stream visitErrorRule(Expr error) { - return error.accept(this); - } - - @Override - public Stream visitTreeRule(List rules) { - return rules.stream().flatMap(subrule -> subrule.accept(this)); - } - - public Stream visitEndpoint(EndpointResult endpoint) { - return Stream.concat( - endpoint.getUrl() - .accept(this), - endpoint.getProperties() - .entrySet() - .stream() - .flatMap(map -> map.getValue().accept(this)) - ); - } - - public Stream visitConditions(List conditions) { - return conditions.stream().flatMap(c -> c.getFn().accept(this)); - } -} diff --git a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/ValidateUriScheme.java b/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/ValidateUriScheme.java deleted file mode 100644 index 75daab21ccfc..000000000000 --- a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/ValidateUriScheme.java +++ /dev/null @@ -1,71 +0,0 @@ -package software.amazon.awssdk.services.rules; - -import java.util.List; -import java.util.Map; -import java.util.stream.Stream; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.EndpointResult; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Identifier; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Literal; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.Template; - -/** - * Validate that URIs start with a scheme - */ -public class ValidateUriScheme extends TraversingVisitor { - boolean checkingEndpoint = false; - - @Override - public Stream visitEndpoint(EndpointResult endpoint) { - checkingEndpoint = true; - Stream errors = endpoint.getUrl().accept(this); - checkingEndpoint = false; - return errors; - } - - @Override - public Stream visitLiteral(Literal literal) { - return literal.accept(new Literal.Visitor>() { - @Override - public Stream visitBool(boolean b) { - return Stream.empty(); - } - - @Override - public Stream visitStr(Template value) { - return validateTemplate(value); - } - - @Override - public Stream visitObject(Map members) { - return Stream.empty(); - } - - @Override - public Stream visitTuple(List members) { - return Stream.empty(); - } - - @Override - public Stream visitInt(int value) { - return Stream.empty(); - } - }); - } - - private Stream validateTemplate(Template template) { - if (checkingEndpoint) { - Template.Part head = template.getParts().get(0); - if (head instanceof Template.Literal) { - String templateStart = ((Template.Literal) head).getValue(); - if (!(templateStart.startsWith("http://") || templateStart.startsWith("https://"))) { - return Stream.of(new ValidationError( - ValidationErrorType.INVALID_URI, - "URI should start with `http://` or `https://` but the URI started with " + templateStart) - ); - } - } - /* Allow dynamic URIs for now—we should lint that at looks like a scheme at some point */ - } - return Stream.empty(); - } -} diff --git a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/ValidationError.java b/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/ValidationError.java deleted file mode 100644 index 4e37db505cbb..000000000000 --- a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/ValidationError.java +++ /dev/null @@ -1,41 +0,0 @@ -package software.amazon.awssdk.services.rules; - -import java.util.Objects; - -public final class ValidationError { - private final ValidationErrorType validationErrorType; - private final String error; - - public ValidationError(ValidationErrorType validationErrorType, String error) { - this.validationErrorType = validationErrorType; - this.error = error; - } - - public ValidationErrorType validationErrorType() { - return validationErrorType; - } - - public String error() { - return error; - } - - @Override - public String toString() { - return this.validationErrorType + ", " + this.error; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (obj == null || obj.getClass() != this.getClass()) return false; - ValidationError that = (ValidationError) obj; - return Objects.equals(this.validationErrorType, that.validationErrorType) && - Objects.equals(this.error, that.error); - } - - @Override - public int hashCode() { - return Objects.hash(validationErrorType, error); - } - -} diff --git a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/ValidationErrorType.java b/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/ValidationErrorType.java deleted file mode 100644 index 36b4d93f6bd5..000000000000 --- a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/ValidationErrorType.java +++ /dev/null @@ -1,14 +0,0 @@ -package software.amazon.awssdk.services.rules; - -public enum ValidationErrorType { - INCONSISTENT_PARAMETER_TYPE, - UNSUPPORTED_PARAMETER_TYPE, - PARAMETER_MISMATCH, - PARAMETER_TYPE_MISMATCH, - SERVICE_ID_MISMATCH, - REQUIRED_PARAMETER_MISSING, - PARAMETER_IS_NOT_USED, - PARAMETER_IS_NOT_DEFINED, - - INVALID_URI, -} diff --git a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/testutil/TestDiscovery.java b/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/testutil/TestDiscovery.java deleted file mode 100644 index d8099708f535..000000000000 --- a/test/codegen-generated-classes-test/src/test/java/software/amazon/awssdk/services/rules/testutil/TestDiscovery.java +++ /dev/null @@ -1,196 +0,0 @@ -package software.amazon.awssdk.services.rules.testutil; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.UncheckedIOException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import software.amazon.awssdk.protocols.jsoncore.JsonNode; -import software.amazon.awssdk.services.restjsonendpointproviders.endpoints.internal.EndpointRuleset; -import software.amazon.awssdk.services.rules.EndpointTest; -import software.amazon.awssdk.services.rules.EndpointTestSuite; - -public class TestDiscovery { - private static final String RESOURCE_ROOT = "/rules"; - - public static final class RulesTestcase { - private final EndpointRuleset ruleset; - private final EndpointTest testcase; - - public RulesTestcase(EndpointRuleset ruleset, EndpointTest testcase) { - this.ruleset = ruleset; - this.testcase = testcase; - } - - @Override - public String toString() { - return testcase.getDocumentation(); - } - - public EndpointRuleset ruleset() { - return ruleset; - } - - public EndpointTest testcase() { - return testcase; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (obj == null || obj.getClass() != this.getClass()) return false; - RulesTestcase that = (RulesTestcase) obj; - return Objects.equals(this.ruleset, that.ruleset) && - Objects.equals(this.testcase, that.testcase); - } - - @Override - public int hashCode() { - return Objects.hash(ruleset, testcase); - } - - } - - public static final class RulesTestSuite { - private final EndpointRuleset ruleset; - private final List testSuites; - - public RulesTestSuite(EndpointRuleset ruleset, List testSuites) { - this.ruleset = ruleset; - this.testSuites = testSuites; - } - - @Override - public String toString() { - return ruleset.toString(); - } - - public EndpointRuleset ruleset() { - return ruleset; - } - - public List testSuites() { - return testSuites; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (obj == null || obj.getClass() != this.getClass()) return false; - RulesTestSuite that = (RulesTestSuite) obj; - return Objects.equals(this.ruleset, that.ruleset) && - Objects.equals(this.testSuites, that.testSuites); - } - - @Override - public int hashCode() { - return Objects.hash(ruleset, testSuites); - } - - } - - public Stream testSuites() { - JsonNode.parser(); - List rulesetNodes = getValidRules() - .stream() - .map(e -> JsonNode.parser().parse(getResourceStream("valid-rules/" + e))) - .collect(Collectors.toList()); - - List testSuiteFiles = getManifestEntries("test-cases/manifest.txt") - .stream() - .map(e -> JsonNode.parser().parse(getResourceStream("test-cases/" + e))) - .collect(Collectors.toList()); - - List rulesets = rulesetNodes.stream() - .map(EndpointRuleset::fromNode) - .collect(Collectors.toList()); - List rulesetIds = rulesets.stream() - .map(EndpointRuleset::getServiceId) - .collect(Collectors.toList()); - if (rulesetIds.stream() - .distinct() - .count() != rulesets.size()) { - throw new RuntimeException(String.format("Duplicate service ids discovered: %s", rulesets.stream() - .map(EndpointRuleset::getServiceId) - .sorted() - .collect(Collectors.toList()))); - } - - List testSuites = testSuiteFiles.stream() - .map(EndpointTestSuite::fromNode) - .collect(Collectors.toList()); - testSuites.stream() - .filter(testSuite -> !rulesetIds.contains(testSuite.getService())) - .forEach(bad -> { - throw new RuntimeException("did not find service for " + bad.getService()); - }); - return rulesets.stream() - .map(ruleset -> { - List matchingTestSuites = testSuites.stream() - .filter(test -> test.getService() - .equals(ruleset.getServiceId())) - .collect(Collectors.toList()); - return new RulesTestSuite(ruleset, matchingTestSuites); - }); - } - - private List getManifestEntries(String path) { - String absPath = RESOURCE_ROOT + "/" + path; - try (BufferedReader br = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(absPath)))) { - List entries = new ArrayList<>(); - while (true) { - String e = br.readLine(); - if (e == null) { - break; - } - entries.add(e); - } - return entries; - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - private InputStream getResourceStream(String path) { - String absPath = RESOURCE_ROOT + "/" + path; - return getClass().getResourceAsStream(absPath); - } - - private URL getResource(String path) { - String absPath = RESOURCE_ROOT + "/" + path; - return getClass().getResource(absPath); - } - - public RulesTestSuite getTestSuite(String name) { - return new RulesTestSuite(rulesetFromPath(name), Collections.singletonList(testSuiteFromPath(name))); - } - - public List getValidRules() { - return getManifestEntries("valid-rules/manifest.txt"); - } - - public URL validRulesetUrl(String name) { - return getResource("valid-rules/" + name); - } - - public URL testCaseUrl(String name) { - return getResource("test-cases/" + name); - } - - private EndpointRuleset rulesetFromPath(String name) { - return EndpointRuleset.fromNode(JsonNode.parser().parse(Objects.requireNonNull(this.getClass() - .getResourceAsStream(String.format("valid-rules/%s", name))))); - } - - private EndpointTestSuite testSuiteFromPath(String name) { - return EndpointTestSuite.fromNode(JsonNode.parser().parse(Objects.requireNonNull(this.getClass() - .getResourceAsStream(String.format("test-cases/%s", name))))); - } -} diff --git a/test/protocol-tests/src/main/resources/codegen-resources/json10/customization.config b/test/protocol-tests/src/main/resources/codegen-resources/json10/customization.config index bb763afd276b..ec7c8d355d50 100644 --- a/test/protocol-tests/src/main/resources/codegen-resources/json10/customization.config +++ b/test/protocol-tests/src/main/resources/codegen-resources/json10/customization.config @@ -1,4 +1,3 @@ { - "skipEndpointTestGeneration": true, - "enableGenerateCompiledEndpointRules": true + "skipEndpointTestGeneration": true } diff --git a/test/protocol-tests/src/main/resources/codegen-resources/sdkrpcv2/customization.config b/test/protocol-tests/src/main/resources/codegen-resources/sdkrpcv2/customization.config index 4a57cda840dd..f137036979c6 100644 --- a/test/protocol-tests/src/main/resources/codegen-resources/sdkrpcv2/customization.config +++ b/test/protocol-tests/src/main/resources/codegen-resources/sdkrpcv2/customization.config @@ -1,4 +1,3 @@ { - "enableGenerateCompiledEndpointRules": true, "skipEndpointTestGeneration": true } diff --git a/test/protocol-tests/src/main/resources/codegen-resources/smithy-query/customization.config b/test/protocol-tests/src/main/resources/codegen-resources/smithy-query/customization.config index bb763afd276b..ec7c8d355d50 100644 --- a/test/protocol-tests/src/main/resources/codegen-resources/smithy-query/customization.config +++ b/test/protocol-tests/src/main/resources/codegen-resources/smithy-query/customization.config @@ -1,4 +1,3 @@ { - "skipEndpointTestGeneration": true, - "enableGenerateCompiledEndpointRules": true + "skipEndpointTestGeneration": true }