internal static void BackgroundSDKDefaultConfigValidation()

in src/Aspire.Hosting.AWS/SdkUtilities.cs [79:95]


    internal static void BackgroundSDKDefaultConfigValidation(ILogger logger)
    {
        var chain = new Amazon.Runtime.CredentialManagement.CredentialProfileStoreChain();
        var profiles = chain.ListProfiles();

        // If there are no profiles then the developer is unlikely connecting in the dev environment
        // to AWS with the SDK. In this case it doesn't make sense to validate credentials.
        if (profiles.Count == 0)
            return;

        // If there is not a default profile then skip validating it.
        var defaultProfile = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("AWS_PROFILE")) ? Environment.GetEnvironmentVariable("AWS_PROFILE") : SharedCredentialsFile.DefaultProfileName;
        if (profiles.FirstOrDefault(x => string.Equals(defaultProfile, x.Name)) == null)
            return;

        _ = ValidateSdkConfigAsync(logger, new AWSSDKConfig(), true);
    }