Skip to content

Commit

Permalink
Merge pull request #7 from awslabs/master
Browse files Browse the repository at this point in the history
Update fork
  • Loading branch information
rlecomte authored Jul 23, 2024
2 parents f4f1d8a + b27359e commit c5b16ea
Show file tree
Hide file tree
Showing 31 changed files with 558 additions and 153 deletions.
24 changes: 9 additions & 15 deletions .github/workflows/MavenCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
pull_request:
branches: [ master ]
release:
branches: [ master ]
types: [ created ]
branches: [ master ]
types: [ created ]

jobs:
build:
runs-on: ${{ matrix.operating-system }}
Expand All @@ -19,31 +19,25 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
java-version: ['8', '9', '11', '13']
java-version: ['8', '11', '17']

steps:
- uses: actions/checkout@v2

- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java-version }}

- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: install build-tools
run: mvn --file build-tools/pom.xml clean install

- name: Clean, build and install

- name: Clean, build and install
run: mvn --file pom.xml clean install

- name: Run tests
run: mvn --file pom.xml test


- name: Build package
run: mvn -B package --file pom.xml
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#Ignore IntelliJ files
.idea/
.DS_Store
*.iml

#Ignore Maven files
**/target

**/.settings
**/*.project
**/*.classpath
**/*.factorypath
**/dependency-reduced-pom.xml
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,25 @@ GlueSchemaRegistryKafkaSerializer/GlueSchemaRegistryKafkaDeserializer.

## Release 1.1.14
* Upgraded Protobuf dependency version to prevent a CVE
* Upgraded everit-json-schema dependency version to prevent a CVE
* Upgraded everit-json-schema dependency version to prevent a CVE

## Release 1.1.15
* Upgrade Avro, Apicurio and Localhost utils versions

## Release 1.1.16
* Upgraded Wire version
* Excluded some transitive dependencies that are having vulnerabilities

## Release 1.1.17
* Upgraded kafka dependencies version

## Release 1.1.18
* Add a dummy class in the serializer-deserializer-msk-iam module for javadoc and source jar generation
* Upgraded Avro and Json dependencies version
* Upgraded AWS SDK v1 and v2 versions to fix vulnerabilities

## Release 1.1.19
* Upgraded dependency versions to remove ION dependencies

