// Path: appender-core/src/main/java/com/van/logging/utils/StringUtils.java
// public class StringUtils {
// 
//     /**
//      * Checks to see if a String is defined and not empty after trimming
//      *
//      * @param s the String to test
//      *
//      * @return true if the string is not null and is not empty
//      */
//     public static boolean isTruthy(String s) {
//         return (null != s && !s.trim().isEmpty());
//     }
// 
//     /**
//      * If the string passed in is not blank or null and did not end with the trailing value, then the trailing value
//      * will be appended to it in the returned value.
//      *
//      * @param s the string to conditionally add the trailing value to. If null, then null will be returned.
//      * @param trailing the trailing value to append. If null, then s will be returned unmodified.
//      *
//      * @return the string s with the trailing value appended as necessary.
//      */
//     public static String addTrailingIfNeeded(String s, String trailing) {
//         String value = s;
//         if ((null != s) && (null != trailing)) {
//             if (isTruthy(s) && !s.endsWith(trailing)) {
//                 value = s + trailing;
//             }
//         }
//         return value;
//     }
// }


import com.amazonaws.auth.*;
import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.regions.Region;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.van.logging.utils.StringUtils;
     * secretKey are null, then the default credential configuration for AWS is used.
     *
     * Similarly, if region is null, then the default region is used.
     *
     * See https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html and
     * https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/java-dg-region-selection.html
     *
     * @param accessKey optional access key for S3 access.
     * @param secretKey optional secret key for S3 access.
     * @param sessionToken optional session token for S3 access.
     * @param region optional region to use.
     * @param serviceEndpoint optional service endpoint to use when initializing the S3 Client.
     * @param signingRegion optional signing region to use when initializing the S3 Client.
     * @param pathStyleAccess optional boolean indicating if path style URL should be used
     *
     * @return the client class to use for S3 access.
     */
    public static AmazonS3 buildClient(
        String accessKey, String secretKey, String sessionToken,
        Region region,
        String serviceEndpoint, String signingRegion, boolean pathStyleAccess
    ) {
        AWSCredentialsProvider credentialsProvider =
            getCredentialsProvider(accessKey, secretKey, sessionToken);
        AmazonS3ClientBuilder builder = getS3ClientBuilder()
            .withCredentials(credentialsProvider)
            .withPathStyleAccessEnabled(pathStyleAccess);
        if (region != null) {
            builder = builder.withRegion(region.getName());
        }
// Path: appender-core/src/main/java/com/van/logging/utils/StringUtils.java
// public class StringUtils {
// 
//     /**
//      * Checks to see if a String is defined and not empty after trimming
//      *
//      * @param s the String to test
//      *
//      * @return true if the string is not null and is not empty
//      */
//     public static boolean isTruthy(String s) {
//         return (null != s && !s.trim().isEmpty());
//     }
// 
//     /**
//      * If the string passed in is not blank or null and did not end with the trailing value, then the trailing value
//      * will be appended to it in the returned value.
//      *
//      * @param s the string to conditionally add the trailing value to. If null, then null will be returned.
//      * @param trailing the trailing value to append. If null, then s will be returned unmodified.
//      *
//      * @return the string s with the trailing value appended as necessary.
//      */
//     public static String addTrailingIfNeeded(String s, String trailing) {
//         String value = s;
//         if ((null != s) && (null != trailing)) {
//             if (isTruthy(s) && !s.endsWith(trailing)) {
//                 value = s + trailing;
//             }
//         }
//         return value;
//     }
// }


// Path: appender-core/src/main/java/com/van/logging/aws/AwsClientHelpers.java
import com.amazonaws.auth.*;
import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.regions.Region;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.van.logging.utils.StringUtils;

     * secretKey are null, then the default credential configuration for AWS is used.
     *
     * Similarly, if region is null, then the default region is used.
     *
     * See https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html and
     * https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/java-dg-region-selection.html
     *
     * @param accessKey optional access key for S3 access.
     * @param secretKey optional secret key for S3 access.
     * @param sessionToken optional session token for S3 access.
     * @param region optional region to use.
     * @param serviceEndpoint optional service endpoint to use when initializing the S3 Client.
     * @param signingRegion optional signing region to use when initializing the S3 Client.
     * @param pathStyleAccess optional boolean indicating if path style URL should be used
     *
     * @return the client class to use for S3 access.
     */
    public static AmazonS3 buildClient(
        String accessKey, String secretKey, String sessionToken,
        Region region,
        String serviceEndpoint, String signingRegion, boolean pathStyleAccess
    ) {
        AWSCredentialsProvider credentialsProvider =
            getCredentialsProvider(accessKey, secretKey, sessionToken);
        AmazonS3ClientBuilder builder = getS3ClientBuilder()
            .withCredentials(credentialsProvider)
            .withPathStyleAccessEnabled(pathStyleAccess);
        if (region != null) {
            builder = builder.withRegion(region.getName());
        }
        if (StringUtils.isTruthy(serviceEndpoint)) {