|
63 | 63 | import software.amazon.awssdk.codegen.poet.rules.EndpointParamsKnowledgeIndex;
|
64 | 64 | import software.amazon.awssdk.codegen.poet.rules.EndpointRulesSpecUtils;
|
65 | 65 | import software.amazon.awssdk.codegen.utils.AuthUtils;
|
| 66 | +import software.amazon.awssdk.codegen.validation.ModelInvalidException; |
| 67 | +import software.amazon.awssdk.codegen.validation.ValidationEntry; |
| 68 | +import software.amazon.awssdk.codegen.validation.ValidationErrorId; |
| 69 | +import software.amazon.awssdk.codegen.validation.ValidationErrorSeverity; |
66 | 70 | import software.amazon.awssdk.core.SdkPlugin;
|
67 | 71 | import software.amazon.awssdk.core.checksums.RequestChecksumCalculation;
|
68 | 72 | import software.amazon.awssdk.core.checksums.RequestChecksumCalculationResolver;
|
@@ -320,11 +324,20 @@ private MethodSpec mergeServiceDefaultsMethod() {
|
320 | 324 |
|
321 | 325 | private void configureEnvironmentBearerToken(MethodSpec.Builder builder) {
|
322 | 326 | if (!authSchemeSpecUtils.useSraAuth()) {
|
323 |
| - throw new IllegalStateException("The enableEnvironmentBearerToken customization requires SRA Auth."); |
| 327 | + ValidationEntry entry = ValidationEntry.create(ValidationErrorId.INVALID_CODEGEN_CUSTOMIZATION, |
| 328 | + ValidationErrorSeverity.DANGER, |
| 329 | + "The enableEnvironmentBearerToken customization requires" |
| 330 | + + " the SRA Auth customization."); |
| 331 | + |
| 332 | + throw ModelInvalidException.fromEntry(entry); |
324 | 333 | }
|
325 | 334 | if (!AuthUtils.usesBearerAuth(model)) {
|
326 |
| - throw new IllegalStateException("The enableEnvironmentBearerToken customization requires the service to model and " |
327 |
| - + "support smithy.api#httpBearerAuth."); |
| 335 | + ValidationEntry entry = |
| 336 | + ValidationEntry.create( ValidationErrorId.INVALID_CODEGEN_CUSTOMIZATION, ValidationErrorSeverity.DANGER, |
| 337 | + "The enableEnvironmentBearerToken customization requires the service to model" |
| 338 | + + " and support smithy.api#httpBearerAuth."); |
| 339 | + |
| 340 | + throw ModelInvalidException.fromEntry(entry); |
328 | 341 | }
|
329 | 342 |
|
330 | 343 | builder.addStatement("$T tokenFromEnv = new $T().getStringValue()",
|
|
0 commit comments