diff --git a/docs/pom.xml b/docs/pom.xml
index eac4c560e..6e2133981 100644
--- a/docs/pom.xml
+++ b/docs/pom.xml
@@ -22,10 +22,10 @@
org.springframework.cloud
spring-cloud-aws
- 2.3.0.BUILD-SNAPSHOT
+ 3.0.0-SNAPSHOT
spring-cloud-aws-docs
- pom
+ jar
Spring Cloud AWS Docs
Spring Cloud AWS Docs
@@ -86,6 +86,10 @@
org.apache.maven.plugins
maven-antrun-plugin
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+
maven-deploy-plugin
diff --git a/pom.xml b/pom.xml
index 23f1f1915..1e810bb9d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,12 +22,12 @@
org.springframework.cloud
spring-cloud-build
- 2.3.2.BUILD-SNAPSHOT
+ 3.0.0-SNAPSHOT
spring-cloud-aws
- 2.3.0.BUILD-SNAPSHOT
+ 3.0.0-SNAPSHOT
pom
Spring Cloud AWS
Spring Cloud AWS
@@ -59,11 +59,13 @@
spring-cloud-aws-messaging
spring-cloud-aws-autoconfigure
spring-cloud-aws-parameter-store-config
+ spring-cloud-aws-appconfig
spring-cloud-aws-secrets-manager-config
spring-cloud-starter-aws
spring-cloud-starter-aws-jdbc
spring-cloud-starter-aws-messaging
spring-cloud-starter-aws-parameter-store-config
+ spring-cloud-starter-aws-appconfig
spring-cloud-starter-aws-secrets-manager-config
spring-cloud-aws-integration-test
docs
diff --git a/spring-cloud-aws-appconfig/pom.xml b/spring-cloud-aws-appconfig/pom.xml
new file mode 100644
index 000000000..6f43836b3
--- /dev/null
+++ b/spring-cloud-aws-appconfig/pom.xml
@@ -0,0 +1,49 @@
+
+
+
+ 4.0.0
+
+ org.springframework.cloud
+ spring-cloud-aws
+ 3.0.0-SNAPSHOT
+
+
+ spring-cloud-aws-appconfig
+
+ Spring Cloud AWS AppConfig Configuration
+ Spring Cloud AWS AppConfig Configuration
+
+
+
+
+ org.springframework
+ spring-context
+
+
+
+ org.springframework.cloud
+ spring-cloud-context
+
+
+
+ com.amazonaws
+ aws-java-sdk-appconfig
+
+
+
diff --git a/spring-cloud-aws-appconfig/src/main/java/org/springframework/cloud/aws/appconfig/AwsAppConfigPropertySource.java b/spring-cloud-aws-appconfig/src/main/java/org/springframework/cloud/aws/appconfig/AwsAppConfigPropertySource.java
new file mode 100644
index 000000000..052612664
--- /dev/null
+++ b/spring-cloud-aws-appconfig/src/main/java/org/springframework/cloud/aws/appconfig/AwsAppConfigPropertySource.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2013-2020 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License 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 org.springframework.cloud.aws.appconfig;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.Set;
+
+import com.amazonaws.services.appconfig.AmazonAppConfig;
+import com.amazonaws.services.appconfig.model.GetConfigurationRequest;
+import com.amazonaws.services.appconfig.model.GetConfigurationResult;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
+import org.springframework.core.env.EnumerablePropertySource;
+import org.springframework.core.io.ByteArrayResource;
+import org.springframework.util.ReflectionUtils;
+
+/**
+ * @author jarpz
+ */
+public class AwsAppConfigPropertySource extends EnumerablePropertySource {
+
+ private static final String SUPPORTED_TYPE_JSON = "application/json";
+
+ private static final String SUPPORTED_TYPE_YAML = "application/x-yaml";
+
+ private final String clientId;
+
+ private final String application;
+
+ private final String configurationVersion;
+
+ private final String environment;
+
+ private Properties properties;
+
+ public AwsAppConfigPropertySource(String name, String clientId, String application, String environment,
+ String configurationVersion, AmazonAppConfig appConfigClient) {
+ super(name, appConfigClient);
+ this.clientId = clientId;
+ this.application = application;
+ this.configurationVersion = configurationVersion;
+ this.environment = environment;
+ }
+
+ public void init() {
+ GetConfigurationRequest request = new GetConfigurationRequest().withClientId(clientId)
+ .withApplication(application).withConfiguration(name)
+ .withClientConfigurationVersion(configurationVersion).withEnvironment(environment);
+
+ getAppConfig(request);
+ }
+
+ @Override
+ public String[] getPropertyNames() {
+ Set strings = properties.stringPropertyNames();
+ return strings.toArray(new String[0]);
+ }
+
+ @Override
+ public Object getProperty(String name) {
+ return properties.get(name);
+ }
+
+ private void getAppConfig(GetConfigurationRequest request) {
+ GetConfigurationResult result = this.source.getConfiguration(request);
+
+ logger.trace(String.format("loading file: %s/%s/%s/%s", application, name, environment,
+ result.getConfigurationVersion()));
+
+ switch (result.getContentType()) {
+ case SUPPORTED_TYPE_YAML:
+ processYamlContent(result.getContent());
+ break;
+ case SUPPORTED_TYPE_JSON:
+ processJsonContent(result.getContent());
+ break;
+ default:
+ throw new IllegalStateException(String.format("Unsupported content type: %s", result.getContentType()));
+ }
+ }
+
+ private void processYamlContent(ByteBuffer byteBuffer) {
+ YamlPropertiesFactoryBean bean = new YamlPropertiesFactoryBean();
+
+ bean.setResources(new ByteArrayResource(byteBuffer.array()));
+
+ properties = bean.getObject();
+ }
+
+ private void processJsonContent(ByteBuffer byteBuffer) {
+ try {
+ Map map = new ObjectMapper().readValue(byteBuffer.array(),
+ new TypeReference