Skip to content

Commit 43abf17

Browse files
committed
Add AWS rules engine extension
1 parent 7aec981 commit 43abf17

File tree

12 files changed

+582
-2
lines changed

12 files changed

+582
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package software.amazon.smithy.java.aws.client.core.settings;
7+
8+
import software.amazon.smithy.java.client.core.ClientSetting;
9+
import software.amazon.smithy.java.context.Context;
10+
11+
/**
12+
* Configures an AWS Account ID.
13+
*/
14+
public interface AccountIdSetting<B extends ClientSetting<B>> extends RegionSetting<B> {
15+
/**
16+
* AWS Account ID to use.
17+
*/
18+
Context.Key<String> AWS_ACCOUNT_ID = Context.key("AWS Account ID");
19+
20+
/**
21+
* Sets the AWS Account ID.
22+
*
23+
* @param awsAccountId AWS account ID to set.
24+
* @return self
25+
*/
26+
default B awsAccountId(String awsAccountId) {
27+
return putConfig(AWS_ACCOUNT_ID, awsAccountId);
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package software.amazon.smithy.java.aws.client.core.settings;
7+
8+
import software.amazon.smithy.java.client.core.ClientSetting;
9+
import software.amazon.smithy.java.context.Context;
10+
11+
/**
12+
* Configures AWS specific endpoint settings.
13+
*/
14+
public interface EndpointSettings<B extends ClientSetting<B>> extends RegionSetting<B>, AccountIdSetting<B> {
15+
/**
16+
* If the SDK client is configured to use dual stack endpoints, defaults to false.
17+
*/
18+
Context.Key<Boolean> USE_DUAL_STACK = Context.key("Whether to use dual stack endpoint");
19+
20+
/**
21+
* If the SDK client is configured to use FIPS-compliant endpoints, defaults to false.
22+
*/
23+
Context.Key<Boolean> USE_FIPS = Context.key("Whether to use FIPS endpoints");
24+
25+
/**
26+
* The mode used when resolving Account ID based endpoints.
27+
*/
28+
Context.Key<String> ACCOUNT_ID_ENDPOINT_MODE = Context.key("Account ID endpoint mode");
29+
30+
/**
31+
* Configures if the SDK uses dual stack endpoints. Defaults to false.
32+
*
33+
* @param useDualStack True to enable dual stack.
34+
* @return self
35+
*/
36+
default B useDualStackEndpoint(boolean useDualStack) {
37+
return putConfig(USE_DUAL_STACK, useDualStack);
38+
}
39+
40+
/**
41+
* Configures if the SDK uses FIPS endpoints. Defaults to false.
42+
*
43+
* @param useFips True to enable FIPS endpoints.
44+
* @return self
45+
*/
46+
default B useFipsEndpoint(boolean useFips) {
47+
return putConfig(USE_FIPS, useFips);
48+
}
49+
50+
/**
51+
* Sets the account ID endpoint mode for endpoint resolution.
52+
*
53+
* @param accountIdEndpointMode Account ID based endpoint resolution mode.
54+
* @return self
55+
*/
56+
default B accountIdEndpointMode(String accountIdEndpointMode) {
57+
return putConfig(ACCOUNT_ID_ENDPOINT_MODE, accountIdEndpointMode);
58+
}
59+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package software.amazon.smithy.java.aws.client.core.settings;
7+
8+
import software.amazon.smithy.java.client.core.ClientSetting;
9+
import software.amazon.smithy.java.context.Context;
10+
11+
/**
12+
* Configures AWS specific endpoint settings.
13+
*/
14+
public interface S3EndpointSettings<B extends ClientSetting<B>> extends EndpointSettings<B> {
15+
/**
16+
* If the SDK client is configured to use S3 transfer acceleration, defaults to false.
17+
*/
18+
Context.Key<Boolean> S3_ACCELERATE = Context.key("AWS::S3::Accelerate");
19+
20+
/**
21+
* If the SDK client is configured to not use S3's multi-region access points, defaults to false.
22+
*/
23+
Context.Key<Boolean> S3_DISABLE_MULTI_REGION_ACCESS_POINTS = Context.key("AWS::S3::DisableMultiRegionAccessPoints");
24+
25+
/**
26+
* If the SDK client is configured to use solely S3 path style routing, defaults to false.
27+
*/
28+
Context.Key<Boolean> S3_FORCE_PATH_STYLE = Context.key("AWS::S3::ForcePathStyle");
29+
30+
/**
31+
* If the SDK client is configured to use S3 bucket ARN regions or raise an error when the bucket ARN and client
32+
* region differ, defaults to true.
33+
*/
34+
Context.Key<Boolean> S3_USE_ARN_REGION = Context.key("AWS::S3::UseArnRegion");
35+
36+
/**
37+
* If the SDK client is configured to use S3's global endpoint instead of the regional us-east-1 endpoint,
38+
* defaults to false.
39+
*/
40+
Context.Key<Boolean> S3_USE_GLOBAL_ENDPOINT = Context.key("AWS::S3::UseGlobalEndpoint");
41+
42+
/**
43+
* If the SDK client is configured to use S3 Control bucket ARN regions or raise an error when the bucket ARN
44+
* and client region differ, defaults to true.
45+
*/
46+
Context.Key<Boolean> S3_CONTROL_USE_ARN_REGION = Context.key("AWS::S3Control::UseArnRegion");
47+
48+
/**
49+
* Configures if the SDK client is configured to use S3 transfer acceleration, defaults to false.
50+
*
51+
* @param useS3Accelerate True to enable.
52+
* @return self
53+
*/
54+
default B s3useAccelerate(boolean useS3Accelerate) {
55+
return putConfig(S3_ACCELERATE, useS3Accelerate);
56+
}
57+
58+
/**
59+
* If the SDK client is configured to not use S3's multi-region access points, defaults to false.
60+
*
61+
* @param value True to disable MRAP.
62+
* @return self
63+
*/
64+
default B s3disableMultiRegionAccessPoints(boolean value) {
65+
return putConfig(S3_DISABLE_MULTI_REGION_ACCESS_POINTS, value);
66+
}
67+
68+
/**
69+
* If the SDK client is configured to use solely S3 path style routing, defaults to false.
70+
*
71+
* @param usePathStyle True to force path style.
72+
* @return self
73+
*/
74+
default B s3forcePathStyle(boolean usePathStyle) {
75+
return putConfig(S3_FORCE_PATH_STYLE, usePathStyle);
76+
}
77+
78+
/**
79+
* If the SDK client is configured to use S3 bucket ARN regions or raise an error when the bucket ARN and client
80+
* region differ, defaults to true.
81+
*
82+
* @param useArnRegion True to use ARN region.
83+
* @return self
84+
*/
85+
default B s3useArnRegion(boolean useArnRegion) {
86+
return putConfig(S3_USE_ARN_REGION, useArnRegion);
87+
}
88+
89+
/**
90+
* If the SDK client is configured to use S3's global endpoint instead of the regional us-east-1 endpoint,
91+
* defaults to false.
92+
*
93+
* @param useGlobalEndpoint True to enable global endpoint.
94+
* @return self
95+
*/
96+
default B s3useGlobalEndpoint(boolean useGlobalEndpoint) {
97+
return putConfig(S3_USE_GLOBAL_ENDPOINT, useGlobalEndpoint);
98+
}
99+
100+
/**
101+
* If the SDK client is configured to use S3 Control bucket ARN regions or raise an error when the bucket ARN
102+
* and client region differ, defaults to true.
103+
*
104+
* @param useArnRegion True to enable S3 control ARN region.
105+
* @return self
106+
*/
107+
default B s3controlUseArnRegion(boolean useArnRegion) {
108+
return putConfig(S3_CONTROL_USE_ARN_REGION, useArnRegion);
109+
}
110+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package software.amazon.smithy.java.aws.client.core.settings;
7+
8+
import software.amazon.smithy.java.client.core.ClientSetting;
9+
import software.amazon.smithy.java.context.Context;
10+
11+
/**
12+
* Configures AWS specific endpoint settings.
13+
*/
14+
public interface StsEndpointSettings<B extends ClientSetting<B>> extends EndpointSettings<B> {
15+
/**
16+
* If the SDK client is configured to use STS' global endpoint instead of the regional us-east-1 endpoint,
17+
* defaults to false.
18+
*/
19+
Context.Key<Boolean> STS_USE_GLOBAL_ENDPOINT = Context.key("AWS::STS::UseGlobalEndpoint");
20+
21+
/**
22+
* Configures if if the SDK client is configured to use STS' global endpoint instead of the regional us-east-1
23+
* endpoint, defaults to false.
24+
*
25+
* @param useGlobalEndpoint True to enable global endpoints.
26+
* @return self
27+
*/
28+
default B stsUseGlobalEndpoint(boolean useGlobalEndpoint) {
29+
return putConfig(STS_USE_GLOBAL_ENDPOINT, useGlobalEndpoint);
30+
}
31+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
plugins {
2+
id("smithy-java.module-conventions")
3+
}
4+
5+
description = "This module provides AWS-Specific client rules engine functionality"
6+
7+
extra["displayName"] = "Smithy :: Java :: AWS :: Client :: Rules Engine"
8+
extra["moduleName"] = "software.amazon.smithy.java.aws.client.rulesengine"
9+
10+
dependencies {
11+
api(project(":aws:client:aws-client-core"))
12+
api(project(":client:client-rulesengine"))
13+
api(libs.smithy.aws.endpoints)
14+
}

0 commit comments

Comments
 (0)