Skip to content

Commit 1d868df

Browse files
authored
Endpoint discovery support (#1263)
* configuration to control endpoint discovery * shared components for endpoint discovery - includes cache and middleware * add config source assertion, also updates Makefile to replace go mod prior to config assertion * java: adds endpoint discovery generator and renames ResolveClientConfig class * TimestreamWrite client generated * TimestreamQuery client generated * Dynamodb client generated with endpoint discovery support * add integration test for timestreamwrite service * generated service client and protocol tests * update repotool to not fail if no build artifact is present * make EnableEndpointDiscoveryState enums typed, shared config does not fall back to auto state, renames assert package to configtesting * java change to encapsulate endpoint discovery related options into an endpoint discovery options type * update cache to store after deletion takes place in case cache limit is reached * generated dynamodb client * generated timestream client * remove stale code and fix comment * adds change notes for endpoint-discovery feature * rebase branch with master and generated client for add helper change
1 parent 39470b2 commit 1d868df

File tree

10,005 files changed

+24885
-20046
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

10,005 files changed

+24885
-20046
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "4dac0d44-3b06-4c37-b202-0df3a296b7d3",
3+
"type": "feature",
4+
"description": "Module supporting endpoint-discovery across all service clients.",
5+
"modules": [
6+
"service/internal/endpoint-discovery"
7+
]
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"id": "831c0006-90e9-4b1e-aece-aac1957a3c6b",
3+
"type": "feature",
4+
"description": "Adds support for endpoint discovery.",
5+
"modules": [
6+
"service/dynamodb",
7+
"service/timestreamquery",
8+
"service/timestreamwrite"
9+
]
10+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "91058950-a49d-4f42-8b78-56ff9186f51e",
3+
"type": "feature",
4+
"description": "Adds configuration values for enabling endpoint discovery.",
5+
"modules": [
6+
"."
7+
]
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "9888f20f-d728-49b3-b220-7fd34a84700b",
3+
"type": "feature",
4+
"description": "Adds configuration setting for enabling endpoint discovery.",
5+
"modules": [
6+
"config"
7+
]
8+
}

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ add-module-license-files sync-models sync-endpoints-model sync-endpoints.json cl
5353
sync-api-models copy-attributevalue-feature min-go-version-% update-requires smithy-annotate-stable \
5454
update-module-metadata
5555

56-
generate: smithy-generate update-requires update-module-metadata smithy-annotate-stable gen-config-asserts \
57-
copy-attributevalue-feature gen-repo-mod-replace gen-mod-dropreplace-smithy min-go-version-. tidy-modules-. \
56+
generate: smithy-generate update-requires gen-repo-mod-replace update-module-metadata smithy-annotate-stable \
57+
gen-config-asserts copy-attributevalue-feature gen-mod-dropreplace-smithy min-go-version-. tidy-modules-. \
5858
add-module-license-files gen-aws-ptrs format
5959

6060
smithy-generate:

aws/config.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,34 @@ func (c Config) Copy() Config {
8686
cp := c
8787
return cp
8888
}
89+
90+
// EndpointDiscoveryEnableState indicates if endpoint discovery is
91+
// enabled, disabled, auto or unset state.
92+
//
93+
// Default behavior (Auto or Unset) indicates operations that require endpoint
94+
// discovery will use Endpoint Discovery by default. Operations that
95+
// optionally use Endpoint Discovery will not use Endpoint Discovery
96+
// unless EndpointDiscovery is explicitly enabled.
97+
type EndpointDiscoveryEnableState uint
98+
99+
// Enumeration values for EndpointDiscoveryEnableState
100+
const (
101+
// EndpointDiscoveryUnset represents EndpointDiscoveryEnableState is unset.
102+
// Users do not need to use this value explicitly. The behavior for unset
103+
// is the same as for EndpointDiscoveryAuto.
104+
EndpointDiscoveryUnset EndpointDiscoveryEnableState = iota
105+
106+
// EndpointDiscoveryAuto represents an AUTO state that allows endpoint
107+
// discovery only when required by the api. This is the default
108+
// configuration resolved by the client if endpoint discovery is neither
109+
// enabled or disabled.
110+
EndpointDiscoveryAuto // default state
111+
112+
// EndpointDiscoveryDisabled indicates client MUST not perform endpoint
113+
// discovery even when required.
114+
EndpointDiscoveryDisabled
115+
116+
// EndpointDiscoveryEnabled indicates client MUST always perform endpoint
117+
// discovery if supported for the operation.
118+
EndpointDiscoveryEnabled
119+
)

codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AddAwsConfigFields.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ private void writeAwsConfigConstructor(Model model, ServiceShape service, GoWrit
249249

250250
List<AwsConfigField> configFields = new ArrayList<>(AWS_CONFIG_FIELDS);
251251
// add client specific config fields
252-
for (AwsConfigField cfgField : ResolveClientConfig.AWS_CONFIG_FIELDS) {
252+
for (AwsConfigField cfgField : ResolveClientConfigFromSources.AWS_CONFIG_FIELDS) {
253253
configFields.add(cfgField);
254254
}
255255

codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsGoDependency.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* A class of constants for dependencies used by this package.
2323
*/
2424
public class AwsGoDependency {
25+
public static final String AWS_SOURCE_PATH = "github.com/aws/aws-sdk-go-v2";
26+
2527
public static final GoDependency AWS_REST_JSON_PROTOCOL = aws("aws/protocol/restjson");
2628
public static final GoDependency AWS_QUERY_PROTOCOL = aws("aws/protocol/query");
2729
public static final GoDependency AWS_EC2QUERY_PROTOCOL = aws("aws/protocol/ec2query");
@@ -35,11 +37,13 @@ public class AwsGoDependency {
3537
public static final GoDependency AWSTESTING_UNIT = aws("internal/awstesting/unit");
3638

3739
public static final GoDependency S3_SHARED_CONFIG = aws("service/internal/s3shared/config", "s3sharedconfig");
40+
public static final GoDependency SERVICE_INTERNAL_CONFIG = awsModuleDep("internal/configsources",
41+
null, Versions.SERVICE_INTERNAL_CONFIG, "internalConfig");
42+
public static final GoDependency SERVICE_INTERNAL_ENDPOINT_DISCOVERY = awsModuleDep("service/internal/endpoint-discovery",
43+
null, Versions.SERVICE_INTERNAL_ENDPOINT_DISCOVERY, "internalEndpointDiscovery");
3844

3945
public static final GoDependency REGEXP = SmithyGoDependency.stdlib("regexp");
4046

41-
public static final String AWS_SOURCE_PATH = "github.com/aws/aws-sdk-go-v2";
42-
4347
protected AwsGoDependency() {
4448
}
4549

@@ -55,18 +59,18 @@ protected static GoDependency aws(String relativePath, String alias) {
5559
* awsModuleDep returns a GoDependency relative to the version of AWS_SDK core.
5660
*
5761
* @param moduleImportPath the module path within aws sdk to be added as go mod dependency.
58-
* @param relativePath the relative path which will be used as import path relative to aws sdk path.
59-
* @param version the version of the aws module dependency to be imported
60-
* @param alias the go import alias.
62+
* @param relativePath the relative path which will be used as import path relative to aws sdk path.
63+
* @param version the version of the aws module dependency to be imported
64+
* @param alias the go import alias.
6165
* @return GoDependency
6266
*/
6367
protected static GoDependency awsModuleDep(
64-
String moduleImportPath,
65-
String relativePath,
66-
String version,
67-
String alias
68+
String moduleImportPath,
69+
String relativePath,
70+
String version,
71+
String alias
6872
) {
69-
moduleImportPath = AWS_SOURCE_PATH+ "/" + moduleImportPath;
73+
moduleImportPath = AWS_SOURCE_PATH + "/" + moduleImportPath;
7074
return module(moduleImportPath, relativePath, version, alias);
7175
}
7276

@@ -85,5 +89,7 @@ protected static GoDependency module(
8589

8690
private static final class Versions {
8791
private static final String AWS_SDK = "v1.4.0";
92+
private static final String SERVICE_INTERNAL_CONFIG = "v0.0.0-00010101000000-000000000000";
93+
private static final String SERVICE_INTERNAL_ENDPOINT_DISCOVERY = "v0.0.0-00010101000000-000000000000";
8894
}
8995
}

codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsHttpPresignURLClientGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ private void writePresignOperationFunction(
237237

238238
writer.openBlock("result, _, err := c.client.invokeOperation(ctx, $S, params, clientOptFns,", ")",
239239
operationSymbol.getName(), () -> {
240-
writer.write("$L,", OperationGenerator
240+
writer.write("c.client.$L,", OperationGenerator
241241
.getAddOperationMiddlewareFuncName(operationSymbol));
242242
writer.write("$L(options).$L,", CONVERT_TO_PRESIGN_TYPE_NAME,
243243
CONVERT_TO_PRESIGN_MIDDLEWARE_NAME);

0 commit comments

Comments
 (0)