forked from quarkiverse/quarkus-amazon-services
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add api gateway management api extension (quarkiverse#1451)
- Loading branch information
1 parent
3a715ca
commit b0604df
Showing
16 changed files
with
4,106 additions
and
0 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,83 @@ | ||
<?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-apigatewaymanagementapi-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>quarkus-amazon-apigatewaymanagementapi-deployment</artifactId> | ||
<name>Quarkus - Amazon Services - Api Gateway Management Api - 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-apigatewaymanagementapi</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> |
215 changes: 215 additions & 0 deletions
215
...o/quarkus/amazon/apigatewaymanagementapi/deployment/ApiGatewayManagementApiProcessor.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,215 @@ | ||
package io.quarkus.amazon.apigatewaymanagementapi.deployment; | ||
|
||
import java.util.List; | ||
|
||
import org.jboss.jandex.DotName; | ||
|
||
import io.quarkus.amazon.apigatewaymanagementapi.runtime.ApiGatewayManagementApiBuildTimeConfig; | ||
import io.quarkus.amazon.apigatewaymanagementapi.runtime.ApiGatewayManagementApiRecorder; | ||
import io.quarkus.amazon.common.deployment.AbstractAmazonServiceProcessor; | ||
import io.quarkus.amazon.common.deployment.AmazonClientAsyncResultBuildItem; | ||
import io.quarkus.amazon.common.deployment.AmazonClientAsyncTransportBuildItem; | ||
import io.quarkus.amazon.common.deployment.AmazonClientInterceptorsPathBuildItem; | ||
import io.quarkus.amazon.common.deployment.AmazonClientSyncResultBuildItem; | ||
import io.quarkus.amazon.common.deployment.AmazonClientSyncTransportBuildItem; | ||
import io.quarkus.amazon.common.deployment.AmazonHttpClients; | ||
import io.quarkus.amazon.common.deployment.RequireAmazonClientBuildItem; | ||
import io.quarkus.amazon.common.deployment.RequireAmazonClientInjectionBuildItem; | ||
import io.quarkus.amazon.common.deployment.RequireAmazonClientTransportBuilderBuildItem; | ||
import io.quarkus.amazon.common.deployment.RequireAmazonTelemetryBuildItem; | ||
import io.quarkus.amazon.common.deployment.spi.EventLoopGroupBuildItem; | ||
import io.quarkus.amazon.common.runtime.AmazonClientApacheTransportRecorder; | ||
import io.quarkus.amazon.common.runtime.AmazonClientAwsCrtTransportRecorder; | ||
import io.quarkus.amazon.common.runtime.AmazonClientCommonRecorder; | ||
import io.quarkus.amazon.common.runtime.AmazonClientNettyTransportRecorder; | ||
import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; | ||
import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; | ||
import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; | ||
import io.quarkus.arc.deployment.SyntheticBeanBuildItem; | ||
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.apigatewaymanagementapi.ApiGatewayManagementApiAsyncClient; | ||
import software.amazon.awssdk.services.apigatewaymanagementapi.ApiGatewayManagementApiAsyncClientBuilder; | ||
import software.amazon.awssdk.services.apigatewaymanagementapi.ApiGatewayManagementApiClient; | ||
import software.amazon.awssdk.services.apigatewaymanagementapi.ApiGatewayManagementApiClientBuilder; | ||
|
||
public class ApiGatewayManagementApiProcessor extends AbstractAmazonServiceProcessor { | ||
|
||
private static final String AMAZON_PAYMENTCRYPTOGRAPHYDATA = "amazon-apigatewaymanagementapi"; | ||
|
||
ApiGatewayManagementApiBuildTimeConfig buildTimeConfig; | ||
|
||
@Override | ||
protected String amazonServiceClientName() { | ||
return AMAZON_PAYMENTCRYPTOGRAPHYDATA; | ||
} | ||
|
||
@Override | ||
protected String configName() { | ||
return "apigatewaymanagementapi"; | ||
} | ||
|
||
@Override | ||
protected DotName syncClientName() { | ||
return DotName.createSimple(ApiGatewayManagementApiClient.class.getName()); | ||
} | ||
|
||
@Override | ||
protected DotName asyncClientName() { | ||
return DotName.createSimple(ApiGatewayManagementApiAsyncClient.class.getName()); | ||
} | ||
|
||
@Override | ||
protected String builtinInterceptorsPath() { | ||
return "software/amazon/awssdk/services/inspector/execution.interceptors"; | ||
} | ||
|
||
@BuildStep | ||
void setup( | ||
BuildProducer<ExtensionSslNativeSupportBuildItem> extensionSslNativeSupport, | ||
BuildProducer<FeatureBuildItem> feature, | ||
BuildProducer<AmazonClientInterceptorsPathBuildItem> interceptors) { | ||
|
||
setupExtension(extensionSslNativeSupport, feature, interceptors); | ||
} | ||
|
||
@BuildStep | ||
void discoverClientInjectionPoints(BeanRegistrationPhaseBuildItem beanRegistrationPhase, | ||
BuildProducer<RequireAmazonClientInjectionBuildItem> requireClientInjectionProducer) { | ||
|
||
discoverClientInjectionPointsInternal(beanRegistrationPhase, requireClientInjectionProducer); | ||
} | ||
|
||
@BuildStep | ||
void discover( | ||
List<RequireAmazonClientInjectionBuildItem> amazonClientInjectionPoints, | ||
BuildProducer<RequireAmazonClientBuildItem> requireClientProducer) { | ||
|
||
discoverClient(amazonClientInjectionPoints, requireClientProducer); | ||
} | ||
|
||
@BuildStep | ||
void discoverTelemetry(BuildProducer<RequireAmazonTelemetryBuildItem> telemetryProducer) { | ||
|
||
discoverTelemetry(telemetryProducer, buildTimeConfig.sdk()); | ||
} | ||
|
||
@BuildStep | ||
void setupClient(List<RequireAmazonClientBuildItem> clientRequirements, | ||
BuildProducer<RequireAmazonClientTransportBuilderBuildItem> clientProducer) { | ||
|
||
setupClient(clientRequirements, clientProducer, buildTimeConfig.sdk(), buildTimeConfig.syncClient(), | ||
buildTimeConfig.asyncClient()); | ||
} | ||
|
||
@BuildStep(onlyIf = AmazonHttpClients.IsAmazonApacheHttpServicePresent.class) | ||
@Record(ExecutionTime.RUNTIME_INIT) | ||
void setupApacheSyncTransport(List<RequireAmazonClientTransportBuilderBuildItem> amazonClients, | ||
ApiGatewayManagementApiRecorder 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<RequireAmazonClientTransportBuilderBuildItem> amazonClients, | ||
ApiGatewayManagementApiRecorder 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<RequireAmazonClientTransportBuilderBuildItem> amazonClients, | ||
ApiGatewayManagementApiRecorder 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<RequireAmazonClientTransportBuilderBuildItem> amazonClients, | ||
ApiGatewayManagementApiRecorder 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<RequireAmazonClientTransportBuilderBuildItem> amazonClients, | ||
ApiGatewayManagementApiRecorder recorder, | ||
AmazonClientAwsCrtTransportRecorder transportRecorder, | ||
BuildProducer<AmazonClientAsyncTransportBuildItem> asyncTransports) { | ||
|
||
createAwsCrtAsyncTransportBuilder(amazonClients, | ||
transportRecorder, | ||
buildTimeConfig.asyncClient(), | ||
recorder.getAsyncConfig(), | ||
asyncTransports); | ||
} | ||
|
||
@BuildStep | ||
@Record(ExecutionTime.RUNTIME_INIT) | ||
void createClientBuilders(ApiGatewayManagementApiRecorder recorder, | ||
AmazonClientCommonRecorder commonRecorder, | ||
AmazonClientOpenTelemetryRecorder otelRecorder, | ||
List<RequireAmazonClientInjectionBuildItem> amazonClientInjections, | ||
List<RequireAmazonTelemetryBuildItem> amazonRequireTelemtryClients, | ||
List<AmazonClientSyncTransportBuildItem> syncTransports, | ||
List<AmazonClientAsyncTransportBuildItem> asyncTransports, | ||
BuildProducer<SyntheticBeanBuildItem> syntheticBeans, | ||
BuildProducer<AmazonClientSyncResultBuildItem> clientSync, | ||
BuildProducer<AmazonClientAsyncResultBuildItem> clientAsync, | ||
LaunchModeBuildItem launchModeBuildItem, | ||
ExecutorBuildItem executorBuildItem) { | ||
|
||
createClientBuilders( | ||
recorder, | ||
commonRecorder, | ||
otelRecorder, | ||
buildTimeConfig, | ||
amazonClientInjections, | ||
amazonRequireTelemtryClients, | ||
syncTransports, | ||
asyncTransports, | ||
ApiGatewayManagementApiClientBuilder.class, | ||
ApiGatewayManagementApiAsyncClientBuilder.class, | ||
null, | ||
syntheticBeans, | ||
clientSync, | ||
clientAsync, | ||
launchModeBuildItem, | ||
executorBuildItem); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...n/apigatewaymanagementapi/deployment/ApiGatewayManagementApiSyncClientFullConfigTest.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,29 @@ | ||
package io.quarkus.amazon.apigatewaymanagementapi.deployment; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import software.amazon.awssdk.services.apigatewaymanagementapi.ApiGatewayManagementApiAsyncClient; | ||
import software.amazon.awssdk.services.apigatewaymanagementapi.ApiGatewayManagementApiClient; | ||
|
||
public class ApiGatewayManagementApiSyncClientFullConfigTest { | ||
|
||
@Inject | ||
ApiGatewayManagementApiClient client; | ||
|
||
@Inject | ||
ApiGatewayManagementApiAsyncClient async; | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addAsResource("sync-urlconn-full-config.properties", "application.properties")); | ||
|
||
@Test | ||
public void test() { | ||
// should finish with success | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
apigatewaymanagementapi/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.apigatewaymanagementapi.endpoint-override=http://localhost:9090 | ||
|
||
quarkus.apigatewaymanagementapi.aws.region=us-east-1 | ||
quarkus.apigatewaymanagementapi.aws.credentials.type=static | ||
quarkus.apigatewaymanagementapi.aws.credentials.static-provider.access-key-id=test-key | ||
quarkus.apigatewaymanagementapi.aws.credentials.static-provider.secret-access-key=test-secret | ||
|
||
quarkus.apigatewaymanagementapi.sync-client.type = url | ||
quarkus.apigatewaymanagementapi.sync-client.connection-timeout = 0.100S | ||
quarkus.apigatewaymanagementapi.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-apigatewaymanagementapi-parent</artifactId> | ||
<name>Quarkus - Amazon Services - Api Gateway Management Api</name> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>runtime</module> | ||
<module>deployment</module> | ||
</modules> | ||
|
||
</project> |
Oops, something went wrong.