in tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/generators/cpp/CppClientGenerator.java [225:251]
private void CheckAndEnableSigV4A(final ServiceModel serviceModel, VelocityContext context) {
List<String> c2jAuthList = serviceModel.getMetadata().getAuth();
String serviceId = serviceModel.getMetadata().getServiceId();
if (c2jAuthList != null && c2jAuthList.contains("aws.auth#sigv4a") ||
servicesMissingMultiAuthMRAPTrait.contains(serviceId)) {
context.put("multiRegionAccessPointSupported", true);
}
// todo: remove these checks later
if (!context.containsKey("multiRegionAccessPointSupported")) {
boolean hasSigV4AOperation = serviceModel.getOperations().values().stream()
.anyMatch(op -> op.getAuth() != null && op.getAuth().contains("aws.auth#sigv4a"));
if (serviceModel.getEndpointRules() != null &&
(serviceModel.getEndpointRules().contains("\"sigv4a\"") || hasSigV4AOperation)) {
throw new RuntimeException("Endpoint rules or operation reference sigv4a auth scheme but c2j model " + serviceId +
" does not list aws.auth#sigv4a as a supported auth!");
}
}
if (c2jAuthList != null) {
boolean hasSigV4AndBearer = c2jAuthList.contains("smithy.api#httpBearerAuth") &&
(c2jAuthList.contains("aws.auth#sigv4a") || c2jAuthList.contains("aws.auth#sigv4"));
if (!serviceModel.isUseSmithyClient() && hasSigV4AndBearer) {
throw new RuntimeException("SDK Clients cannot mix AWS and Bearer Credentials without enabling Smithy Identity!");
}
}
}