public static void verifyAuthorizationTypeParameterMapping()

in aws-events-connection/src/main/java/software/amazon/events/connection/Utils.java [32:57]


    public static void verifyAuthorizationTypeParameterMapping(ResourceModel model){
        final String type = model.getAuthorizationType();
        final AuthParameters parameters = model.getAuthParameters();

        switch (ConnectionAuthorizationType.valueOf(type)) {
            case BASIC:
                if (parameters.getBasicAuthParameters() == null) {
                    throw new CfnInvalidRequestException("BasicAuthParameters not provided for BASIC AuthorizationType.");
                }
                break;
            case API_KEY:
                if (parameters.getApiKeyAuthParameters() == null) {
                    throw new CfnInvalidRequestException("ApiKeyAuthParameters not provided for API_KEY AuthorizationType.");
                }
                break;
            case OAUTH_CLIENT_CREDENTIALS:
                if (parameters.getOAuthParameters() == null) {
                    throw new CfnInvalidRequestException("OAuthParameters not provided for OAUTH_CLIENT_CREDENTIALS AuthorizationType.");
                }
                break;
            default:
                throw new CfnGeneralServiceException(String.format("Couldn't create %s due to invalid authorization type: %s",
                        ResourceModel.TYPE_NAME, type));
        }

    }