Search in sources :

Example 1 with AwsParamStorePropertySource

use of io.awspring.cloud.paramstore.AwsParamStorePropertySource 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

AWSSimpleSystemsManagement (com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagement)1 AwsParamStorePropertySource (io.awspring.cloud.paramstore.AwsParamStorePropertySource)1 ConfigData (org.springframework.boot.context.config.ConfigData)1 ConfigDataResourceNotFoundException (org.springframework.boot.context.config.ConfigDataResourceNotFoundException)1