## Release 1.1.20
* Upgrade the dependency version to remove commons:compress dependency
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The recommended way to use the AWS Glue Schema Registry Library for Java is to c
<dependency>
<groupId>software.amazon.glue</groupId>
<artifactId>schema-registry-serde</artifactId>
<version>1.1.14</version>
<version>1.1.20</version>
</dependency>
```
### Code Example
Expand Down Expand Up @@ -381,7 +381,7 @@ Alternatively, a schema registry naming strategy implementation can be provided.
properties.put(AWSSchemaRegistryConstants.SCHEMA_NAMING_GENERATION_CLASS,
"com.amazonaws.services.schemaregistry.serializers.avro.CustomerProvidedSchemaNamingStrategy");
```
An example test implementation class is [here](https://github.com/awslabs/aws-glue-schema-registry/blob/master/avro-serializer-deserializer/src/test/java/com/amazonaws/services/schemaregistry/serializers/avro/CustomerProvidedSchemaNamingStrategy.java).
An example test implementation class is [here](https://github.com/awslabs/aws-glue-schema-registry/blob/master/serializer-deserializer/src/test/java/com/amazonaws/services/schemaregistry/serializers/avro/CustomerProvidedSchemaNamingStrategy.java).

### Providing Registry Description

Expand Down Expand Up @@ -490,7 +490,7 @@ It should look like this
* If using bash, run the below commands to set-up your CLASSPATH in your bash_profile. (For any other shell, update the environment accordingly.)
```bash
echo 'export GSR_LIB_BASE_DIR=<>' >>~/.bash_profile
echo 'export GSR_LIB_VERSION=1.1.14' >>~/.bash_profile
echo 'export GSR_LIB_VERSION=1.1.20' >>~/.bash_profile
echo 'export KAFKA_HOME=<your kafka installation directory>' >>~/.bash_profile
echo 'export CLASSPATH=$CLASSPATH:$GSR_LIB_BASE_DIR/avro-kafkaconnect-converter/target/schema-registry-kafkaconnect-converter-$GSR_LIB_VERSION.jar:$GSR_LIB_BASE_DIR/common/target/schema-registry-common-$GSR_LIB_VERSION.jar:$GSR_LIB_BASE_DIR/avro-serializer-deserializer/target/schema-registry-serde-$GSR_LIB_VERSION.jar' >>~/.bash_profile
source ~/.bash_profile
Expand Down Expand Up @@ -549,7 +549,7 @@ It should look like this
<dependency>
<groupId>software.amazon.glue</groupId>
<artifactId>schema-registry-kafkastreams-serde</artifactId>
<version>1.1.14</version>
<version>1.1.20</version>
</dependency>
```
Expand Down Expand Up @@ -587,7 +587,7 @@ repository for the latest support: [Avro SerializationSchema and Deserialization
<dependency>
<groupId>software.amazon.glue</groupId>
<artifactId>schema-registry-flink-serde</artifactId>
<version>1.1.14</version>
<version>1.1.20</version>
</dependency>
```
### Code Example
Expand Down
4 changes: 2 additions & 2 deletions avro-flink-serde/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ inside Amazon VPC.](https://docs.aws.amazon.com/kinesisanalytics/latest/java/vpc
<dependency>
<groupId>software.amazon.glue</groupId>
<artifactId>schema-registry-flink-serde</artifactId>
<version>1.1.8/version>
<version>1.1.20/version>
</dependency>
```
### Code Example
Expand Down Expand Up @@ -67,4 +67,4 @@ inside Amazon VPC.](https://docs.aws.amazon.com/kinesisanalytics/latest/java/vpc
GlueSchemaRegistryAvroDeserializationSchema.forGeneric(schema, configs),
properties);
DataStream<GenericRecord> stream = env.addSource(consumer);
```
```
18 changes: 10 additions & 8 deletions avro-flink-serde/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<groupId>software.amazon.glue</groupId>
<artifactId>schema-registry-flink-serde</artifactId>
<version>1.1.14</version>
<version>1.1.20</version>
<name>AWS Glue Schema Registry Flink Avro Serialization Deserialization Schema</name>
<description>The AWS Glue Schema Registry Library for Apache Flink enables Java developers to easily integrate
their Apache Flink applications with AWS Glue Schema Registry
Expand Down Expand Up @@ -66,7 +66,13 @@
<dependency>
<groupId>software.amazon.glue</groupId>
<artifactId>schema-registry-serde</artifactId>
<version>1.1.14</version>
<version>1.1.20</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.26</version>
<scope>provided</scope>
</dependency>

<dependency>
Expand Down Expand Up @@ -143,11 +149,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.21</version>
</dependency>

<dependency>
<groupId>org.apache.flink</groupId>
Expand Down Expand Up @@ -181,6 +182,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
Expand Down Expand Up @@ -217,7 +219,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<version>0.8.8</version>
<executions>
<execution>
<goals>
Expand Down
6 changes: 5 additions & 1 deletion avro-kafkaconnect-converter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<parent>
<groupId>software.amazon.glue</groupId>
<artifactId>schema-registry-parent</artifactId>
<version>1.1.14</version>
<version>1.1.20</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -69,6 +69,10 @@
<groupId>org.apache.kafka</groupId>
<artifactId>connect-api</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions build-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>software.amazon.glue</groupId>
<artifactId>schema-registry-parent</artifactId>
<version>1.1.14</version>
<version>1.1.20</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -62,7 +62,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<version>0.8.8</version>
<executions>
<execution>
<phase>verify</phase>
Expand Down
10 changes: 1 addition & 9 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>software.amazon.glue</groupId>
<artifactId>schema-registry-parent</artifactId>
<version>1.1.14</version>
<version>1.1.20</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -89,10 +89,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand All @@ -109,10 +105,6 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-utils</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import software.amazon.awssdk.core.interceptor.ExecutionAttributes;
import software.amazon.awssdk.core.interceptor.ExecutionInterceptor;
import software.amazon.awssdk.core.retry.RetryPolicy;
import software.amazon.awssdk.http.urlconnection.ProxyConfiguration;
import software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.glue.GlueClient;
Expand Down Expand Up @@ -89,12 +90,18 @@ public AWSSchemaRegistryClient(@NonNull AwsCredentialsProvider credentialsProvid
.retryPolicy(retryPolicy)
.addExecutionInterceptor(new UserAgentRequestInterceptor())
.build();
UrlConnectionHttpClient.Builder urlConnectionHttpClientBuilder = UrlConnectionHttpClient.builder();
if (glueSchemaRegistryConfiguration.getProxyUrl() != null) {
log.debug("Creating http client using proxy {}", glueSchemaRegistryConfiguration.getProxyUrl().toString());
ProxyConfiguration proxy = ProxyConfiguration.builder().endpoint(glueSchemaRegistryConfiguration.getProxyUrl()).build();
urlConnectionHttpClientBuilder.proxyConfiguration(proxy);
}

GlueClientBuilder glueClientBuilder = GlueClient
.builder()
.credentialsProvider(credentialsProvider)
.overrideConfiguration(overrideConfiguration)
.httpClient(UrlConnectionHttpClient.builder().build())
.httpClient(urlConnectionHttpClientBuilder.build())
.region(Region.of(glueSchemaRegistryConfiguration.getRegion()));

if (glueSchemaRegistryConfiguration.getEndPoint() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.EnumUtils;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.regions.providers.DefaultAwsRegionProviderChain;
import software.amazon.awssdk.services.glue.model.Compatibility;

import java.net.URI;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -54,6 +57,7 @@ public class GlueSchemaRegistryConfiguration {
private Map<String, String> tags = new HashMap<>();
private Map<String, String> metadata;
private String secondaryDeserializer;
private URI proxyUrl;

/**
* Name of the application using the serializer/deserializer.
Expand Down Expand Up @@ -99,6 +103,7 @@ private void buildSchemaRegistryConfigs(Map<String, ?> configs) {
validateAndSetMetadata(configs);
validateAndSetUserAgent(configs);
validateAndSetSecondaryDeserializer(configs);
validateAndSetProxyUrl(configs);
}

private void validateAndSetSecondaryDeserializer(Map<String, ?> configs) {
Expand Down Expand Up @@ -147,7 +152,15 @@ private void validateAndSetAWSRegion(Map<String, ?> configs) {
if (isPresent(configs, AWSSchemaRegistryConstants.AWS_REGION)) {
this.region = String.valueOf(configs.get(AWSSchemaRegistryConstants.AWS_REGION));
} else {
throw new AWSSchemaRegistryException("Region is not defined in the properties");
try {
this.region = DefaultAwsRegionProviderChain
.builder()
.build()
.getRegion()
.id();
} catch (SdkClientException ex) {
throw new AWSSchemaRegistryException("Region is not defined in the properties", ex);
}
}
}

Expand Down Expand Up @@ -183,6 +196,18 @@ private void validateAndSetAWSEndpoint(Map<String, ?> configs) {
}
}

private void validateAndSetProxyUrl(Map<String, ?> configs) {
if (isPresent(configs, AWSSchemaRegistryConstants.PROXY_URL)) {
String value = (String) configs.get(AWSSchemaRegistryConstants.PROXY_URL);
try {
this.proxyUrl = URI.create(value);
} catch (IllegalArgumentException e) {
String message = String.format("Proxy URL property is not a valid URL: %s", value);
throw new AWSSchemaRegistryException(message, e);
}
}
}

private void validateAndSetDescription(Map<String, ?> configs) throws AWSSchemaRegistryException {
if (isPresent(configs, AWSSchemaRegistryConstants.DESCRIPTION)) {
this.description = String.valueOf(configs.get(AWSSchemaRegistryConstants.DESCRIPTION));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
import software.amazon.awssdk.services.glue.model.Compatibility;

public final class AWSSchemaRegistryConstants {
/**
* Proxy URL to use while connecting to AWS endpoint.
*/
public static final String PROXY_URL = "proxyUrl";
/**
* AWS endpoint to use while initializing the client for service.
*/
Expand Down
Loading

0 comments on commit c5b16ea

Please sign in to comment.