/* * Copyright 2018 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 com.amazonaws.secretsmanager.sql; import com.amazonaws.secretsmanager.caching.SecretCache; import com.amazonaws.secretsmanager.caching.SecretCacheConfiguration; import com.amazonaws.services.secretsmanager.AWSSecretsManager; import com.amazonaws.services.secretsmanager.AWSSecretsManagerClientBuilder; /** * Dummy database driver wrapper. */ public class AWSSecretsManagerDummyDriver extends AWSSecretsManagerDriver { public static final String SUBPREFIX = "dummy"; /** * Constructs the driver setting the properties from the properties file using system properties as defaults. * Instantiates the secret cache with default options. */ public AWSSecretsManagerDummyDriver() { super(); } /** * Constructs the driver setting the properties from the properties file using system properties as defaults. * Uses the passed in SecretCache. */ public AWSSecretsManagerDummyDriver(SecretCache cache) { super(cache); } /** * Constructs the driver setting the properties from the properties file using system properties as defaults. * Instantiates the secret cache with the passed in client builder. * * @param builder Builder used to instantiate cache */ public AWSSecretsManagerDummyDriver(AWSSecretsManagerClientBuilder builder) { super(builder); } /** * Constructs the driver setting the properties from the properties file using system properties as defaults. * Instantiates the secret cache with the provided AWS Secrets Manager client. * * @param client AWS Secrets Manager client to instantiate cache */ public AWSSecretsManagerDummyDriver(AWSSecretsManager client) { super(client); } /** * Constructs the driver setting the properties from the properties file using system properties as defaults. * Instantiates the secret cache with the provided cache configuration. * * @param cacheConfig Cache configuration to instantiate cache */ public AWSSecretsManagerDummyDriver(SecretCacheConfiguration cacheConfig) { super(cacheConfig); } @Override public String getPropertySubprefix() { return SUBPREFIX; } public boolean exceptionIsDueToAuth; @Override public boolean isExceptionDueToAuthenticationError(Exception e) { return exceptionIsDueToAuth; } @Override public String constructUrlFromEndpointPortDatabase(String endpoint, String port, String dbname) { return "mysuperconnectionurl"; } @Override public String getDefaultDriverClass() { return "com.amazonaws.secretsmanager.sql.DummyDriver"; } }