Search in sources :

Example 6 with ConfigDataResourceNotFoundException

use of org.springframework.boot.context.config.ConfigDataResourceNotFoundException in project spring-cloud-aws by awspring.

the class AwsParamStoreConfigDataLoader method load.

@Override
public ConfigData load(ConfigDataLoaderContext context, AwsParamStoreConfigDataResource resource) {
    try {
        AWSSimpleSystemsManagement ssm = context.getBootstrapContext().get(AWSSimpleSystemsManagement.class);
        AwsParamStorePropertySource propertySource = resource.getPropertySources().createPropertySource(resource.getContext(), resource.isOptional(), ssm);
        if (propertySource != null) {
            return new ConfigData(Collections.singletonList(propertySource));
        } else {
            return null;
        }
    } catch (Exception e) {
        throw new ConfigDataResourceNotFoundException(resource, e);
    }
}
Also used : AwsParamStorePropertySource(io.awspring.cloud.paramstore.AwsParamStorePropertySource) ConfigData(org.springframework.boot.context.config.ConfigData) ConfigDataResourceNotFoundException(org.springframework.boot.context.config.ConfigDataResourceNotFoundException) AWSSimpleSystemsManagement(com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagement) ConfigDataResourceNotFoundException(org.springframework.boot.context.config.ConfigDataResourceNotFoundException)

Aggregations

ConfigData (org.springframework.boot.context.config.ConfigData)6 ConfigDataResourceNotFoundException (org.springframework.boot.context.config.ConfigDataResourceNotFoundException)6 ArrayList (java.util.ArrayList)2 Nullable (org.springframework.lang.Nullable)2 AWSSecretsManager (com.amazonaws.services.secretsmanager.AWSSecretsManager)1 AWSSimpleSystemsManagement (com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagement)1 ConsulClient (com.ecwid.consul.v1.ConsulClient)1 ParameterStorePropertySource (io.awspring.cloud.parameterstore.ParameterStorePropertySource)1 AwsParamStorePropertySource (io.awspring.cloud.paramstore.AwsParamStorePropertySource)1 AwsSecretsManagerPropertySource (io.awspring.cloud.secretsmanager.AwsSecretsManagerPropertySource)1 SecretsManagerPropertySource (io.awspring.cloud.secretsmanager.SecretsManagerPropertySource)1 CuratorFramework (org.apache.curator.framework.CuratorFramework)1 Option (org.springframework.boot.context.config.ConfigData.Option)1 SecretsManagerClient (software.amazon.awssdk.services.secretsmanager.SecretsManagerClient)1 SsmClient (software.amazon.awssdk.services.ssm.SsmClient)1