Skip to content

Commit 8cbd76a

Browse files
committed
Add sfn specific http configs
1 parent 0878730 commit 8cbd76a

File tree

4 files changed

+96
-1
lines changed

4 files changed

+96
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"category": "AWS Step Functions",
3+
"type": "feature",
4+
"description": "Add sfn specific http configurations. See [#1325](https://github.com/aws/aws-sdk-java-v2/issues/1325)"
5+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package software.amazon.awssdk.services.sfn;
17+
18+
import static org.junit.Assert.assertNotNull;
19+
20+
import org.junit.AfterClass;
21+
import org.junit.BeforeClass;
22+
import org.junit.Test;
23+
import software.amazon.awssdk.testutils.service.AwsIntegrationTestBase;
24+
25+
public class SfnIntegrationTest extends AwsIntegrationTestBase {
26+
27+
private static SfnClient sfnClient;
28+
private static String activityArn;
29+
30+
@BeforeClass
31+
public static void setUpClient() {
32+
sfnClient = SfnClient.builder().credentialsProvider(CREDENTIALS_PROVIDER_CHAIN).build();
33+
activityArn = sfnClient.createActivity(b -> b.name("test")).activityArn();
34+
}
35+
36+
@AfterClass
37+
public static void cleanUp() {
38+
if (activityArn != null) {
39+
sfnClient.deleteActivity(b -> b.activityArn(activityArn));
40+
}
41+
}
42+
43+
@Test
44+
public void getActivityTask_shouldWorkByDefault(){
45+
assertNotNull(sfnClient.getActivityTask(b -> b.activityArn(activityArn)));
46+
}
47+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package software.amazon.awssdk.services.sfn.internal;
17+
18+
import java.time.Duration;
19+
import software.amazon.awssdk.annotations.SdkInternalApi;
20+
import software.amazon.awssdk.http.SdkHttpConfigurationOption;
21+
import software.amazon.awssdk.utils.AttributeMap;
22+
23+
/**
24+
* Sfn specific http configurations.
25+
*/
26+
@SdkInternalApi
27+
public final class SfnHttpConfigurationOptions {
28+
29+
private static final AttributeMap OPTIONS = AttributeMap
30+
.builder()
31+
// Sfn has long polling APIs such as getActivityTask that could take up to
32+
// 60 seconds to respond
33+
.put(SdkHttpConfigurationOption.READ_TIMEOUT, Duration.ofSeconds(65))
34+
.build();
35+
36+
private SfnHttpConfigurationOptions() {
37+
}
38+
39+
public static AttributeMap defaultHttpConfig() {
40+
return OPTIONS;
41+
}
42+
}

services/sfn/src/main/resources/codegen-resources/customization.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"verifiedSimpleMethods" : [
33
"listActivities",
44
"listStateMachines"
5-
]
5+
],
6+
"serviceSpecificHttpConfig": "software.amazon.awssdk.services.sfn.internal.SfnHttpConfigurationOptions"
67
}

0 commit comments

Comments
 (0)