-
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 Logs SDK * Fixing docs * Added CloudWatchLogsSyncClientTest * Review tests * `cloudwatch-logs` to `cloudwatchlogs` * Rename docs * Add missing configuration for cloudwatchlogs * Apply suggestions from code review --------- Co-authored-by: Sébastien Crocquesel <88554524+scrocquesel@users.noreply.github.com>
- Loading branch information
1 parent
ea4ade9
commit 8968501
Showing
27 changed files
with
3,314 additions
and
3 deletions.
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-cloudwatchlogs-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>quarkus-amazon-cloudwatchlogs-deployment</artifactId> | ||
<name>Quarkus - Amazon Services - CloudWatch Logs - 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-cloudwatchlogs</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkiverse.amazonservices</groupId> | ||
<artifactId>quarkus-amazon-devservices-cloudwatchlogs</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
...oyment/src/main/java/io/quarkus/amazon/cloudwatch/deployment/CloudWatchLogsProcessor.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.CloudWatchLogsBuildTimeConfig; | ||
import io.quarkus.amazon.cloudwatch.runtime.CloudWatchLogsClientProducer; | ||
import io.quarkus.amazon.cloudwatch.runtime.CloudWatchLogsRecorder; | ||
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.cloudwatchlogs.CloudWatchLogsAsyncClient; | ||
import software.amazon.awssdk.services.cloudwatchlogs.CloudWatchLogsAsyncClientBuilder; | ||
import software.amazon.awssdk.services.cloudwatchlogs.CloudWatchLogsClient; | ||
import software.amazon.awssdk.services.cloudwatchlogs.CloudWatchLogsClientBuilder; | ||
|
||
public class CloudWatchLogsProcessor extends AbstractAmazonServiceProcessor { | ||
|
||
private static final String AMAZON_CLOUDWATCH = "amazon-cloudwatchlogs"; | ||
|
||
CloudWatchLogsBuildTimeConfig buildTimeConfig; | ||
|
||
@Override | ||
protected String amazonServiceClientName() { | ||
return AMAZON_CLOUDWATCH; | ||
} | ||
|
||
@Override | ||
protected String configName() { | ||
return "cloudwatchlogs"; | ||
} | ||
|
||
@Override | ||
protected DotName syncClientName() { | ||
return DotName.createSimple(CloudWatchLogsClient.class.getName()); | ||
} | ||
|
||
@Override | ||
protected DotName asyncClientName() { | ||
return DotName.createSimple(CloudWatchLogsAsyncClient.class.getName()); | ||
} | ||
|
||
@Override | ||
protected String builtinInterceptorsPath() { | ||
return "software/amazon/awssdk/services/cloudwatchlogs/execution.interceptors"; | ||
} | ||
|
||
@BuildStep | ||
AdditionalBeanBuildItem producer() { | ||
return AdditionalBeanBuildItem.unremovableOf(CloudWatchLogsClientProducer.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, CloudWatchLogsRecorder 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, CloudWatchLogsRecorder 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, CloudWatchLogsRecorder 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, CloudWatchLogsRecorder 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, CloudWatchLogsRecorder recorder, | ||
AmazonClientAwsCrtTransportRecorder transportRecorder, | ||
BuildProducer<AmazonClientAsyncTransportBuildItem> asyncTransports) { | ||
|
||
createAwsCrtAsyncTransportBuilder(amazonClients, | ||
transportRecorder, | ||
buildTimeConfig.asyncClient(), | ||
recorder.getAsyncConfig(), | ||
asyncTransports); | ||
} | ||
|
||
@BuildStep | ||
@Record(ExecutionTime.RUNTIME_INIT) | ||
void createClientBuilders(CloudWatchLogsRecorder 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, | ||
CloudWatchLogsClientBuilder.class, | ||
CloudWatchLogsAsyncClientBuilder.class, | ||
null, | ||
syntheticBeans, | ||
clientSync, | ||
clientAsync, | ||
launchModeBuildItem, | ||
executorBuildItem); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
.../java/io/quarkus/amazon/cloudwatch/deployment/CloudWatchLogsSyncClientFullConfigTest.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.cloudwatchlogs.CloudWatchLogsAsyncClient; | ||
import software.amazon.awssdk.services.cloudwatchlogs.CloudWatchLogsClient; | ||
|
||
public class CloudWatchLogsSyncClientFullConfigTest { | ||
|
||
@Inject | ||
CloudWatchLogsClient client; | ||
|
||
@Inject | ||
CloudWatchLogsAsyncClient 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
cloudwatchlogs/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.cloudwatchlogs.endpoint-override=http://localhost:9090 | ||
|
||
quarkus.cloudwatchlogs.aws.region=us-east-1 | ||
quarkus.cloudwatchlogs.aws.credentials.type=static | ||
quarkus.cloudwatchlogs.aws.credentials.static-provider.access-key-id=test-key | ||
quarkus.cloudwatchlogs.aws.credentials.static-provider.secret-access-key=test-secret | ||
|
||
quarkus.cloudwatchlogs.sync-client.type = url | ||
quarkus.cloudwatchlogs.sync-client.connection-timeout = 0.100S | ||
quarkus.cloudwatchlogs.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-cloudwatchlogs-parent</artifactId> | ||
<name>Quarkus - Amazon Services - CloudWatch Logs</name> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>runtime</module> | ||
<module>deployment</module> | ||
</modules> | ||
|
||
</project> |
Oops, something went wrong.