Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Update xlang kinesis to v2 #33416

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/trigger_files/beam_PostCommit_Python.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"comment": "Modify this file in a trivial way to cause this test suite to run.",
"modification": 7
"modification": 8
}

2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

## Breaking Changes

* X behavior was changed ([#X](https://github.com/apache/beam/issues/X)).
* AWS V1 I/Os have been removed (Java). As part of this, x-lang Python I/Os no longer support setting producer_properties ([#33430](https://github.com/apache/beam/issues/33430)).

## Deprecations

Expand Down
39 changes: 39 additions & 0 deletions sdks/java/io/amazon-web-services2/expansion-service/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
* http://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.
*/

apply plugin: 'org.apache.beam.module'
apply plugin: 'application'
mainClassName = "org.apache.beam.sdk.expansion.service.ExpansionService"

applyJavaNature(
automaticModuleName: 'org.apache.beam.sdk.io.amazon-web-services2.expansion.service',
exportJavadoc: false,
validateShadowJar: false,
shadowClosure: {},
)

description = "Apache Beam :: SDKs :: Java :: IO :: Amazon Web Services 2 :: Expansion Service"
ext.summary = "Expansion service serving AWS2"

dependencies {
implementation project(":sdks:java:expansion-service")
permitUnusedDeclared project(":sdks:java:expansion-service")
implementation project(":sdks:java:io:amazon-web-services2")
permitUnusedDeclared project(":sdks:java:io:amazon-web-services2")
runtimeOnly library.java.slf4j_jdk14
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import software.amazon.awssdk.http.apache.ApacheHttpClient;
import software.amazon.awssdk.http.apache.ProxyConfiguration;
import software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient;
import software.amazon.awssdk.internal.http.NoneTlsKeyManagersProvider;
import software.amazon.awssdk.regions.Region;

/**
Expand Down Expand Up @@ -161,7 +162,12 @@ public <BuilderT extends AwsClientBuilder<BuilderT, ClientT>, ClientT> BuilderT

HttpClientConfiguration httpConfig = options.getHttpClientConfiguration();
ProxyConfiguration proxyConfig = options.getProxyConfiguration();
if (proxyConfig != null || httpConfig != null) {
boolean skipCertificateVerification = false;
if (config.skipCertificateVerification() != null) {
skipCertificateVerification = config.skipCertificateVerification();
throw new RuntimeException("config was non-null " + skipCertificateVerification);
}
if (proxyConfig != null || httpConfig != null || skipCertificateVerification) {
if (builder instanceof SdkSyncClientBuilder) {
ApacheHttpClient.Builder client = syncClientBuilder();

Expand All @@ -177,6 +183,12 @@ public <BuilderT extends AwsClientBuilder<BuilderT, ClientT>, ClientT> BuilderT
setOptional(httpConfig.maxConnections(), client::maxConnections);
}

if (skipCertificateVerification) {
client.tlsKeyManagersProvider(NoneTlsKeyManagersProvider.getInstance());
throw new RuntimeException(
"Made it this far - probably means the tlsKeyManagersProvider is not right");
}

// must use builder to make sure client is managed by the SDK
((SdkSyncClientBuilder<?, ?>) builder).httpClientBuilder(client);
} else if (builder instanceof SdkAsyncClientBuilder) {
Expand All @@ -201,6 +213,12 @@ public <BuilderT extends AwsClientBuilder<BuilderT, ClientT>, ClientT> BuilderT
setOptional(httpConfig.maxConnections(), client::maxConcurrency);
}

if (skipCertificateVerification) {
client.tlsKeyManagersProvider(NoneTlsKeyManagersProvider.getInstance());
throw new RuntimeException(
"Made it this far - probably means the tlsKeyManagersProvider is not right");
}

// must use builder to make sure client is managed by the SDK
((SdkAsyncClientBuilder<?, ?>) builder).httpClientBuilder(client);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ public abstract class ClientConfiguration implements Serializable {
return regionId() != null ? Region.of(regionId()) : null;
}

/**
* Optional flag to skip certificate verification. Should only be overriden for test scenarios. If
* set, this overwrites the default in {@link AwsOptions#skipCertificateVerification()}.
*/
@JsonProperty
public abstract @Nullable @Pure Boolean skipCertificateVerification();

/**
* Optional service endpoint to use AWS compatible services instead, e.g. for testing. If set,
* this overwrites the default in {@link AwsOptions#getEndpoint()}.
Expand Down Expand Up @@ -156,6 +163,13 @@ public Builder retry(Consumer<RetryConfiguration.Builder> retry) {
return retry(builder.build());
}

/**
* Optional flag to skip certificate verification. Should only be overriden for test scenarios.
* If set, this overwrites the default in {@link AwsOptions#skipCertificateVerification()}.
*/
@JsonProperty
public abstract Builder skipCertificateVerification(boolean skipCertificateVerification);

abstract Builder regionId(String region);

abstract Builder credentialsProviderAsJson(String credentialsProvider);
Expand Down
Loading
Loading