Skip to content

Add endpoint rules engine #681

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
@@ -0,0 +1,29 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.java.aws.client.core.settings;

import software.amazon.smithy.java.client.core.ClientSetting;
import software.amazon.smithy.java.context.Context;

/**
* Configures an AWS Account ID.
*/
public interface AccountIdSetting<B extends ClientSetting<B>> extends RegionSetting<B> {
/**
* AWS Account ID to use.
*/
Context.Key<String> AWS_ACCOUNT_ID = Context.key("AWS Account ID");

/**
* Sets the AWS Account ID.
*
* @param awsAccountId AWS account ID to set.
* @return self
*/
default B awsAccountId(String awsAccountId) {
return putConfig(AWS_ACCOUNT_ID, awsAccountId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.java.aws.client.core.settings;

import software.amazon.smithy.java.client.core.ClientSetting;
import software.amazon.smithy.java.context.Context;

/**
* Configures AWS specific endpoint settings.
*/
public interface EndpointSettings<B extends ClientSetting<B>> extends RegionSetting<B>, AccountIdSetting<B> {
/**
* If the SDK client is configured to use dual stack endpoints, defaults to false.
*/
Context.Key<Boolean> USE_DUAL_STACK = Context.key("Whether to use dual stack endpoint");

/**
* If the SDK client is configured to use FIPS-compliant endpoints, defaults to false.
*/
Context.Key<Boolean> USE_FIPS = Context.key("Whether to use FIPS endpoints");

/**
* The mode used when resolving Account ID based endpoints.
*/
Context.Key<String> ACCOUNT_ID_ENDPOINT_MODE = Context.key("Account ID endpoint mode");

/**
* Configures if the SDK uses dual stack endpoints. Defaults to false.
*
* @param useDualStack True to enable dual stack.
* @return self
*/
default B useDualStackEndpoint(boolean useDualStack) {
return putConfig(USE_DUAL_STACK, useDualStack);
}

/**
* Configures if the SDK uses FIPS endpoints. Defaults to false.
*
* @param useFips True to enable FIPS endpoints.
* @return self
*/
default B useFipsEndpoint(boolean useFips) {
return putConfig(USE_FIPS, useFips);
}

/**
* Sets the account ID endpoint mode for endpoint resolution.
*
* @param accountIdEndpointMode Account ID based endpoint resolution mode.
* @return self
*/
default B accountIdEndpointMode(String accountIdEndpointMode) {
return putConfig(ACCOUNT_ID_ENDPOINT_MODE, accountIdEndpointMode);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.java.aws.client.core.settings;

import software.amazon.smithy.java.client.core.ClientSetting;
import software.amazon.smithy.java.context.Context;

/**
* Configures AWS specific endpoint settings.
*/
public interface S3EndpointSettings<B extends ClientSetting<B>> extends EndpointSettings<B> {
/**
* If the SDK client is configured to use S3 transfer acceleration, defaults to false.
*/
Context.Key<Boolean> S3_ACCELERATE = Context.key("AWS::S3::Accelerate");

/**
* If the SDK client is configured to not use S3's multi-region access points, defaults to false.
*/
Context.Key<Boolean> S3_DISABLE_MULTI_REGION_ACCESS_POINTS = Context.key("AWS::S3::DisableMultiRegionAccessPoints");

/**
* If the SDK client is configured to use solely S3 path style routing, defaults to false.
*/
Context.Key<Boolean> S3_FORCE_PATH_STYLE = Context.key("AWS::S3::ForcePathStyle");

/**
* If the SDK client is configured to use S3 bucket ARN regions or raise an error when the bucket ARN and client
* region differ, defaults to true.
*/
Context.Key<Boolean> S3_USE_ARN_REGION = Context.key("AWS::S3::UseArnRegion");

/**
* If the SDK client is configured to use S3's global endpoint instead of the regional us-east-1 endpoint,
* defaults to false.
*/
Context.Key<Boolean> S3_USE_GLOBAL_ENDPOINT = Context.key("AWS::S3::UseGlobalEndpoint");

/**
* If the SDK client is configured to use S3 Control bucket ARN regions or raise an error when the bucket ARN
* and client region differ, defaults to true.
*/
Context.Key<Boolean> S3_CONTROL_USE_ARN_REGION = Context.key("AWS::S3Control::UseArnRegion");

/**
* Configures if the SDK client is configured to use S3 transfer acceleration, defaults to false.
*
* @param useS3Accelerate True to enable.
* @return self
*/
default B s3useAccelerate(boolean useS3Accelerate) {
return putConfig(S3_ACCELERATE, useS3Accelerate);
}

/**
* If the SDK client is configured to not use S3's multi-region access points, defaults to false.
*
* @param value True to disable MRAP.
* @return self
*/
default B s3disableMultiRegionAccessPoints(boolean value) {
return putConfig(S3_DISABLE_MULTI_REGION_ACCESS_POINTS, value);
}

/**
* If the SDK client is configured to use solely S3 path style routing, defaults to false.
*
* @param usePathStyle True to force path style.
* @return self
*/
default B s3forcePathStyle(boolean usePathStyle) {
return putConfig(S3_FORCE_PATH_STYLE, usePathStyle);
}

/**
* If the SDK client is configured to use S3 bucket ARN regions or raise an error when the bucket ARN and client
* region differ, defaults to true.
*
* @param useArnRegion True to use ARN region.
* @return self
*/
default B s3useArnRegion(boolean useArnRegion) {
return putConfig(S3_USE_ARN_REGION, useArnRegion);
}

/**
* If the SDK client is configured to use S3's global endpoint instead of the regional us-east-1 endpoint,
* defaults to false.
*
* @param useGlobalEndpoint True to enable global endpoint.
* @return self
*/
default B s3useGlobalEndpoint(boolean useGlobalEndpoint) {
return putConfig(S3_USE_GLOBAL_ENDPOINT, useGlobalEndpoint);
}

/**
* If the SDK client is configured to use S3 Control bucket ARN regions or raise an error when the bucket ARN
* and client region differ, defaults to true.
*
* @param useArnRegion True to enable S3 control ARN region.
* @return self
*/
default B s3controlUseArnRegion(boolean useArnRegion) {
return putConfig(S3_CONTROL_USE_ARN_REGION, useArnRegion);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.java.aws.client.core.settings;

import software.amazon.smithy.java.client.core.ClientSetting;
import software.amazon.smithy.java.context.Context;

/**
* Configures AWS specific endpoint settings.
*/
public interface StsEndpointSettings<B extends ClientSetting<B>> extends EndpointSettings<B> {
/**
* If the SDK client is configured to use STS' global endpoint instead of the regional us-east-1 endpoint,
* defaults to false.
*/
Context.Key<Boolean> STS_USE_GLOBAL_ENDPOINT = Context.key("AWS::STS::UseGlobalEndpoint");

/**
* Configures if if the SDK client is configured to use STS' global endpoint instead of the regional us-east-1
* endpoint, defaults to false.
*
* @param useGlobalEndpoint True to enable global endpoints.
* @return self
*/
default B stsUseGlobalEndpoint(boolean useGlobalEndpoint) {
return putConfig(STS_USE_GLOBAL_ENDPOINT, useGlobalEndpoint);
}
}
14 changes: 14 additions & 0 deletions aws/client/aws-client-rulesengine/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
id("smithy-java.module-conventions")
}

description = "This module provides AWS-Specific client rules engine functionality"

extra["displayName"] = "Smithy :: Java :: AWS :: Client :: Rules Engine"
extra["moduleName"] = "software.amazon.smithy.java.aws.client.rulesengine"

dependencies {
api(project(":aws:client:aws-client-core"))
api(project(":client:client-rulesengine"))
api(libs.smithy.aws.endpoints)
}
Loading
Loading