Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public enum BuiltInParameter {
AWS_USE_DUAL_STACK,
AWS_USE_FIPS,
SDK_ENDPOINT,
AWS_AUTH_ACCOUNT_ID,
AWS_STS_USE_GLOBAL_ENDPOINT,
AWS_S3_FORCE_PATH_STYLE,
AWS_S3_ACCELERATE,
Expand All @@ -43,6 +44,8 @@ public static BuiltInParameter fromValue(String s) {
return AWS_USE_FIPS;
case "sdk::endpoint":
return SDK_ENDPOINT;
case "aws::auth::accountid":
return AWS_AUTH_ACCOUNT_ID;
case "aws::sts::useglobalendpoint":
return AWS_STS_USE_GLOBAL_ENDPOINT;
case "aws::s3::forcepathstyle":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ private MethodSpec ruleParams() {
case SDK_ENDPOINT:
builtInFn = "endpointBuiltIn";
break;
case AWS_AUTH_ACCOUNT_ID:
builtInFn = "accountIdBuiltIn";
break;
case AWS_S3_USE_GLOBAL_ENDPOINT:
builtInFn = "useGlobalEndpointBuiltIn";
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public final class AwsEndpointProviderUtils {
return executionAttributes.getAttribute(AwsExecutionAttribute.FIPS_ENDPOINT_ENABLED);
}

public static String accountIdBuiltIn(ExecutionAttributes executionAttributes) {
return executionAttributes.getAttribute(AwsExecutionAttribute.AWS_AUTH_ACCOUNT_ID);
}

/**
* Returns the endpoint set on the client. Note that this strips off the query part of the URI because the endpoint
* rules library, e.g. {@code ParseURL} will return an exception if the URI it parses has query parameters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
"type": "boolean",
"builtIn": "AWS::UseFIPS"
},
"awsAccountId": {
"type": "String",
"builtIn": "AWS::Auth::AccountId"
},
"endpointId": {
"type": "string"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public final class QueryEndpointParams {

private final Boolean useFIPSEndpoint;

private final String awsAccountId;

private final String endpointId;

private final Boolean defaultTrueParam;
Expand All @@ -34,6 +36,7 @@ private QueryEndpointParams(BuilderImpl builder) {
this.region = builder.region;
this.useDualStackEndpoint = builder.useDualStackEndpoint;
this.useFIPSEndpoint = builder.useFIPSEndpoint;
this.awsAccountId = builder.awsAccountId;
this.endpointId = builder.endpointId;
this.defaultTrueParam = builder.defaultTrueParam;
this.defaultStringParam = builder.defaultStringParam;
Expand All @@ -59,6 +62,10 @@ public Boolean useFipsEndpoint() {
return useFIPSEndpoint;
}

public String awsAccountId() {
return awsAccountId;
}

public String endpointId() {
return endpointId;
}
Expand Down Expand Up @@ -95,6 +102,8 @@ public interface Builder {

Builder useFipsEndpoint(Boolean useFIPSEndpoint);

Builder awsAccountId(String awsAccountId);

Builder endpointId(String endpointId);

Builder defaultTrueParam(Boolean defaultTrueParam);
Expand All @@ -120,6 +129,8 @@ private static class BuilderImpl implements Builder {

private Boolean useFIPSEndpoint;

private String awsAccountId;

private String endpointId;

private Boolean defaultTrueParam = true;
Expand Down Expand Up @@ -152,6 +163,12 @@ public Builder useFipsEndpoint(Boolean useFIPSEndpoint) {
return this;
}

@Override
public Builder awsAccountId(String awsAccountId) {
this.awsAccountId = awsAccountId;
return this;
}

@Override
public Builder endpointId(String endpointId) {
this.endpointId = endpointId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ private static Map<Identifier, Value> toIdentifierValueMap(QueryEndpointParams p
if (params.useFipsEndpoint() != null) {
paramsMap.put(Identifier.of("useFIPSEndpoint"), Value.fromBool(params.useFipsEndpoint()));
}
if (params.awsAccountId() != null) {
paramsMap.put(Identifier.of("awsAccountId"), Value.fromStr(params.awsAccountId()));
}
if (params.endpointId() != null) {
paramsMap.put(Identifier.of("endpointId"), Value.fromStr(params.endpointId()));
}
Expand Down Expand Up @@ -297,6 +300,9 @@ private static EndpointRuleset ruleSet() {
.addParameter(
Parameter.builder().name("useFIPSEndpoint").type(ParameterType.fromValue("boolean"))
.required(false).builtIn("AWS::UseFIPS").build())
.addParameter(
Parameter.builder().name("awsAccountId").type(ParameterType.fromValue("String"))
.required(false).builtIn("AWS::Auth::AccountId").build())
.addParameter(
Parameter.builder().name("endpointId").type(ParameterType.fromValue("string"))
.required(false).build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ private static QueryEndpointParams ruleParams(Context.ModifyRequest context, Exe
builder.region(AwsEndpointProviderUtils.regionBuiltIn(executionAttributes));
builder.useDualStackEndpoint(AwsEndpointProviderUtils.dualStackEnabledBuiltIn(executionAttributes));
builder.useFipsEndpoint(AwsEndpointProviderUtils.fipsEnabledBuiltIn(executionAttributes));
builder.awsAccountId(AwsEndpointProviderUtils.accountIdBuiltIn(executionAttributes));
setClientContextParams(builder, executionAttributes);
setContextParams(builder, executionAttributes.getAttribute(AwsExecutionAttribute.OPERATION_NAME), context.request());
setStaticContextParams(builder, executionAttributes.getAttribute(AwsExecutionAttribute.OPERATION_NAME));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* AWS-specific attributes attached to the execution. This information is available to {@link ExecutionInterceptor}s.
*/
@SdkPublicApi
public final class AwsExecutionAttribute extends SdkExecutionAttribute {
public final class AwsExecutionAttribute extends SdkExecutionAttribute {
/**
* The AWS {@link Region} the client was configured with. This is not always same as the
* {@link AwsSignerExecutionAttribute#SIGNING_REGION} for global services like IAM.
Expand Down Expand Up @@ -58,6 +58,12 @@ public final class AwsExecutionAttribute extends SdkExecutionAttribute {
public static final ExecutionAttribute<Boolean> USE_GLOBAL_ENDPOINT =
new ExecutionAttribute<>("UseGlobalEndpoint");

/**
* The AWS account ID associated with the identity resolved for this request.
*/
public static final ExecutionAttribute<String> AWS_AUTH_ACCOUNT_ID =
new ExecutionAttribute<>("AwsAuthAccountId");

private AwsExecutionAttribute() {
}
}