-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: CloudWatch SDK * Update amazon-cloudwatch.adoc Amend docs description * Update pom.xml Co-authored-by: Sébastien Crocquesel <88554524+scrocquesel@users.noreply.github.com> * Update bom/pom.xml Co-authored-by: Sébastien Crocquesel <88554524+scrocquesel@users.noreply.github.com> * Update bom/pom.xml Co-authored-by: Sébastien Crocquesel <88554524+scrocquesel@users.noreply.github.com> * Update pom.xml * Add quarkus-amazon-cloudwatch.adoc * Fix documentation * Added some tests * Move the tests to the Integration module --------- Co-authored-by: Sébastien Crocquesel <88554524+scrocquesel@users.noreply.github.com>
- Loading branch information
1 parent
acaecf9
commit be1fbb2
Showing
25 changed files
with
4,656 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.quarkiverse.amazonservices</groupId> | ||
<artifactId>quarkus-amazon-cloudwatch-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>quarkus-amazon-cloudwatch-deployment</artifactId> | ||
<name>Quarkus - Amazon Services - CloudWatch - Deployment</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-core-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkiverse.amazonservices</groupId> | ||
<artifactId>quarkus-amazon-common-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkiverse.amazonservices</groupId> | ||
<artifactId>quarkus-amazon-cloudwatch</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkiverse.amazonservices</groupId> | ||
<artifactId>quarkus-amazon-devservices-cloudwatch</artifactId> | ||
</dependency> | ||
|
||
<!-- Test dependencies --> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5-internal</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.rest-assured</groupId> | ||
<artifactId>rest-assured</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>netty-nio-client</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<!-- Imported manually because conditional dependencies | ||
are not automatically added to test scope --> | ||
<dependency> | ||
<groupId>io.quarkiverse.amazonservices</groupId> | ||
<artifactId>quarkus-amazon-netty-client-internal-deployment</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>aws-crt-client</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>url-connection-client</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${quarkus.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
186 changes: 186 additions & 0 deletions
186
...deployment/src/main/java/io/quarkus/amazon/cloudwatch/deployment/CloudWatchProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
package io.quarkus.amazon.cloudwatch.deployment; | ||
|
||
import java.util.List; | ||
|
||
import org.jboss.jandex.DotName; | ||
|
||
import io.quarkus.amazon.cloudwatch.runtime.CloudWatchBuildTimeConfig; | ||
import io.quarkus.amazon.cloudwatch.runtime.CloudWatchClientProducer; | ||
import io.quarkus.amazon.cloudwatch.runtime.CloudWatchRecorder; | ||
import io.quarkus.amazon.common.deployment.*; | ||
import io.quarkus.amazon.common.deployment.spi.EventLoopGroupBuildItem; | ||
import io.quarkus.amazon.common.runtime.*; | ||
import io.quarkus.arc.deployment.AdditionalBeanBuildItem; | ||
import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; | ||
import io.quarkus.arc.deployment.SyntheticBeanBuildItem; | ||
import io.quarkus.deployment.Capabilities; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.annotations.ExecutionTime; | ||
import io.quarkus.deployment.annotations.Record; | ||
import io.quarkus.deployment.builditem.ExecutorBuildItem; | ||
import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem; | ||
import io.quarkus.deployment.builditem.FeatureBuildItem; | ||
import io.quarkus.deployment.builditem.LaunchModeBuildItem; | ||
import software.amazon.awssdk.services.cloudwatch.CloudWatchAsyncClient; | ||
import software.amazon.awssdk.services.cloudwatch.CloudWatchAsyncClientBuilder; | ||
import software.amazon.awssdk.services.cloudwatch.CloudWatchClient; | ||
import software.amazon.awssdk.services.cloudwatch.CloudWatchClientBuilder; | ||
|
||
public class CloudWatchProcessor extends AbstractAmazonServiceProcessor { | ||
|
||
private static final String AMAZON_CLOUDWATCH = "amazon-cloudwatch"; | ||
|
||
CloudWatchBuildTimeConfig buildTimeConfig; | ||
|
||
@Override | ||
protected String amazonServiceClientName() { | ||
return AMAZON_CLOUDWATCH; | ||
} | ||
|
||
@Override | ||
protected String configName() { | ||
return "cloudwatch"; | ||
} | ||
|
||
@Override | ||
protected DotName syncClientName() { | ||
return DotName.createSimple(CloudWatchClient.class.getName()); | ||
} | ||
|
||
@Override | ||
protected DotName asyncClientName() { | ||
return DotName.createSimple(CloudWatchAsyncClient.class.getName()); | ||
} | ||
|
||
@Override | ||
protected String builtinInterceptorsPath() { | ||
return "software/amazon/awssdk/services/cloudwatch/execution.interceptors"; | ||
} | ||
|
||
@BuildStep | ||
AdditionalBeanBuildItem producer() { | ||
return AdditionalBeanBuildItem.unremovableOf(CloudWatchClientProducer.class); | ||
} | ||
|
||
@BuildStep | ||
void setup( | ||
BuildProducer<ExtensionSslNativeSupportBuildItem> extensionSslNativeSupport, | ||
BuildProducer<FeatureBuildItem> feature, | ||
BuildProducer<AmazonClientInterceptorsPathBuildItem> interceptors) { | ||
|
||
setupExtension(extensionSslNativeSupport, feature, interceptors); | ||
} | ||
|
||
@BuildStep | ||
void discover(BeanRegistrationPhaseBuildItem beanRegistrationPhase, | ||
BuildProducer<RequireAmazonClientBuildItem> requireClientProducer) { | ||
|
||
discoverClient(beanRegistrationPhase, requireClientProducer); | ||
} | ||
|
||
@BuildStep | ||
void setupClient(List<RequireAmazonClientBuildItem> clientRequirements, | ||
BuildProducer<AmazonClientBuildItem> clientProducer) { | ||
|
||
setupClient(clientRequirements, clientProducer, buildTimeConfig.sdk(), buildTimeConfig.syncClient(), | ||
buildTimeConfig.asyncClient()); | ||
} | ||
|
||
@BuildStep(onlyIf = AmazonHttpClients.IsAmazonApacheHttpServicePresent.class) | ||
@Record(ExecutionTime.RUNTIME_INIT) | ||
void setupApacheSyncTransport(List<AmazonClientBuildItem> amazonClients, CloudWatchRecorder recorder, | ||
AmazonClientApacheTransportRecorder transportRecorder, | ||
BuildProducer<AmazonClientSyncTransportBuildItem> syncTransports) { | ||
|
||
createApacheSyncTransportBuilder(amazonClients, | ||
transportRecorder, | ||
buildTimeConfig.syncClient(), | ||
recorder.getSyncConfig(), | ||
syncTransports); | ||
} | ||
|
||
@BuildStep(onlyIf = AmazonHttpClients.IsAmazonAwsCrtHttpServicePresent.class) | ||
@Record(ExecutionTime.RUNTIME_INIT) | ||
void setupAwsCrtSyncTransport(List<AmazonClientBuildItem> amazonClients, CloudWatchRecorder recorder, | ||
AmazonClientAwsCrtTransportRecorder transportRecorder, | ||
BuildProducer<AmazonClientSyncTransportBuildItem> syncTransports) { | ||
|
||
createAwsCrtSyncTransportBuilder(amazonClients, | ||
transportRecorder, | ||
buildTimeConfig.syncClient(), | ||
recorder.getSyncConfig(), | ||
syncTransports); | ||
} | ||
|
||
@BuildStep(onlyIf = AmazonHttpClients.IsAmazonUrlConnectionHttpServicePresent.class) | ||
@Record(ExecutionTime.RUNTIME_INIT) | ||
void setupUrlConnectionSyncTransport(List<AmazonClientBuildItem> amazonClients, CloudWatchRecorder recorder, | ||
AmazonClientUrlConnectionTransportRecorder transportRecorder, | ||
BuildProducer<AmazonClientSyncTransportBuildItem> syncTransports) { | ||
|
||
createUrlConnectionSyncTransportBuilder(amazonClients, | ||
transportRecorder, | ||
buildTimeConfig.syncClient(), | ||
recorder.getSyncConfig(), | ||
syncTransports); | ||
} | ||
|
||
@BuildStep(onlyIf = AmazonHttpClients.IsAmazonNettyHttpServicePresent.class) | ||
@Record(ExecutionTime.RUNTIME_INIT) | ||
void setupNettyAsyncTransport(List<AmazonClientBuildItem> amazonClients, CloudWatchRecorder recorder, | ||
AmazonClientNettyTransportRecorder transportRecorder, | ||
BuildProducer<AmazonClientAsyncTransportBuildItem> asyncTransports, | ||
EventLoopGroupBuildItem eventLoopSupplier) { | ||
|
||
createNettyAsyncTransportBuilder(amazonClients, | ||
transportRecorder, | ||
buildTimeConfig.asyncClient(), | ||
recorder.getAsyncConfig(), | ||
asyncTransports, eventLoopSupplier.getMainEventLoopGroup()); | ||
} | ||
|
||
@BuildStep(onlyIf = AmazonHttpClients.IsAmazonAwsCrtHttpServicePresent.class) | ||
@Record(ExecutionTime.RUNTIME_INIT) | ||
void setupAwsCrtAsyncTransport(List<AmazonClientBuildItem> amazonClients, CloudWatchRecorder recorder, | ||
AmazonClientAwsCrtTransportRecorder transportRecorder, | ||
BuildProducer<AmazonClientAsyncTransportBuildItem> asyncTransports) { | ||
|
||
createAwsCrtAsyncTransportBuilder(amazonClients, | ||
transportRecorder, | ||
buildTimeConfig.asyncClient(), | ||
recorder.getAsyncConfig(), | ||
asyncTransports); | ||
} | ||
|
||
@BuildStep | ||
@Record(ExecutionTime.RUNTIME_INIT) | ||
void createClientBuilders(CloudWatchRecorder recorder, | ||
Capabilities capabilities, | ||
AmazonClientCommonRecorder commonRecorder, | ||
AmazonClientOpenTelemetryRecorder otelRecorder, | ||
List<AmazonClientSyncTransportBuildItem> syncTransports, | ||
List<AmazonClientAsyncTransportBuildItem> asyncTransports, | ||
BuildProducer<SyntheticBeanBuildItem> syntheticBeans, | ||
BuildProducer<AmazonClientSyncResultBuildItem> clientSync, | ||
BuildProducer<AmazonClientAsyncResultBuildItem> clientAsync, | ||
LaunchModeBuildItem launchModeBuildItem, | ||
ExecutorBuildItem executorBuildItem) { | ||
|
||
createClientBuilders(capabilities, | ||
recorder, | ||
commonRecorder, | ||
otelRecorder, | ||
buildTimeConfig, | ||
syncTransports, | ||
asyncTransports, | ||
CloudWatchClientBuilder.class, | ||
CloudWatchAsyncClientBuilder.class, | ||
null, | ||
syntheticBeans, | ||
clientSync, | ||
clientAsync, | ||
launchModeBuildItem, | ||
executorBuildItem); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...test/java/io/quarkus/amazon/cloudwatch/deployment/CloudWatchSyncClientFullConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.quarkus.amazon.cloudwatch.deployment; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import software.amazon.awssdk.services.cloudwatch.CloudWatchAsyncClient; | ||
import software.amazon.awssdk.services.cloudwatch.CloudWatchClient; | ||
|
||
public class CloudWatchSyncClientFullConfigTest { | ||
|
||
@Inject | ||
CloudWatchClient client; | ||
|
||
@Inject | ||
CloudWatchAsyncClient async; | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addAsResource("sync-urlconn-full-config.properties", "application.properties")); | ||
|
||
@Test | ||
public void test() { | ||
// should finish with success | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
cloudwatch/deployment/src/test/resources/sync-urlconn-full-config.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
quarkus.cloudwatch.endpoint-override=http://localhost:9090 | ||
|
||
quarkus.cloudwatch.aws.region=us-east-1 | ||
quarkus.cloudwatch.aws.credentials.type=static | ||
quarkus.cloudwatch.aws.credentials.static-provider.access-key-id=test-key | ||
quarkus.cloudwatch.aws.credentials.static-provider.secret-access-key=test-secret | ||
|
||
quarkus.cloudwatch.sync-client.type = url | ||
quarkus.cloudwatch.sync-client.connection-timeout = 0.100S | ||
quarkus.cloudwatch.sync-client.socket-timeout = 0.100S |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.quarkiverse.amazonservices</groupId> | ||
<artifactId>quarkus-amazon-services-build-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
<relativePath>../build-parent/pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>quarkus-amazon-cloudwatch-parent</artifactId> | ||
<name>Quarkus - Amazon Services - CloudWatch</name> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>runtime</module> | ||
<module>deployment</module> | ||
</modules> | ||
|
||
</project> |
Oops, something went wrong.