index
int64
0
0
repo_id
stringlengths
26
205
file_path
stringlengths
51
246
content
stringlengths
8
433k
__index_level_0__
int64
0
10k
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/docs/AsyncOperationDocProvider.java
/* * 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.docs; import static software.amazon.awssdk.codegen.internal.Constant.ASYNC_STREAMING_INPUT_PARAM; import static software.amazon.awssdk.codegen.internal.Constant.ASYNC_STREAMING_OUTPUT_PARAM; import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; import software.amazon.awssdk.codegen.model.intermediate.OperationModel; /** * Implementations of {@link OperationDocProvider} for async client methods. This implementation is for the typical * async method (i.e. on that takes a request object and returns a {@link java.util.concurrent.CompletableFuture} of the response * object). Subclasses provide documentation for specialized method overloads like simple no-arg methods. */ class AsyncOperationDocProvider extends OperationDocProvider { private static final String REQUEST_BODY_DOCS = "Functional interface that can be implemented to produce the request content " + "in a non-blocking manner. The size of the content is expected to be known up front. " + "See {@link AsyncRequestBody} for specific details on implementing this interface as well " + "as links to precanned implementations for common scenarios like uploading from a file. "; private static final String STREAM_RESPONSE_TRANSFORMER_DOCS = "The response transformer for processing the streaming response in a " + "non-blocking manner. See {@link AsyncResponseTransformer} for details on how this callback " + "should be implemented and for links to precanned implementations for common scenarios like " + "downloading to a file. "; AsyncOperationDocProvider(IntermediateModel model, OperationModel opModel, DocConfiguration configuration) { super(model, opModel, configuration); } @Override protected String getDefaultServiceDocs() { return String.format("Invokes the %s operation asynchronously.", opModel.getOperationName()); } @Override protected String getInterfaceName() { return model.getMetadata().getAsyncInterface(); } @Override protected void applyReturns(DocumentationBuilder docBuilder) { if (opModel.hasStreamingOutput()) { docBuilder.returns("A future to the transformed result of the AsyncResponseTransformer."); } else { docBuilder.returns("A Java Future containing the result of the %s operation returned by the service.", opModel.getOperationName()); } } @Override protected void applyParams(DocumentationBuilder docBuilder) { emitRequestParm(docBuilder); if (opModel.hasStreamingInput()) { docBuilder.param(ASYNC_STREAMING_INPUT_PARAM, REQUEST_BODY_DOCS + getStreamingInputDocs()); } if (opModel.hasStreamingOutput()) { docBuilder.param(ASYNC_STREAMING_OUTPUT_PARAM, STREAM_RESPONSE_TRANSFORMER_DOCS + getStreamingOutputDocs()); } } @Override protected void applyThrows(DocumentationBuilder docBuilder) { docBuilder.asyncThrows(getThrows()); } /** * Provider for streaming simple methods that take a file (to either upload from for streaming inputs or download to for * streaming outputs). */ static class AsyncFile extends AsyncOperationDocProvider { AsyncFile(IntermediateModel model, OperationModel opModel, DocConfiguration configuration) { super(model, opModel, configuration); } @Override protected void applyParams(DocumentationBuilder docBuilder) { emitRequestParm(docBuilder); if (opModel.hasStreamingInput()) { docBuilder.param("sourcePath", SIMPLE_FILE_INPUT_DOCS + getStreamingInputDocs()); } if (opModel.hasStreamingOutput()) { docBuilder.param("destinationPath", SIMPLE_FILE_OUTPUT_DOCS + getStreamingOutputDocs()); } } } /** * Provider for simple method that takes no arguments and creates an empty request object. */ static class AsyncNoArg extends AsyncOperationDocProvider { AsyncNoArg(IntermediateModel model, OperationModel opModel, DocConfiguration configuration) { super(model, opModel, configuration); } @Override protected void applyParams(DocumentationBuilder docBuilder) { } } /** * Provider for traditional paginated method that takes in a request object and returns a response object. */ static class AsyncPaginated extends AsyncOperationDocProvider { AsyncPaginated(IntermediateModel model, OperationModel opModel, DocConfiguration configuration) { super(model, opModel, configuration); } @Override protected String appendToDescription() { return paginationDocs.getDocsForAsyncOperation(); } @Override protected void applyReturns(DocumentationBuilder docBuilder) { docBuilder.returns("A custom publisher that can be subscribed to request a stream of response pages."); } } /** * Provider for paginated simple method that takes no arguments and creates an empty request object. */ static class AsyncPaginatedNoArg extends AsyncPaginated { AsyncPaginatedNoArg(IntermediateModel model, OperationModel opModel, DocConfiguration configuration) { super(model, opModel, configuration); } @Override protected void applyParams(DocumentationBuilder docBuilder) { } } }
3,500
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/docs/OperationDocs.java
/* * 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.docs; import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; import software.amazon.awssdk.codegen.model.intermediate.OperationModel; /** * Provides documentation for an operation method on the client interface. Use * {@link #getDocs(IntermediateModel, OperationModel, ClientType)} to retrieve documentation for the typical overload for an * operation (i.e. the one that takes in a request object and returns a response object in the simple case) or use * {@link #getDocs(IntermediateModel, OperationModel, ClientType, SimpleMethodOverload)} with the specified * convenience overload as defined in {@link SimpleMethodOverload}. */ public final class OperationDocs { private OperationDocs() { } /** * Get documentation for the {@link SimpleMethodOverload#NORMAL} overload. That is, the actual implementation that * simple methods delegate to. * * @param model {@link IntermediateModel} * @param opModel {@link OperationModel} to generate Javadocs for. * @param clientType Which client type the Javadoc is being generated for. * @return Formatted Javadocs for operation method. */ public static String getDocs(IntermediateModel model, OperationModel opModel, ClientType clientType) { return getDocs(model, opModel, clientType, SimpleMethodOverload.NORMAL); } /** * Equivalent to calling * {@link #getDocs(IntermediateModel, OperationModel, ClientType, SimpleMethodOverload, DocConfiguration)} with a default * {@link DocConfiguration} */ public static String getDocs(IntermediateModel model, OperationModel opModel, ClientType clientType, SimpleMethodOverload simpleMethodOverload) { return getDocs(model, opModel, clientType, simpleMethodOverload, new DocConfiguration()); } /** * Get documentation for a specific {@link SimpleMethodOverload}. * * @param model {@link IntermediateModel} * @param opModel {@link OperationModel} to generate Javadocs for. * @param clientType Which client type the Javadoc is being generated for. * @param simpleMethodOverload Overload type to generate docs for. * @return Formatted Javadocs for operation method. */ public static String getDocs(IntermediateModel model, OperationModel opModel, ClientType clientType, SimpleMethodOverload simpleMethodOverload, DocConfiguration docConfig) { switch (clientType) { case SYNC: return simpleMethodOverload.syncDocsProvider(model, opModel, docConfig).getDocs(); case ASYNC: return simpleMethodOverload.asyncDocsProvider(model, opModel, docConfig).getDocs(); default: throw new UnsupportedOperationException("Unknown client type: " + clientType); } } }
3,501
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/docs/SyncOperationDocProvider.java
/* * 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.docs; import static software.amazon.awssdk.codegen.internal.Constant.SYNC_CLIENT_DESTINATION_PATH_PARAM_NAME; import static software.amazon.awssdk.codegen.internal.Constant.SYNC_CLIENT_SOURCE_PATH_PARAM_NAME; import static software.amazon.awssdk.codegen.internal.Constant.SYNC_STREAMING_INPUT_PARAM; import static software.amazon.awssdk.codegen.internal.Constant.SYNC_STREAMING_OUTPUT_PARAM; import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; import software.amazon.awssdk.codegen.model.intermediate.OperationModel; import software.amazon.awssdk.codegen.utils.PaginatorUtils; import software.amazon.awssdk.core.ResponseBytes; import software.amazon.awssdk.core.ResponseInputStream; import software.amazon.awssdk.core.sync.ResponseTransformer; /** * Implementations of {@link OperationDocProvider} for sync client methods. This implementation is for the typical * sync method (i.e. on that takes a request and returns a response object). Subclasses provide documentation for * specialized method overloads like simple no-arg methods. */ class SyncOperationDocProvider extends OperationDocProvider { private static final String DEFAULT_RETURN = "Result of the %s operation returned by the service."; private static final String REQUEST_BODY_DOCS = "The content to send to the service. A {@link RequestBody} can be created using one of " + "several factory methods for various sources of data. For example, to create a request body " + "from a file you can do the following. " + "<pre>{@code RequestBody.fromFile(new File(\"myfile.txt\"))}</pre>" + "See documentation in {@link RequestBody} for additional details and which sources of data are supported. "; private static final String STREAM_RESPONSE_HANDLER_DOCS = "Functional interface for processing the streamed response content. The unmarshalled %s " + "and an InputStream to the response content are provided as parameters to the callback. " + "The callback may return a transformed type which will be the return value of this method. " + "See {@link " + ResponseTransformer.class.getName() + "} for details on " + "implementing this interface and for links to pre-canned implementations for common scenarios " + "like downloading to a file. "; SyncOperationDocProvider(IntermediateModel model, OperationModel opModel, DocConfiguration configuration) { super(model, opModel, configuration); } @Override protected String getDefaultServiceDocs() { return String.format("Invokes the %s operation.", opModel.getOperationName()); } @Override protected String getInterfaceName() { return model.getMetadata().getSyncInterface(); } @Override protected void applyReturns(DocumentationBuilder docBuilder) { if (opModel.hasStreamingOutput()) { docBuilder.returns("The transformed result of the ResponseTransformer."); } else { docBuilder.returns(DEFAULT_RETURN, opModel.getOperationName()); } } @Override protected void applyParams(DocumentationBuilder docBuilder) { emitRequestParm(docBuilder); if (opModel.hasStreamingInput()) { docBuilder.param(SYNC_STREAMING_INPUT_PARAM, REQUEST_BODY_DOCS + getStreamingInputDocs()); } if (opModel.hasStreamingOutput()) { docBuilder.param(SYNC_STREAMING_OUTPUT_PARAM, STREAM_RESPONSE_HANDLER_DOCS + getStreamingOutputDocs(), opModel.getOutputShape().getShapeName(), getStreamingOutputDocs()); } } @Override protected void applyThrows(DocumentationBuilder docBuilder) { docBuilder.syncThrows(getThrows()); } /** * Provider for streaming simple methods that take a file (to either upload from for streaming inputs or download to for * streaming outputs). */ static class SyncFile extends SyncOperationDocProvider { SyncFile(IntermediateModel model, OperationModel opModel, DocConfiguration configuration) { super(model, opModel, configuration); } @Override protected void applyParams(DocumentationBuilder docBuilder) { emitRequestParm(docBuilder); if (opModel.hasStreamingInput()) { docBuilder.param(SYNC_CLIENT_SOURCE_PATH_PARAM_NAME, SIMPLE_FILE_INPUT_DOCS + getStreamingInputDocs()) // Link to non-simple method for discoverability .see("#%s(%s, RequestBody)", opModel.getMethodName(), opModel.getInput().getVariableType()); } if (opModel.hasStreamingOutput()) { docBuilder.param(SYNC_CLIENT_DESTINATION_PATH_PARAM_NAME, SIMPLE_FILE_OUTPUT_DOCS + getStreamingOutputDocs()) // Link to non-simple method for discoverability .see("#%s(%s, ResponseTransformer)", opModel.getMethodName(), opModel.getInput().getVariableType()); } } } /** * Provider for streaming output simple methods that return an {@link ResponseInputStream} * containing response content and unmarshalled POJO. Only applicable to operations that have a streaming member in * the output shape. */ static class SyncInputStream extends SyncOperationDocProvider { SyncInputStream(IntermediateModel model, OperationModel opModel, DocConfiguration configuration) { super(model, opModel, configuration); } @Override protected void applyReturns(DocumentationBuilder docBuilder) { docBuilder.returns( "A {@link ResponseInputStream} containing data streamed from service. Note that this is an unmanaged " + "reference to the underlying HTTP connection so great care must be taken to ensure all data if fully read " + "from the input stream and that it is properly closed. Failure to do so may result in sub-optimal behavior " + "and exhausting connections in the connection pool. The unmarshalled response object can be obtained via " + "{@link ResponseInputStream#response()}. " + getStreamingOutputDocs()); // Link to non-simple method for discoverability docBuilder.see("#getObject(%s, ResponseTransformer)", opModel.getMethodName(), opModel.getInput().getVariableType()); } @Override protected void applyParams(DocumentationBuilder docBuilder) { emitRequestParm(docBuilder); } } /** * Provider for streaming output simple methods that return an {@link ResponseBytes} containing the in-memory response content * and the unmarshalled POJO. Only applicable to operations that have a streaming member in the output shape. */ static class SyncBytes extends SyncOperationDocProvider { SyncBytes(IntermediateModel model, OperationModel opModel, DocConfiguration configuration) { super(model, opModel, configuration); } @Override protected void applyReturns(DocumentationBuilder docBuilder) { docBuilder.returns( "A {@link ResponseBytes} that loads the data streamed from the service into memory and exposes it in " + "convenient in-memory representations like a byte buffer or string. The unmarshalled response object can " + "be obtained via {@link ResponseBytes#response()}. " + getStreamingOutputDocs()); // Link to non-simple method for discoverability docBuilder.see("#getObject(%s, ResponseTransformer)", opModel.getMethodName(), opModel.getInput().getVariableType()); } @Override protected void applyParams(DocumentationBuilder docBuilder) { emitRequestParm(docBuilder); } } /** * Provider for simple method that takes no arguments and creates an empty request object. */ static class SyncNoArg extends SyncOperationDocProvider { SyncNoArg(IntermediateModel model, OperationModel opModel, DocConfiguration configuration) { super(model, opModel, configuration); } @Override protected void applyParams(DocumentationBuilder docBuilder) { // Link to non-simple method for discoverability docBuilder.see("#%s(%s)", opModel.getMethodName(), opModel.getInput().getVariableType()); } } /** * Provider for standard paginated method that takes in a request object and returns a response object. */ static class SyncPaginated extends SyncOperationDocProvider { SyncPaginated(IntermediateModel model, OperationModel opModel, DocConfiguration configuration) { super(model, opModel, configuration); } @Override protected String appendToDescription() { return paginationDocs.getDocsForSyncOperation(); } @Override protected void applyReturns(DocumentationBuilder docBuilder) { docBuilder.returns("A custom iterable that can be used to iterate through all the response pages."); } } /** * Provider for paginated simple method that takes no arguments and creates an empty request object. */ static class SyncPaginatedNoArg extends SyncPaginated { SyncPaginatedNoArg(IntermediateModel model, OperationModel opModel, DocConfiguration configuration) { super(model, opModel, configuration); } @Override protected void applyParams(DocumentationBuilder docBuilder) { // Link to non-simple method for discoverability docBuilder.see("#%s(%s)", PaginatorUtils.getPaginatedMethodName(opModel.getMethodName()), opModel.getInput().getVariableType()); } } }
3,502
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/naming/NamingStrategy.java
/* * 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.naming; import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; import software.amazon.awssdk.codegen.model.intermediate.MemberModel; import software.amazon.awssdk.codegen.model.service.Shape; import software.amazon.awssdk.core.SdkField; /** * Strategy to name various Java constructs based on the naming in the model and potentially customizations. */ public interface NamingStrategy { /** * Retrieve the service name that should be used based on the model. */ String getServiceName(); /** * Retrieve the client package name that should be used based on the service name. */ String getClientPackageName(String serviceName); /** * Retrieve the model package name that should be used based on the service name. */ String getModelPackageName(String serviceName); /** * Retrieve the transform package name that should be used based on the service name. */ String getTransformPackageName(String serviceName); /** * Retrieve the request transform package name that should be used based on the service name. */ String getRequestTransformPackageName(String serviceName); /** * Retrieve the paginators package name that should be used based on the service name. */ String getPaginatorsPackageName(String serviceName); /** * Retrieve the waiters package name that should be used based on the service name. */ String getWaitersPackageName(String serviceName); /** * Retrieve the endpoint rules package name that should be used based on the service name. */ String getEndpointRulesPackageName(String serviceName); /** * Retrieve the auth scheme package name that should be used based on the service name. */ String getAuthSchemePackageName(String serviceName); /** * Retrieve the smote test package name that should be used based on the service name. */ String getSmokeTestPackageName(String serviceName); /** * @param errorShapeName Name of error shape to derive exception class name from. * @return Appropriate name to use for a Java exception class name */ String getExceptionName(String errorShapeName); /** * @param operationName Name of operation used to derive request class name. * @return Appropriate name to use for the Java class representing the request shape. */ String getRequestClassName(String operationName); /** * @param operationName Name of operation used to derive response class name. * @return Appropriate name to use for the Java class representing the response shape. */ String getResponseClassName(String operationName); /** * @param name Some contextual name to derive variable name from (i.e. member name, java class name, etc). * @return Appropriate name to use for a Java variable or field. */ String getVariableName(String name); /** * @param enumValue Enum value as defined in the service model used to derive the java name. * @return Appropriate name to use for a Java enum value */ String getEnumValueName(String enumValue); /** * @param shapeName Name of structure used to derive Java class name. * @return Appropriate name to use for a Java class for an arbitrary (not a request, response, error) structure. */ String getShapeClassName(String shapeName); /** * @param memberName Member name to name getter for. * @param shape The shape associated with the member. * @return Name of the getter method for a model class member. */ String getFluentGetterMethodName(String memberName, Shape parentShape, Shape shape); /** * @param memberName The full member to get the name for. * @param shape The shape associated with the member. * @return Name of the getter method for an enum model class member. */ String getFluentEnumGetterMethodName(String memberName, Shape parentShape, Shape shape); /** * @param memberName Member name to name getter for. * @return Name of the JavaBean getter method for model class member. */ String getBeanStyleGetterMethodName(String memberName, Shape parentShape, Shape c2jShape); /** * @param memberName Member name to name setter for. * @return Name of the JavaBean setter method for model class member. */ String getBeanStyleSetterMethodName(String memberName, Shape parentShape, Shape c2jShape); /** * @param memberName Member name to name fluent setter for. * @return Appropriate name to use for fluent setter method (i.e. withFoo) for a model class member. */ String getFluentSetterMethodName(String memberName, Shape parentShape, Shape shape); /** * @param memberName The full member to get the name for. * @param shape The shape associated with the member. * @return Name of the getter method for an enum model class member. */ String getFluentEnumSetterMethodName(String memberName, Shape parentShape, Shape shape); /** * Stuttering is intentional, returns the name of the {@link SdkField} field. * * @param memberModel Member to generate field name for. * @return Name of field for {@link SdkField} pojo. */ String getSdkFieldFieldName(MemberModel memberModel); /** * Returns the name of the provided member as if it will be included in an enum (as in, when the parent shape is a union * and we need to create an enum with each member name in it). * * @param memberModel Member to generate the union enum type name for. */ String getUnionEnumTypeName(MemberModel memberModel); /** * Names a method that would check for existence of the member in the response. * * @param memberName The member name to get the method name for. * @param parentShape The shape containing the member. * @return Name of an existence check method. */ String getExistenceCheckMethodName(String memberName, Shape parentShape); /** * Verify the customer-visible naming in the provided intermediate model will compile and is idiomatic to Java. */ void validateCustomerVisibleNaming(IntermediateModel trimmedModel); }
3,503
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/naming/DefaultNamingStrategy.java
/* * 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.naming; import static java.util.stream.Collectors.joining; import static software.amazon.awssdk.codegen.internal.Constant.CONFLICTING_NAME_SUFFIX; import static software.amazon.awssdk.codegen.internal.Constant.EXCEPTION_CLASS_SUFFIX; import static software.amazon.awssdk.codegen.internal.Constant.FAULT_CLASS_SUFFIX; import static software.amazon.awssdk.codegen.internal.Constant.REQUEST_CLASS_SUFFIX; import static software.amazon.awssdk.codegen.internal.Constant.RESPONSE_CLASS_SUFFIX; import static software.amazon.awssdk.codegen.internal.Utils.unCapitalize; import static software.amazon.awssdk.utils.internal.CodegenNamingUtils.pascalCase; import static software.amazon.awssdk.utils.internal.CodegenNamingUtils.splitOnWordBoundaries; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Locale; import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.regex.Pattern; import java.util.stream.Stream; import software.amazon.awssdk.codegen.internal.Constant; import software.amazon.awssdk.codegen.internal.Utils; import software.amazon.awssdk.codegen.model.config.customization.CustomizationConfig; import software.amazon.awssdk.codegen.model.config.customization.UnderscoresInNameBehavior; import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; import software.amazon.awssdk.codegen.model.intermediate.MemberModel; import software.amazon.awssdk.codegen.model.intermediate.Metadata; import software.amazon.awssdk.codegen.model.service.ServiceModel; import software.amazon.awssdk.codegen.model.service.Shape; import software.amazon.awssdk.utils.Logger; import software.amazon.awssdk.utils.StringUtils; import software.amazon.awssdk.utils.Validate; /** * Default implementation of naming strategy respecting. */ public class DefaultNamingStrategy implements NamingStrategy { private static final Logger log = Logger.loggerFor(DefaultNamingStrategy.class); private static final Pattern VALID_IDENTIFIER_NAME = Pattern.compile("\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*"); private static final String COLLISION_DISAMBIGUATION_PREFIX = "Default"; private static final Set<String> RESERVED_KEYWORDS; private static final Set<String> RESERVED_EXCEPTION_METHOD_NAMES; private static final Set<Object> RESERVED_STRUCTURE_METHOD_NAMES; static { Set<String> reservedJavaKeywords = new HashSet<>(); Collections.addAll(reservedJavaKeywords, "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "default", "do", "double", "else", "enum", "extends", "false", "final", "finally", "float", "for", "goto", "if", "implements", "import", "instanceof", "int", "interface", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "strictfp", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "void", "volatile", "while"); RESERVED_KEYWORDS = Collections.unmodifiableSet(reservedJavaKeywords); Set<String> reservedJavaMethodNames = new HashSet<>(); Collections.addAll(reservedJavaMethodNames, "equals", "finalize", "getClass", "hashCode", "notify", "notifyAll", "toString", "wait"); Set<String> reserveJavaPojoMethodNames = new HashSet<>(reservedJavaMethodNames); Collections.addAll(reserveJavaPojoMethodNames, "builder", "sdkFields", "toBuilder"); Set<String> reservedExceptionMethodNames = new HashSet<>(reserveJavaPojoMethodNames); Collections.addAll(reservedExceptionMethodNames, "awsErrorDetails", "cause", "fillInStackTrace", "getCause", "getLocalizedMessage", "getMessage", "getStackTrace", "getSuppressed", "isClockSkewException", "isThrottlingException", "printStackTrace", "requestId", "retryable", "serializableBuilderClass", "statusCode"); RESERVED_EXCEPTION_METHOD_NAMES = Collections.unmodifiableSet(reservedExceptionMethodNames); Set<String> reservedStructureMethodNames = new HashSet<>(reserveJavaPojoMethodNames); Collections.addAll(reservedStructureMethodNames, "overrideConfiguration", "sdkHttpResponse"); RESERVED_STRUCTURE_METHOD_NAMES = Collections.unmodifiableSet(reservedStructureMethodNames); } private final ServiceModel serviceModel; private final CustomizationConfig customizationConfig; public DefaultNamingStrategy(ServiceModel serviceModel, CustomizationConfig customizationConfig) { this.serviceModel = serviceModel; this.customizationConfig = customizationConfig == null ? CustomizationConfig.create() : customizationConfig; } private static boolean isJavaKeyword(String word) { return RESERVED_KEYWORDS.contains(word) || RESERVED_KEYWORDS.contains(StringUtils.lowerCase(word)); } @Override public String getServiceName() { String baseName = Stream.of(serviceModel.getMetadata().getServiceId()) .filter(Objects::nonNull) .filter(s -> !s.trim().isEmpty()) .findFirst() .orElseThrow(() -> new IllegalStateException("ServiceId is missing in the c2j model.")); baseName = pascalCase(baseName); // Special cases baseName = Utils.removeLeading(baseName, "Amazon"); baseName = Utils.removeLeading(baseName, "Aws"); baseName = Utils.removeTrailing(baseName, "Service"); return baseName; } @Override public String getClientPackageName(String serviceName) { return getCustomizedPackageName(concatServiceNameIfShareModel(serviceName), Constant.PACKAGE_NAME_CLIENT_PATTERN); } @Override public String getModelPackageName(String serviceName) { // Share model package classes if we are sharing models. if (customizationConfig.getShareModelConfig() != null && customizationConfig.getShareModelConfig().getShareModelWith() != null) { serviceName = customizationConfig.getShareModelConfig().getShareModelWith(); } return getCustomizedPackageName(serviceName, Constant.PACKAGE_NAME_MODEL_PATTERN); } @Override public String getTransformPackageName(String serviceName) { // Share transform package classes if we are sharing models. if (customizationConfig.getShareModelConfig() != null && customizationConfig.getShareModelConfig().getShareModelWith() != null) { serviceName = customizationConfig.getShareModelConfig().getShareModelWith(); } return getCustomizedPackageName(serviceName, Constant.PACKAGE_NAME_TRANSFORM_PATTERN); } @Override public String getRequestTransformPackageName(String serviceName) { return getCustomizedPackageName(concatServiceNameIfShareModel(serviceName), Constant.PACKAGE_NAME_TRANSFORM_PATTERN); } @Override public String getPaginatorsPackageName(String serviceName) { return getCustomizedPackageName(concatServiceNameIfShareModel(serviceName), Constant.PACKAGE_NAME_PAGINATORS_PATTERN); } @Override public String getWaitersPackageName(String serviceName) { return getCustomizedPackageName(concatServiceNameIfShareModel(serviceName), Constant.PACKAGE_NAME_WAITERS_PATTERN); } @Override public String getEndpointRulesPackageName(String serviceName) { return getCustomizedPackageName(concatServiceNameIfShareModel(serviceName), Constant.PACKAGE_NAME_RULES_PATTERN); } @Override public String getAuthSchemePackageName(String serviceName) { return getCustomizedPackageName(concatServiceNameIfShareModel(serviceName), Constant.PACKAGE_NAME_AUTH_SCHEME_PATTERN); } @Override public String getSmokeTestPackageName(String serviceName) { return getCustomizedPackageName(concatServiceNameIfShareModel(serviceName), Constant.PACKAGE_NAME_SMOKE_TEST_PATTERN); } /** * If the service is sharing models with other services, we need to concatenate its customized package name * if provided or service name with the shared service name. */ private String concatServiceNameIfShareModel(String serviceName) { if (customizationConfig.getShareModelConfig() != null) { return customizationConfig.getShareModelConfig().getShareModelWith() + "." + Optional.ofNullable(customizationConfig.getShareModelConfig().getPackageName()).orElse(serviceName); } return serviceName; } private String screamCase(String word) { return Stream.of(splitOnWordBoundaries(word)).map(s -> s.toUpperCase(Locale.US)).collect(joining("_")); } private String getCustomizedPackageName(String serviceName, String defaultPattern) { return String.format(defaultPattern, StringUtils.lowerCase(serviceName)); } @Override public String getExceptionName(String errorShapeName) { String baseName; if (errorShapeName.endsWith(FAULT_CLASS_SUFFIX)) { baseName = pascalCase(errorShapeName.substring(0, errorShapeName.length() - FAULT_CLASS_SUFFIX.length())) + EXCEPTION_CLASS_SUFFIX; } else if (errorShapeName.endsWith(EXCEPTION_CLASS_SUFFIX)) { baseName = pascalCase(errorShapeName); } else { baseName = pascalCase(errorShapeName) + EXCEPTION_CLASS_SUFFIX; } if (baseName.equals(getServiceName() + EXCEPTION_CLASS_SUFFIX)) { return COLLISION_DISAMBIGUATION_PREFIX + baseName; } return baseName; } @Override public String getRequestClassName(String operationName) { String baseName = pascalCase(operationName) + REQUEST_CLASS_SUFFIX; if (!operationName.equals(getServiceName())) { return baseName; } return COLLISION_DISAMBIGUATION_PREFIX + baseName; } @Override public String getResponseClassName(String operationName) { String baseName = pascalCase(operationName) + RESPONSE_CLASS_SUFFIX; if (!operationName.equals(getServiceName())) { return baseName; } return COLLISION_DISAMBIGUATION_PREFIX + baseName; } @Override public String getVariableName(String name) { // Exclude keywords because they will not compile, and exclude reserved method names because they're frequently // used for local variable names. if (isJavaKeyword(name) || RESERVED_STRUCTURE_METHOD_NAMES.contains(name) || RESERVED_EXCEPTION_METHOD_NAMES.contains(name)) { return unCapitalize(name + CONFLICTING_NAME_SUFFIX); } return unCapitalize(name); } @Override public String getEnumValueName(String enumValue) { String result = enumValue; // Special cases result = result.replaceAll("textORcsv", "TEXT_OR_CSV"); // Split into words result = String.join("_", splitOnWordBoundaries(result)); // Enums should be upper-case result = StringUtils.upperCase(result); if (!result.matches("^[A-Z][A-Z0-9_]*$")) { String attempt = result; log.warn(() -> "Invalid enum member generated for input '" + enumValue + "'. Best attempt: '" + attempt + "' If this " + "enum is not customized out, the build will fail."); } return result; } @Override public String getShapeClassName(String shapeName) { return Utils.capitalize(shapeName); } @Override public String getFluentGetterMethodName(String memberName, Shape parentShape, Shape shape) { String getterMethodName = Utils.unCapitalize(memberName); getterMethodName = rewriteInvalidMemberName(getterMethodName, parentShape); if (Utils.isOrContainsEnumShape(shape, serviceModel.getShapes())) { getterMethodName += "AsString"; if (Utils.isListShape(shape) || Utils.isMapShape(shape)) { getterMethodName += "s"; } } return getterMethodName; } @Override public String getFluentEnumGetterMethodName(String memberName, Shape parentShape, Shape shape) { if (!Utils.isOrContainsEnumShape(shape, serviceModel.getShapes())) { return null; } String getterMethodName = Utils.unCapitalize(memberName); getterMethodName = rewriteInvalidMemberName(getterMethodName, parentShape); return getterMethodName; } @Override public String getExistenceCheckMethodName(String memberName, Shape parentShape) { String existenceCheckMethodName = Utils.unCapitalize(memberName); existenceCheckMethodName = rewriteInvalidMemberName(existenceCheckMethodName, parentShape); return String.format("has%s", Utils.capitalize(existenceCheckMethodName)); } @Override public String getBeanStyleGetterMethodName(String memberName, Shape parentShape, Shape c2jShape) { String fluentGetterMethodName; if (Utils.isOrContainsEnumShape(c2jShape, serviceModel.getShapes())) { // Use the enum (modeled) name for bean-style getters fluentGetterMethodName = getFluentEnumGetterMethodName(memberName, parentShape, c2jShape); } else { fluentGetterMethodName = getFluentGetterMethodName(memberName, parentShape, c2jShape); } return String.format("get%s", Utils.capitalize(fluentGetterMethodName)); } @Override public String getBeanStyleSetterMethodName(String memberName, Shape parentShape, Shape c2jShape) { String beanStyleGetter = getBeanStyleGetterMethodName(memberName, parentShape, c2jShape); return String.format("set%s", beanStyleGetter.substring("get".length())); } @Override public String getFluentSetterMethodName(String memberName, Shape parentShape, Shape shape) { String setterMethodName = Utils.unCapitalize(memberName); setterMethodName = rewriteInvalidMemberName(setterMethodName, parentShape); if (Utils.isOrContainsEnumShape(shape, serviceModel.getShapes()) && (Utils.isListShape(shape) || Utils.isMapShape(shape))) { setterMethodName += "WithStrings"; } return setterMethodName; } @Override public String getFluentEnumSetterMethodName(String memberName, Shape parentShape, Shape shape) { if (!Utils.isOrContainsEnumShape(shape, serviceModel.getShapes())) { return null; } String setterMethodName = Utils.unCapitalize(memberName); setterMethodName = rewriteInvalidMemberName(setterMethodName, parentShape); return setterMethodName; } @Override public String getSdkFieldFieldName(MemberModel memberModel) { return screamCase(memberModel.getName()) + "_FIELD"; } @Override public String getUnionEnumTypeName(MemberModel memberModel) { return screamCase(memberModel.getName()); } private String rewriteInvalidMemberName(String memberName, Shape parentShape) { if (isJavaKeyword(memberName) || isDisallowedNameForShape(memberName, parentShape)) { return Utils.unCapitalize(memberName + CONFLICTING_NAME_SUFFIX); } return memberName; } private boolean isDisallowedNameForShape(String name, Shape parentShape) { // Reserve the name "type" for union shapes. if (parentShape.isUnion() && name.equals("type")) { return true; } if (parentShape.isException()) { return RESERVED_EXCEPTION_METHOD_NAMES.contains(name); } else { return RESERVED_STRUCTURE_METHOD_NAMES.contains(name); } } @Override public void validateCustomerVisibleNaming(IntermediateModel trimmedModel) { Metadata metadata = trimmedModel.getMetadata(); validateCustomerVisibleName(metadata.getSyncInterface(), "metadata-derived interface name"); validateCustomerVisibleName(metadata.getSyncBuilderInterface(), "metadata-derived builder interface name"); validateCustomerVisibleName(metadata.getAsyncInterface(), "metadata-derived async interface name"); validateCustomerVisibleName(metadata.getAsyncBuilderInterface(), "metadata-derived async builder interface name"); validateCustomerVisibleName(metadata.getBaseBuilderInterface(), "metadata-derived builder interface name"); validateCustomerVisibleName(metadata.getBaseExceptionName(), "metadata-derived exception name"); validateCustomerVisibleName(metadata.getBaseRequestName(), "metadata-derived request name"); validateCustomerVisibleName(metadata.getBaseResponseName(), "metadata-derived response name"); trimmedModel.getOperations().values().forEach(operation -> { validateCustomerVisibleName(operation.getOperationName(), "operations"); }); trimmedModel.getWaiters().forEach((name, waiter) -> { validateCustomerVisibleName(name, "waiters"); }); trimmedModel.getShapes().values().forEach(shape -> { String shapeName = shape.getShapeName(); validateCustomerVisibleName(shapeName, "shapes"); shape.getMembers().forEach(member -> { validateCustomerVisibleName(member.getFluentGetterMethodName(), shapeName + " shape"); validateCustomerVisibleName(member.getFluentSetterMethodName(), shapeName + " shape"); validateCustomerVisibleName(member.getFluentEnumGetterMethodName(), shapeName + " shape"); validateCustomerVisibleName(member.getFluentEnumSetterMethodName(), shapeName + " shape"); validateCustomerVisibleName(member.getExistenceCheckMethodName(), shapeName + " shape"); validateCustomerVisibleName(member.getBeanStyleGetterMethodName(), shapeName + " shape"); validateCustomerVisibleName(member.getBeanStyleSetterMethodName(), shapeName + " shape"); validateCustomerVisibleName(member.getEnumType(), shapeName + " shape"); }); }); } private void validateCustomerVisibleName(String name, String location) { if (name == null) { return; } if (name.contains("_")) { UnderscoresInNameBehavior behavior = customizationConfig.getUnderscoresInNameBehavior(); String supportedBehaviors = Arrays.toString(UnderscoresInNameBehavior.values()); Validate.notNull(behavior, "Encountered a name or identifier that the customer will see (%s in the %s) with an underscore. " + "This isn't idiomatic in Java. Please either remove the underscores or apply the " + "'underscoresInNameBehavior' customization for this service (Supported " + "'underscoresInNameBehavior' values: %s).", name, location, supportedBehaviors); Validate.isTrue(behavior == UnderscoresInNameBehavior.ALLOW, "Unsupported underscoresInShapeNameBehavior: %s. Supported values: %s", behavior, supportedBehaviors); } Validate.isTrue(VALID_IDENTIFIER_NAME.matcher(name).matches(), "Encountered a name or identifier that is invalid within Java (%s in %s). Please remove invalid " + "characters.", name, location); } }
3,504
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/compression/RequestCompression.java
/* * 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.compression; import java.util.List; import software.amazon.awssdk.annotations.SdkInternalApi; /** * Class to map the RequestCompression trait of an operation. */ @SdkInternalApi public class RequestCompression { private List<String> encodings; public List<String> getEncodings() { return encodings; } public void setEncodings(List<String> encodings) { this.encodings = encodings; } }
3,505
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/ServiceConfig.java
/* * 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.model.config.customization; public class ServiceConfig { /** * Specifies the name of the client configuration class to use if a service * has a specific advanced client configuration class. Null if the service * does not have advanced configuration. */ private String className; /** * Whether the service config has a property used to manage dualstack (should be deprecated in favor of * AwsClientBuilder#dualstackEnabled). */ private boolean hasDualstackProperty = false; /** * Whether the service config has a property used to manage FIPS (should be deprecated in favor of * AwsClientBuilder#fipsEnabled). */ private boolean hasFipsProperty = false; /** * Whether the service config has a property used to manage useArnRegion (should be deprecated in favor of * AwsClientBuilder#fipsEnabled). */ private boolean hasUseArnRegionProperty = false; private boolean hasMultiRegionEnabledProperty = false; private boolean hasPathStyleAccessEnabledProperty = false; private boolean hasAccelerateModeEnabledProperty = false; private boolean hasCrossRegionAccessEnabledProperty = false; public String getClassName() { return className; } public void setClassName(String className) { this.className = className; } public boolean hasDualstackProperty() { return hasDualstackProperty; } public void setHasDualstackProperty(boolean hasDualstackProperty) { this.hasDualstackProperty = hasDualstackProperty; } public boolean hasFipsProperty() { return hasFipsProperty; } public void setHasFipsProperty(boolean hasFipsProperty) { this.hasFipsProperty = hasFipsProperty; } public boolean hasUseArnRegionProperty() { return hasUseArnRegionProperty; } public void setHasUseArnRegionProperty(boolean hasUseArnRegionProperty) { this.hasUseArnRegionProperty = hasUseArnRegionProperty; } public boolean hasMultiRegionEnabledProperty() { return hasMultiRegionEnabledProperty; } public void setHasMultiRegionEnabledProperty(boolean hasMultiRegionEnabledProperty) { this.hasMultiRegionEnabledProperty = hasMultiRegionEnabledProperty; } public boolean hasForcePathTypeEnabledProperty() { return hasPathStyleAccessEnabledProperty; } public void setHasPathStyleAccessEnabledProperty(boolean hasPathStyleAccessEnabledProperty) { this.hasPathStyleAccessEnabledProperty = hasPathStyleAccessEnabledProperty; } public boolean hasCrossRegionAccessEnabledProperty() { return hasCrossRegionAccessEnabledProperty; } public void setHasCrossRegionAccessEnabledProperty(boolean hasCrossRegionAccessEnabledProperty) { this.hasCrossRegionAccessEnabledProperty = hasCrossRegionAccessEnabledProperty; } public boolean hasAccelerateModeEnabledProperty() { return hasAccelerateModeEnabledProperty; } public void setHasAccelerateModeEnabledProperty(boolean hasAccelerateModeEnabledProperty) { this.hasAccelerateModeEnabledProperty = hasAccelerateModeEnabledProperty; } }
3,506
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/ShareModelConfig.java
/* * 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.model.config.customization; /** * Contains custom properties for services that share models with other services. */ public class ShareModelConfig { /** * A service name that this service client should share models with. The models and non-request marshallers will be generated * into the same directory as the provided service's models. */ private String shareModelWith; /** * The package name of the provided service. Service name will be used if not provided. */ private String packageName; public String getShareModelWith() { return shareModelWith; } public void setShareModelWith(String shareModelWith) { this.shareModelWith = shareModelWith; } public String getPackageName() { return packageName; } public void setPackageName(String packageName) { this.packageName = packageName; } }
3,507
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/ModifyModelShapeModifier.java
/* * 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.model.config.customization; public class ModifyModelShapeModifier { /** * Indicates whether a member should be annotated as {@link Deprecated}. */ private boolean deprecated; /** * The Javadoc message that will be included with the {@link Deprecated} annotation. */ private String deprecatedMessage; /** * Indicates whether a renamed member should create getters and setters under the existing name */ private boolean existingNameDeprecated; /** * Sets a name for a member used by the SDK, eliminating the existing name */ private String emitPropertyName; /** * The name for the enum to be used in the java class. This overrides the * name computed by the code generator for the enum. */ private String emitEnumName; /** * The value for the enum to be used in the java class. This overrides the * values computed by the code generator for the enum. */ private String emitEnumValue; /** * Emit as a different primitive type. Used by AWS Budget Service to change string * to BigDecimal (see API-433). */ private String emitAsType; private String marshallLocationName; private String unmarshallLocationName; public String getDeprecatedMessage() { return deprecatedMessage; } public void setDeprecatedMessage(String deprecatedMessage) { this.deprecatedMessage = deprecatedMessage; } public boolean isDeprecated() { return deprecated; } public void setDeprecated(boolean deprecated) { this.deprecated = deprecated; } public boolean isExistingNameDeprecated() { return existingNameDeprecated; } public void setExistingNameDeprecated(boolean existingNameDeprecated) { this.existingNameDeprecated = existingNameDeprecated; } public String getEmitPropertyName() { return emitPropertyName; } public void setEmitPropertyName(String emitPropertyName) { this.emitPropertyName = emitPropertyName; } public String getEmitEnumName() { return emitEnumName; } public void setEmitEnumName(String emitEnumName) { this.emitEnumName = emitEnumName; } public String getEmitEnumValue() { return emitEnumValue; } public void setEmitEnumValue(String emitEnumValue) { this.emitEnumValue = emitEnumValue; } public String getMarshallLocationName() { return marshallLocationName; } public void setMarshallLocationName(String marshallLocationName) { this.marshallLocationName = marshallLocationName; } public String getUnmarshallLocationName() { return unmarshallLocationName; } public void setUnmarshallLocationName(String unmarshallLocationName) { this.unmarshallLocationName = unmarshallLocationName; } public String getEmitAsType() { return emitAsType; } public void setEmitAsType(String emitAsType) { this.emitAsType = emitAsType; } }
3,508
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/ConvenienceTypeOverload.java
/* * 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.model.config.customization; import software.amazon.awssdk.codegen.model.intermediate.MemberModel; import software.amazon.awssdk.codegen.model.intermediate.ShapeModel; /** * Customization to allow generation of additional setter overloads for a 'convenience' type (i.e. a * different type then what the member actually is but a more convenient representation to work * with, I.E. String rather than SdkBytes). Customization is configured with an adapter that knows * how to convert the 'convenience' type to the actual member type * <p> * Note - This customization is not directly exposed through {@link CustomizationConfig} at the * moment. Instead several pre-canned customizations use this under the hood but expose limited * functionality for overloading setters. This decision was made to discourage use of overloaded * types and instead model the member in a more natural way to begin with. In the future we may * either decide to fully expose this customization or just add more pre-canned settings as the need * arises * </p> * <p> * Currently this does not support overloads for List or Map types but it could be easily * implemented in the Generator. * </p> */ public class ConvenienceTypeOverload { /** * Name of the shape this customization applies to */ private String shapeName; /** * Name of the member this customization applies to */ private String memberName; /** * Convenience type to generate an overload for */ private String convenienceType; /** * Fully qualified adapter class that can convert from the convenience type to the actual type */ private String typeAdapterFqcn; public String getShapeName() { return shapeName; } public void setShapeName(String shapeName) { this.shapeName = shapeName; } public ConvenienceTypeOverload withShapeName(String shapeName) { this.shapeName = shapeName; return this; } public String getMemberName() { return memberName; } public void setMemberName(String memberName) { this.memberName = memberName; } public ConvenienceTypeOverload withMemberName(String memberName) { this.memberName = memberName; return this; } public String getConvenienceType() { return convenienceType; } public void setConvenienceType(String convenienceType) { this.convenienceType = convenienceType; } public ConvenienceTypeOverload withConvenienceType(String convenienceType) { this.convenienceType = convenienceType; return this; } public String getTypeAdapterFqcn() { return typeAdapterFqcn; } public void setTypeAdapterFqcn(String typeAdapterFqcn) { this.typeAdapterFqcn = typeAdapterFqcn; } public ConvenienceTypeOverload withTypeAdapterFqcn(String typeAdapterFqcn) { this.typeAdapterFqcn = typeAdapterFqcn; return this; } /** * @param shape * Current shape * @param member * Current member * @return True if the {@link ConvenienceTypeOverload} applies. False otherwise */ public boolean accepts(ShapeModel shape, MemberModel member) { return shape.getC2jName().equals(shapeName) && member.getC2jName().equals(memberName); } }
3,509
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/ShapeModifier.java
/* * 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.model.config.customization; import java.util.List; import java.util.Map; import software.amazon.awssdk.codegen.model.service.Member; /** * Use shapeModifiers customization to add/remove shape members or to modify the * properties of a member. */ public class ShapeModifier { private boolean excludeShape; private List<String> exclude; private List<Map<String, ModifyModelShapeModifier>> modify; private List<Map<String, Member>> inject; private Integer staxTargetDepthOffset; private Boolean union; /** * @return true if the whole shape should be excluded. */ public boolean isExcludeShape() { return excludeShape; } public void setExcludeShape(boolean excludeShape) { this.excludeShape = excludeShape; } /** * @return A list of member names that should be excluded when processing * the given shape. */ public List<String> getExclude() { return exclude; } public void setExclude(List<String> exclude) { this.exclude = exclude; } /** * @return List of singleton maps, each containing the name of a shape * member, and the modifications that we want to apply to it. */ public List<Map<String, ModifyModelShapeModifier>> getModify() { return modify; } public void setModify(List<Map<String, ModifyModelShapeModifier>> modify) { this.modify = modify; } /** * @return A list of singleton maps, each containing a custom member that we want to inject to this shape. */ public List<Map<String, Member>> getInject() { return inject; } public void setInject(List<Map<String, Member>> inject) { this.inject = inject; } /** * @return the depth offset to use during staxUnmarshalling */ public Integer getStaxTargetDepthOffset() { return staxTargetDepthOffset; } public void setStaxTargetDepthOffset(Integer staxTargetDepthOffset) { this.staxTargetDepthOffset = staxTargetDepthOffset; } public Boolean isUnion() { return union; } public void setUnion(Boolean union) { this.union = union; } }
3,510
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/MultipartCustomization.java
/* * 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.model.config.customization; public class MultipartCustomization { private String multipartConfigurationClass; private String multipartConfigMethodDoc; private String multipartEnableMethodDoc; private String contextParamEnabledKey; private String contextParamConfigKey; public String getMultipartConfigurationClass() { return multipartConfigurationClass; } public void setMultipartConfigurationClass(String multipartConfigurationClass) { this.multipartConfigurationClass = multipartConfigurationClass; } public String getMultipartConfigMethodDoc() { return multipartConfigMethodDoc; } public void setMultipartConfigMethodDoc(String multipartMethodDoc) { this.multipartConfigMethodDoc = multipartMethodDoc; } public String getMultipartEnableMethodDoc() { return multipartEnableMethodDoc; } public void setMultipartEnableMethodDoc(String multipartEnableMethodDoc) { this.multipartEnableMethodDoc = multipartEnableMethodDoc; } public String getContextParamEnabledKey() { return contextParamEnabledKey; } public void setContextParamEnabledKey(String contextParamEnabledKey) { this.contextParamEnabledKey = contextParamEnabledKey; } public String getContextParamConfigKey() { return contextParamConfigKey; } public void setContextParamConfigKey(String contextParamConfigKey) { this.contextParamConfigKey = contextParamConfigKey; } }
3,511
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/MetadataConfig.java
/* * 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.model.config.customization; /** * Contains custom properties to override in service and intermediate model metadata. */ public class MetadataConfig { private String protocol; private String contentType; public String getProtocol() { return protocol; } public void setProtocol(final String protocol) { this.protocol = protocol; } /** * Gets the Custom value for Content Type Header. * This customization is supported only for JSON protocol. * @return contentType. */ public String getContentType() { return contentType; } public void setContentType(final String contentType) { this.contentType = contentType; } }
3,512
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/CustomizationConfig.java
/* * 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.model.config.customization; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import software.amazon.awssdk.codegen.model.service.ClientContextParam; import software.amazon.awssdk.core.retry.RetryMode; import software.amazon.awssdk.core.traits.PayloadTrait; import software.amazon.awssdk.utils.AttributeMap; /** * {@code service-2.json} models can be manually modified via defining properties in an associated {@code customization.config} * file. This class defines the Java bean representation that will be used to parse the JSON customization file. The bean can * then be later queried in the misc. codegen steps. */ public class CustomizationConfig { /** * List of 'convenience' overloads to generate for model classes. Convenience overloads expose a * different type that is adapted to the real type */ private final List<ConvenienceTypeOverload> convenienceTypeOverloads = new ArrayList<>(); /** * Configuration object for service-specific configuration options. */ private ServiceConfig serviceConfig = new ServiceConfig(); /** * Specify shapes to be renamed. */ private Map<String, String> renameShapes; /** * Custom service and intermediate model metadata properties. */ private MetadataConfig customServiceMetadata; /** * Codegen customization mechanism shared by the .NET SDK */ private Map<String, OperationModifier> operationModifiers; private Map<String, ShapeSubstitution> shapeSubstitutions; private CustomSdkShapes customSdkShapes; private Map<String, ShapeModifier> shapeModifiers; /** * Sets the custom field name that identifies the type of modeled exception for JSON protocols. * Normally this is '__type' but Glacier has a custom error code field named simply 'code'. */ private String customErrorCodeFieldName; /** * Service specific base class for all modeled exceptions. By default this is syncInterface + * Exception (i.e. AmazonSQSException). Currently only DynamoDB Streams utilizes this * customization since it shares exception types with the DynamoDB client. * * <p>This customization should only provide the simple class name. The typical model package * will be used when fully qualifying references to this exception</p> * * <p><b>Note:</b> that if a custom base class is provided the generator will not generate one. * We assume it already exists.</p> */ private String sdkModeledExceptionBaseClassName; /** * Service calculates CRC32 checksum from compressed file when Accept-Encoding: gzip header is provided. */ private boolean calculateCrc32FromCompressedData; /** * Exclude the create() method on a client. This is useful for global services that will need a global region configured to * work. */ private boolean excludeClientCreateMethod = false; /** * Configurations for the service that share model with other services. The models and non-request marshallers will be * generated into the same directory as the provided service's models. */ private ShareModelConfig shareModelConfig; /** * Fully qualified name of the class that contains the custom http config. The class should expose a public static method * with name "defaultHttpConfig" that returns an {@link AttributeMap} containing the desired http config defaults. * * See SWF customization.config for an example. */ private String serviceSpecificHttpConfig; /** * APIs that have no required arguments in their model but can't be called via a simple method */ private List<String> excludedSimpleMethods = new ArrayList<>(); /** * APIs that have no required arguments in their model but can't be called via a simple method. * Superseded by {@link #excludedSimpleMethods} */ @Deprecated private List<String> blacklistedSimpleMethods = new ArrayList<>(); /** * APIs that are not Get/List/Describe APIs that have been verified that they are able * to be used through simple methods */ private List<String> verifiedSimpleMethods = new ArrayList<>(); /** * If a service isn't in the endpoints.json, the region that should be used for simple method integration tests. */ private String defaultSimpleMethodTestRegion; private List<String> deprecatedOperations = new ArrayList<>(); private List<String> deprecatedShapes = new ArrayList<>(); private String sdkRequestBaseClassName; private String sdkResponseBaseClassName; private Map<String, String> modelMarshallerDefaultValueSupplier = new HashMap<>(); /** * Custom Retry Policy */ private String customRetryPolicy; private boolean skipSyncClientGeneration; /** * Customization to attach the {@link PayloadTrait} to a member. Currently this is only used for * S3 which doesn't model a member as a payload trait even though it is. */ private Map<String, String> attachPayloadTraitToMember = new HashMap<>(); /** * Custom Response metadata */ private Map<String, String> customResponseMetadata; /** * Custom protocol factory implementation. Currently this is only respected by the REST-XML protocol as only S3 * needs a custom factory. */ private String customProtocolFactoryFqcn; /** * Map of paginated operations that use custom class generation. * Key - c2j operation name * Value - indicates the type of pagination strategy to use */ private Map<String, String> paginationCustomization; /** * Config to generate a utilities() in the low-level client */ private UtilitiesMethod utilitiesMethod; /** * Config to generate a additional Builder methods in the client interface. */ private List<AdditionalBuilderMethod> additionalBuilderMethods; /** * Force generation of deprecated client builder method 'enableEndpointDiscovery'. Only services that already had * this method when it was deprecated require this flag to be set. */ private boolean enableEndpointDiscoveryMethodRequired = false; /** * Arnable fields used in s3 control */ private Map<String, S3ArnableFieldConfig> s3ArnableFields; /** * Allow a customer to set an endpoint override AND bypass endpoint discovery on their client even when endpoint discovery * enabled is true and endpoint discovery is required for an operation. This customization should almost never be "true" * because it creates a confusing customer experience. */ private boolean allowEndpointOverrideForEndpointDiscoveryRequiredOperations = false; /** * Customization to instruct the code generator to use the legacy model generation scheme for the given events. * <p> * <b>NOTE</b>This customization is primarily here to preserve backwards compatibility with existing code before the * generation scheme for the visitor methods was changed. There should be no good reason to use this customization * for any other purpose. */ private Map<String, List<String>> useLegacyEventGenerationScheme = new HashMap<>(); /** * How the code generator should behave when it encounters shapes with underscores in the name. */ private UnderscoresInNameBehavior underscoresInNameBehavior; private String userAgent; private RetryMode defaultRetryMode; /** * Whether to generate an abstract decorator class that delegates to the async service client */ private boolean delegateAsyncClientClass; /** * Whether to generate an abstract decorator class that delegates to the sync service client */ private boolean delegateSyncClientClass; /** * Fully qualified name of a class that given the default sync client instance can return the final client instance, * for instance by decorating the client with specific-purpose implementations of the client interface. * See S3 customization.config for an example. */ private String syncClientDecorator; /** * Fully qualified name of a class that given the default async client instance can return the final client instance, * for instance by decorating the client with specific-purpose implementations of the client interface. * See S3 customization.config for an example. */ private String asyncClientDecorator; /** * Only for s3. A set of customization to related to multipart operations. */ private MultipartCustomization multipartCustomization; /** * Whether to skip generating endpoint tests from endpoint-tests.json */ private boolean skipEndpointTestGeneration; /** * Whether to generate client-level endpoint tests; overrides test case criteria such as operation inputs. */ private boolean generateEndpointClientTests; /** * A mapping from the skipped test's description to the reason why it's being skipped. */ private Map<String, String> skipEndpointTests; private boolean useGlobalEndpoint; private List<String> interceptors = new ArrayList<>(); private List<String> internalPlugins = new ArrayList<>(); /** * Whether marshallers perform validations against members marked with RequiredTrait. */ private boolean requiredTraitValidationEnabled = false; /** * Whether SRA based auth logic should be used. */ private boolean useSraAuth = false; /** * Whether to generate auth scheme params based on endpoint params. */ private boolean enableEndpointAuthSchemeParams = false; /** * List of endpoint params to be used for the auth scheme params */ private List<String> allowedEndpointAuthSchemeParams = Collections.emptyList(); /** * Whether the list of allowed endpoint auth scheme params was explicitly configured. */ private boolean allowedEndpointAuthSchemeParamsConfigured = false; /** * Customization to attach map of Custom client param configs that can be set on a client builder. */ private Map<String, ClientContextParam> customClientContextParams; private CustomizationConfig() { } public static CustomizationConfig create() { return new CustomizationConfig(); } public Map<String, OperationModifier> getOperationModifiers() { return operationModifiers; } public void setOperationModifiers(Map<String, OperationModifier> operationModifiers) { this.operationModifiers = operationModifiers; } public Map<String, String> getRenameShapes() { return renameShapes; } public void setRenameShapes(Map<String, String> renameShapes) { this.renameShapes = renameShapes; } public CustomSdkShapes getCustomSdkShapes() { return customSdkShapes; } public void setCustomSdkShapes(CustomSdkShapes customSdkShapes) { this.customSdkShapes = customSdkShapes; } public Map<String, ShapeSubstitution> getShapeSubstitutions() { return shapeSubstitutions; } public void setShapeSubstitutions(Map<String, ShapeSubstitution> shapeSubstitutions) { this.shapeSubstitutions = shapeSubstitutions; } public Map<String, ShapeModifier> getShapeModifiers() { return shapeModifiers; } public void setShapeModifiers(Map<String, ShapeModifier> shapeModifiers) { this.shapeModifiers = shapeModifiers; } public List<ConvenienceTypeOverload> getConvenienceTypeOverloads() { return this.convenienceTypeOverloads; } public void setConvenienceTypeOverloads(List<ConvenienceTypeOverload> convenienceTypeOverloads) { this.convenienceTypeOverloads.addAll(convenienceTypeOverloads); } public MetadataConfig getCustomServiceMetadata() { return customServiceMetadata; } public void setCustomServiceMetadata(MetadataConfig metadataConfig) { this.customServiceMetadata = metadataConfig; } public String getCustomErrorCodeFieldName() { return customErrorCodeFieldName; } public void setCustomErrorCodeFieldName(String customErrorCodeFieldName) { this.customErrorCodeFieldName = customErrorCodeFieldName; } public String getSdkModeledExceptionBaseClassName() { return sdkModeledExceptionBaseClassName; } public void setSdkModeledExceptionBaseClassName(String sdkModeledExceptionBaseClassName) { this.sdkModeledExceptionBaseClassName = sdkModeledExceptionBaseClassName; } public boolean isCalculateCrc32FromCompressedData() { return calculateCrc32FromCompressedData; } public void setCalculateCrc32FromCompressedData( boolean calculateCrc32FromCompressedData) { this.calculateCrc32FromCompressedData = calculateCrc32FromCompressedData; } public boolean isExcludeClientCreateMethod() { return excludeClientCreateMethod; } public void setExcludeClientCreateMethod(boolean excludeClientCreateMethod) { this.excludeClientCreateMethod = excludeClientCreateMethod; } public ShareModelConfig getShareModelConfig() { return shareModelConfig; } public void setShareModelConfig(ShareModelConfig shareModelConfig) { this.shareModelConfig = shareModelConfig; } public String getServiceSpecificHttpConfig() { return serviceSpecificHttpConfig; } public void setServiceSpecificHttpConfig(String serviceSpecificHttpConfig) { this.serviceSpecificHttpConfig = serviceSpecificHttpConfig; } public List<String> getExcludedSimpleMethods() { return excludedSimpleMethods; } public void setExcludedSimpleMethods(List<String> excludedSimpleMethods) { this.excludedSimpleMethods = excludedSimpleMethods; } /** * Use {@link #getExcludedSimpleMethods()} */ @Deprecated public List<String> getBlacklistedSimpleMethods() { return blacklistedSimpleMethods; } /** * Use {@link #setExcludedSimpleMethods(List)} */ @Deprecated public void setBlacklistedSimpleMethods(List<String> blackListedSimpleMethods) { this.blacklistedSimpleMethods = blackListedSimpleMethods; } public List<String> getVerifiedSimpleMethods() { return verifiedSimpleMethods; } public void setVerifiedSimpleMethods(List<String> verifiedSimpleMethods) { this.verifiedSimpleMethods = verifiedSimpleMethods; } public String getDefaultSimpleMethodTestRegion() { return defaultSimpleMethodTestRegion; } public void setDefaultSimpleMethodTestRegion(String defaultSimpleMethodTestRegion) { this.defaultSimpleMethodTestRegion = defaultSimpleMethodTestRegion; } public List<String> getDeprecatedOperations() { return deprecatedOperations; } public void setDeprecatedOperations(List<String> deprecatedOperations) { this.deprecatedOperations = deprecatedOperations; } public List<String> getDeprecatedShapes() { return deprecatedShapes; } public void setDeprecatedShapes(List<String> deprecatedShapes) { this.deprecatedShapes = deprecatedShapes; } public String getSdkRequestBaseClassName() { return sdkRequestBaseClassName; } public void setSdkRequestBaseClassName(String sdkRequestBaseClassName) { this.sdkRequestBaseClassName = sdkRequestBaseClassName; } public String getSdkResponseBaseClassName() { return sdkResponseBaseClassName; } public void setSdkResponseBaseClassName(String sdkResponseBaseClassName) { this.sdkResponseBaseClassName = sdkResponseBaseClassName; } public Map<String, String> getModelMarshallerDefaultValueSupplier() { return modelMarshallerDefaultValueSupplier; } public void setModelMarshallerDefaultValueSupplier(Map<String, String> modelMarshallerDefaultValueSupplier) { this.modelMarshallerDefaultValueSupplier = modelMarshallerDefaultValueSupplier; } public String getCustomRetryPolicy() { return customRetryPolicy; } public void setCustomRetryPolicy(String customRetryPolicy) { this.customRetryPolicy = customRetryPolicy; } public boolean isSkipSyncClientGeneration() { return skipSyncClientGeneration; } public void setSkipSyncClientGeneration(boolean skipSyncClientGeneration) { this.skipSyncClientGeneration = skipSyncClientGeneration; } public Map<String, String> getAttachPayloadTraitToMember() { return attachPayloadTraitToMember; } public void setAttachPayloadTraitToMember(Map<String, String> attachPayloadTraitToMember) { this.attachPayloadTraitToMember = attachPayloadTraitToMember; } public Map<String, String> getCustomResponseMetadata() { return customResponseMetadata; } public void setCustomResponseMetadata(Map<String, String> customResponseMetadata) { this.customResponseMetadata = customResponseMetadata; } public String getCustomProtocolFactoryFqcn() { return customProtocolFactoryFqcn; } public void setCustomProtocolFactoryFqcn(String customProtocolFactoryFqcn) { this.customProtocolFactoryFqcn = customProtocolFactoryFqcn; } public Map<String, String> getPaginationCustomization() { return paginationCustomization; } public void setPaginationCustomization(Map<String, String> paginationCustomization) { this.paginationCustomization = paginationCustomization; } public UtilitiesMethod getUtilitiesMethod() { return utilitiesMethod; } public void setUtilitiesMethod(UtilitiesMethod utilitiesMethod) { this.utilitiesMethod = utilitiesMethod; } public List<AdditionalBuilderMethod> getAdditionalBuilderMethods() { return additionalBuilderMethods; } public void setAdditionalBuilderMethods(List<AdditionalBuilderMethod> additionalBuilderMethods) { this.additionalBuilderMethods = additionalBuilderMethods; } public boolean isEnableEndpointDiscoveryMethodRequired() { return enableEndpointDiscoveryMethodRequired; } public void setEnableEndpointDiscoveryMethodRequired(boolean enableEndpointDiscoveryMethodRequired) { this.enableEndpointDiscoveryMethodRequired = enableEndpointDiscoveryMethodRequired; } public Map<String, S3ArnableFieldConfig> getS3ArnableFields() { return s3ArnableFields; } public CustomizationConfig withS3ArnableFields(Map<String, S3ArnableFieldConfig> s3ArnableFields) { this.s3ArnableFields = s3ArnableFields; return this; } public void setS3ArnableFields(Map<String, S3ArnableFieldConfig> s3ArnableFields) { this.s3ArnableFields = s3ArnableFields; } public boolean allowEndpointOverrideForEndpointDiscoveryRequiredOperations() { return allowEndpointOverrideForEndpointDiscoveryRequiredOperations; } public void setAllowEndpointOverrideForEndpointDiscoveryRequiredOperations( boolean allowEndpointOverrideForEndpointDiscoveryRequiredOperations) { this.allowEndpointOverrideForEndpointDiscoveryRequiredOperations = allowEndpointOverrideForEndpointDiscoveryRequiredOperations; } public Map<String, List<String>> getUseLegacyEventGenerationScheme() { return useLegacyEventGenerationScheme; } public void setUseLegacyEventGenerationScheme(Map<String, List<String>> useLegacyEventGenerationScheme) { this.useLegacyEventGenerationScheme = useLegacyEventGenerationScheme; } public UnderscoresInNameBehavior getUnderscoresInNameBehavior() { return underscoresInNameBehavior; } public void setUnderscoresInNameBehavior(UnderscoresInNameBehavior behavior) { this.underscoresInNameBehavior = behavior; } public CustomizationConfig withUnderscoresInShapeNameBehavior(UnderscoresInNameBehavior behavior) { this.underscoresInNameBehavior = behavior; return this; } public String getUserAgent() { return userAgent; } public void setUserAgent(String userAgent) { this.userAgent = userAgent; } public CustomizationConfig withUserAgent(String userAgent) { this.userAgent = userAgent; return this; } public RetryMode getDefaultRetryMode() { return defaultRetryMode; } public void setDefaultRetryMode(RetryMode defaultRetryMode) { this.defaultRetryMode = defaultRetryMode; } public ServiceConfig getServiceConfig() { return serviceConfig; } public void setServiceConfig(ServiceConfig serviceConfig) { this.serviceConfig = serviceConfig; } public boolean isDelegateAsyncClientClass() { return delegateAsyncClientClass; } public void setDelegateAsyncClientClass(boolean delegateAsyncClientClass) { this.delegateAsyncClientClass = delegateAsyncClientClass; } public String getSyncClientDecorator() { return syncClientDecorator; } public void setSyncClientDecorator(String syncClientDecorator) { this.syncClientDecorator = syncClientDecorator; } public String getAsyncClientDecorator() { return asyncClientDecorator; } public void setAsyncClientDecorator(String asyncClientDecorator) { this.asyncClientDecorator = asyncClientDecorator; } public boolean isDelegateSyncClientClass() { return delegateSyncClientClass; } public void setDelegateSyncClientClass(boolean delegateSyncClientClass) { this.delegateSyncClientClass = delegateSyncClientClass; } public boolean isSkipEndpointTestGeneration() { return skipEndpointTestGeneration; } public void setSkipEndpointTestGeneration(boolean skipEndpointTestGeneration) { this.skipEndpointTestGeneration = skipEndpointTestGeneration; } public boolean isGenerateEndpointClientTests() { return generateEndpointClientTests; } public void setGenerateEndpointClientTests(boolean generateEndpointClientTests) { this.generateEndpointClientTests = generateEndpointClientTests; } public boolean useGlobalEndpoint() { return useGlobalEndpoint; } public void setUseGlobalEndpoint(boolean useGlobalEndpoint) { this.useGlobalEndpoint = useGlobalEndpoint; } public Map<String, String> getSkipEndpointTests() { return skipEndpointTests; } public void setSkipEndpointTests(Map<String, String> skipEndpointTests) { this.skipEndpointTests = skipEndpointTests; } public List<String> getInterceptors() { return interceptors; } public void setInterceptors(List<String> interceptors) { this.interceptors = interceptors; } public List<String> getInternalPlugins() { return internalPlugins; } public void setInternalPlugins(List<String> internalPlugins) { this.internalPlugins = internalPlugins; } public boolean isRequiredTraitValidationEnabled() { return requiredTraitValidationEnabled; } public void setRequiredTraitValidationEnabled(boolean requiredTraitValidationEnabled) { this.requiredTraitValidationEnabled = requiredTraitValidationEnabled; } public void setUseSraAuth(boolean useSraAuth) { this.useSraAuth = useSraAuth; } // TODO(post-sra-identity-auth): Remove this customization and all related switching logic, keeping only the // useSraAuth==true branch going forward. public boolean useSraAuth() { return useSraAuth; } public void setEnableEndpointAuthSchemeParams(boolean enableEndpointAuthSchemeParams) { this.enableEndpointAuthSchemeParams = enableEndpointAuthSchemeParams; } public boolean isEnableEndpointAuthSchemeParams() { return enableEndpointAuthSchemeParams; } public void setAllowedEndpointAuthSchemeParams(List<String> allowedEndpointAuthSchemeParams) { this.allowedEndpointAuthSchemeParamsConfigured = true; this.allowedEndpointAuthSchemeParams = allowedEndpointAuthSchemeParams; } public List<String> getAllowedEndpointAuthSchemeParams() { return this.allowedEndpointAuthSchemeParams; } public boolean getAllowedEndpointAuthSchemeParamsConfigured() { return allowedEndpointAuthSchemeParamsConfigured; } public Map<String, ClientContextParam> getCustomClientContextParams() { return customClientContextParams; } public void setCustomClientContextParams(Map<String, ClientContextParam> customClientContextParams) { this.customClientContextParams = customClientContextParams; } public MultipartCustomization getMultipartCustomization() { return this.multipartCustomization; } public void setMultipartCustomization(MultipartCustomization multipartCustomization) { this.multipartCustomization = multipartCustomization; } }
3,513
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/ShapeSubstitution.java
/* * 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.model.config.customization; import java.util.List; /** * Use shapeSubstitutions customization to override all appearances of the given * shape with a new shape, and optionally use a specific member of the original * shape as the data source. * * When emitFromMember is supplied, an additional marshalling and unmarshalling * path is added to reflect the wire representation of the member. */ public class ShapeSubstitution { private String emitAsShape; private String emitFromMember; /** * This contains a list of shapes for which the additional marshalling * path will not be added. This customization is specifically added for * EC2 where we replace all occurrences of AttributeValue with Value in * the model classes. However the wire representation is not changed. * * TODO This customization has been added to preserve backwards * compatibility of EC2 APIs. This should be removed as part of next major * version bump. */ private List<String> skipMarshallPathForShapes; public String getEmitAsShape() { return emitAsShape; } public void setEmitAsShape(String emitAsShape) { this.emitAsShape = emitAsShape; } public String getEmitFromMember() { return emitFromMember; } public void setEmitFromMember(String emitFromMember) { this.emitFromMember = emitFromMember; } public List<String> getSkipMarshallPathForShapes() { return skipMarshallPathForShapes; } public void setSkipMarshallPathForShapes(List<String> skipMarshallPathForShapes) { this.skipMarshallPathForShapes = skipMarshallPathForShapes; } }
3,514
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/AuthPolicyActions.java
/* * 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.model.config.customization; /** * Customization configuration for policy actions enums file. */ public class AuthPolicyActions { /** * If true, the enum file generation is skipped. By default the policy * action file is generated. */ private boolean skip; /** * The prefix to be used for an enum value. */ private String actionPrefix; /** * File name prefix for the actions file. */ private String fileNamePrefix; public boolean isSkip() { return skip; } public void setSkip(boolean skip) { this.skip = skip; } public String getActionPrefix() { return actionPrefix; } public void setActionPrefix(String actionPrefix) { this.actionPrefix = actionPrefix; } public String getFileNamePrefix() { return fileNamePrefix; } public void setFileNamePrefix(String fileNamePrefix) { this.fileNamePrefix = fileNamePrefix; } }
3,515
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/AdditionalBuilderMethod.java
/* * 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.model.config.customization; import java.util.Locale; import software.amazon.awssdk.core.ClientType; /** * Config required to generate the additional static methods in Client interface. */ public class AdditionalBuilderMethod { /** * Name of the additional static method. */ private String methodName; /** * Fqcn of the return type */ private String returnType; /** * Fqcn of the class that will delegate the static method call */ private String instanceType; /** * JavaDoc for the method */ private String javaDoc; /** * Method body */ private String statement; /** * The clientType for which the builder needs to be added. */ private ClientType clientType; public String getReturnType() { return returnType; } public void setReturnType(String returnType) { this.returnType = returnType; } public String getJavaDoc() { return javaDoc; } public void setJavaDoc(String javaDoc) { this.javaDoc = javaDoc; } public String getMethodName() { return methodName; } public void setMethodName(String methodName) { this.methodName = methodName; } public String getInstanceType() { return instanceType; } public void setInstanceType(String instanceType) { this.instanceType = instanceType; } public String getClientType() { return clientType != null ? clientType.toString() : null; } public void setClientType(String clientType) { this.clientType = clientType != null ? ClientType.valueOf(clientType.toUpperCase(Locale.US)) : null; } public ClientType getClientTypeEnum() { return clientType; } public void setClientTypeEnum(ClientType clientType) { this.clientType = clientType; } public String getStatement() { return statement; } public void setStatement(String statement) { this.statement = statement; } }
3,516
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/CustomSdkShapes.java
/* * 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.model.config.customization; import java.util.Collections; import java.util.Map; import software.amazon.awssdk.codegen.model.service.Shape; public class CustomSdkShapes { private Map<String, Shape> shapes; public Map<String, Shape> getShapes() { return shapes; } public void setShapes(Map<String, Shape> shapes) { this.shapes = shapes != null ? Collections.unmodifiableMap(shapes) : Collections.emptyMap(); } public Shape getShape(String shapeName) { return shapes.get(shapeName); } }
3,517
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/S3ArnableFieldConfig.java
/* * 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.model.config.customization; import java.util.Map; /** * Indicating a field that can be an ARN */ public class S3ArnableFieldConfig { private String field; private String arnConverterFqcn; private String arnResourceFqcn; /** * The ARN field to be substituted set the value from the getter */ private String arnResourceSubstitutionGetter; private String baseArnResourceFqcn; private String executionAttributeKeyFqcn; private String executionAttributeValueFqcn; /** * Contains the fields that need to be populated if null from the getter methods. * * The key is the field name and the value is the getter method in ARN which supplies the value */ private Map<String, String> otherFieldsToPopulate; public String getField() { return field; } /** * Sets the field * * @param field The new field value. * @return This object for method chaining. */ public S3ArnableFieldConfig setField(String field) { this.field = field; return this; } /** * @return the FQCN of the ArnConverter */ public String getArnConverterFqcn() { return arnConverterFqcn; } /** * Sets the arnConverterFqcn * * @param arnConverterFqcn The new arnConverterFqcn value. * @return This object for method chaining. */ public S3ArnableFieldConfig setArnConverterFqcn(String arnConverterFqcn) { this.arnConverterFqcn = arnConverterFqcn; return this; } public String getArnResourceFqcn() { return arnResourceFqcn; } /** * Sets the arnResourceFqcn * * @param arnResourceFqcn The new arnResourceFqcn value. * @return This object for method chaining. */ public S3ArnableFieldConfig setArnResourceFqcn(String arnResourceFqcn) { this.arnResourceFqcn = arnResourceFqcn; return this; } public String getArnResourceSubstitutionGetter() { return arnResourceSubstitutionGetter; } /** * Sets the arnResourceSubstitutionGetter * * @param arnResourceSubstitutionGetter The new arnResourceSubstitutionGetter value. * @return This object for method chaining. */ public S3ArnableFieldConfig setArnResourceSubstitutionGetter(String arnResourceSubstitutionGetter) { this.arnResourceSubstitutionGetter = arnResourceSubstitutionGetter; return this; } public Map<String, String> getOtherFieldsToPopulate() { return otherFieldsToPopulate; } /** * Sets the substitionSetterToGetter * * @param substitionSetterToGetter The new substitionSetterToGetter value. * @return This object for method chaining. */ public S3ArnableFieldConfig setSubstitionSetterToGetter(Map<String, String> substitionSetterToGetter) { this.otherFieldsToPopulate = substitionSetterToGetter; return this; } public String getBaseArnResourceFqcn() { return baseArnResourceFqcn; } /** * Sets the baseArnResourceFqcn * * @param baseArnResourceFqcn The new baseArnResourceFqcn value. * @return This object for method chaining. */ public S3ArnableFieldConfig setBaseArnResourceFqcn(String baseArnResourceFqcn) { this.baseArnResourceFqcn = baseArnResourceFqcn; return this; } public String getExecutionAttributeKeyFqcn() { return executionAttributeKeyFqcn; } /** * Sets the executionAttributeKeyFqcn * * @param executionAttributeKeyFqcn The new executionAttributeKeyFqcn value. * @return This object for method chaining. */ public S3ArnableFieldConfig setExecutionAttributeKeyFqcn(String executionAttributeKeyFqcn) { this.executionAttributeKeyFqcn = executionAttributeKeyFqcn; return this; } public String getExecutionAttributeValueFqcn() { return executionAttributeValueFqcn; } /** * Sets the executionAttributeValueFqcn * * @param executionAttributeValueFqcn The new executionAttributeValueFqcn value. * @return This object for method chaining. */ public S3ArnableFieldConfig setExecutionAttributeValueFqcn(String executionAttributeValueFqcn) { this.executionAttributeValueFqcn = executionAttributeValueFqcn; return this; } /** * Sets the otherFieldsToPopulate * * @param otherFieldsToPopulate The new otherFieldsToPopulate value. * @return This object for method chaining. */ public S3ArnableFieldConfig setOtherFieldsToPopulate(Map<String, String> otherFieldsToPopulate) { this.otherFieldsToPopulate = otherFieldsToPopulate; return this; } }
3,518
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/OperationModifier.java
/* * 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.model.config.customization; /** * Use operationModifiers customization to exclude a given operation, or add a * wrapper around the result shape. */ public class OperationModifier { private boolean exclude; private boolean useWrappingResult; private String wrappedResultShape; private String wrappedResultMember; /** * @return true if this operation should be excluded when processing the * service model. When this option is set, both input and output * shapes are excluded too. */ public boolean isExclude() { return exclude; } public void setExclude(boolean exclude) { this.exclude = exclude; } /** * @return true if the output shape of this operation is a thin wrapper * around the real logical result (e.g., EC2 Reservation wrapped by * RunInstancesResult), and that we want to directly return the * unwrapped result in the generated client. */ public boolean isUseWrappingResult() { return useWrappingResult; } public void setUseWrappingResult(boolean useWrappingResult) { this.useWrappingResult = useWrappingResult; } /** * @return the shape of the member that represents the wrapped result. * @see #isUseWrappingResult() */ public String getWrappedResultShape() { return wrappedResultShape; } public void setWrappedResultShape(String wrappedResultShape) { this.wrappedResultShape = wrappedResultShape; } /** * @return the name of the member that represents the wrapped result. * @see #isUseWrappingResult() */ public String getWrappedResultMember() { return wrappedResultMember; } public void setWrappedResultMember(String wrappedResultMember) { this.wrappedResultMember = wrappedResultMember; } }
3,519
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/UtilitiesMethod.java
/* * 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.model.config.customization; import java.util.ArrayList; import java.util.List; /** * Config required to generate the utilities method that returns an instance of * hand-written Utilities class */ public class UtilitiesMethod { public static final String METHOD_NAME = "utilities"; /** Fqcn of the return type of the operation */ private String returnType; /** Fqcn of the instance type to be created */ private String instanceType; /** * The utilities method will call a protected create() method in the hand-written Utilities class. * These the ordered list of parameters that needs to be passed to the create method. */ private List<String> createMethodParams = new ArrayList<>(); public String getReturnType() { return returnType; } public void setReturnType(String returnType) { this.returnType = returnType; } public List<String> getCreateMethodParams() { return createMethodParams; } public void setCreateMethodParams(List<String> createMethodParams) { this.createMethodParams = createMethodParams; } public String getInstanceType() { return instanceType; } public void setInstanceType(String instanceType) { this.instanceType = instanceType; } }
3,520
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/UnderscoresInNameBehavior.java
/* * 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.model.config.customization; /** * Valid values for the {@link CustomizationConfig#setUnderscoresInNameBehavior} customization. */ public enum UnderscoresInNameBehavior { /** * Allow the underscores in names, and generating shapes with names that are non-idiomatic to the language. */ ALLOW }
3,521
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules/endpoints/BuiltInParameter.java
/* * 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.model.rules.endpoints; import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Locale; public enum BuiltInParameter { AWS_REGION, AWS_USE_DUAL_STACK, AWS_USE_FIPS, SDK_ENDPOINT, AWS_STS_USE_GLOBAL_ENDPOINT, AWS_S3_FORCE_PATH_STYLE, AWS_S3_ACCELERATE, AWS_S3_USE_GLOBAL_ENDPOINT, AWS_S3_DISABLE_MULTI_REGION_ACCESS_POINTS, AWS_S3_USE_ARN_REGION, AWS_S3_CONTROL_USE_ARN_REGION ; @JsonCreator public static BuiltInParameter fromValue(String s) { switch (s.toLowerCase(Locale.ENGLISH)) { case "aws::region": return AWS_REGION; case "aws::usedualstack": return AWS_USE_DUAL_STACK; case "aws::usefips": return AWS_USE_FIPS; case "sdk::endpoint": return SDK_ENDPOINT; case "aws::sts::useglobalendpoint": return AWS_STS_USE_GLOBAL_ENDPOINT; case "aws::s3::forcepathstyle": return AWS_S3_FORCE_PATH_STYLE; case "aws::s3::accelerate": return AWS_S3_ACCELERATE; case "aws::s3::useglobalendpoint": return AWS_S3_USE_GLOBAL_ENDPOINT; case "aws::s3::disablemultiregionaccesspoints": return AWS_S3_DISABLE_MULTI_REGION_ACCESS_POINTS; case "aws::s3::usearnregion": return AWS_S3_USE_ARN_REGION; case "aws::s3control::usearnregion": return AWS_S3_CONTROL_USE_ARN_REGION; default: throw new RuntimeException("Unrecognized builtin: " + s); } } }
3,522
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules/endpoints/EndpointTestSuiteModel.java
/* * 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.model.rules.endpoints; import java.util.ArrayList; import java.util.List; public class EndpointTestSuiteModel { private List<EndpointTestModel> testCases = new ArrayList<>(); public List<EndpointTestModel> getTestCases() { return testCases; } public void setTestCases(List<EndpointTestModel> testCases) { this.testCases = testCases; } }
3,523
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules/endpoints/ExpectModel.java
/* * 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.model.rules.endpoints; import com.fasterxml.jackson.core.TreeNode; import java.util.List; import java.util.Map; public class ExpectModel { private String error; private Endpoint endpoint; public String getError() { return error; } public void setError(String error) { this.error = error; } public Endpoint getEndpoint() { return endpoint; } public void setEndpoint(Endpoint endpoint) { this.endpoint = endpoint; } public static class Endpoint { private String url; private Map<String, List<String>> headers; private Map<String, TreeNode> properties; public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public Map<String, List<String>> getHeaders() { return headers; } public void setHeaders(Map<String, List<String>> headers) { this.headers = headers; } public Map<String, TreeNode> getProperties() { return properties; } public void setProperties(Map<String, TreeNode> properties) { this.properties = properties; } } }
3,524
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules/endpoints/EndpointModel.java
/* * 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.model.rules.endpoints; import com.fasterxml.jackson.core.TreeNode; import java.util.List; import java.util.Map; public class EndpointModel { private TreeNode url; private Map<String, List<TreeNode>> headers; private Map<String, TreeNode> properties; public TreeNode getUrl() { return url; } public void setUrl(TreeNode url) { this.url = url; } public Map<String, List<TreeNode>> getHeaders() { return headers; } public void setHeaders(Map<String, List<TreeNode>> headers) { this.headers = headers; } public Map<String, TreeNode> getProperties() { return properties; } public void setProperties(Map<String, TreeNode> properties) { this.properties = properties; } }
3,525
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules/endpoints/ConditionModel.java
/* * 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.model.rules.endpoints; import com.fasterxml.jackson.core.TreeNode; import java.util.List; public class ConditionModel { private String fn; private List<TreeNode> argv; private String assign; public String getFn() { return fn; } public void setFn(String fn) { this.fn = fn; } public String getAssign() { return assign; } public void setAssign(String assign) { this.assign = assign; } public List<TreeNode> getArgv() { return argv; } public void setArgv(List<TreeNode> argv) { this.argv = argv; } }
3,526
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules/endpoints/OperationInput.java
/* * 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.model.rules.endpoints; import com.fasterxml.jackson.core.TreeNode; import java.util.Map; public class OperationInput { private String operationName; private Map<String, TreeNode> operationParams; public String getOperationName() { return operationName; } public void setOperationName(String operationName) { this.operationName = operationName; } public Map<String, TreeNode> getOperationParams() { return operationParams; } public void setOperationParams(Map<String, TreeNode> operationParams) { this.operationParams = operationParams; } }
3,527
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules/endpoints/ParameterDeprecatedModel.java
/* * 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.model.rules.endpoints; public class ParameterDeprecatedModel { private String message; private String since; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getSince() { return since; } public void setSince(String since) { this.since = since; } }
3,528
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules/endpoints/EndpointTestModel.java
/* * 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.model.rules.endpoints; import com.fasterxml.jackson.core.TreeNode; import java.util.List; import java.util.Map; public class EndpointTestModel { private String documentation; private Map<String, TreeNode> params; private List<OperationInput> operationInputs; private ExpectModel expect; public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = documentation; } public Map<String, TreeNode> getParams() { return params; } public void setParams(Map<String, TreeNode> params) { this.params = params; } public List<OperationInput> getOperationInputs() { return operationInputs; } public void setOperationInputs(List<OperationInput> operationInputs) { this.operationInputs = operationInputs; } public ExpectModel getExpect() { return expect; } public void setExpect(ExpectModel expect) { this.expect = expect; } }
3,529
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules/endpoints/RuleModel.java
/* * 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.model.rules.endpoints; import java.util.List; public class RuleModel { private String type; private List<ConditionModel> conditions; // for type == error private String error; // for type == tree private List<RuleModel> rules; // for type == endpoint private EndpointModel endpoint; public String getType() { return type; } public void setType(String type) { this.type = type; } public List<ConditionModel> getConditions() { return conditions; } public void setConditions(List<ConditionModel> conditions) { this.conditions = conditions; } public String getError() { return error; } public void setError(String error) { this.error = error; } public List<RuleModel> getRules() { return rules; } public void setRules(List<RuleModel> rules) { this.rules = rules; } public EndpointModel getEndpoint() { return endpoint; } public void setEndpoint(EndpointModel endpoint) { this.endpoint = endpoint; } }
3,530
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/rules/endpoints/ParameterModel.java
/* * 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.model.rules.endpoints; import com.fasterxml.jackson.core.TreeNode; public class ParameterModel { private String type; private String builtIn; private TreeNode defaultValue; private Boolean required; private ParameterDeprecatedModel deprecated; private String documentation; public String getType() { return type; } public void setType(String type) { this.type = type; } public BuiltInParameter getBuiltInEnum() { if (builtIn == null) { return null; } return BuiltInParameter.fromValue(builtIn); } public String getBuiltIn() { return builtIn; } public void setBuiltIn(String builtIn) { this.builtIn = builtIn; } public TreeNode getDefault() { return defaultValue; } public void setDefault(TreeNode defaultValue) { this.defaultValue = defaultValue; } public Boolean isRequired() { return required; } public void setRequired(Boolean required) { this.required = required; } public ParameterDeprecatedModel getDeprecated() { return deprecated; } public void setDeprecated(ParameterDeprecatedModel deprecated) { this.deprecated = deprecated; } public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = documentation; } }
3,531
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/ServiceMetadata.java
/* * 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.model.service; import java.util.List; import java.util.Map; public class ServiceMetadata { private String apiVersion; private String endpointPrefix; private String signingName; private String serviceAbbreviation; private String serviceFullName; private String serviceId; private String xmlNamespace; private String protocol; private String jsonVersion; private Map<String, String> awsQueryCompatible; private boolean resultWrapped; private String signatureVersion; private String targetPrefix; private String uid; private List<String> auth; private Map<String, String> protocolSettings; public String getApiVersion() { return apiVersion; } public void setApiVersion(String apiVersion) { this.apiVersion = apiVersion; } public String getEndpointPrefix() { return endpointPrefix; } public void setEndpointPrefix(String endpointPrefix) { this.endpointPrefix = endpointPrefix; } public String getSigningName() { if (signingName == null) { setSigningName(endpointPrefix); } return signingName; } public void setSigningName(String signingName) { this.signingName = signingName; } public String getServiceAbbreviation() { return serviceAbbreviation; } public void setServiceAbbreviation(String serviceAbbreviation) { this.serviceAbbreviation = serviceAbbreviation; } public String getServiceFullName() { return serviceFullName; } public void setServiceFullName(String serviceFullName) { this.serviceFullName = serviceFullName; } public String getXmlNamespace() { return xmlNamespace; } public void setXmlNamespace(String xmlNamespace) { this.xmlNamespace = xmlNamespace; } public String getProtocol() { return protocol; } public void setProtocol(String protocol) { this.protocol = protocol; } public String getJsonVersion() { return jsonVersion; } public void setJsonVersion(String jsonVersion) { this.jsonVersion = jsonVersion; } public Map<String, String> getAwsQueryCompatible() { return awsQueryCompatible; } public void setAwsQueryCompatible(Map<String, String> awsQueryCompatible) { this.awsQueryCompatible = awsQueryCompatible; } public boolean isResultWrapped() { return resultWrapped; } public void setResultWrapped(boolean resultWrapped) { this.resultWrapped = resultWrapped; } public String getSignatureVersion() { return signatureVersion; } public void setSignatureVersion(String signatureVersion) { this.signatureVersion = signatureVersion; } public String getTargetPrefix() { return targetPrefix; } public void setTargetPrefix(String targetPrefix) { this.targetPrefix = targetPrefix; } public String getUid() { return uid; } public void setUid(String uid) { this.uid = uid; } public List<String> getAuth() { return auth; } public void setAuth(List<String> auth) { this.auth = auth; } public Map<String, String> getProtocolSettings() { return protocolSettings; } public void setProtocolSettings(Map<String, String> protocolSettings) { this.protocolSettings = protocolSettings; } public String getServiceId() { return serviceId; } public void setServiceId(String serviceId) { this.serviceId = serviceId; } }
3,532
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/ContextParam.java
/* * 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.model.service; public class ContextParam { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } }
3,533
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/MapValueType.java
/* * 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.model.service; public class MapValueType { private String shape; private String locationName; public String getShape() { return shape; } public void setShape(String shape) { this.shape = shape; } public String getLocationName() { return locationName; } public void setLocationName(String locationName) { this.locationName = locationName; } }
3,534
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/EndpointRuleSetModel.java
/* * 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.model.service; import java.io.IOException; import java.io.InputStream; import java.io.UncheckedIOException; import java.util.List; import java.util.Map; import software.amazon.awssdk.codegen.internal.Jackson; import software.amazon.awssdk.codegen.model.rules.endpoints.ParameterModel; import software.amazon.awssdk.codegen.model.rules.endpoints.RuleModel; import software.amazon.awssdk.utils.IoUtils; public class EndpointRuleSetModel { private String serviceId; private String version; private Map<String, ParameterModel> parameters; private List<RuleModel> rules; public static EndpointRuleSetModel defaultRules(String endpointPrefix) { try (InputStream defaultRulesSet = EndpointRuleSetModel.class .getResourceAsStream("/software/amazon/awssdk/codegen/default-endpoint-rule-set.json")) { String rules = IoUtils.toUtf8String(defaultRulesSet); rules = String.format(rules, endpointPrefix); return Jackson.load(EndpointRuleSetModel.class, rules); } catch (IOException e) { throw new UncheckedIOException(e); } } public String getServiceId() { return serviceId; } public void setServiceId(String serviceId) { this.serviceId = serviceId; } public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } public Map<String, ParameterModel> getParameters() { return parameters; } public void setParameters(Map<String, ParameterModel> parameters) { this.parameters = parameters; } public List<RuleModel> getRules() { return rules; } public void setRules(List<RuleModel> rules) { this.rules = rules; } }
3,535
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/EndpointTrait.java
/* * 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.model.service; /** * This trait can be used to resolve the endpoint of an API using the original endpoint * derived from client or set by customer. * * This trait allows using modeled members in the input shape to modify the endpoint. This is for SDK internal use. * * See `API Operation Endpoint Trait` SEP */ public final class EndpointTrait { /** * Expression that must be expanded by the client before invoking the API call. * The expanded expression is added as a prefix to the original endpoint host derived on the client. */ private String hostPrefix; public String getHostPrefix() { return hostPrefix; } public void setHostPrefix(String hostPrefix) { this.hostPrefix = hostPrefix; } }
3,536
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/MapKeyType.java
/* * 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.model.service; public class MapKeyType { private String shape; private String locationName; public String getShape() { return shape; } public void setShape(String shape) { this.shape = shape; } public String getLocationName() { return locationName; } public void setLocationName(String locationName) { this.locationName = locationName; } }
3,537
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/Waiters.java
/* * 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.model.service; import java.util.Collections; import java.util.HashMap; import java.util.Map; public class Waiters { private static final Waiters NONE = new Waiters(Collections.emptyMap()); private Map<String, WaiterDefinition> waiters; // Needed for JSON deserialization private Waiters() { this(new HashMap<>()); } private Waiters(Map<String, WaiterDefinition> waiters) { this.waiters = waiters; } public static Waiters none() { return NONE; } public Map<String, WaiterDefinition> getWaiters() { return waiters; } public void setWaiters(Map<String, WaiterDefinition> waiters) { this.waiters = waiters; } public WaiterDefinition getWaiterDefinition(String waiterName) { return waiters.get(waiterName); } }
3,538
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/Operation.java
/* * 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.model.service; import java.util.List; import java.util.Map; import software.amazon.awssdk.codegen.checksum.HttpChecksum; import software.amazon.awssdk.codegen.compression.RequestCompression; import software.amazon.awssdk.codegen.model.intermediate.EndpointDiscovery; public class Operation { private String name; private boolean deprecated; private String deprecatedMessage; private Http http; private Input input; private Output output; private String documentation; private String authorizer; private List<ErrorMap> errors; private EndpointDiscovery endpointdiscovery; private boolean endpointoperation; private EndpointTrait endpoint; private AuthType authtype; private List<String> auth; private boolean httpChecksumRequired; private HttpChecksum httpChecksum; private RequestCompression requestCompression; private Map<String, StaticContextParam> staticContextParams; public String getName() { return name; } public void setName(String name) { this.name = name; } public Operation withName(String name) { this.name = name; return this; } public boolean isDeprecated() { return deprecated; } public void setDeprecated(boolean deprecated) { this.deprecated = deprecated; } public String getDeprecatedMessage() { return deprecatedMessage; } public void setDeprecatedMessage(String deprecatedMessage) { this.deprecatedMessage = deprecatedMessage; } public Http getHttp() { return http; } public void setHttp(Http http) { this.http = http; } public Operation withHttp(Http http) { this.http = http; return this; } public Input getInput() { return input; } public void setInput(Input input) { this.input = input; } public Operation withInput(Input input) { this.input = input; return this; } public Output getOutput() { return output; } public void setOutput(Output output) { this.output = output; } public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = documentation; } public List<ErrorMap> getErrors() { return errors; } public void setErrors(List<ErrorMap> errors) { this.errors = errors; } public AuthType getAuthtype() { return authtype; } public void setAuthtype(String authtype) { this.authtype = AuthType.fromValue(authtype); } public List<String> getAuth() { return auth; } public void setAuth(List<String> auth) { this.auth = auth; } public String getAuthorizer() { return authorizer; } public void setAuthorizer(String authorizer) { this.authorizer = authorizer; } public EndpointDiscovery getEndpointdiscovery() { return endpointdiscovery; } public void setEndpointdiscovery(EndpointDiscovery endpointdiscovery) { this.endpointdiscovery = endpointdiscovery; } public boolean isEndpointoperation() { return endpointoperation; } public void setEndpointoperation(boolean endpointoperation) { this.endpointoperation = endpointoperation; } public EndpointTrait getEndpoint() { return endpoint; } public void setEndpoint(EndpointTrait endpoint) { this.endpoint = endpoint; } public boolean isHttpChecksumRequired() { return httpChecksumRequired; } public void setHttpChecksumRequired(boolean httpChecksumRequired) { this.httpChecksumRequired = httpChecksumRequired; } public HttpChecksum getHttpChecksum() { return httpChecksum; } public void setHttpChecksum(HttpChecksum httpChecksum) { this.httpChecksum = httpChecksum; } public RequestCompression getRequestCompression() { return requestCompression; } public void setRequestCompression(RequestCompression requestCompression) { this.requestCompression = requestCompression; } public Map<String, StaticContextParam> getStaticContextParams() { return staticContextParams; } public void setStaticContextParams(Map<String, StaticContextParam> staticContextParams) { this.staticContextParams = staticContextParams; } }
3,539
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/ErrorTrait.java
/* * 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.model.service; /** * Expresses content of the error trait */ public class ErrorTrait { private String code; private Integer httpStatusCode; public String getCode() { return code; } public void setCode(String code) { this.code = code; } public Integer getHttpStatusCode() { return httpStatusCode; } public void setHttpStatusCode(Integer httpStatusCode) { this.httpStatusCode = httpStatusCode; } }
3,540
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/WaiterDefinition.java
/* * 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.model.service; import java.util.List; public class WaiterDefinition { private int delay; private int maxAttempts; private String operation; private List<Acceptor> acceptors; public WaiterDefinition() { } public int getDelay() { return delay; } public void setDelay(int delay) { this.delay = delay; } public int getMaxAttempts() { return maxAttempts; } public void setMaxAttempts(int maxAttempts) { this.maxAttempts = maxAttempts; } public String getOperation() { return operation; } public void setOperation(String operation) { this.operation = operation; } public List<Acceptor> getAcceptors() { return acceptors; } public void setAcceptors(List<Acceptor> acceptors) { this.acceptors = acceptors; } }
3,541
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/StaticContextParam.java
/* * 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.model.service; import com.fasterxml.jackson.core.TreeNode; public class StaticContextParam { private TreeNode value; public TreeNode getValue() { return value; } public void setValue(TreeNode value) { this.value = value; } }
3,542
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/Authorizer.java
/* * 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.model.service; public class Authorizer { private String name; private Placement placement; public String getName() { return name; } public void setName(String name) { this.name = name; } public void setPlacement(Placement placement) { this.placement = placement; } public Location getTokenLocation() { return placement != null ? placement.getLocation() : null; } public String getTokenName() { return placement != null ? placement.getName() : null; } public static class Placement { private Location location; private String name; public Location getLocation() { return location; } public void setLocation(Location location) { this.location = location; } public String getName() { return name; } public void setName(String name) { this.name = name; } } }
3,543
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/ErrorMap.java
/* * 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.model.service; public class ErrorMap { private String shape; private String documentation; private boolean exception; private boolean fault; private ErrorTrait error; public String getShape() { return shape; } public void setShape(String shape) { this.shape = shape; } public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = documentation; } public boolean isException() { return exception; } public void setException(boolean exception) { this.exception = exception; } public boolean isFault() { return fault; } public void setFault(boolean fault) { this.fault = fault; } public ErrorTrait getError() { return error; } public void setError(ErrorTrait error) { this.error = error; } }
3,544
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/ClientContextParam.java
/* * 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.model.service; public class ClientContextParam { private String documentation; private String type; public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = documentation; } public String getType() { return type; } public void setType(String type) { this.type = type; } }
3,545
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/ShapeType.java
/* * 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.model.service; public enum ShapeType { Structure("structure"), List("list"), Map("map"); private String name; ShapeType(String name) { this.name = name; } public String getName() { return name; } }
3,546
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/Http.java
/* * 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.model.service; public class Http { private String method; private String requestUri; private String responseCode; public String getMethod() { return method; } public void setMethod(String method) { this.method = method; } public Http withMethod(String method) { this.method = method; return this; } public String getRequestUri() { return requestUri; } public void setRequestUri(String requestUri) { this.requestUri = requestUri; } public Http withRequestUri(String requestUri) { this.requestUri = requestUri; return this; } public String getResponseCode() { return responseCode; } public void setResponseCode(String responseCode) { this.responseCode = responseCode; } }
3,547
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/Output.java
/* * 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.model.service; public class Output { private String shape; private String documentation; private String locationName; private String resultWrapper; public String getShape() { return shape; } public void setShape(String shape) { this.shape = shape; } public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = documentation; } public String getLocationName() { return locationName; } public void setLocationName(String locationName) { this.locationName = locationName; } public String getResultWrapper() { return resultWrapper; } public void setResultWrapper(String resultWrapper) { this.resultWrapper = resultWrapper; } }
3,548
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/ServiceModel.java
/* * 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.model.service; import java.util.Collections; import java.util.Map; public class ServiceModel { private ServiceMetadata metadata; private Map<String, Operation> operations; private Map<String, Shape> shapes; private Map<String, Authorizer> authorizers; private Map<String, ClientContextParam> clientContextParams; private String documentation; public ServiceModel() { } public ServiceModel(ServiceMetadata metadata, Map<String, Operation> operations, Map<String, Shape> shapes, Map<String, Authorizer> authorizers) { this.metadata = metadata; this.operations = operations; this.shapes = shapes; this.authorizers = authorizers; } public ServiceMetadata getMetadata() { return metadata; } public void setMetadata(ServiceMetadata metadata) { this.metadata = metadata; } public Map<String, Operation> getOperations() { return operations; } public void setOperations(Map<String, Operation> operations) { this.operations = operations != null ? operations : Collections.emptyMap(); } /** * Convenience getter to retrieve an {@link Operation} by name. * * @param operationName Name of operation to retrieve. * @return Operation or null if not found. */ public Operation getOperation(String operationName) { return operations.get(operationName); } public Map<String, Shape> getShapes() { return shapes; } public void setShapes(Map<String, Shape> shapes) { this.shapes = shapes != null ? shapes : Collections.emptyMap(); } /** * Convenience getter to retrieve a {@link Shape} by name. * * @param shapeName Name of shape to retrieve. * @return Shape or null if not found. */ public Shape getShape(String shapeName) { return shapes.get(shapeName); } public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = documentation; } public Map<String, Authorizer> getAuthorizers() { return authorizers != null ? authorizers : Collections.emptyMap(); } public void setAuthorizers(Map<String, Authorizer> authorizers) { this.authorizers = authorizers; } public Map<String, ClientContextParam> getClientContextParams() { return clientContextParams; } public void setClientContextParams(Map<String, ClientContextParam> clientContextParams) { this.clientContextParams = clientContextParams; } }
3,549
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/Input.java
/* * 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.model.service; public class Input { private String shape; private String documentation; private String locationName; private XmlNamespace xmlNamespace; public String getShape() { return shape; } public void setShape(String shape) { this.shape = shape; } public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = documentation; } public String getLocationName() { return locationName; } public void setLocationName(String locationName) { this.locationName = locationName; } public XmlNamespace getXmlNamespace() { return xmlNamespace; } public void setXmlNamespace(XmlNamespace xmlNamespace) { this.xmlNamespace = xmlNamespace; } }
3,550
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/Member.java
/* * 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.model.service; public class Member { private String shape; private String location; private String locationName; private boolean payload; private boolean streaming; private boolean requiresLength; private String documentation; private String queryName; private boolean flattened; private XmlNamespace xmlNamespace; private boolean idempotencyToken; private boolean deprecated; private String deprecatedMessage; private boolean jsonvalue; private String timestampFormat; private boolean eventpayload; private boolean eventheader; private boolean endpointdiscoveryid; private boolean sensitive; private boolean xmlAttribute; private String deprecatedName; private ContextParam contextParam; public String getShape() { return shape; } public void setShape(String shape) { this.shape = shape; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public String getLocationName() { return locationName; } public void setLocationName(String locationName) { this.locationName = locationName; } public boolean isPayload() { return payload; } public void setPayload(boolean payload) { this.payload = payload; } public boolean isStreaming() { return streaming; } public void setStreaming(boolean streaming) { this.streaming = streaming; } public boolean isRequiresLength() { return requiresLength; } public void setRequiresLength(boolean requiresLength) { this.requiresLength = requiresLength; } public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = documentation; } public String getQueryName() { return queryName; } public void setQueryName(String queryName) { this.queryName = queryName; } public boolean isFlattened() { return flattened; } public void setFlattened(boolean flattened) { this.flattened = flattened; } public XmlNamespace getXmlNamespace() { return xmlNamespace; } public void setXmlNamespace(XmlNamespace xmlNamespace) { this.xmlNamespace = xmlNamespace; } public boolean isIdempotencyToken() { return idempotencyToken; } public void setIdempotencyToken(boolean idempotencyToken) { this.idempotencyToken = idempotencyToken; } public boolean isDeprecated() { return deprecated; } public void setDeprecated(boolean deprecated) { this.deprecated = deprecated; } public String getDeprecatedMessage() { return deprecatedMessage; } public void setDeprecatedMessage(String deprecatedMessage) { this.deprecatedMessage = deprecatedMessage; } public boolean getJsonvalue() { return jsonvalue; } public void setJsonvalue(boolean jsonvalue) { this.jsonvalue = jsonvalue; } public String getTimestampFormat() { return timestampFormat; } public void setTimestampFormat(String timestampFormat) { this.timestampFormat = timestampFormat; } public boolean isEventpayload() { return eventpayload; } public void setEventpayload(boolean eventpayload) { this.eventpayload = eventpayload; } public boolean isEventheader() { return eventheader; } public void setEventheader(boolean eventheader) { this.eventheader = eventheader; } public boolean isEndpointdiscoveryid() { return endpointdiscoveryid; } public void setEndpointdiscoveryid(boolean endpointdiscoveryid) { this.endpointdiscoveryid = endpointdiscoveryid; } public boolean isSensitive() { return sensitive; } public void setSensitive(boolean sensitive) { this.sensitive = sensitive; } public boolean isXmlAttribute() { return xmlAttribute; } public void setXmlAttribute(boolean xmlAttribute) { this.xmlAttribute = xmlAttribute; } public void setDeprecatedName(String deprecatedName) { this.deprecatedName = deprecatedName; } public String getDeprecatedName() { return deprecatedName; } public ContextParam getContextParam() { return contextParam; } public void setContextParam(ContextParam contextParam) { this.contextParam = contextParam; } }
3,551
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/Location.java
/* * 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.model.service; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; public enum Location { URI("uri"), HEADER("header"), HEADERS("headers"), STATUS_CODE("statusCode"), QUERY_STRING("querystring"); private final String location; Location(String location) { this.location = location; } @JsonCreator public static Location forValue(String location) { if (location == null) { return null; } for (Location locationEnum : Location.values()) { if (locationEnum.location.equals(location)) { return locationEnum; } } throw new IllegalArgumentException( "Unknown enum value for ParameterHttpMapping.location: " + location); } @JsonValue @Override public String toString() { return this.location; } }
3,552
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/AuthType.java
/* * 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.model.service; import java.util.Arrays; import software.amazon.awssdk.utils.StringUtils; public enum AuthType { NONE("none"), CUSTOM("custom"), IAM("iam"), V4("v4"), V4_UNSIGNED_BODY("v4-unsigned-body"), S3("s3"), S3V4("s3v4"), BEARER("bearer") ; private final String value; AuthType(String value) { this.value = value; } public static AuthType fromValue(String value) { String normalizedValue = StringUtils.lowerCase(value); return Arrays.stream(values()) .filter(authType -> authType.value.equals(normalizedValue)) .findFirst() .orElseThrow(() -> new IllegalArgumentException(String.format("Unknown AuthType '%s'", normalizedValue))); } }
3,553
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/Acceptor.java
/* * 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.model.service; import com.fasterxml.jackson.jr.stree.JrsValue; public class Acceptor { private String matcher; private String argument; private String state; private JrsValue expected; public Acceptor() { } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getMatcher() { return matcher; } public void setMatcher(String matcher) { this.matcher = matcher; } public String getArgument() { return argument; } public void setArgument(String argument) { this.argument = argument; } public JrsValue getExpected() { return expected; } public void setExpected(JrsValue expected) { this.expected = expected; } }
3,554
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/Paginators.java
/* * 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.model.service; import java.util.Collections; import java.util.HashMap; import java.util.Map; /** * POJO class to represent the paginators.json file. */ public class Paginators { private static final Paginators NONE = new Paginators(Collections.emptyMap()); private Map<String, PaginatorDefinition> pagination; private Paginators() { this(new HashMap<>()); } private Paginators(Map<String, PaginatorDefinition> pagination) { this.pagination = pagination; } public static Paginators none() { return NONE; } /** * Returns a map of operation name to its {@link PaginatorDefinition}. */ public Map<String, PaginatorDefinition> getPagination() { return pagination; } public void setPagination(Map<String, PaginatorDefinition> pagination) { this.pagination = pagination; } public PaginatorDefinition getPaginatorDefinition(String operationName) { return pagination.get(operationName); } }
3,555
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/XmlNamespace.java
/* * 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.model.service; public class XmlNamespace { private String prefix; private String uri; public String getPrefix() { return prefix; } public void setPrefix(String prefix) { this.prefix = prefix; } public String getUri() { return uri; } public void setUri(String uri) { this.uri = uri; } }
3,556
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/PaginatorDefinition.java
/* * 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.model.service; import static java.util.Collections.singletonList; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.jr.stree.JrsArray; import com.fasterxml.jackson.jr.stree.JrsValue; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.regex.Pattern; import software.amazon.awssdk.utils.CollectionUtils; import software.amazon.awssdk.utils.Validate; /** * Represents the structure for each operation in paginators-1.json file * * This class is used to generate auto-paginated APIs. */ public class PaginatorDefinition { private static final String VALID_REGEX = "[a-zA-Z.]+"; /** * The members in the request which needs to be set to get the next page. */ private List<String> inputToken; /** * The members in the response which are used to get the next page. */ private List<String> outputToken; /** * The paginated list of members in the response */ private List<String> resultKey; /** * The name of the member in the response that indicates if the response is truncated. * If the value of member is true, there are more results that can be retrieved. * If the value of member is false, then there are no additional results. * * This is an optional field. If this value is missing, use the outputToken instead to check * if more results are available or not. */ private String moreResults; /** * The member in the request that is used to limit the number of results per page. */ private String limitKey; public PaginatorDefinition() { } public List<String> getInputToken() { return inputToken; } public void setInputToken(List<String> inputToken) { this.inputToken = inputToken; } public List<String> getOutputToken() { return outputToken; } public void setOutputToken(List<String> outputToken) { this.outputToken = outputToken; } public List<String> getResultKey() { return resultKey; } public void setResultKey(List<String> resultKey) { this.resultKey = resultKey; } public String getMoreResults() { return moreResults; } public void setMoreResults(String moreResults) { this.moreResults = moreResults; } public String getLimitKey() { return limitKey; } public void setLimitKey(String limitKey) { this.limitKey = limitKey; } /** * Returns a boolean value indicating if the information present in this object * is sufficient to generate the paginated APIs. * * @return True if all necessary information to generate paginator APIs is present. Otherwise false. */ public boolean isValid() { Pattern p = Pattern.compile(VALID_REGEX); return !CollectionUtils.isNullOrEmpty(inputToken) && !CollectionUtils.isNullOrEmpty(outputToken) && outputToken.stream().allMatch(t -> p.matcher(t).matches()); } private List<String> asList(JrsValue node) { if (node.isArray()) { List<String> output = new ArrayList<>(); Iterator<JrsValue> elements = ((JrsArray) node).elements(); elements.forEachRemaining(v -> output.add(asString(v))); return output; } else { return singletonList(asString(node)); } } private String asString(JrsValue value) { Validate.isTrue(value.asToken() == JsonToken.VALUE_STRING, "Expected a string node: " + value); return value.asText(); } // CHECKSTYLE:OFF - These are all gross versions of the setter methods that match the C2J name. /** * Gross version of {@link #setLimitKey} that matches the JSON attribute name. */ public void setLimit_key(String limitKey) { this.limitKey = limitKey; } /** * Gross version of {@link #setInputToken} that matches the JSON attribute name. */ public void setInput_token(JrsValue inputToken) { this.inputToken = asList(inputToken); } /** * Gross version of {@link #setOutputToken} that matches the JSON attribute name. */ public void setOutput_token(JrsValue outputToken) { this.outputToken = asList(outputToken); } /** * Gross version of {@link #setResultKey} that matches the JSON attribute name. */ public void setResult_key(JrsValue resultKey) { this.resultKey = asList(resultKey); } /** * Gross version of {@link #setMoreResults} that matches the JSON attribute name. */ public void setMore_results(String moreResults) { this.moreResults = moreResults; } // CHECKSTYLE:ON }
3,557
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/HostPrefixProcessor.java
/* * 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.model.service; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import software.amazon.awssdk.utils.StringUtils; /** * Class to process the hostPrefix value in the {@link EndpointTrait} class. * This is used during client generation. */ public final class HostPrefixProcessor { /** * Pattern to retrieve the content between the curly braces */ private static final String CURLY_BRACES_PATTERN = "\\{([^}]+)}"; private static final Pattern PATTERN = Pattern.compile(CURLY_BRACES_PATTERN); /** * This is the same as the {@link EndpointTrait#hostPrefix} expression with labels replaced by "%s" * * For example, if expression in host trait is "{Bucket}-{AccountId}-", then * hostWithStringSpecifier will be "%s-%s-" */ private String hostWithStringSpecifier; /** * The list of member c2j names in input shape that are referenced in the host expression. * * For example, if expression in host trait is "{Bucket}-{AccountId}-", then the * list would contain [Bucket, AccountId]. */ private List<String> c2jNames; public HostPrefixProcessor(String hostExpression) { this.hostWithStringSpecifier = hostExpression; this.c2jNames = new ArrayList<>(); replaceHostLabelsWithStringSpecifier(hostExpression); } /** * Replace all the labels in host with %s symbols and collect the input shape member names into a list */ private void replaceHostLabelsWithStringSpecifier(String hostExpression) { if (StringUtils.isEmpty(hostExpression)) { throw new IllegalArgumentException("Given host prefix is either null or empty"); } Matcher matcher = PATTERN.matcher(hostExpression); while (matcher.find()) { String matched = matcher.group(1); c2jNames.add(matched); hostWithStringSpecifier = hostWithStringSpecifier.replaceFirst("\\{" + matched + "}", "%s"); } } public String hostWithStringSpecifier() { return hostWithStringSpecifier; } public List<String> c2jNames() { return c2jNames; } }
3,558
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/Shape.java
/* * 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.model.service; import java.util.Collections; import java.util.List; import java.util.Map; public class Shape { private String type; private Map<String, Member> members = Collections.emptyMap(); private String documentation; private List<String> required; private List<String> enumValues; private String payload; private boolean flattened; private boolean synthetic; private boolean exception; private boolean streaming; private boolean requiresLength; private boolean wrapper; private Member listMember; private Member mapKeyType; private Member mapValueType; private ErrorTrait error; private long min; private long max; private String pattern; private boolean fault; private boolean deprecated; private String deprecatedMessage; private boolean eventstream; private boolean event; private String timestampFormat; private boolean sensitive; private XmlNamespace xmlNamespace; private boolean document; private boolean union; public boolean isFault() { return fault; } public void setFault(boolean fault) { this.fault = fault; } public String getPattern() { return pattern; } public void setPattern(String pattern) { this.pattern = pattern; } public String getType() { return type; } public void setType(String type) { this.type = type; } public Map<String, Member> getMembers() { return members; } public void setMembers(Map<String, Member> members) { this.members = members; } public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = documentation; } public List<String> getRequired() { return required; } public void setRequired(List<String> required) { this.required = required; } public List<String> getEnumValues() { return enumValues; } public void setEnumValues(List<String> enumValues) { this.enumValues = enumValues; } /** * The actual JSON value of "enumValues". */ public void setEnum(List<String> enumValues) { this.enumValues = enumValues; } public String getPayload() { return payload; } public void setPayload(String payload) { this.payload = payload; } public boolean isFlattened() { return flattened; } public void setFlattened(boolean flattened) { this.flattened = flattened; } /** * Returns flag that indicates whether this shape is a custom SDK shape. If true, this shape will be excluded from the static * SdkFields, preventing it from being marshalled. */ public boolean isSynthetic() { return synthetic; } /** * Sets flag that indicates whether this shape is a custom SDK shape. If true, this shape will be excluded from the static * SdkFields, preventing it from being marshalled. */ public void setSynthetic(boolean synthetic) { this.synthetic = synthetic; } public boolean isException() { return exception; } public void setException(boolean exception) { this.exception = exception; } public Member getMapKeyType() { return mapKeyType; } public void setMapKeyType(Member mapKeyType) { this.mapKeyType = mapKeyType; } /** * The actual JSON name of "mapKeyType". */ public void setKey(Member key) { this.mapKeyType = key; } public Member getMapValueType() { return mapValueType; } public void setMapValueType(Member mapValueType) { this.mapValueType = mapValueType; } /** * The actual JSON name of "mapValueType". */ public void setValue(Member value) { this.mapValueType = value; } public Member getListMember() { return listMember; } public void setListMember(Member listMember) { this.listMember = listMember; } /** * The actual JSON name of "listMember". */ public void setMember(Member listMember) { this.listMember = listMember; } public long getMin() { return min; } public void setMin(long min) { this.min = min; } public long getMax() { return max; } public void setMax(long max) { this.max = max; } public boolean isStreaming() { return streaming; } public void setStreaming(boolean streaming) { this.streaming = streaming; } public boolean isRequiresLength() { return requiresLength; } public void setRequiresLength(boolean requiresLength) { this.requiresLength = requiresLength; } public boolean isWrapper() { return wrapper; } public void setWrapper(boolean wrapper) { this.wrapper = wrapper; } public ErrorTrait getError() { return error; } public void setError(ErrorTrait error) { this.error = error; } public boolean isDeprecated() { return deprecated; } public void setDeprecated(boolean deprecated) { this.deprecated = deprecated; } public String getDeprecatedMessage() { return deprecatedMessage; } public void setDeprecatedMessage(String deprecatedMessage) { this.deprecatedMessage = deprecatedMessage; } public boolean isEventstream() { return eventstream; } public void setEventstream(boolean eventstream) { this.eventstream = eventstream; } public boolean isEvent() { return event; } public void setEvent(boolean event) { this.event = event; } public String getTimestampFormat() { return timestampFormat; } public void setTimestampFormat(String timestampFormat) { this.timestampFormat = timestampFormat; } public boolean isSensitive() { return sensitive; } public void setSensitive(boolean sensitive) { this.sensitive = sensitive; } public XmlNamespace getXmlNamespace() { return xmlNamespace; } public void setXmlNamespace(XmlNamespace xmlNamespace) { this.xmlNamespace = xmlNamespace; } public boolean isDocument() { return document; } public void setDocument(boolean document) { this.document = document; } public boolean isUnion() { return union; } public void setUnion(boolean union) { this.union = union; } }
3,559
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/service/ParameterModel.java
/* * 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.model.service; public class ParameterModel { private String type; /** * The type of this parameter. Currently, only "boolean" and "string" are * permitted for parameters. */ public String getType() { return type; } public void setType(String type) { this.type = type; } }
3,560
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/SimpleMethodFormModel.java
/* * 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.model.intermediate; import java.util.Iterator; import java.util.List; import software.amazon.awssdk.codegen.internal.Utils; public class SimpleMethodFormModel { private List<ArgumentModel> arguments; public List<ArgumentModel> getArguments() { return arguments; } public void setArguments(List<ArgumentModel> arguments) { this.arguments = arguments; } public String getArgumentsDeclaration() { StringBuilder builder = new StringBuilder(); Iterator<ArgumentModel> iter = arguments.iterator(); while (iter.hasNext()) { ArgumentModel arg = iter.next(); builder.append(arg.getType()) .append(" ") .append(arg.getName()); if (iter.hasNext()) { builder.append(", "); } } return builder.toString(); } public String getWithMethodCalls() { StringBuilder builder = new StringBuilder(); for (ArgumentModel arg : arguments) { builder.append(".with") .append(Utils.capitalize(arg.getName())) .append("(") .append(arg.getName()) .append(")"); } return builder.toString(); } }
3,561
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/IntermediateModel.java
/* * 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.model.intermediate; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.IOException; import java.io.InputStream; import java.io.UncheckedIOException; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Optional; import software.amazon.awssdk.awscore.AwsResponse; import software.amazon.awssdk.awscore.AwsResponseMetadata; import software.amazon.awssdk.codegen.model.config.customization.CustomizationConfig; import software.amazon.awssdk.codegen.model.rules.endpoints.EndpointTestSuiteModel; import software.amazon.awssdk.codegen.model.service.ClientContextParam; import software.amazon.awssdk.codegen.model.service.EndpointRuleSetModel; import software.amazon.awssdk.codegen.model.service.PaginatorDefinition; import software.amazon.awssdk.codegen.model.service.WaiterDefinition; import software.amazon.awssdk.codegen.naming.NamingStrategy; import software.amazon.awssdk.utils.IoUtils; public final class IntermediateModel { private static final String FILE_HEADER; private Metadata metadata; private Map<String, OperationModel> operations; private Map<String, ShapeModel> shapes; private CustomizationConfig customizationConfig; private Optional<OperationModel> endpointOperation; private Map<String, PaginatorDefinition> paginators; private Map<String, WaiterDefinition> waiters; @JsonIgnore private EndpointRuleSetModel endpointRuleSetModel; @JsonIgnore private EndpointTestSuiteModel endpointTestSuiteModel; @JsonIgnore private NamingStrategy namingStrategy; private Map<String, ClientContextParam> clientContextParams; static { FILE_HEADER = loadDefaultFileHeader(); } public IntermediateModel() { this.operations = new HashMap<>(); this.shapes = new HashMap<>(); this.endpointOperation = Optional.empty(); this.paginators = new HashMap<>(); this.waiters = new HashMap<>(); this.namingStrategy = null; } public IntermediateModel(Metadata metadata, Map<String, OperationModel> operations, Map<String, ShapeModel> shapes, CustomizationConfig customizationConfig) { this(metadata, operations, shapes, customizationConfig, null, Collections.emptyMap(), null, Collections.emptyMap(), null, null, null); } public IntermediateModel( Metadata metadata, Map<String, OperationModel> operations, Map<String, ShapeModel> shapes, CustomizationConfig customizationConfig, OperationModel endpointOperation, Map<String, PaginatorDefinition> paginators, NamingStrategy namingStrategy, Map<String, WaiterDefinition> waiters, EndpointRuleSetModel endpointRuleSetModel, EndpointTestSuiteModel endpointTestSuiteModel, Map<String, ClientContextParam> clientContextParams) { this.metadata = metadata; this.operations = operations; this.shapes = shapes; this.customizationConfig = customizationConfig; this.endpointOperation = Optional.ofNullable(endpointOperation); this.paginators = paginators; this.namingStrategy = namingStrategy; this.waiters = waiters; this.endpointRuleSetModel = endpointRuleSetModel; this.endpointTestSuiteModel = endpointTestSuiteModel; this.clientContextParams = clientContextParams; } public Metadata getMetadata() { return metadata; } public void setMetadata(Metadata metadata) { this.metadata = metadata; } public Map<String, OperationModel> getOperations() { return operations; } public void setOperations(Map<String, OperationModel> operations) { this.operations = operations; } public OperationModel getOperation(String operationName) { return getOperations().get(operationName); } public Map<String, ShapeModel> getShapes() { return shapes; } public void setShapes(Map<String, ShapeModel> shapes) { this.shapes = shapes; } /** * Looks up a shape by name and verifies that the expected C2J name matches * @param shapeName the name of the shape in the intermediate model * @param shapeC2jName C2J's name for the shape * @return the ShapeModel * @throws IllegalArgumentException if no matching shape is found */ public ShapeModel getShapeByNameAndC2jName(String shapeName, String shapeC2jName) { for (ShapeModel sm : getShapes().values()) { if (shapeName.equals(sm.getShapeName()) && shapeC2jName.equals(sm.getC2jName())) { return sm; } } throw new IllegalArgumentException("C2J shape " + shapeC2jName + " with shape name " + shapeName + " does not exist in " + "the intermediate model."); } public CustomizationConfig getCustomizationConfig() { return customizationConfig; } public void setCustomizationConfig(CustomizationConfig customizationConfig) { this.customizationConfig = customizationConfig; } public Map<String, PaginatorDefinition> getPaginators() { return paginators; } public Map<String, WaiterDefinition> getWaiters() { return waiters; } public EndpointRuleSetModel getEndpointRuleSetModel() { if (endpointRuleSetModel == null) { endpointRuleSetModel = EndpointRuleSetModel.defaultRules(metadata.getEndpointPrefix()); } return endpointRuleSetModel; } public EndpointTestSuiteModel getEndpointTestSuiteModel() { if (endpointTestSuiteModel == null) { endpointTestSuiteModel = new EndpointTestSuiteModel(); } return endpointTestSuiteModel; } public Map<String, ClientContextParam> getClientContextParams() { return clientContextParams; } public void setPaginators(Map<String, PaginatorDefinition> paginators) { this.paginators = paginators; } public NamingStrategy getNamingStrategy() { return namingStrategy; } public void setNamingStrategy(NamingStrategy namingStrategy) { this.namingStrategy = namingStrategy; } public String getCustomRetryPolicy() { return customizationConfig.getCustomRetryPolicy(); } public String getSdkModeledExceptionBaseFqcn() { return String.format("%s.%s", metadata.getFullModelPackageName(), getSdkModeledExceptionBaseClassName()); } public String getSdkModeledExceptionBaseClassName() { if (customizationConfig.getSdkModeledExceptionBaseClassName() != null) { return customizationConfig.getSdkModeledExceptionBaseClassName(); } else { return metadata.getBaseExceptionName(); } } public String getSdkRequestBaseClassName() { if (customizationConfig.getSdkRequestBaseClassName() != null) { return customizationConfig.getSdkRequestBaseClassName(); } else { return metadata.getBaseRequestName(); } } public String getSdkResponseBaseClassName() { if (customizationConfig.getSdkResponseBaseClassName() != null) { return customizationConfig.getSdkResponseBaseClassName(); } else { return metadata.getBaseResponseName(); } } public Optional<String> syncClientDecoratorClassName() { if (customizationConfig.getSyncClientDecorator() != null) { return Optional.of(customizationConfig.getSyncClientDecorator()); } return Optional.empty(); } public Optional<String> asyncClientDecoratorClassName() { String asyncClientDecorator = customizationConfig.getAsyncClientDecorator(); if (customizationConfig.getAsyncClientDecorator() != null) { return Optional.of(asyncClientDecorator); } return Optional.empty(); } public String getFileHeader() { return FILE_HEADER; } private static String loadDefaultFileHeader() { try (InputStream inputStream = IntermediateModel.class.getResourceAsStream("/software/amazon/awssdk/codegen/DefaultFileHeader.txt")) { return IoUtils.toUtf8String(inputStream); } catch (IOException e) { throw new UncheckedIOException(e); } } public String getSdkBaseResponseFqcn() { return String.format("%s<%s>", AwsResponse.class.getName(), getResponseMetadataClassName()); } private String getResponseMetadataClassName() { return AwsResponseMetadata.class.getName(); } public Optional<OperationModel> getEndpointOperation() { return endpointOperation; } public void setEndpointOperation(OperationModel endpointOperation) { this.endpointOperation = Optional.ofNullable(endpointOperation); } public boolean hasPaginators() { return paginators.size() > 0; } public boolean hasWaiters() { return waiters.size() > 0; } public boolean containsRequestSigners() { return getShapes().values().stream() .anyMatch(ShapeModel::isRequestSignerAware); } public boolean containsRequestEventStreams() { return getOperations().values().stream() .anyMatch(OperationModel::hasEventStreamInput); } }
3,562
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/MemberModel.java
/* * 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.model.intermediate; import static software.amazon.awssdk.codegen.internal.Constant.LF; import static software.amazon.awssdk.codegen.internal.DocumentationUtils.defaultExistenceCheck; import static software.amazon.awssdk.codegen.internal.DocumentationUtils.defaultFluentReturn; import static software.amazon.awssdk.codegen.internal.DocumentationUtils.defaultGetter; import static software.amazon.awssdk.codegen.internal.DocumentationUtils.defaultGetterParam; import static software.amazon.awssdk.codegen.internal.DocumentationUtils.defaultSetter; import static software.amazon.awssdk.codegen.internal.DocumentationUtils.defaultSetterParam; import static software.amazon.awssdk.codegen.internal.DocumentationUtils.stripHtmlTags; import com.fasterxml.jackson.annotation.JsonIgnore; import com.squareup.javapoet.ClassName; import java.util.List; import java.util.Map; import java.util.Optional; import software.amazon.awssdk.codegen.internal.TypeUtils; import software.amazon.awssdk.codegen.model.service.ContextParam; import software.amazon.awssdk.core.SdkBytes; import software.amazon.awssdk.core.SdkField; import software.amazon.awssdk.core.protocol.MarshallingType; import software.amazon.awssdk.core.util.SdkAutoConstructList; import software.amazon.awssdk.core.util.SdkAutoConstructMap; import software.amazon.awssdk.protocols.core.PathMarshaller; import software.amazon.awssdk.utils.StringUtils; public class MemberModel extends DocumentationModel { private String name; private String c2jName; private String c2jShape; private VariableModel variable; private VariableModel setterModel; private ReturnTypeModel getterModel; private ParameterHttpMapping http; private boolean deprecated; private String deprecatedMessage; private boolean required; private boolean synthetic; private ListModel listModel; private MapModel mapModel; private String enumType; private String xmlNameSpaceUri; private boolean idempotencyToken; private ShapeModel shape; private String fluentGetterMethodName; private String fluentEnumGetterMethodName; private String fluentSetterMethodName; private String fluentEnumSetterMethodName; private String existenceCheckMethodName; private String beanStyleGetterName; private String beanStyleSetterName; private String unionEnumTypeName; private boolean isJsonValue; private String timestampFormat; private boolean eventPayload; private boolean eventHeader; private boolean endpointDiscoveryId; private boolean sensitive; private boolean xmlAttribute; private String deprecatedName; private String fluentDeprecatedGetterMethodName; private String fluentDeprecatedSetterMethodName; private String deprecatedBeanStyleSetterMethodName; private ContextParam contextParam; public String getName() { return name; } public void setName(String name) { this.name = name; } public MemberModel withName(String name) { setName(name); return this; } public boolean isSynthetic() { return synthetic; } public void setSynthetic(boolean synthetic) { this.synthetic = synthetic; } public String getC2jName() { return c2jName; } public void setC2jName(String c2jName) { this.c2jName = c2jName; } public MemberModel withC2jName(String c2jName) { setC2jName(c2jName); return this; } public String getC2jShape() { return c2jShape; } public void setC2jShape(String c2jShape) { this.c2jShape = c2jShape; } public MemberModel withC2jShape(String c2jShape) { setC2jShape(c2jShape); return this; } public VariableModel getVariable() { return variable; } public void setVariable(VariableModel variable) { this.variable = variable; } public MemberModel withVariable(VariableModel variable) { setVariable(variable); return this; } public VariableModel getSetterModel() { return setterModel; } public void setSetterModel(VariableModel setterModel) { this.setterModel = setterModel; } public MemberModel withSetterModel(VariableModel setterModel) { setSetterModel(setterModel); return this; } public String getFluentGetterMethodName() { return fluentGetterMethodName; } public void setFluentGetterMethodName(String fluentGetterMethodName) { this.fluentGetterMethodName = fluentGetterMethodName; } public MemberModel withFluentGetterMethodName(String getterMethodName) { setFluentGetterMethodName(getterMethodName); return this; } public String getFluentEnumGetterMethodName() { return fluentEnumGetterMethodName; } public void setFluentEnumGetterMethodName(String fluentEnumGetterMethodName) { this.fluentEnumGetterMethodName = fluentEnumGetterMethodName; } public MemberModel withFluentEnumGetterMethodName(String fluentEnumGetterMethodName) { setFluentEnumGetterMethodName(fluentEnumGetterMethodName); return this; } public String getBeanStyleGetterMethodName() { return beanStyleGetterName; } public void setBeanStyleGetterMethodName(String beanStyleGetterName) { this.beanStyleGetterName = beanStyleGetterName; } public MemberModel withBeanStyleGetterMethodName(String beanStyleGetterName) { this.beanStyleGetterName = beanStyleGetterName; return this; } public String getBeanStyleSetterMethodName() { return beanStyleSetterName; } public void setBeanStyleSetterMethodName(String beanStyleSetterName) { this.beanStyleSetterName = beanStyleSetterName; } public MemberModel withBeanStyleSetterMethodName(String beanStyleSetterName) { this.beanStyleSetterName = beanStyleSetterName; return this; } public String getFluentSetterMethodName() { return fluentSetterMethodName; } public void setFluentSetterMethodName(String fluentSetterMethodName) { this.fluentSetterMethodName = fluentSetterMethodName; } public MemberModel withFluentSetterMethodName(String fluentMethodName) { setFluentSetterMethodName(fluentMethodName); return this; } public String getFluentEnumSetterMethodName() { return fluentEnumSetterMethodName; } public void setFluentEnumSetterMethodName(String fluentEnumSetterMethodName) { this.fluentEnumSetterMethodName = fluentEnumSetterMethodName; } public MemberModel withFluentEnumSetterMethodName(String fluentEnumSetterMethodName) { setFluentEnumSetterMethodName(fluentEnumSetterMethodName); return this; } public String getExistenceCheckMethodName() { return existenceCheckMethodName; } public void setExistenceCheckMethodName(String existenceCheckMethodName) { this.existenceCheckMethodName = existenceCheckMethodName; } public MemberModel withExistenceCheckMethodName(String existenceCheckMethodName) { setExistenceCheckMethodName(existenceCheckMethodName); return this; } public ReturnTypeModel getGetterModel() { return getterModel; } public void setGetterModel(ReturnTypeModel getterModel) { this.getterModel = getterModel; } public MemberModel withGetterModel(ReturnTypeModel getterModel) { setGetterModel(getterModel); return this; } public ParameterHttpMapping getHttp() { return http; } public void setHttp(ParameterHttpMapping parameterHttpMapping) { this.http = parameterHttpMapping; } public boolean isSimple() { return TypeUtils.isSimple(variable.getVariableType()); } public boolean isList() { return listModel != null; } public boolean isMap() { return mapModel != null; } public boolean isDeprecated() { return deprecated; } public void setDeprecated(boolean deprecated) { this.deprecated = deprecated; } public String getDeprecatedMessage() { return deprecatedMessage; } public void setDeprecatedMessage(String deprecatedMessage) { this.deprecatedMessage = deprecatedMessage; } public boolean isRequired() { return required; } public void setRequired(boolean required) { this.required = required; } public boolean isEventPayload() { return eventPayload; } public void setEventPayload(boolean eventPayload) { this.eventPayload = eventPayload; } public boolean isEventHeader() { return eventHeader; } public void setEventHeader(boolean eventHeader) { this.eventHeader = eventHeader; } public boolean isEndpointDiscoveryId() { return endpointDiscoveryId; } public void setEndpointDiscoveryId(boolean endpointDiscoveryId) { this.endpointDiscoveryId = endpointDiscoveryId; } public ListModel getListModel() { return listModel; } public void setListModel(ListModel listModel) { this.listModel = listModel; } public MemberModel withListModel(ListModel list) { setListModel(list); return this; } public MapModel getMapModel() { return mapModel; } public void setMapModel(MapModel map) { this.mapModel = map; } public MemberModel withMapModel(MapModel map) { setMapModel(map); return this; } public String getEnumType() { return enumType; } public void setEnumType(String enumType) { this.enumType = enumType; } public MemberModel withEnumType(String enumType) { setEnumType(enumType); return this; } public String getXmlNameSpaceUri() { return xmlNameSpaceUri; } public void setXmlNameSpaceUri(String xmlNameSpaceUri) { this.xmlNameSpaceUri = xmlNameSpaceUri; } public MemberModel withXmlNameSpaceUri(String xmlNameSpaceUri) { setXmlNameSpaceUri(xmlNameSpaceUri); return this; } public String getSetterDocumentation() { StringBuilder docBuilder = new StringBuilder(); docBuilder.append(StringUtils.isNotBlank(documentation) ? documentation : defaultSetter().replace("%s", name) + "\n"); docBuilder.append(getParamDoc()) .append(getEnumDoc()); return docBuilder.toString(); } public String getGetterDocumentation() { StringBuilder docBuilder = new StringBuilder(); docBuilder.append(StringUtils.isNotBlank(documentation) ? documentation : defaultGetter().replace("%s", name)) .append(LF); if (returnTypeIs(List.class) || returnTypeIs(Map.class)) { appendParagraph(docBuilder, "Attempts to modify the collection returned by this method will result in an " + "UnsupportedOperationException."); } if (enumType != null) { if (returnTypeIs(List.class)) { appendParagraph(docBuilder, "If the list returned by the service includes enum values that are not available in the " + "current SDK version, {@link #%s} will use {@link %s#UNKNOWN_TO_SDK_VERSION} in place of those " + "values in the list. The raw values returned by the service are available from {@link #%s}.", getFluentEnumGetterMethodName(), getEnumType(), getFluentGetterMethodName()); } else if (returnTypeIs(Map.class)) { appendParagraph(docBuilder, "If the map returned by the service includes enum values that are not available in the " + "current SDK version, {@link #%s} will not include those keys in the map. {@link #%s} " + "will include all data from the service.", getFluentEnumGetterMethodName(), getEnumType(), getFluentGetterMethodName()); } else { appendParagraph(docBuilder, "If the service returns an enum value that is not available in the current SDK version, " + "{@link #%s} will return {@link %s#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the " + "service is available from {@link #%s}.", getFluentEnumGetterMethodName(), getEnumType(), getFluentGetterMethodName()); } } if (getAutoConstructClassIfExists().isPresent()) { appendParagraph(docBuilder, "This method will never return null. If you would like to know whether the service returned this " + "field (so that you can differentiate between null and empty), you can use the {@link #%s} method.", getExistenceCheckMethodName()); } String variableDesc = StringUtils.isNotBlank(documentation) ? documentation : defaultGetterParam().replace("%s", name); docBuilder.append("@return ") .append(stripHtmlTags(variableDesc)) .append(getEnumDoc()); return docBuilder.toString(); } public String getDeprecatedGetterDocumentation() { String getterDocumentation = getGetterDocumentation(); return getterDocumentation + LF + "@deprecated Use {@link #" + getFluentGetterMethodName() + "()}" + LF; } private boolean returnTypeIs(Class<?> clazz) { String returnType = this.getGetterModel().getReturnType(); return returnType != null && returnType.startsWith(clazz.getName()); // Use startsWith in case it's parametrized } public String getFluentSetterDocumentation() { return getSetterDocumentation() + LF + "@return " + stripHtmlTags(defaultFluentReturn()) + getEnumDoc(); } public String getExistenceCheckDocumentation() { return defaultExistenceCheck().replace("%s", name) + LF; } public String getDeprecatedSetterDocumentation() { return getFluentSetterDocumentation() + LF + "@deprecated Use {@link #" + getFluentSetterMethodName() + "(" + setterModel.getSimpleType() + ")}" + LF; } public String getDefaultConsumerFluentSetterDocumentation(String variableType) { return (StringUtils.isNotBlank(documentation) ? documentation : defaultSetter().replace("%s", name) + "\n") + LF + "This is a convenience method that creates an instance of the {@link " + variableType + ".Builder} avoiding the need to create one manually via {@link " + variableType + "#builder()}.\n" + LF + "<p>" + "When the {@link Consumer} completes, {@link " + variableType + ".Builder#build()} is called immediately and its result is passed to {@link #" + getFluentGetterMethodName() + "(" + variable.getSimpleType() + ")}." + LF + "@param " + variable.getVariableName() + " a consumer that will call methods on {@link " + variableType + ".Builder}" + LF + "@return " + stripHtmlTags(defaultFluentReturn()) + LF + "@see #" + getFluentSetterMethodName() + "(" + variable.getVariableSetterType() + ")"; } public String getUnionConstructorDocumentation() { return "Create an instance of this class with {@link #" + this.getFluentGetterMethodName() + "()} initialized to the given value." + LF + LF + getSetterDocumentation(); } private String getParamDoc() { return LF + "@param " + variable.getVariableName() + " " + stripHtmlTags(StringUtils.isNotBlank(documentation) ? documentation : defaultSetterParam().replace("%s", name)); } private String getEnumDoc() { StringBuilder docBuilder = new StringBuilder(); if (enumType != null) { docBuilder.append(LF).append("@see ").append(enumType); } return docBuilder.toString(); } public boolean isIdempotencyToken() { return idempotencyToken; } public void setIdempotencyToken(boolean idempotencyToken) { this.idempotencyToken = idempotencyToken; } public boolean getIsBinary() { return http.getIsStreaming() || (isSdkBytesType() && (http.getIsPayload() || isEventPayload())); } /** * @return Implementation of {@link PathMarshaller} to use if this member is bound the the URI. * @throws IllegalStateException If this member is not bound to the URI. Templates should first check * {@link ParameterHttpMapping#isUri()} first. */ // TODO remove when rest XML marshaller refactor is merged @JsonIgnore public String getPathMarshaller() { if (!http.isUri()) { throw new IllegalStateException("Only members bound to the URI have a path marshaller"); } String prefix = PathMarshaller.class.getName(); if (http.isGreedy()) { return prefix + ".GREEDY"; } else if (isIdempotencyToken()) { return prefix + ".IDEMPOTENCY"; } else { return prefix + ".NON_GREEDY"; } } public boolean isJsonValue() { return isJsonValue; } public void setJsonValue(boolean jsonValue) { isJsonValue = jsonValue; } public MemberModel withJsonValue(boolean jsonValue) { setJsonValue(jsonValue); return this; } public String getTimestampFormat() { return timestampFormat; } public void setTimestampFormat(String timestampFormat) { this.timestampFormat = timestampFormat; } public MemberModel withTimestampFormat(String timestampFormat) { setTimestampFormat(timestampFormat); return this; } public void setSensitive(boolean sensitive) { this.sensitive = sensitive; } public boolean isSensitive() { return sensitive; } public boolean isXmlAttribute() { return xmlAttribute; } public void setXmlAttribute(boolean xmlAttribute) { this.xmlAttribute = xmlAttribute; } public MemberModel withXmlAttribtue(boolean xmlAttribtue) { this.xmlAttribute = xmlAttribtue; return this; } public String getDeprecatedName() { return deprecatedName; } public void setDeprecatedName(String deprecatedName) { this.deprecatedName = deprecatedName; } public MemberModel withDeprecatedName(String deprecatedName) { this.deprecatedName = deprecatedName; return this; } @JsonIgnore public boolean hasBuilder() { return !(isSimple() || isList() || isMap()); } @JsonIgnore public boolean containsBuildable() { return containsBuildable(true); } private boolean containsBuildable(boolean root) { if (!root && hasBuilder()) { return true; } if (isList()) { return getListModel().getListMemberModel().containsBuildable(false); } if (isMap()) { MapModel mapModel = getMapModel(); return mapModel.getKeyModel().containsBuildable(false) || mapModel.getValueModel().containsBuildable(false); } return false; } @JsonIgnore public boolean isSdkBytesType() { return SdkBytes.class.getName().equals(variable.getVariableType()); } /** * @return Marshalling type to use when creating a {@link SdkField}. Must be a * field of {@link MarshallingType}. */ public String getMarshallingType() { if (isList()) { return "LIST"; } else if (isMap()) { return "MAP"; } else if (!isSimple()) { return "SDK_POJO"; } else { return TypeUtils.getMarshallingType(variable.getSimpleType()); } } @JsonIgnore public ShapeModel getShape() { return shape; } public void setShape(ShapeModel shape) { this.shape = shape; } @Override public String toString() { return c2jName; } private void appendParagraph(StringBuilder builder, String content, Object... contentArgs) { builder.append("<p>") .append(LF) .append(String.format(content, contentArgs)) .append(LF) .append("</p>") .append(LF); } public Optional<ClassName> getAutoConstructClassIfExists() { if (isList()) { return Optional.of(ClassName.get(SdkAutoConstructList.class)); } else if (isMap()) { return Optional.of(ClassName.get(SdkAutoConstructMap.class)); } return Optional.empty(); } public void setDeprecatedFluentGetterMethodName(String fluentDeprecatedGetterMethodName) { this.fluentDeprecatedGetterMethodName = fluentDeprecatedGetterMethodName; } public String getDeprecatedFluentGetterMethodName() { return fluentDeprecatedGetterMethodName; } public void setDeprecatedFluentSetterMethodName(String fluentDeprecatedSetterMethodName) { this.fluentDeprecatedSetterMethodName = fluentDeprecatedSetterMethodName; } public String getDeprecatedFluentSetterMethodName() { return fluentDeprecatedSetterMethodName; } public String getDeprecatedBeanStyleSetterMethodName() { return deprecatedBeanStyleSetterMethodName; } public void setDeprecatedBeanStyleSetterMethodName(String deprecatedBeanStyleSetterMethodName) { this.deprecatedBeanStyleSetterMethodName = deprecatedBeanStyleSetterMethodName; } public String getUnionEnumTypeName() { return unionEnumTypeName; } public void setUnionEnumTypeName(String unionEnumTypeName) { this.unionEnumTypeName = unionEnumTypeName; } public ContextParam getContextParam() { return contextParam; } public void setContextParam(ContextParam contextParam) { this.contextParam = contextParam; } }
3,563
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/VariableModel.java
/* * 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.model.intermediate; import java.util.Collection; import java.util.List; public class VariableModel extends DocumentationModel { private String variableName; private String variableType; /** * Variable declaration type, which can be different from the * {@link #variableType}, for example, for auto construct list or map. * Otherwise, it's the same as the {@link #variableType}. */ private String variableDeclarationType; public VariableModel() { } public VariableModel(String variableName, String variableType) { this(variableName, variableType, variableType); } public VariableModel(String variableName, String variableType, String variableDeclarationType) { setVariableName(variableName); setVariableType(variableType); setVariableDeclarationType(variableDeclarationType); } public String getVariableName() { return variableName; } public void setVariableName(String variableName) { this.variableName = variableName; } public String getVariableType() { return variableType; } public void setVariableType(String variableType) { this.variableType = variableType; } public String getSimpleType() { if (variableType.contains(".")) { return variableType.substring(variableType.lastIndexOf('.') + 1); } return variableType; } public VariableModel withDocumentation(String documentation) { setDocumentation(documentation); return this; } public String getVariableDeclarationType() { return variableDeclarationType; } public void setVariableDeclarationType(String variableDeclarationType) { this.variableDeclarationType = variableDeclarationType; } /** * Returns the Java type used for the input parameter of a setter method. */ public String getVariableSetterType() { String prefix = List.class.getName(); if (variableType.startsWith(prefix)) { return Collection.class.getName() + variableType.substring(prefix.length()); } else { return variableType; } } @Override public String toString() { return variableName; } }
3,564
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/AuthorizerModel.java
/* * 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.model.intermediate; import com.fasterxml.jackson.annotation.JsonIgnore; import software.amazon.awssdk.codegen.model.service.Location; public class AuthorizerModel extends DocumentationModel { private final String name; private final String interfaceName; private final Location authTokenLocation; private final String tokenName; public AuthorizerModel(String name, String interfaceName, Location authTokenLocation, String tokenName) { this.name = name; this.interfaceName = interfaceName; this.authTokenLocation = authTokenLocation; this.tokenName = tokenName; } public String getName() { return name; } public boolean hasTokenPlacement() { return tokenName != null && authTokenLocation != null; } public String getTokenName() { return tokenName; } public String getInterfaceName() { return interfaceName; } public Location getAuthTokenLocation() { return authTokenLocation; } @JsonIgnore public String getAddAuthTokenMethod() { switch (authTokenLocation) { case HEADER: return "addHeader"; case QUERY_STRING: return "addParameter"; default: throw new IllegalArgumentException(String.format("Unhandled Location type for Auth Token Location '%s'", authTokenLocation)); } } }
3,565
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/ShapeMarshaller.java
/* * 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.model.intermediate; public class ShapeMarshaller { private String action; private String verb; private String target; private String requestUri; private String locationName; private String xmlNameSpaceUri; public String getAction() { return action; } public void setAction(String action) { this.action = action; } public ShapeMarshaller withAction(String action) { setAction(action); return this; } public String getVerb() { return verb; } public void setVerb(String verb) { this.verb = verb; } public ShapeMarshaller withVerb(String verb) { setVerb(verb); return this; } public String getTarget() { return target; } public void setTarget(String target) { this.target = target; } public ShapeMarshaller withTarget(String target) { setTarget(target); return this; } public String getRequestUri() { return requestUri; } public void setRequestUri(String requestUri) { this.requestUri = requestUri; } public ShapeMarshaller withRequestUri(String requestUri) { setRequestUri(requestUri); return this; } public String getLocationName() { return locationName; } public void setLocationName(String locationName) { this.locationName = locationName; } public ShapeMarshaller withLocationName(String locationName) { setLocationName(locationName); return this; } public String getXmlNameSpaceUri() { return xmlNameSpaceUri; } public void setXmlNameSpaceUri(String xmlNameSpaceUri) { this.xmlNameSpaceUri = xmlNameSpaceUri; } public ShapeMarshaller withXmlNameSpaceUri(String xmlNameSpaceUri) { setXmlNameSpaceUri(xmlNameSpaceUri); return this; } }
3,566
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/ExceptionModel.java
/* * 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.model.intermediate; public class ExceptionModel { private String exceptionName; private String documentation; private Integer httpStatusCode; public ExceptionModel() { } public ExceptionModel(String exceptionName) { this.exceptionName = exceptionName; } public String getExceptionName() { return exceptionName; } public void setExceptionName(String exceptionName) { this.exceptionName = exceptionName; } public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = documentation; } public ExceptionModel withDocumentation(String documentation) { setDocumentation(documentation); return this; } public Integer getHttpStatusCode() { return httpStatusCode; } public void setHttpStatusCode(Integer httpStatusCode) { this.httpStatusCode = httpStatusCode; } public ExceptionModel withHttpStatusCode(Integer httpStatusCode) { this.httpStatusCode = httpStatusCode; return this; } }
3,567
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/Protocol.java
/* * 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.model.intermediate; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; public enum Protocol { EC2("ec2"), AWS_JSON("json"), REST_JSON("rest-json"), CBOR("cbor"), QUERY("query"), REST_XML("rest-xml"); private String protocol; Protocol(String protocol) { this.protocol = protocol; } @JsonCreator public static Protocol fromValue(String strProtocol) { if (strProtocol == null) { return null; } for (Protocol protocol : Protocol.values()) { if (protocol.protocol.equals(strProtocol)) { return protocol; } } throw new IllegalArgumentException("Unknown enum value for Protocol : " + strProtocol); } @JsonValue public String getValue() { return protocol; } }
3,568
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/ReturnTypeModel.java
/* * 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.model.intermediate; public class ReturnTypeModel { private String returnType; private String documentation; public ReturnTypeModel() { } public ReturnTypeModel(String returnType) { setReturnType(returnType); } public String getReturnType() { return returnType; } public void setReturnType(String returnType) { this.returnType = returnType; } public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = documentation; } public ReturnTypeModel withDocumentation(String documentation) { setDocumentation(documentation); return this; } }
3,569
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/ArgumentModel.java
/* * 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.model.intermediate; public class ArgumentModel extends DocumentationModel { private String name; private String type; private boolean isEnumArg; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public ArgumentModel withName(String name) { this.name = name; return this; } public ArgumentModel withType(String type) { this.type = type; return this; } public boolean getIsEnumArg() { return isEnumArg; } public void setIsEnumArg(boolean isEnumArg) { this.isEnumArg = isEnumArg; } public ArgumentModel withIsEnumArg(boolean isEnumArg) { this.isEnumArg = isEnumArg; return this; } }
3,570
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/EnumModel.java
/* * 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.model.intermediate; /** * Represents a single enum field in a enum. */ public class EnumModel { /** The value for the enum field.*/ private String value; /** The name of the enum field. */ private String name; public EnumModel() { } public EnumModel(String name, String value) { this.name = name; this.value = value; } public String getName() { return name; } public void setName(String name) { this.name = name; } public void setValue(String value) { this.value = value; } public String getValue() { return value; } }
3,571
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/ShapeType.java
/* * 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.model.intermediate; public enum ShapeType { Request("Request"), Response("Response"), Exception("Exception"), Enum("Enum"), Model("Model"); private String value; ShapeType(String value) { this.value = value; } public static ShapeType fromValue(String value) { if (value.equals(Request.getValue())) { return Request; } else if (value.equals(Response.getValue())) { return Response; } else if (value.equals(Enum.getValue())) { return Enum; } else if (value.equals(Exception.getValue())) { return Exception; } else { return Model; } } public String getValue() { return value; } }
3,572
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/OperationModel.java
/* * 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.model.intermediate; import com.fasterxml.jackson.annotation.JsonIgnore; import java.util.ArrayList; import java.util.List; import java.util.Map; import software.amazon.awssdk.codegen.checksum.HttpChecksum; import software.amazon.awssdk.codegen.compression.RequestCompression; import software.amazon.awssdk.codegen.docs.ClientType; import software.amazon.awssdk.codegen.docs.DocConfiguration; import software.amazon.awssdk.codegen.docs.OperationDocs; import software.amazon.awssdk.codegen.docs.SimpleMethodOverload; import software.amazon.awssdk.codegen.internal.Utils; import software.amazon.awssdk.codegen.model.service.AuthType; import software.amazon.awssdk.codegen.model.service.EndpointTrait; import software.amazon.awssdk.codegen.model.service.StaticContextParam; public class OperationModel extends DocumentationModel { private String operationName; private String serviceProtocol; private boolean deprecated; private String deprecatedMessage; private VariableModel input; private ReturnTypeModel returnType; private List<ExceptionModel> exceptions = new ArrayList<>(); private List<SimpleMethodFormModel> simpleMethods; private boolean hasBlobMemberAsPayload; private boolean hasStringMemberAsPayload; private boolean isAuthenticated = true; private AuthType authType; private List<AuthType> auth; private boolean isPaginated; private boolean endpointOperation; private boolean endpointCacheRequired; private EndpointDiscovery endpointDiscovery; @JsonIgnore private ShapeModel inputShape; @JsonIgnore private ShapeModel outputShape; private EndpointTrait endpointTrait; private boolean httpChecksumRequired; private HttpChecksum httpChecksum; private RequestCompression requestCompression; @JsonIgnore private Map<String, StaticContextParam> staticContextParams; public String getOperationName() { return operationName; } public void setOperationName(String operationName) { this.operationName = operationName; } public String getMethodName() { return Utils.unCapitalize(operationName); } public String getServiceProtocol() { return serviceProtocol; } public void setServiceProtocol(String serviceProtocol) { this.serviceProtocol = serviceProtocol; } public boolean isDeprecated() { return deprecated; } public void setDeprecated(boolean deprecated) { this.deprecated = deprecated; } public String getDeprecatedMessage() { return deprecatedMessage; } public void setDeprecatedMessage(String deprecatedMessage) { this.deprecatedMessage = deprecatedMessage; } public String getDocs(IntermediateModel model, ClientType clientType) { return OperationDocs.getDocs(model, this, clientType); } public String getDocs(IntermediateModel model, ClientType clientType, SimpleMethodOverload methodOverload) { return OperationDocs.getDocs(model, this, clientType, methodOverload); } public String getDocs(IntermediateModel model, ClientType clientType, SimpleMethodOverload methodOverload, DocConfiguration config) { return OperationDocs.getDocs(model, this, clientType, methodOverload, config); } public boolean isAuthenticated() { return isAuthenticated; } public void setIsAuthenticated(boolean isAuthenticated) { this.isAuthenticated = isAuthenticated; } public AuthType getAuthType() { return authType; } public void setAuthType(AuthType authType) { this.authType = authType; } public List<AuthType> getAuth() { return auth; } public void setAuth(List<AuthType> auth) { this.auth = auth; } public ShapeModel getInputShape() { return inputShape; } public void setInputShape(ShapeModel inputShape) { this.inputShape = inputShape; } public ShapeModel getOutputShape() { return outputShape; } public void setOutputShape(ShapeModel outputShape) { this.outputShape = outputShape; } public VariableModel getInput() { return input; } public void setInput(VariableModel input) { this.input = input; } public ReturnTypeModel getReturnType() { return returnType; } public void setReturnType(ReturnTypeModel returnType) { this.returnType = returnType; } public String getSyncReturnType() { return returnType.getReturnType(); } public List<ExceptionModel> getExceptions() { return exceptions; } public void setExceptions(List<ExceptionModel> exceptions) { this.exceptions = exceptions; } public void addException(ExceptionModel exception) { exceptions.add(exception); } @JsonIgnore public List<SimpleMethodFormModel> getSimpleMethodForms() { return simpleMethods; } public void addSimpleMethodForm(List<ArgumentModel> arguments) { if (this.simpleMethods == null) { this.simpleMethods = new ArrayList<>(); } SimpleMethodFormModel form = new SimpleMethodFormModel(); form.setArguments(arguments); this.simpleMethods.add(form); } public boolean getHasBlobMemberAsPayload() { return this.hasBlobMemberAsPayload; } public void setHasBlobMemberAsPayload(boolean hasBlobMemberAsPayload) { this.hasBlobMemberAsPayload = hasBlobMemberAsPayload; } public boolean getHasStringMemberAsPayload() { return this.hasStringMemberAsPayload; } public void setHasStringMemberAsPayload(boolean hasStringMemberAsPayload) { this.hasStringMemberAsPayload = hasStringMemberAsPayload; } public boolean hasStreamingInput() { return inputShape != null && inputShape.isHasStreamingMember(); } public boolean hasStreamingOutput() { return outputShape != null && outputShape.isHasStreamingMember(); } @JsonIgnore public boolean isStreaming() { return hasStreamingInput() || hasStreamingOutput(); } public boolean isEndpointOperation() { return endpointOperation; } public void setEndpointOperation(boolean endpointOperation) { this.endpointOperation = endpointOperation; } public boolean isEndpointCacheRequired() { return endpointCacheRequired; } public void setEndpointCacheRequired(boolean endpointCacheRequired) { this.endpointCacheRequired = endpointCacheRequired; } public boolean isPaginated() { return isPaginated; } public void setPaginated(boolean paginated) { isPaginated = paginated; } public EndpointDiscovery getEndpointDiscovery() { return endpointDiscovery; } public void setEndpointDiscovery(EndpointDiscovery endpointDiscovery) { this.endpointDiscovery = endpointDiscovery; } /** * Returns the endpoint trait that will be used to resolve the endpoint of an API. */ public EndpointTrait getEndpointTrait() { return endpointTrait; } /** * Sets the endpoint trait that will be used to resolve the endpoint of an API. */ public void setEndpointTrait(EndpointTrait endpointTrait) { this.endpointTrait = endpointTrait; } /** * @return True if the operation has an event stream member in the output shape. False otherwise. */ public boolean hasEventStreamOutput() { return containsEventStream(outputShape); } /** * @return True if the operation has an event stream member in the input shape. False otherwise. */ public boolean hasEventStreamInput() { return containsEventStream(inputShape); } public boolean hasRequiresLengthInInput() { return inputShape != null && inputShape.isHasRequiresLengthMember(); } private boolean containsEventStream(ShapeModel shapeModel) { return shapeModel != null && shapeModel.getMembers() != null && shapeModel.getMembers().stream() .filter(m -> m.getShape() != null) .anyMatch(m -> m.getShape().isEventStream()); } public boolean isHttpChecksumRequired() { return httpChecksumRequired; } public void setHttpChecksumRequired(boolean httpChecksumRequired) { this.httpChecksumRequired = httpChecksumRequired; } public HttpChecksum getHttpChecksum() { return httpChecksum; } public void setHttpChecksum(HttpChecksum httpChecksum) { this.httpChecksum = httpChecksum; } public RequestCompression getRequestCompression() { return requestCompression; } public void setRequestCompression(RequestCompression requestCompression) { this.requestCompression = requestCompression; } public Map<String, StaticContextParam> getStaticContextParams() { return staticContextParams; } public void setStaticContextParams(Map<String, StaticContextParam> staticContextParams) { this.staticContextParams = staticContextParams; } }
3,573
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/Metadata.java
/* * 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.model.intermediate; import java.util.List; import java.util.Map; import software.amazon.awssdk.awscore.exception.AwsErrorDetails; import software.amazon.awssdk.codegen.model.service.AuthType; import software.amazon.awssdk.utils.StringUtils; public class Metadata { private String apiVersion; private Protocol protocol; private String documentation; private String defaultEndpoint; private String defaultRegion; private String defaultEndpointWithoutHttpProtocol; private String syncInterface; private String syncClient; private String syncBuilderInterface; private String syncBuilder; private String asyncInterface; private String asyncClient; private String asyncBuilderInterface; private String asyncBuilder; private String baseBuilderInterface; private String baseBuilder; private String rootPackageName; private String clientPackageName; private String modelPackageName; private String transformPackageName; private String requestTransformPackageName; private String paginatorsPackageName; private String authPolicyPackageName; private String waitersPackageName; private String endpointRulesPackageName; private String authSchemePackageName; private String serviceAbbreviation; private String serviceFullName; private String serviceName; private String baseExceptionName; private String contentType; private String jsonVersion; private Map<String, String> awsQueryCompatible; private String endpointPrefix; private String signingName; private boolean requiresIamSigners; private boolean requiresApiKey; private String uid; private AuthType authType; private String baseRequestName; private String baseResponseName; private boolean supportsH2; private String serviceId; private List<AuthType> auth; public List<AuthType> getAuth() { return auth; } public void setAuth(List<AuthType> auth) { this.auth = auth; } public Metadata withAuth(List<AuthType> auth) { this.auth = auth; return this; } public String getApiVersion() { return apiVersion; } public void setApiVersion(String apiVersion) { this.apiVersion = apiVersion; } public Metadata withApiVersion(String apiVersion) { setApiVersion(apiVersion); return this; } public Protocol getProtocol() { return protocol; } public void setProtocol(Protocol protocol) { this.protocol = protocol; } public Metadata withProtocol(Protocol protocol) { setProtocol(protocol); return this; } public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = documentation; } public Metadata withDocumentation(String documentation) { setDocumentation(documentation); return this; } public String getDefaultEndpoint() { return defaultEndpoint; } public void setDefaultEndpoint(String defaultEndpoint) { this.defaultEndpoint = defaultEndpoint; } public Metadata withDefaultEndpoint(String defaultEndpoint) { setDefaultEndpoint(defaultEndpoint); return this; } public String getDefaultRegion() { return defaultRegion; } public void setDefaultRegion(String defaultRegion) { this.defaultRegion = defaultRegion; } public Metadata withDefaultRegion(String defaultRegion) { setDefaultRegion(defaultRegion); return this; } public String getDefaultEndpointWithoutHttpProtocol() { return defaultEndpointWithoutHttpProtocol; } public void setDefaultEndpointWithoutHttpProtocol( String defaultEndpointWithoutHttpProtocol) { this.defaultEndpointWithoutHttpProtocol = defaultEndpointWithoutHttpProtocol; } public Metadata withDefaultEndpointWithoutHttpProtocol( String defaultEndpointWithoutHttpProtocol) { setDefaultEndpointWithoutHttpProtocol(defaultEndpointWithoutHttpProtocol); return this; } public String getSyncInterface() { return syncInterface; } public void setSyncInterface(String syncInterface) { this.syncInterface = syncInterface; } public Metadata withSyncInterface(String syncInterface) { setSyncInterface(syncInterface); return this; } public String getSyncClient() { return syncClient; } public void setSyncClient(String syncClient) { this.syncClient = syncClient; } public Metadata withSyncClient(String syncClient) { setSyncClient(syncClient); return this; } public String getSyncBuilderInterface() { return syncBuilderInterface; } public void setSyncBuilderInterface(String syncBuilderInterface) { this.syncBuilderInterface = syncBuilderInterface; } public Metadata withSyncBuilderInterface(String syncBuilderInterface) { this.syncBuilderInterface = syncBuilderInterface; return this; } public String getSyncBuilder() { return syncBuilder; } public void setSyncBuilder(String syncBuilder) { this.syncBuilder = syncBuilder; } public Metadata withSyncBuilder(String syncBuilder) { this.syncBuilder = syncBuilder; return this; } public String getAsyncInterface() { return asyncInterface; } public void setAsyncInterface(String asyncInterface) { this.asyncInterface = asyncInterface; } public Metadata withAsyncInterface(String asyncInterface) { setAsyncInterface(asyncInterface); return this; } public String getAsyncClient() { return asyncClient; } public void setAsyncClient(String asyncClient) { this.asyncClient = asyncClient; } public Metadata withAsyncClient(String asyncClient) { setAsyncClient(asyncClient); return this; } public String getAsyncBuilderInterface() { return asyncBuilderInterface; } public void setAsyncBuilderInterface(String asyncBuilderInterface) { this.asyncBuilderInterface = asyncBuilderInterface; } public Metadata withAsyncBuilderInterface(String asyncBuilderInterface) { this.asyncBuilderInterface = asyncBuilderInterface; return this; } public String getBaseBuilderInterface() { return baseBuilderInterface; } public void setBaseBuilderInterface(String baseBuilderInterface) { this.baseBuilderInterface = baseBuilderInterface; } public Metadata withBaseBuilderInterface(String baseBuilderInterface) { this.baseBuilderInterface = baseBuilderInterface; return this; } public String getBaseBuilder() { return baseBuilder; } public void setBaseBuilder(String baseBuilder) { this.baseBuilder = baseBuilder; } public Metadata withBaseBuilder(String baseBuilder) { this.baseBuilder = baseBuilder; return this; } public String getAsyncBuilder() { return asyncBuilder; } public void setAsyncBuilder(String asyncBuilder) { this.asyncBuilder = asyncBuilder; } public Metadata withAsyncBuilder(String asyncBuilder) { this.asyncBuilder = asyncBuilder; return this; } public String getBaseExceptionName() { return baseExceptionName; } public void setBaseExceptionName(String baseExceptionName) { this.baseExceptionName = baseExceptionName; } public Metadata withBaseExceptionName(String baseExceptionName) { setBaseExceptionName(baseExceptionName); return this; } public String getRootPackageName() { return rootPackageName; } public void setRootPackageName(String rootPackageName) { this.rootPackageName = rootPackageName; } public Metadata withRootPackageName(String rootPackageName) { setRootPackageName(rootPackageName); return this; } public String getFullClientPackageName() { return joinPackageNames(rootPackageName, getClientPackageName()); } public String getFullClientInternalPackageName() { return joinPackageNames(getFullClientPackageName(), "internal"); } public String getClientPackageName() { return clientPackageName; } public void setClientPackageName(String clientPackageName) { this.clientPackageName = clientPackageName; } public Metadata withClientPackageName(String clientPackageName) { setClientPackageName(clientPackageName); return this; } public String getFullModelPackageName() { return joinPackageNames(rootPackageName, getModelPackageName()); } public String getModelPackageName() { return modelPackageName; } public void setModelPackageName(String modelPackageName) { this.modelPackageName = modelPackageName; } public Metadata withModelPackageName(String modelPackageName) { setModelPackageName(modelPackageName); return this; } public String getFullTransformPackageName() { return joinPackageNames(rootPackageName, getTransformPackageName()); } public String getTransformPackageName() { return transformPackageName; } public void setTransformPackageName(String transformPackageName) { this.transformPackageName = transformPackageName; } public Metadata withTransformPackageName(String transformPackageName) { setTransformPackageName(transformPackageName); return this; } public String getFullRequestTransformPackageName() { return joinPackageNames(rootPackageName, getRequestTransformPackageName()); } public String getRequestTransformPackageName() { return requestTransformPackageName; } public void setRequestTransformPackageName(String requestTransformPackageName) { this.requestTransformPackageName = requestTransformPackageName; } public Metadata withRequestTransformPackageName(String requestTransformPackageName) { setRequestTransformPackageName(requestTransformPackageName); return this; } public String getFullPaginatorsPackageName() { return joinPackageNames(rootPackageName, getPaginatorsPackageName()); } public String getPaginatorsPackageName() { return paginatorsPackageName; } public void setPaginatorsPackageName(String paginatorsPackageName) { this.paginatorsPackageName = paginatorsPackageName; } public Metadata withPaginatorsPackageName(String paginatorsPackageName) { setPaginatorsPackageName(paginatorsPackageName); return this; } public String getFullAuthPolicyPackageName() { return joinPackageNames(rootPackageName, getAuthPolicyPackageName()); } public String getAuthPolicyPackageName() { return authPolicyPackageName; } public void setAuthPolicyPackageName(String authPolicyPackageName) { this.authPolicyPackageName = authPolicyPackageName; } public Metadata withAuthPolicyPackageName(String authPolicyPackageName) { setAuthPolicyPackageName(authPolicyPackageName); return this; } public void setServiceAbbreviation(String serviceAbbreviation) { this.serviceAbbreviation = serviceAbbreviation; } public Metadata withServiceAbbreviation(String serviceAbbreviation) { setServiceAbbreviation(serviceAbbreviation); return this; } public void setServiceFullName(String serviceFullName) { this.serviceFullName = serviceFullName; } public Metadata withServiceFullName(String serviceFullName) { setServiceFullName(serviceFullName); return this; } /** * Returns a convenient name for the service. If an abbreviated form * of the service name is available it will return that, otherwise it * will return the full service name. */ public String getDescriptiveServiceName() { if (serviceAbbreviation != null) { return serviceAbbreviation; } return serviceFullName; } /** * @return Unique, short name for the service. Suitable for displaying in metadata like {@link AwsErrorDetails} and * for use in metrics. Should not be used in documentation, use {@link #getDescriptiveServiceName()} for that. */ public String getServiceName() { return this.serviceName; } public void setServiceName(String serviceName) { this.serviceName = serviceName; } public Metadata withServiceName(String serviceName) { setServiceName(serviceName); return this; } public String getJsonVersion() { return jsonVersion; } public void setJsonVersion(String jsonVersion) { this.jsonVersion = jsonVersion; } public Metadata withJsonVersion(String jsonVersion) { setJsonVersion(jsonVersion); return this; } public Map<String, String> getAwsQueryCompatible() { return awsQueryCompatible; } public void setAwsQueryCompatible(Map<String, String> awsQueryCompatible) { this.awsQueryCompatible = awsQueryCompatible; } public Metadata withAwsQueryCompatible(Map<String, String> awsQueryCompatible) { setAwsQueryCompatible(awsQueryCompatible); return this; } public boolean isCborProtocol() { return protocol == Protocol.CBOR; } public boolean isJsonProtocol() { return protocol == Protocol.CBOR || protocol == Protocol.AWS_JSON || protocol == Protocol.REST_JSON; } public boolean isXmlProtocol() { return protocol == Protocol.EC2 || protocol == Protocol.QUERY || protocol == Protocol.REST_XML; } public boolean isQueryProtocol() { return protocol == Protocol.EC2 || protocol == Protocol.QUERY; } /** * @return True for RESTful protocols. False for all other protocols (RPC, Query, etc). */ public static boolean isNotRestProtocol(String protocol) { switch (Protocol.fromValue(protocol)) { case REST_JSON: case REST_XML: return false; default: return true; } } public String getEndpointPrefix() { return endpointPrefix; } public void setEndpointPrefix(String endpointPrefix) { this.endpointPrefix = endpointPrefix; } public Metadata withEndpointPrefix(String endpointPrefix) { setEndpointPrefix(endpointPrefix); return this; } public String getSigningName() { return signingName; } public void setSigningName(String signingName) { this.signingName = signingName; } public Metadata withSigningName(String signingName) { setSigningName(signingName); return this; } public void setContentType(String contentType) { this.contentType = contentType; } public String getContentType() { return contentType; } public boolean isRequiresIamSigners() { return requiresIamSigners; } public void setRequiresIamSigners(boolean requiresIamSigners) { this.requiresIamSigners = requiresIamSigners; } public boolean isRequiresApiKey() { return requiresApiKey; } public Metadata withRequiresApiKey(boolean requiresApiKey) { this.requiresApiKey = requiresApiKey; return this; } public String getUid() { return uid; } public void setUid(String uid) { this.uid = uid; } public Metadata withUid(String uid) { setUid(uid); return this; } public AuthType getAuthType() { return authType; } public void setAuthType(AuthType authType) { this.authType = authType; } public Metadata withAuthType(AuthType authType) { this.authType = authType; return this; } public String getBaseRequestName() { return baseRequestName; } public Metadata withBaseRequestName(String baseRequestName) { this.baseRequestName = baseRequestName; return this; } public String getBaseResponseName() { return baseResponseName; } public Metadata withBaseResponseName(String baseResponseName) { this.baseResponseName = baseResponseName; return this; } private String joinPackageNames(String lhs, String rhs) { return StringUtils.isBlank(rhs) ? lhs : lhs + '.' + rhs; } public boolean supportsH2() { return supportsH2; } public void setSupportsH2(boolean supportsH2) { this.supportsH2 = supportsH2; } public Metadata withSupportsH2(boolean supportsH2) { setSupportsH2(supportsH2); return this; } public String getServiceId() { return serviceId; } public void setServiceId(String serviceId) { this.serviceId = serviceId; } public Metadata withServiceId(String serviceId) { setServiceId(serviceId); return this; } public String getWaitersPackageName() { return waitersPackageName; } public void setWaitersPackageName(String waitersPackageName) { this.waitersPackageName = waitersPackageName; } public Metadata withWaitersPackageName(String waitersPackageName) { setWaitersPackageName(waitersPackageName); return this; } public String getFullWaitersPackageName() { return joinPackageNames(rootPackageName, getWaitersPackageName()); } public String getFullWaitersInternalPackageName() { return joinPackageNames(getFullWaitersPackageName(), "internal"); } public void setEndpointRulesPackageName(String endpointRulesPackageName) { this.endpointRulesPackageName = endpointRulesPackageName; } public Metadata withEndpointRulesPackageName(String endpointRulesPackageName) { setEndpointRulesPackageName(endpointRulesPackageName); return this; } public String getEndpointRulesPackageName() { return endpointRulesPackageName; } public String getFullEndpointRulesPackageName() { return joinPackageNames(rootPackageName, getEndpointRulesPackageName()); } public String getFullInternalEndpointRulesPackageName() { return joinPackageNames(getFullEndpointRulesPackageName(), "internal"); } public void setAuthSchemePackageName(String authSchemePackageName) { this.authSchemePackageName = authSchemePackageName; } public Metadata withAuthSchemePackageName(String authSchemePackageName) { setAuthSchemePackageName(authSchemePackageName); return this; } public String getAuthSchemePackageName() { return authSchemePackageName; } public String getFullAuthSchemePackageName() { return joinPackageNames(rootPackageName, getAuthSchemePackageName()); } public String getFullInternalAuthSchemePackageName() { return joinPackageNames(getFullAuthSchemePackageName(), "internal"); } public String getFullInternalPackageName() { return joinPackageNames(getFullClientPackageName(), "internal"); } }
3,574
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/MapModel.java
/* * 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.model.intermediate; public class MapModel { private String implType; private String interfaceType; private String keyLocationName; private MemberModel keyModel; private String valueLocationName; private MemberModel valueModel; public MapModel() { } public MapModel(String implType, String interfaceType, String keyLocationName, MemberModel keyModel, String valueLocationName, MemberModel valueModel) { this.implType = implType; this.interfaceType = interfaceType; this.keyLocationName = keyLocationName; this.keyModel = keyModel; this.valueLocationName = valueLocationName; this.valueModel = valueModel; } public String getImplType() { return implType; } public void setImplType(String implType) { this.implType = implType; } public String getInterfaceType() { return interfaceType; } public void setInterfaceType(String interfaceType) { this.interfaceType = interfaceType; } public String getKeyLocationName() { return keyLocationName; } public void setKeyLocationName(String keyLocationName) { this.keyLocationName = keyLocationName; } public MemberModel getKeyModel() { return keyModel; } public void setKeyModel(MemberModel keyModel) { this.keyModel = keyModel; } public String getValueLocationName() { return valueLocationName; } public void setValueLocationName(String valueLocationName) { this.valueLocationName = valueLocationName; } public MemberModel getValueModel() { return valueModel; } public void setValueModel(MemberModel valueModel) { this.valueModel = valueModel; } public String getTemplateType() { return interfaceType + "<" + keyModel.getVariable().getVariableType() + "," + valueModel.getVariable().getVariableType() + ">"; } public String getEntryType() { return String.format("Map.Entry<%s, %s>", keyModel.getVariable().getVariableType(), valueModel.getVariable().getVariableType()); } }
3,575
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/ListModel.java
/* * 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.model.intermediate; import software.amazon.awssdk.codegen.internal.TypeUtils; public class ListModel { private String implType; private String memberType; private String interfaceType; private MemberModel listMemberModel; private String memberLocationName; private String memberAdditionalMarshallingPath; private String memberAdditionalUnmarshallingPath; public ListModel() { } public ListModel(String memberType, String memberLocationName, String implType, String interfaceType, MemberModel listMemberModel) { this.memberType = memberType; this.memberLocationName = memberLocationName; this.implType = implType; this.interfaceType = interfaceType; this.listMemberModel = listMemberModel; } public String getImplType() { return implType; } public void setImplType(String implType) { this.implType = implType; } public String getMemberType() { return memberType; } public void setMemberType(String memberType) { this.memberType = memberType; } public String getInterfaceType() { return interfaceType; } public void setInterfaceType(String interfaceType) { this.interfaceType = interfaceType; } public MemberModel getListMemberModel() { return listMemberModel; } public void setListMemberModel(MemberModel listMemberModel) { this.listMemberModel = listMemberModel; } public String getMemberLocationName() { return memberLocationName; } public void setMemberLocationName(String memberLocationName) { this.memberLocationName = memberLocationName; } public String getMemberAdditionalMarshallingPath() { return memberAdditionalMarshallingPath; } public void setMemberAdditionalMarshallingPath( String memberAdditionalMarshallingPath) { this.memberAdditionalMarshallingPath = memberAdditionalMarshallingPath; } public String getMemberAdditionalUnmarshallingPath() { return memberAdditionalUnmarshallingPath; } public void setMemberAdditionalUnmarshallingPath( String memberAdditionalUnmarshallingPath) { this.memberAdditionalUnmarshallingPath = memberAdditionalUnmarshallingPath; } public boolean isSimple() { return TypeUtils.isSimple(memberType); } public boolean isMap() { return memberType.startsWith(TypeUtils .getDataTypeMapping(TypeUtils.TypeKey.MAP_INTERFACE)); } public String getTemplateType() { return interfaceType + "<" + memberType + ">"; } public String getTemplateImplType() { return implType + "<" + memberType + ">"; } public String getSimpleType() { int startIndex = memberType.lastIndexOf('.'); return memberType.substring(startIndex + 1); } }
3,576
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/EndpointDiscovery.java
/* * 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.model.intermediate; public class EndpointDiscovery { private boolean required; public boolean isRequired() { return required; } public void setRequired(boolean required) { this.required = required; } }
3,577
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/ShapeUnmarshaller.java
/* * 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.model.intermediate; public class ShapeUnmarshaller { private String resultWrapper; private boolean flattened; public String getResultWrapper() { return resultWrapper; } public void setResultWrapper(String resultWrapper) { this.resultWrapper = resultWrapper; } public ShapeUnmarshaller withResultWrapper(String resultWrapper) { setResultWrapper(resultWrapper); return this; } public boolean isFlattened() { return flattened; } public void setFlattened(boolean flattened) { this.flattened = flattened; } public ShapeUnmarshaller withFlattened(boolean flattened) { setFlattened(flattened); return this; } }
3,578
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/ShapeModel.java
/* * 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.model.intermediate; import static software.amazon.awssdk.codegen.internal.Constant.LF; import static software.amazon.awssdk.codegen.internal.Constant.REQUEST_CLASS_SUFFIX; import static software.amazon.awssdk.codegen.internal.Constant.RESPONSE_CLASS_SUFFIX; import static software.amazon.awssdk.codegen.internal.DocumentationUtils.removeFromEnd; import com.fasterxml.jackson.annotation.JsonIgnore; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import software.amazon.awssdk.codegen.model.intermediate.customization.ShapeCustomizationInfo; import software.amazon.awssdk.codegen.model.service.XmlNamespace; import software.amazon.awssdk.utils.StringUtils; public class ShapeModel extends DocumentationModel implements HasDeprecation { private String c2jName; // shapeName might be later modified by the customization. private String shapeName; // the local variable name inside marshaller/unmarshaller implementation private boolean deprecated; private String deprecatedMessage; private String type; private List<String> required; private boolean hasPayloadMember; private boolean hasHeaderMember; private boolean hasStatusCodeMember; private boolean hasStreamingMember; private boolean hasRequiresLengthMember; private boolean wrapper; private boolean simpleMethod; private String requestSignerClassFqcn; private EndpointDiscovery endpointDiscovery; private List<MemberModel> members; private List<EnumModel> enums; private VariableModel variable; private ShapeMarshaller marshaller; private ShapeUnmarshaller unmarshaller; private String errorCode; private Integer httpStatusCode; private boolean fault; private ShapeCustomizationInfo customization = new ShapeCustomizationInfo(); private boolean isEventStream; private boolean isEvent; private XmlNamespace xmlNamespace; private boolean document; private boolean union; public ShapeModel() { } public ShapeModel(String c2jName) { this.c2jName = c2jName; } public String getShapeName() { return shapeName; } public void setShapeName(String shapeName) { this.shapeName = shapeName; } @Override public boolean isDeprecated() { return deprecated; } public void setDeprecated(boolean deprecated) { this.deprecated = deprecated; } public String getDeprecatedMessage() { return deprecatedMessage; } public void setDeprecatedMessage(String deprecatedMessage) { this.deprecatedMessage = deprecatedMessage; } public String getC2jName() { return c2jName; } public void setC2jName(String c2jName) { this.c2jName = c2jName; } public String getType() { return type; } @JsonIgnore public void setType(ShapeType shapeType) { setType(shapeType.getValue()); } public void setType(String type) { this.type = type; } @JsonIgnore public ShapeType getShapeType() { return ShapeType.fromValue(type); } public ShapeModel withType(String type) { this.type = type; return this; } // Returns the list of C2j member names that are required for this shape. public List<String> getRequired() { return required; } public void setRequired(List<String> required) { this.required = required; } public boolean isHasPayloadMember() { return hasPayloadMember; } public void setHasPayloadMember(boolean hasPayloadMember) { this.hasPayloadMember = hasPayloadMember; } public ShapeModel withHasPayloadMember(boolean hasPayloadMember) { setHasPayloadMember(hasPayloadMember); return this; } /** * @return The member explicitly designated as the payload member */ @JsonIgnore public MemberModel getPayloadMember() { MemberModel payloadMember = null; for (MemberModel member : members) { if (member.getHttp().getIsPayload()) { if (payloadMember == null) { payloadMember = member; } else { throw new IllegalStateException( String.format("Only one payload member can be explicitly set on %s. This is likely an error in " + "the C2J model", c2jName)); } } } return payloadMember; } /** * @return The list of members whose location is not specified. If no payload member is * explicitly set then these members will appear in the payload */ @JsonIgnore public List<MemberModel> getUnboundMembers() { List<MemberModel> unboundMembers = new ArrayList<>(); if (members != null) { for (MemberModel member : members) { if (member.getHttp().getLocation() == null && !member.getHttp().getIsPayload()) { if (hasPayloadMember) { // There is an explicit payload, but this unbound // member isn't it. // Note: Somewhat unintuitive, explicit payloads don't // have an explicit location; they're identified by // the payload HTTP trait being true. throw new IllegalStateException(String.format( "C2J Shape %s has both an explicit payload member and unbound (no explicit location) member, %s." + " This is undefined behavior, verify the correctness of the C2J model.", c2jName, member.getName())); } unboundMembers.add(member); } } } return unboundMembers; } /** * @return The list of members whose are not marked with either eventheader or eventpayload trait. */ @JsonIgnore public List<MemberModel> getUnboundEventMembers() { if (members == null) { return new ArrayList<>(); } return members.stream() .filter(m -> !m.isEventHeader()) .filter(m -> !m.isEventPayload()) .collect(Collectors.toList()); } /** * @return True if the shape has an explicit payload member or implicit payload member(s). */ public boolean hasPayloadMembers() { return hasPayloadMember || getExplicitEventPayloadMember() != null || hasImplicitPayloadMembers(); } public boolean hasImplicitPayloadMembers() { return !getUnboundMembers().isEmpty() || hasImplicitEventPayloadMembers(); } public boolean hasImplicitEventPayloadMembers() { return isEvent() && !getUnboundEventMembers().isEmpty(); } /** * Explicit event payload member will have "eventpayload" trait set to true. * There can be at most only one member that can be declared as explicit payload. * * @return the member that has the 'eventpayload' trait set to true. If none found, return null. */ public MemberModel getExplicitEventPayloadMember() { if (members == null) { return null; } return members.stream() .filter(MemberModel::isEventPayload) .findFirst() .orElse(null); } /** * If all members in shape have eventheader trait, then there is no payload */ public boolean hasNoEventPayload() { return members == null || members.stream().allMatch(MemberModel::isEventHeader); } public boolean isHasStreamingMember() { return hasStreamingMember; } public void setHasStreamingMember(boolean hasStreamingMember) { this.hasStreamingMember = hasStreamingMember; } public ShapeModel withHasStreamingMember(boolean hasStreamingMember) { setHasStreamingMember(hasStreamingMember); return this; } public boolean isHasRequiresLengthMember() { return hasRequiresLengthMember; } public void setHasRequiresLengthMember(boolean hasRequiresLengthMember) { this.hasRequiresLengthMember = hasRequiresLengthMember; } public ShapeModel withHasRequiresLengthMember(boolean hasRequiresLengthMember) { setHasRequiresLengthMember(hasRequiresLengthMember); return this; } public boolean isHasHeaderMember() { return hasHeaderMember; } public void setHasHeaderMember(boolean hasHeaderMember) { this.hasHeaderMember = hasHeaderMember; } public ShapeModel withHasHeaderMember(boolean hasHeaderMember) { setHasHeaderMember(hasHeaderMember); return this; } public boolean isHasStatusCodeMember() { return hasStatusCodeMember; } public void setHasStatusCodeMember(boolean hasStatusCodeMember) { this.hasStatusCodeMember = hasStatusCodeMember; } public boolean isWrapper() { return wrapper; } public void setWrapper(boolean wrapper) { this.wrapper = wrapper; } public boolean isSimpleMethod() { return simpleMethod; } public void setSimpleMethod(boolean simpleMethod) { this.simpleMethod = simpleMethod; } public ShapeModel withHasStatusCodeMember(boolean hasStatusCodeMember) { setHasStatusCodeMember(hasStatusCodeMember); return this; } public MemberModel getMemberByVariableName(String memberVariableName) { for (MemberModel memberModel : members) { if (memberModel.getVariable().getVariableName().equals(memberVariableName)) { return memberModel; } } throw new IllegalArgumentException("Unknown member variable name: " + memberVariableName); } public MemberModel getMemberByName(String memberName) { for (MemberModel memberModel : members) { if (memberModel.getName().equals(memberName)) { return memberModel; } } return null; } public MemberModel getMemberByC2jName(String memberName) { for (MemberModel memberModel : members) { if (memberModel.getC2jName().equals(memberName)) { return memberModel; } } return null; } public List<MemberModel> getMembers() { if (members == null) { return Collections.emptyList(); } return members; } /** * @return All non-streaming members of the shape. */ public List<MemberModel> getNonStreamingMembers() { return getMembers().stream() // Filter out binary streaming members .filter(m -> !m.getHttp().getIsStreaming()) // Filter out event stream members (if shape is null then it's primitive and we should include it). .filter(m -> m.getShape() == null || !m.getShape().isEventStream) .collect(Collectors.toList()); } public void setMembers(List<MemberModel> members) { this.members = members; } public void addMember(MemberModel member) { if (this.members == null) { this.members = new ArrayList<>(); } members.add(member); } public List<EnumModel> getEnums() { return enums; } public void setEnums(List<EnumModel> enums) { this.enums = enums; } public void addEnum(EnumModel enumModel) { if (this.enums == null) { this.enums = new ArrayList<>(); } this.enums.add(enumModel); } public VariableModel getVariable() { return variable; } public void setVariable(VariableModel variable) { this.variable = variable; } public ShapeMarshaller getMarshaller() { return marshaller; } public void setMarshaller(ShapeMarshaller marshaller) { this.marshaller = marshaller; } public ShapeUnmarshaller getUnmarshaller() { return unmarshaller; } public void setUnmarshaller(ShapeUnmarshaller unmarshaller) { this.unmarshaller = unmarshaller; } public ShapeCustomizationInfo getCustomization() { return customization; } public void setCustomization(ShapeCustomizationInfo customization) { this.customization = customization; } public Map<String, MemberModel> getMembersAsMap() { Map<String, MemberModel> shapeMembers = new HashMap<>(); // Creating a map of shape's members. This map is used below when // fetching the details of a member. List<MemberModel> memberModels = getMembers(); if (memberModels != null) { for (MemberModel model : memberModels) { shapeMembers.put(model.getName(), model); } } return shapeMembers; } /** * Tries to find the member model associated with the given c2j member name from this shape * model. Returns the member model if present else returns null. */ public MemberModel tryFindMemberModelByC2jName(String memberC2jName, boolean ignoreCase) { List<MemberModel> memberModels = getMembers(); String expectedName = ignoreCase ? StringUtils.lowerCase(memberC2jName) : memberC2jName; if (memberModels != null) { for (MemberModel member : memberModels) { String actualName = ignoreCase ? StringUtils.lowerCase(member.getC2jName()) : member.getC2jName(); if (expectedName.equals(actualName)) { return member; } } } return null; } /** * Returns the member model associated with the given c2j member name from this shape model. */ public MemberModel findMemberModelByC2jName(String memberC2jName) { MemberModel model = tryFindMemberModelByC2jName(memberC2jName, false); if (model == null) { throw new IllegalArgumentException(memberC2jName + " member (c2j name) does not exist in the shape."); } return model; } /** * Takes in the c2j member name as input and removes if the shape contains a member with the * given name. Return false otherwise. */ public boolean removeMemberByC2jName(String memberC2jName, boolean ignoreCase) { // Implicitly depending on the default equals and hashcode // implementation of the class MemberModel MemberModel model = tryFindMemberModelByC2jName(memberC2jName, ignoreCase); return model == null ? false : members.remove(model); } /** * Returns the enum model for the given enum value. * Returns null if no such enum value exists. */ public EnumModel findEnumModelByValue(String enumValue) { if (enums != null) { for (EnumModel enumModel : enums) { if (enumValue.equals(enumModel.getValue())) { return enumModel; } } } return null; } @JsonIgnore public String getDocumentationShapeName() { switch (getShapeType()) { case Request: return removeFromEnd(shapeName, REQUEST_CLASS_SUFFIX); case Response: return removeFromEnd(shapeName, RESPONSE_CLASS_SUFFIX); default: return c2jName; } } public String getUnionTypeGetterDocumentation() { return "Retrieve an enum value representing which member of this object is populated. " + LF + LF + "When this class is returned in a service response, this will be {@link Type#UNKNOWN_TO_SDK_VERSION} if the " + "service returned a member that is only known to a newer SDK version." + LF + LF + "When this class is created directly in your code, this will be {@link Type#UNKNOWN_TO_SDK_VERSION} if zero " + "members are set, and {@code null} if more than one member is set."; } @Override public String toString() { return shapeName; } public String getErrorCode() { return errorCode; } public void setErrorCode(String errorCode) { this.errorCode = errorCode; } /** * Return the httpStatusCode of the exception shape. This value is present only for modeled exceptions. */ public Integer getHttpStatusCode() { return httpStatusCode; } public void setHttpStatusCode(Integer httpStatusCode) { this.httpStatusCode = httpStatusCode; } public boolean isRequestSignerAware() { return requestSignerClassFqcn != null; } public String getRequestSignerClassFqcn() { return requestSignerClassFqcn; } public void setRequestSignerClassFqcn(String authorizerClass) { this.requestSignerClassFqcn = authorizerClass; } public EndpointDiscovery getEndpointDiscovery() { return endpointDiscovery; } public void setEndpointDiscovery(EndpointDiscovery endpointDiscovery) { this.endpointDiscovery = endpointDiscovery; } /** * @return True if the shape is an 'eventstream' shape. The eventstream shape is the tagged union like * container that holds individual 'events'. */ public boolean isEventStream() { return this.isEventStream; } public ShapeModel withIsEventStream(boolean isEventStream) { this.isEventStream = isEventStream; return this; } /** * @return True if the shape is an 'event'. I.E. It is a member of the eventstream and represents one logical event * that can be delivered on the event stream. */ public boolean isEvent() { return this.isEvent; } public ShapeModel withIsEvent(boolean isEvent) { this.isEvent = isEvent; return this; } public XmlNamespace getXmlNamespace() { return xmlNamespace; } public ShapeModel withXmlNamespace(XmlNamespace xmlNamespace) { this.xmlNamespace = xmlNamespace; return this; } public void setXmlNamespace(XmlNamespace xmlNamespace) { this.xmlNamespace = xmlNamespace; } public boolean isDocument() { return document; } public ShapeModel withIsDocument(boolean document) { this.document = document; return this; } public boolean isUnion() { return union; } public void withIsUnion(boolean union) { this.union = union; } public boolean isFault() { return fault; } public ShapeModel withIsFault(boolean fault) { this.fault = fault; return this; } }
3,579
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/HasDeprecation.java
/* * 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.model.intermediate; public interface HasDeprecation { boolean isDeprecated(); }
3,580
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/ParameterHttpMapping.java
/* * 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.model.intermediate; import software.amazon.awssdk.codegen.model.service.Location; import software.amazon.awssdk.core.protocol.MarshallLocation; public class ParameterHttpMapping { private String unmarshallLocationName; private String marshallLocationName; private String additionalUnmarshallingPath; private String additionalMarshallingPath; private boolean isPayload; private boolean isStreaming; private Location location; private boolean flattened; private boolean isGreedy; private boolean requiresLength; public boolean getIsPayload() { return isPayload; } public void setPayload(boolean isPayload) { this.isPayload = isPayload; } public ParameterHttpMapping withPayload(boolean isPayload) { this.isPayload = isPayload; return this; } public boolean getIsStreaming() { return isStreaming; } public void setStreaming(boolean isStreaming) { this.isStreaming = isStreaming; } public ParameterHttpMapping withStreaming(boolean isStreaming) { this.isStreaming = isStreaming; return this; } public Location getLocation() { return location; } public void setLocation(Location location) { this.location = location; } public ParameterHttpMapping withLocation(Location location) { this.location = location; return this; } public boolean isHeader() { return this.location == Location.HEADER; } public boolean isUri() { return this.location == Location.URI; } public boolean isStatusCode() { return this.location == Location.STATUS_CODE; } public boolean isQueryString() { return this.location == Location.QUERY_STRING; } public boolean isFlattened() { return flattened; } public void setFlattened(boolean flattened) { this.flattened = flattened; } public ParameterHttpMapping withFlattened(boolean flattened) { this.flattened = flattened; return this; } public String getUnmarshallLocationName() { return unmarshallLocationName; } public void setUnmarshallLocationName(String unmarshallLocationName) { this.unmarshallLocationName = unmarshallLocationName; } public ParameterHttpMapping withUnmarshallLocationName(String unmarshallLocationName) { this.unmarshallLocationName = unmarshallLocationName; return this; } public String getMarshallLocationName() { return marshallLocationName; } public void setMarshallLocationName(String marshallLocationName) { this.marshallLocationName = marshallLocationName; } public ParameterHttpMapping withMarshallLocationName(String marshallLocationName) { this.marshallLocationName = marshallLocationName; return this; } public String getAdditionalUnmarshallingPath() { return additionalUnmarshallingPath; } public void setAdditionalUnmarshallingPath(String additionalUnmarshallingPath) { this.additionalUnmarshallingPath = additionalUnmarshallingPath; } public ParameterHttpMapping withAdditionalUnmarshallingPath(String additionalUnmarshallingPath) { this.additionalUnmarshallingPath = additionalUnmarshallingPath; return this; } public String getAdditionalMarshallingPath() { return additionalMarshallingPath; } public void setAdditionalMarshallingPath(String additionalMarshallingPath) { this.additionalMarshallingPath = additionalMarshallingPath; } public ParameterHttpMapping withAdditionalMarshallingPath(String additionalMarshallingPath) { this.additionalMarshallingPath = additionalMarshallingPath; return this; } public boolean isGreedy() { return isGreedy; } public ParameterHttpMapping setIsGreedy(boolean greedy) { isGreedy = greedy; return this; } public ParameterHttpMapping withIsGreedy(boolean greedy) { setIsGreedy(greedy); return this; } public boolean isRequiresLength() { return requiresLength; } public void setRequiresLength(boolean requiresLength) { this.requiresLength = requiresLength; } public ParameterHttpMapping withRequiresLength(boolean requiresLength) { setRequiresLength(requiresLength); return this; } public MarshallLocation getMarshallLocation() { if (location == null) { return MarshallLocation.PAYLOAD; } switch (location) { default: return MarshallLocation.PAYLOAD; case STATUS_CODE: return MarshallLocation.STATUS_CODE; case HEADER: case HEADERS: return MarshallLocation.HEADER; case QUERY_STRING: return MarshallLocation.QUERY_PARAM; case URI: return isGreedy ? MarshallLocation.GREEDY_PATH : MarshallLocation.PATH; } } }
3,581
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/DocumentationModel.java
/* * 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.model.intermediate; import static software.amazon.awssdk.codegen.internal.DocumentationUtils.escapeIllegalCharacters; public class DocumentationModel { protected String documentation; public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = escapeIllegalCharacters(documentation); } }
3,582
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/customization/ShapeCustomizationInfo.java
/* * 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.model.intermediate.customization; import com.fasterxml.jackson.annotation.JsonIgnore; public class ShapeCustomizationInfo { private ArtificialResultWrapper artificialResultWrapper; private boolean skipGeneratingModelClass; private boolean skipGeneratingMarshaller; private boolean skipGeneratingUnmarshaller; private int staxTargetDepthOffset; private boolean hasStaxTargetDepthOffset = false; public ArtificialResultWrapper getArtificialResultWrapper() { return artificialResultWrapper; } public void setArtificialResultWrapper( ArtificialResultWrapper artificialResultWrapper) { this.artificialResultWrapper = artificialResultWrapper; } public boolean isSkipGeneratingModelClass() { return skipGeneratingModelClass; } public void setSkipGeneratingModelClass(boolean skipGeneratingModelClass) { this.skipGeneratingModelClass = skipGeneratingModelClass; } public boolean isSkipGeneratingMarshaller() { return skipGeneratingMarshaller; } public void setSkipGeneratingMarshaller(boolean skipGeneratingMarshaller) { this.skipGeneratingMarshaller = skipGeneratingMarshaller; } public boolean isSkipGeneratingUnmarshaller() { return skipGeneratingUnmarshaller; } public void setSkipGeneratingUnmarshaller(boolean skipGeneratingUnmarshaller) { this.skipGeneratingUnmarshaller = skipGeneratingUnmarshaller; } public Integer getStaxTargetDepthOffset() { return staxTargetDepthOffset; } public void setStaxTargetDepthOffset(int staxTargetDepthOffset) { hasStaxTargetDepthOffset = true; this.staxTargetDepthOffset = staxTargetDepthOffset; } @JsonIgnore public boolean hasStaxTargetDepthOffset() { return hasStaxTargetDepthOffset; } }
3,583
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/customization/ArtificialResultWrapper.java
/* * 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.model.intermediate.customization; public class ArtificialResultWrapper { private String wrappedMemberName; private String wrappedMemberSimpleType; public String getWrappedMemberName() { return wrappedMemberName; } public void setWrappedMemberName(String wrappedMemberName) { this.wrappedMemberName = wrappedMemberName; } public String getWrappedMemberSimpleType() { return wrappedMemberSimpleType; } public void setWrappedMemberSimpleType(String wrappedMemberSimpleType) { this.wrappedMemberSimpleType = wrappedMemberSimpleType; } }
3,584
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/NotExpression.java
/* * 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.jmespath.component; /** * A not-expression negates the result of an expression. If the expression results in a truth-like value, a * not-expression will change this value to false. If the expression results in a false-like value, a not-expression will * change this value to true. * * https://jmespath.org/specification.html#not-expressions */ public class NotExpression { private final Expression expression; public NotExpression(Expression expression) { this.expression = expression; } public Expression expression() { return expression; } }
3,585
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/BracketSpecifierWithoutContents.java
/* * 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.jmespath.component; /** * A {@link BracketSpecifier} without content, i.e. []. */ public class BracketSpecifierWithoutContents { }
3,586
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/ParenExpression.java
/* * 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.jmespath.component; /** * A paren-expression allows a user to override the precedence order of an expression, e.g. (a || b) && c. * * https://jmespath.org/specification.html#paren-expressions */ public class ParenExpression { private final Expression expression; public ParenExpression(Expression expression) { this.expression = expression; } public Expression expression() { return expression; } }
3,587
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/WildcardExpression.java
/* * 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.jmespath.component; /** * A wildcard expression is a expression of either * or [*]. A wildcard expression can return multiple elements, and the * remaining expressions are evaluated against each returned element from a wildcard expression. The [*] syntax applies to a * list type and the * syntax applies to a hash type. * * https://jmespath.org/specification.html#wildcard-expressions */ public class WildcardExpression { }
3,588
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/BracketSpecifier.java
/* * 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.jmespath.component; import software.amazon.awssdk.codegen.jmespath.parser.JmesPathVisitor; import software.amazon.awssdk.utils.Validate; /** * A bracket specifier within an {@link IndexExpression}. Either: * <ul> * <li>With content, as in [1], [*] or [1:2:3]: {@link BracketSpecifierWithContents}</li> * <li>Without content, as in []: {@link BracketSpecifierWithContents}</li> * <li>With question-mark content, as in [?foo]: {@link BracketSpecifierWithQuestionMark}</li> * </ul> */ public class BracketSpecifier { private BracketSpecifierWithContents bracketSpecifierWithContents; private BracketSpecifierWithoutContents bracketSpecifierWithoutContents; private BracketSpecifierWithQuestionMark bracketSpecifierWithQuestionMark; public static BracketSpecifier withContents(BracketSpecifierWithContents bracketSpecifierWithContents) { Validate.notNull(bracketSpecifierWithContents, "bracketSpecifierWithContents"); BracketSpecifier result = new BracketSpecifier(); result.bracketSpecifierWithContents = bracketSpecifierWithContents; return result; } public static BracketSpecifier withNumberContents(int numberContents) { return withContents(BracketSpecifierWithContents.number(numberContents)); } public static BracketSpecifier withSliceExpressionContents(SliceExpression sliceExpression) { return withContents(BracketSpecifierWithContents.sliceExpression(sliceExpression)); } public static BracketSpecifier withWildcardExpressionContents(WildcardExpression wildcardExpression) { return withContents(BracketSpecifierWithContents.wildcardExpression(wildcardExpression)); } public static BracketSpecifier withoutContents() { BracketSpecifier result = new BracketSpecifier(); result.bracketSpecifierWithoutContents = new BracketSpecifierWithoutContents(); return result; } public static BracketSpecifier withQuestionMark(BracketSpecifierWithQuestionMark bracketSpecifierWithQuestionMark) { Validate.notNull(bracketSpecifierWithQuestionMark, "bracketSpecifierWithQuestionMark"); BracketSpecifier result = new BracketSpecifier(); result.bracketSpecifierWithQuestionMark = bracketSpecifierWithQuestionMark; return result; } public boolean isBracketSpecifierWithContents() { return bracketSpecifierWithContents != null; } public boolean isBracketSpecifierWithoutContents() { return bracketSpecifierWithoutContents != null; } public boolean isBracketSpecifierWithQuestionMark() { return bracketSpecifierWithQuestionMark != null; } public BracketSpecifierWithContents asBracketSpecifierWithContents() { Validate.validState(isBracketSpecifierWithContents(), "Not a BracketSpecifierWithContents"); return bracketSpecifierWithContents; } public BracketSpecifierWithoutContents asBracketSpecifierWithoutContents() { Validate.validState(isBracketSpecifierWithoutContents(), "Not a BracketSpecifierWithoutContents"); return bracketSpecifierWithoutContents; } public BracketSpecifierWithQuestionMark asBracketSpecifierWithQuestionMark() { Validate.validState(isBracketSpecifierWithQuestionMark(), "Not a BracketSpecifierWithQuestionMark"); return bracketSpecifierWithQuestionMark; } public void visit(JmesPathVisitor visitor) { if (isBracketSpecifierWithContents()) { visitor.visitBracketSpecifierWithContents(asBracketSpecifierWithContents()); } else if (isBracketSpecifierWithoutContents()) { visitor.visitBracketSpecifierWithoutContents(asBracketSpecifierWithoutContents()); } else if (isBracketSpecifierWithQuestionMark()) { visitor.visitBracketSpecifierWithQuestionMark(asBracketSpecifierWithQuestionMark()); } else { throw new IllegalStateException(); } } }
3,589
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/SubExpression.java
/* * 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.jmespath.component; /** * A subexpression is a combination of two expressions separated by the ‘.’ char. A subexpression is evaluated as follows: * <ol> * <li>Evaluate the expression on the left with the original JSON document.</li> * <li>Evaluate the expression on the right with the result of the left expression evaluation.</li> * </ol> * * https://jmespath.org/specification.html#subexpressions */ public class SubExpression { private final Expression leftExpression; private final SubExpressionRight rightSide; public SubExpression(Expression leftExpression, SubExpressionRight rightSide) { this.leftExpression = leftExpression; this.rightSide = rightSide; } public Expression leftExpression() { return leftExpression; } public SubExpressionRight rightSubExpression() { return rightSide; } }
3,590
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/ComparatorExpression.java
/* * 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.jmespath.component; /** * A comparator expression is two expressions separated by a {@link Comparator}. * * Examples: * <ul> * <li>Foo == Bar</li> * <li>Bar <= `101</li> * </ul> */ public class ComparatorExpression { private final Expression leftExpression; private final Comparator comparator; private final Expression rightExpression; public ComparatorExpression(Expression leftExpression, Comparator comparator, Expression rightExpression) { this.leftExpression = leftExpression; this.comparator = comparator; this.rightExpression = rightExpression; } public Expression leftExpression() { return leftExpression; } public Comparator comparator() { return comparator; } public Expression rightExpression() { return rightExpression; } }
3,591
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/MultiSelectList.java
/* * 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.jmespath.component; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; /** * A multiselect expression is used to extract a subset of elements from a JSON hash. Each expression in the multi-select-list * will be evaluated against the JSON document. Each returned element will be the result of evaluating the expression. * * https://jmespath.org/specification.html#multiselect-list */ public class MultiSelectList { private final List<Expression> expressions; public MultiSelectList(Expression... expressions) { this.expressions = Arrays.asList(expressions); } public MultiSelectList(Collection<Expression> expressions) { this.expressions = new ArrayList<>(expressions); } public List<Expression> expressions() { return Collections.unmodifiableList(expressions); } }
3,592
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/MultiSelectHash.java
/* * 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.jmespath.component; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; /** * A multi-select-hash expression is similar to a multi-select-list {@link MultiSelectList} expression, except that a hash is * created instead of a list. A multi-select-hash expression also requires key names to be provided, as specified in the * keyval-expr ({@link KeyValueExpression} rule. * * https://jmespath.org/specification.html#multiselect-hash */ public class MultiSelectHash { private final List<KeyValueExpression> expressions; public MultiSelectHash(KeyValueExpression... expressions) { this.expressions = Arrays.asList(expressions); } public MultiSelectHash(Collection<KeyValueExpression> expressions) { this.expressions = new ArrayList<>(expressions); } public List<KeyValueExpression> keyValueExpressions() { return Collections.unmodifiableList(expressions); } }
3,593
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/FunctionExpression.java
/* * 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.jmespath.component; import java.util.List; /** * A function allowing users to easily transform and filter data in JMESPath expressions. * * https://jmespath.org/specification.html#functions-expressions */ public class FunctionExpression { private final String function; private final List<FunctionArg> functionArgs; public FunctionExpression(String function, List<FunctionArg> functionArgs) { this.function = function; this.functionArgs = functionArgs; } public String function() { return function; } public List<FunctionArg> functionArgs() { return functionArgs; } }
3,594
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/CurrentNode.java
/* * 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.jmespath.component; /** * The current-node expression '@': https://jmespath.org/specification.html#current-node */ public class CurrentNode { }
3,595
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/Expression.java
/* * 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.jmespath.component; import software.amazon.awssdk.codegen.jmespath.parser.JmesPathVisitor; import software.amazon.awssdk.utils.Validate; /** * An expression is any statement that can be executed in isolation from other parts of a JMESPath string. Every valid JMESPath * string is an expression, usually made up of other expressions. * * Examples: https://jmespath.org/examples.html */ public class Expression { private SubExpression subExpression; private IndexExpression indexExpression; private ComparatorExpression comparatorExpression; private OrExpression orExpression; private String identifier; private AndExpression andExpression; private NotExpression notExpression; private ParenExpression parenExpression; private WildcardExpression wildcardExpression; private MultiSelectList multiSelectList; private MultiSelectHash multiSelectHash; private Literal literal; private FunctionExpression functionExpression; private PipeExpression pipeExpression; private String rawString; private CurrentNode currentNode; public static Expression subExpression(SubExpression subExpression) { Validate.notNull(subExpression, "subExpression"); Expression expression = new Expression(); expression.subExpression = subExpression; return expression; } public static Expression indexExpression(IndexExpression indexExpression) { Validate.notNull(indexExpression, "indexExpression"); Expression expression = new Expression(); expression.indexExpression = indexExpression; return expression; } public static Expression comparatorExpression(ComparatorExpression comparatorExpression) { Validate.notNull(comparatorExpression, "comparatorExpression"); Expression expression = new Expression(); expression.comparatorExpression = comparatorExpression; return expression; } public static Expression orExpression(OrExpression orExpression) { Validate.notNull(orExpression, "orExpression"); Expression expression = new Expression(); expression.orExpression = orExpression; return expression; } public static Expression identifier(String identifier) { Validate.notNull(identifier, "identifier"); Expression expression = new Expression(); expression.identifier = identifier; return expression; } public static Expression andExpression(AndExpression andExpression) { Validate.notNull(andExpression, "andExpression"); Expression expression = new Expression(); expression.andExpression = andExpression; return expression; } public static Expression notExpression(NotExpression notExpression) { Validate.notNull(notExpression, "notExpression"); Expression expression = new Expression(); expression.notExpression = notExpression; return expression; } public static Expression parenExpression(ParenExpression parenExpression) { Validate.notNull(parenExpression, "parenExpression"); Expression expression = new Expression(); expression.parenExpression = parenExpression; return expression; } public static Expression wildcardExpression(WildcardExpression wildcardExpression) { Validate.notNull(wildcardExpression, "wildcardExpression"); Expression expression = new Expression(); expression.wildcardExpression = wildcardExpression; return expression; } public static Expression multiSelectList(MultiSelectList multiSelectList) { Validate.notNull(multiSelectList, "multiSelectList"); Expression expression = new Expression(); expression.multiSelectList = multiSelectList; return expression; } public static Expression multiSelectHash(MultiSelectHash multiSelectHash) { Validate.notNull(multiSelectHash, "multiSelectHash"); Expression expression = new Expression(); expression.multiSelectHash = multiSelectHash; return expression; } public static Expression literal(Literal literal) { Validate.notNull(literal, "literal"); Expression expression = new Expression(); expression.literal = literal; return expression; } public static Expression functionExpression(FunctionExpression functionExpression) { Validate.notNull(functionExpression, "functionExpression"); Expression expression = new Expression(); expression.functionExpression = functionExpression; return expression; } public static Expression pipeExpression(PipeExpression pipeExpression) { Validate.notNull(pipeExpression, "pipeExpression"); Expression expression = new Expression(); expression.pipeExpression = pipeExpression; return expression; } public static Expression rawString(String rawString) { Validate.notNull(rawString, "rawString"); Expression expression = new Expression(); expression.rawString = rawString; return expression; } public static Expression currentNode(CurrentNode currentNode) { Validate.notNull(currentNode, "currentNode"); Expression expression = new Expression(); expression.currentNode = currentNode; return expression; } public boolean isSubExpression() { return subExpression != null; } public boolean isIndexExpression() { return indexExpression != null; } public boolean isComparatorExpression() { return comparatorExpression != null; } public boolean isOrExpression() { return orExpression != null; } public boolean isIdentifier() { return identifier != null; } public boolean isAndExpression() { return andExpression != null; } public boolean isNotExpression() { return notExpression != null; } public boolean isParenExpression() { return parenExpression != null; } public boolean isWildcardExpression() { return wildcardExpression != null; } public boolean isMultiSelectList() { return multiSelectList != null; } public boolean isMultiSelectHash() { return multiSelectHash != null; } public boolean isLiteral() { return literal != null; } public boolean isFunctionExpression() { return functionExpression != null; } public boolean isPipeExpression() { return pipeExpression != null; } public boolean isRawString() { return rawString != null; } public boolean isCurrentNode() { return currentNode != null; } public SubExpression asSubExpression() { Validate.validState(isSubExpression(), "Not a SubExpression"); return subExpression; } public IndexExpression asIndexExpression() { Validate.validState(isIndexExpression(), "Not a IndexExpression"); return indexExpression; } public ComparatorExpression asComparatorExpression() { Validate.validState(isComparatorExpression(), "Not a ComparatorExpression"); return comparatorExpression; } public OrExpression asOrExpression() { Validate.validState(isOrExpression(), "Not a OrExpression"); return orExpression; } public String asIdentifier() { Validate.validState(isIdentifier(), "Not a Identifier"); return identifier; } public AndExpression asAndExpression() { Validate.validState(isAndExpression(), "Not a AndExpression"); return andExpression; } public NotExpression asNotExpression() { Validate.validState(isNotExpression(), "Not a NotExpression"); return notExpression; } public ParenExpression asParenExpression() { Validate.validState(isParenExpression(), "Not a ParenExpression"); return parenExpression; } public WildcardExpression asWildcardExpression() { Validate.validState(isWildcardExpression(), "Not a WildcardExpression"); return wildcardExpression; } public MultiSelectList asMultiSelectList() { Validate.validState(isMultiSelectList(), "Not a MultiSelectList"); return multiSelectList; } public MultiSelectHash asMultiSelectHash() { Validate.validState(isMultiSelectHash(), "Not a MultiSelectHash"); return multiSelectHash; } public Literal asLiteral() { Validate.validState(isLiteral(), "Not a Literal"); return literal; } public FunctionExpression asFunctionExpression() { Validate.validState(isFunctionExpression(), "Not a FunctionExpression"); return functionExpression; } public PipeExpression asPipeExpression() { Validate.validState(isPipeExpression(), "Not a PipeExpression"); return pipeExpression; } public String asRawString() { Validate.validState(isRawString(), "Not a RawString"); return rawString; } public CurrentNode asCurrentNode() { Validate.validState(isCurrentNode(), "Not a CurrentNode"); return currentNode; } public void visit(JmesPathVisitor visitor) { if (isSubExpression()) { visitor.visitSubExpression(asSubExpression()); } else if (isIndexExpression()) { visitor.visitIndexExpression(asIndexExpression()); } else if (isComparatorExpression()) { visitor.visitComparatorExpression(asComparatorExpression()); } else if (isOrExpression()) { visitor.visitOrExpression(asOrExpression()); } else if (isIdentifier()) { visitor.visitIdentifier(asIdentifier()); } else if (isAndExpression()) { visitor.visitAndExpression(asAndExpression()); } else if (isNotExpression()) { visitor.visitNotExpression(asNotExpression()); } else if (isParenExpression()) { visitor.visitParenExpression(asParenExpression()); } else if (isWildcardExpression()) { visitor.visitWildcardExpression(asWildcardExpression()); } else if (isMultiSelectList()) { visitor.visitMultiSelectList(asMultiSelectList()); } else if (isMultiSelectHash()) { visitor.visitMultiSelectHash(asMultiSelectHash()); } else if (isLiteral()) { visitor.visitLiteral(asLiteral()); } else if (isFunctionExpression()) { visitor.visitFunctionExpression(asFunctionExpression()); } else if (isPipeExpression()) { visitor.visitPipeExpression(asPipeExpression()); } else if (isRawString()) { visitor.visitRawString(asRawString()); } else if (isCurrentNode()) { visitor.visitCurrentNode(asCurrentNode()); } else { throw new IllegalStateException(); } } }
3,596
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/OrExpression.java
/* * 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.jmespath.component; /** * An or expression will evaluate to either the left expression or the right expression. If the evaluation of the left * expression is not false it is used as the return value. If the evaluation of the right expression is not false it is * used as the return value. If neither the left or right expression are non-null, then a value of null is returned. * * Examples: * <ul> * <li>True || False</li> * <li>Number || EmptyList</li> * <li>a == `1` || b == `2`</li> * </ul> * * https://jmespath.org/specification.html#or-expressions */ public class OrExpression { private final Expression leftExpression; private final Expression rightExpression; public OrExpression(Expression leftExpression, Expression rightExpression) { this.leftExpression = leftExpression; this.rightExpression = rightExpression; } public Expression leftExpression() { return leftExpression; } public Expression rightExpression() { return rightExpression; } }
3,597
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/BracketSpecifierWithQuestionMark.java
/* * 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.jmespath.component; /** * A {@link BracketSpecifier} with a question-mark expression, as in [?Foo]. */ public class BracketSpecifierWithQuestionMark { private final Expression expression; public BracketSpecifierWithQuestionMark(Expression expression) { this.expression = expression; } public Expression expression() { return expression; } }
3,598
0
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath
Create_ds/aws-sdk-java-v2/codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/KeyValueExpression.java
/* * 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.jmespath.component; /** * A key-value expression within a {@link MultiSelectHash}. */ public class KeyValueExpression { private final String key; private final Expression value; public KeyValueExpression(String key, Expression value) { this.key = key; this.value = value; } public String key() { return key; } public Expression value() { return value; } }
3,599