|
5 | 5 |
|
6 | 6 | import java.util.function.Supplier; |
7 | 7 |
|
| 8 | +import cloud.localstack.docker.LocalstackDocker; |
8 | 9 | import com.amazonaws.client.builder.AwsClientBuilder; |
9 | 10 | import com.amazonaws.services.cloudformation.AmazonCloudFormation; |
10 | 11 | import com.amazonaws.services.cloudformation.AmazonCloudFormationClientBuilder; |
|
31 | 32 |
|
32 | 33 | public class DockerTestUtils { |
33 | 34 |
|
34 | | - |
35 | 35 | public static AmazonSQS getClientSQS() { |
36 | 36 | return AmazonSQSClientBuilder.standard(). |
37 | | - withEndpointConfiguration(createEndpointConfiguration(LocalstackDockerTestRunner.getLocalstackDocker()::getEndpointSQS)). |
| 37 | + withEndpointConfiguration(createEndpointConfiguration(LocalstackDocker.INSTANCE::getEndpointSQS)). |
38 | 38 | withCredentials(getCredentialsProvider()).build(); |
39 | 39 | } |
40 | 40 |
|
41 | 41 | public static AmazonSNS getClientSNS() { |
42 | 42 | return AmazonSNSClientBuilder.standard() |
43 | | - .withEndpointConfiguration(createEndpointConfiguration(LocalstackDockerTestRunner.getLocalstackDocker()::getEndpointSNS)) |
| 43 | + .withEndpointConfiguration(createEndpointConfiguration(LocalstackDocker.INSTANCE::getEndpointSNS)) |
44 | 44 | .withCredentials(getCredentialsProvider()).build(); |
45 | 45 | } |
46 | 46 |
|
47 | 47 | public static AWSLambda getClientLambda() { |
48 | 48 | return AWSLambdaClientBuilder.standard(). |
49 | | - withEndpointConfiguration(createEndpointConfiguration(LocalstackDockerTestRunner.getLocalstackDocker()::getEndpointLambda)). |
| 49 | + withEndpointConfiguration(createEndpointConfiguration(LocalstackDocker.INSTANCE::getEndpointLambda)). |
50 | 50 | withCredentials(getCredentialsProvider()).build(); |
51 | 51 | } |
52 | 52 |
|
53 | 53 | public static AmazonS3 getClientS3() { |
54 | 54 | AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard() |
55 | | - .withEndpointConfiguration(createEndpointConfiguration(LocalstackDockerTestRunner.getLocalstackDocker()::getEndpointS3)) |
| 55 | + .withEndpointConfiguration(createEndpointConfiguration(LocalstackDocker.INSTANCE::getEndpointS3)) |
56 | 56 | .withCredentials(getCredentialsProvider()); |
57 | 57 | builder.setPathStyleAccessEnabled(true); |
58 | 58 | return builder.build(); |
59 | 59 | } |
60 | 60 |
|
61 | 61 | public static AmazonKinesis getClientKinesis() { |
62 | 62 | return AmazonKinesisClientBuilder.standard() |
63 | | - .withEndpointConfiguration(createEndpointConfiguration(LocalstackDockerTestRunner.getLocalstackDocker()::getEndpointKinesis)) |
| 63 | + .withEndpointConfiguration(createEndpointConfiguration(LocalstackDocker.INSTANCE::getEndpointKinesis)) |
64 | 64 | .withCredentials(getCredentialsProvider()).build(); |
65 | 65 | } |
66 | 66 |
|
67 | 67 | public static AmazonDynamoDB getClientDynamoDb() { |
68 | 68 | return AmazonDynamoDBClientBuilder.standard() |
69 | | - .withEndpointConfiguration(createEndpointConfiguration(LocalstackDockerTestRunner.getLocalstackDocker()::getEndpointDynamoDB)) |
| 69 | + .withEndpointConfiguration(createEndpointConfiguration(LocalstackDocker.INSTANCE::getEndpointDynamoDB)) |
70 | 70 | .withCredentials(getCredentialsProvider()).build(); |
71 | 71 | } |
72 | 72 |
|
73 | 73 | public static AmazonCloudWatch getClientCloudWatch() { |
74 | 74 | return AmazonCloudWatchClientBuilder.standard() |
75 | | - .withEndpointConfiguration(createEndpointConfiguration(LocalstackDockerTestRunner.getLocalstackDocker()::getEndpointCloudWatch)) |
| 75 | + .withEndpointConfiguration(createEndpointConfiguration(LocalstackDocker.INSTANCE::getEndpointCloudWatch)) |
76 | 76 | .withCredentials(getCredentialsProvider()).build(); |
77 | 77 | } |
78 | 78 |
|
79 | 79 | public static AmazonKinesisFirehose getClientFirehose() { |
80 | 80 | return AmazonKinesisFirehoseClientBuilder.standard() |
81 | | - .withEndpointConfiguration(createEndpointConfiguration(LocalstackDockerTestRunner.getLocalstackDocker()::getEndpointFirehose)) |
| 81 | + .withEndpointConfiguration(createEndpointConfiguration(LocalstackDocker.INSTANCE::getEndpointFirehose)) |
82 | 82 | .withCredentials(getCredentialsProvider()).build(); |
83 | 83 | } |
84 | 84 |
|
85 | 85 | public static AmazonDynamoDBStreams getClientDynamoDbStreams() { |
86 | 86 | return AmazonDynamoDBStreamsClientBuilder.standard() |
87 | | - .withEndpointConfiguration(createEndpointConfiguration(LocalstackDockerTestRunner.getLocalstackDocker()::getEndpointDynamoDBStreams)) |
| 87 | + .withEndpointConfiguration(createEndpointConfiguration(LocalstackDocker.INSTANCE::getEndpointDynamoDBStreams)) |
88 | 88 | .withCredentials(getCredentialsProvider()).build(); |
89 | 89 | } |
90 | 90 |
|
91 | 91 | public static AmazonCloudFormation getClientCloudFormation() { |
92 | 92 | return AmazonCloudFormationClientBuilder.standard() |
93 | | - .withEndpointConfiguration(createEndpointConfiguration(LocalstackDockerTestRunner.getLocalstackDocker()::getEndpointCloudFormation)) |
| 93 | + .withEndpointConfiguration(createEndpointConfiguration(LocalstackDocker.INSTANCE::getEndpointCloudFormation)) |
94 | 94 | .withCredentials(getCredentialsProvider()).build(); |
95 | 95 | } |
96 | 96 |
|
97 | | - |
98 | 97 | private static AwsClientBuilder.EndpointConfiguration createEndpointConfiguration(Supplier<String> supplier) { |
99 | 98 | return getEndpointConfiguration(supplier.get()); |
100 | 99 | } |
|
0 commit comments