diff --git a/.changes/2.31.74.json b/.changes/2.31.74.json
new file mode 100644
index 000000000000..0da6a07188d4
--- /dev/null
+++ b/.changes/2.31.74.json
@@ -0,0 +1,132 @@
+{
+ "version": "2.31.74",
+ "date": "2025-06-30",
+ "entries": [
+ {
+ "type": "feature",
+ "category": "AWS ARC - Zonal Shift",
+ "contributor": "",
+ "description": "Added support for on-demand practice runs and balanced capacity checks in ARC autoshift practice."
+ },
+ {
+ "type": "feature",
+ "category": "AWS B2B Data Interchange",
+ "contributor": "",
+ "description": "Updated APIs to support inbound EDI split capabilities and additional Partnership-level configurations of generated EDI files' contents and format."
+ },
+ {
+ "type": "feature",
+ "category": "AWS CloudFormation",
+ "contributor": "",
+ "description": "Added support for UNKNOWN drift status."
+ },
+ {
+ "type": "feature",
+ "category": "AWS Config",
+ "contributor": "",
+ "description": "Updated ResourceType enum with new resource types onboarded by AWS Config as of June 2025"
+ },
+ {
+ "type": "feature",
+ "category": "AWS Data Exchange",
+ "contributor": "",
+ "description": "This release updates resource Id with alphanumeric constraint, including Asset id, Revision id, Data Set id, Job id, and Event Action id."
+ },
+ {
+ "type": "feature",
+ "category": "AWS Glue",
+ "contributor": "",
+ "description": "releasing source processing properties to support source properties for ODB integrations"
+ },
+ {
+ "type": "feature",
+ "category": "AWS Health Imaging",
+ "contributor": "",
+ "description": "Added new fields to support the concept of primary image sets within the storage hierarchy."
+ },
+ {
+ "type": "feature",
+ "category": "AWS Identity and Access Management",
+ "contributor": "",
+ "description": "Updated IAM ServiceSpecificCredential support to include expiration, API Key output format instead of username and password for services that will support API keys, and the ability to list credentials for all users in the account for a given service configuration."
+ },
+ {
+ "type": "feature",
+ "category": "AWS Outposts",
+ "contributor": "",
+ "description": "Make ContactName and ContactPhoneNumber required fields when creating and updating Outpost Site Addresses."
+ },
+ {
+ "type": "feature",
+ "category": "AWS Parallel Computing Service",
+ "contributor": "",
+ "description": "Fixed the validation pattern for an instance profile Amazon Resource Name (ARN) in AWS PCS."
+ },
+ {
+ "type": "feature",
+ "category": "AWS Transfer Family",
+ "contributor": "",
+ "description": "Added support for dual-stack (IPv4 and IPv6) endpoints for SFTP public endpoints and VPC-internal endpoints (SFTP, FTPS, FTP, and AS2), enabling customers to configure new servers with IPv4 or dual-stack mode, convert existing servers to dual-stack, and use IPv6 with service APIs."
+ },
+ {
+ "type": "feature",
+ "category": "Amazon Bedrock",
+ "contributor": "",
+ "description": "Add support for API Keys, Re-Ranker, implicit filter for RAG / KB evaluation for Bedrock APIs."
+ },
+ {
+ "type": "feature",
+ "category": "Amazon Bedrock Runtime",
+ "contributor": "",
+ "description": "Add API Key and document citations support for Bedrock Runtime APIs"
+ },
+ {
+ "type": "feature",
+ "category": "Amazon CloudWatch Logs",
+ "contributor": "",
+ "description": "Increase minimum length of queryId parameter to 1 character."
+ },
+ {
+ "type": "feature",
+ "category": "Amazon Connect Service",
+ "contributor": "",
+ "description": "This release introduces ChatMetrics to the model, providing comprehensive analytics insights for Amazon Connect chat conversations. Users can access these detailed metrics through the AWS Connect API by using the DescribeContact operation with their specific instance and contact IDs"
+ },
+ {
+ "type": "feature",
+ "category": "Amazon DynamoDB",
+ "contributor": "",
+ "description": "This change adds support for witnesses in global tables. It also adds a new table status, REPLICATION_NOT_AUTHORIZED. This status will indicate scenarios where global replicas table can't be utilized for data plane operations."
+ },
+ {
+ "type": "feature",
+ "category": "Amazon EventBridge",
+ "contributor": "",
+ "description": "Added support for EventBridge Dualstack endpoints in AWS GovCloud (US) regions (us-gov-east-1 and us-gov-west-1). The dualstack endpoints are identical for both FIPS and non-FIPS configurations, following the format: events.{region}.api.aws"
+ },
+ {
+ "type": "feature",
+ "category": "Amazon QuickSight",
+ "contributor": "",
+ "description": "Introduced custom permission capabilities for reporting content. Added menu option in exploration to preserve configuration data when textbox menu option is used. Added support for Athena trusted identity propagation."
+ },
+ {
+ "type": "feature",
+ "category": "Amazon Simple Systems Manager (SSM)",
+ "contributor": "",
+ "description": "Introduces AccessType, a new filter value for the DescribeSessions API."
+ },
+ {
+ "type": "feature",
+ "category": "Network Flow Monitor",
+ "contributor": "",
+ "description": "Add ConflictExceptions to UpdateScope and DeleteScope operations for scopes being mutated."
+ },
+ {
+ "type": "feature",
+ "category": "AWS SDK for Java v2",
+ "contributor": "",
+ "description": "Updated endpoint and partition metadata."
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.changes/2.31.75.json b/.changes/2.31.75.json
new file mode 100644
index 000000000000..1f01be61b2ed
--- /dev/null
+++ b/.changes/2.31.75.json
@@ -0,0 +1,60 @@
+{
+ "version": "2.31.75",
+ "date": "2025-07-01",
+ "entries": [
+ {
+ "type": "feature",
+ "category": "AWS Clean Rooms ML",
+ "contributor": "",
+ "description": "This release introduces support for incremental training and distributed training for custom models in AWS Clean Rooms ML."
+ },
+ {
+ "type": "feature",
+ "category": "AWS SDK for Java v2",
+ "contributor": "",
+ "description": "Add the sdk service client version to the useragent"
+ },
+ {
+ "type": "feature",
+ "category": "Amazon DataZone",
+ "contributor": "",
+ "description": "Add support for the new optional domain-unit-id parameter in the UpdateProject API."
+ },
+ {
+ "type": "feature",
+ "category": "Amazon Elastic Compute Cloud",
+ "contributor": "",
+ "description": "Add Context to GetInstanceTypesFromInstanceRequirements API"
+ },
+ {
+ "type": "feature",
+ "category": "Amazon Relational Database Service",
+ "contributor": "",
+ "description": "Amazon RDS Custom for Oracle now supports multi-AZ database instances."
+ },
+ {
+ "type": "feature",
+ "category": "Amazon SageMaker Service",
+ "contributor": "",
+ "description": "Updated field validation requirements for InstanceGroups."
+ },
+ {
+ "type": "feature",
+ "category": "QBusiness",
+ "contributor": "",
+ "description": "New ChatResponseConfiguration to Customize Q Business chat responses for specific use cases and communication needs. Updated Boosting capability allowing admins to provide preference on date attributes for recency and/or provide a preferred data source."
+ },
+ {
+ "type": "feature",
+ "category": "odb",
+ "contributor": "",
+ "description": "This release adds API operations for Oracle Database@AWS. You can use the APIs to create Exadata infrastructure, ODB networks, and Exadata and Autonomous VM clusters inside AWS data centers. The infrastructure is managed by OCI. You can integrate these resources with AWS services."
+ },
+ {
+ "type": "feature",
+ "category": "AWS SDK for Java v2",
+ "contributor": "",
+ "description": "Updated endpoint and partition metadata."
+ }
+ ]
+}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5e951b9a303a..2f742efa378b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,123 @@
#### 👋 _Looking for changelogs for older versions? You can find them in the [changelogs](./changelogs) directory._
+# __2.31.75__ __2025-07-01__
+## __AWS Clean Rooms ML__
+ - ### Features
+ - This release introduces support for incremental training and distributed training for custom models in AWS Clean Rooms ML.
+
+## __AWS SDK for Java v2__
+ - ### Features
+ - Add the sdk service client version to the useragent
+ - Updated endpoint and partition metadata.
+
+## __Amazon DataZone__
+ - ### Features
+ - Add support for the new optional domain-unit-id parameter in the UpdateProject API.
+
+## __Amazon Elastic Compute Cloud__
+ - ### Features
+ - Add Context to GetInstanceTypesFromInstanceRequirements API
+
+## __Amazon Relational Database Service__
+ - ### Features
+ - Amazon RDS Custom for Oracle now supports multi-AZ database instances.
+
+## __Amazon SageMaker Service__
+ - ### Features
+ - Updated field validation requirements for InstanceGroups.
+
+## __QBusiness__
+ - ### Features
+ - New ChatResponseConfiguration to Customize Q Business chat responses for specific use cases and communication needs. Updated Boosting capability allowing admins to provide preference on date attributes for recency and/or provide a preferred data source.
+
+## __odb__
+ - ### Features
+ - This release adds API operations for Oracle Database@AWS. You can use the APIs to create Exadata infrastructure, ODB networks, and Exadata and Autonomous VM clusters inside AWS data centers. The infrastructure is managed by OCI. You can integrate these resources with AWS services.
+
+# __2.31.74__ __2025-06-30__
+## __AWS ARC - Zonal Shift__
+ - ### Features
+ - Added support for on-demand practice runs and balanced capacity checks in ARC autoshift practice.
+
+## __AWS B2B Data Interchange__
+ - ### Features
+ - Updated APIs to support inbound EDI split capabilities and additional Partnership-level configurations of generated EDI files' contents and format.
+
+## __AWS CloudFormation__
+ - ### Features
+ - Added support for UNKNOWN drift status.
+
+## __AWS Config__
+ - ### Features
+ - Updated ResourceType enum with new resource types onboarded by AWS Config as of June 2025
+
+## __AWS Data Exchange__
+ - ### Features
+ - This release updates resource Id with alphanumeric constraint, including Asset id, Revision id, Data Set id, Job id, and Event Action id.
+
+## __AWS Glue__
+ - ### Features
+ - releasing source processing properties to support source properties for ODB integrations
+
+## __AWS Health Imaging__
+ - ### Features
+ - Added new fields to support the concept of primary image sets within the storage hierarchy.
+
+## __AWS Identity and Access Management__
+ - ### Features
+ - Updated IAM ServiceSpecificCredential support to include expiration, API Key output format instead of username and password for services that will support API keys, and the ability to list credentials for all users in the account for a given service configuration.
+
+## __AWS Outposts__
+ - ### Features
+ - Make ContactName and ContactPhoneNumber required fields when creating and updating Outpost Site Addresses.
+
+## __AWS Parallel Computing Service__
+ - ### Features
+ - Fixed the validation pattern for an instance profile Amazon Resource Name (ARN) in AWS PCS.
+
+## __AWS SDK for Java v2__
+ - ### Features
+ - Updated endpoint and partition metadata.
+
+## __AWS Transfer Family__
+ - ### Features
+ - Added support for dual-stack (IPv4 and IPv6) endpoints for SFTP public endpoints and VPC-internal endpoints (SFTP, FTPS, FTP, and AS2), enabling customers to configure new servers with IPv4 or dual-stack mode, convert existing servers to dual-stack, and use IPv6 with service APIs.
+
+## __Amazon Bedrock__
+ - ### Features
+ - Add support for API Keys, Re-Ranker, implicit filter for RAG / KB evaluation for Bedrock APIs.
+
+## __Amazon Bedrock Runtime__
+ - ### Features
+ - Add API Key and document citations support for Bedrock Runtime APIs
+
+## __Amazon CloudWatch Logs__
+ - ### Features
+ - Increase minimum length of queryId parameter to 1 character.
+
+## __Amazon Connect Service__
+ - ### Features
+ - This release introduces ChatMetrics to the model, providing comprehensive analytics insights for Amazon Connect chat conversations. Users can access these detailed metrics through the AWS Connect API by using the DescribeContact operation with their specific instance and contact IDs
+
+## __Amazon DynamoDB__
+ - ### Features
+ - This change adds support for witnesses in global tables. It also adds a new table status, REPLICATION_NOT_AUTHORIZED. This status will indicate scenarios where global replicas table can't be utilized for data plane operations.
+
+## __Amazon EventBridge__
+ - ### Features
+ - Added support for EventBridge Dualstack endpoints in AWS GovCloud (US) regions (us-gov-east-1 and us-gov-west-1). The dualstack endpoints are identical for both FIPS and non-FIPS configurations, following the format: events.{region}.api.aws
+
+## __Amazon QuickSight__
+ - ### Features
+ - Introduced custom permission capabilities for reporting content. Added menu option in exploration to preserve configuration data when textbox menu option is used. Added support for Athena trusted identity propagation.
+
+## __Amazon Simple Systems Manager (SSM)__
+ - ### Features
+ - Introduces AccessType, a new filter value for the DescribeSessions API.
+
+## __Network Flow Monitor__
+ - ### Features
+ - Add ConflictExceptions to UpdateScope and DeleteScope operations for scopes being mutated.
+
# __2.31.73__ __2025-06-27__
## __AWS Config__
- ### Features
diff --git a/README.md b/README.md
index 7744ca1f76fe..138e78fe5d87 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,7 @@ To automatically manage module versions (currently all modules have the same ver
software.amazon.awssdk
bom
- 2.31.73
+ 2.31.75
pom
import
@@ -85,12 +85,12 @@ Alternatively you can add dependencies for the specific services you use only:
software.amazon.awssdk
ec2
- 2.31.73
+ 2.31.75
software.amazon.awssdk
s3
- 2.31.73
+ 2.31.75
```
@@ -102,7 +102,7 @@ You can import the whole SDK into your project (includes *ALL* services). Please
software.amazon.awssdk
aws-sdk-java
- 2.31.73
+ 2.31.75
```
diff --git a/archetypes/archetype-app-quickstart/pom.xml b/archetypes/archetype-app-quickstart/pom.xml
index 512fe04aef87..dd4bf1d68a1a 100644
--- a/archetypes/archetype-app-quickstart/pom.xml
+++ b/archetypes/archetype-app-quickstart/pom.xml
@@ -20,7 +20,7 @@
archetypes
software.amazon.awssdk
- 2.31.74-SNAPSHOT
+ 2.31.76-SNAPSHOT
4.0.0
diff --git a/archetypes/archetype-lambda/pom.xml b/archetypes/archetype-lambda/pom.xml
index 747cadfbc75c..ef2ea74c4c5f 100644
--- a/archetypes/archetype-lambda/pom.xml
+++ b/archetypes/archetype-lambda/pom.xml
@@ -20,7 +20,7 @@
archetypes
software.amazon.awssdk
- 2.31.74-SNAPSHOT
+ 2.31.76-SNAPSHOT
4.0.0
archetype-lambda
diff --git a/archetypes/archetype-tools/pom.xml b/archetypes/archetype-tools/pom.xml
index edf8a6fb0388..ca41b0676686 100644
--- a/archetypes/archetype-tools/pom.xml
+++ b/archetypes/archetype-tools/pom.xml
@@ -20,7 +20,7 @@
archetypes
software.amazon.awssdk
- 2.31.74-SNAPSHOT
+ 2.31.76-SNAPSHOT
4.0.0
diff --git a/archetypes/pom.xml b/archetypes/pom.xml
index 159f3069c705..ef7e4795d710 100644
--- a/archetypes/pom.xml
+++ b/archetypes/pom.xml
@@ -20,7 +20,7 @@
aws-sdk-java-pom
software.amazon.awssdk
- 2.31.74-SNAPSHOT
+ 2.31.76-SNAPSHOT
4.0.0
archetypes
diff --git a/aws-sdk-java/pom.xml b/aws-sdk-java/pom.xml
index 88625caa659f..71038e870e86 100644
--- a/aws-sdk-java/pom.xml
+++ b/aws-sdk-java/pom.xml
@@ -17,7 +17,7 @@
software.amazon.awssdk
aws-sdk-java-pom
- 2.31.74-SNAPSHOT
+ 2.31.76-SNAPSHOT
../pom.xml
aws-sdk-java
@@ -2093,6 +2093,11 @@ Amazon AutoScaling, etc).
keyspacesstreams
${awsjavasdk.version}
+
+ software.amazon.awssdk
+ odb
+ ${awsjavasdk.version}
+
${project.artifactId}-${project.version}
diff --git a/bom-internal/pom.xml b/bom-internal/pom.xml
index 902d7b6fec1d..5db756cda2de 100644
--- a/bom-internal/pom.xml
+++ b/bom-internal/pom.xml
@@ -20,7 +20,7 @@
aws-sdk-java-pom
software.amazon.awssdk
- 2.31.74-SNAPSHOT
+ 2.31.76-SNAPSHOT
4.0.0
diff --git a/bom/pom.xml b/bom/pom.xml
index 6f66d4f623b2..9219c536ef6e 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -17,7 +17,7 @@
software.amazon.awssdk
aws-sdk-java-pom
- 2.31.74-SNAPSHOT
+ 2.31.76-SNAPSHOT
../pom.xml
bom
@@ -2293,6 +2293,11 @@
keyspacesstreams
${awsjavasdk.version}
+
+ software.amazon.awssdk
+ odb
+ ${awsjavasdk.version}
+
diff --git a/bundle-logging-bridge/pom.xml b/bundle-logging-bridge/pom.xml
index e35d49b6a4b1..0decc070a4f7 100644
--- a/bundle-logging-bridge/pom.xml
+++ b/bundle-logging-bridge/pom.xml
@@ -21,7 +21,7 @@
software.amazon.awssdk
aws-sdk-java-pom
- 2.31.74-SNAPSHOT
+ 2.31.76-SNAPSHOT
bundle-logging-bridge
jar
diff --git a/bundle-sdk/pom.xml b/bundle-sdk/pom.xml
index c261657e5fe6..a89e0182f5f2 100644
--- a/bundle-sdk/pom.xml
+++ b/bundle-sdk/pom.xml
@@ -21,7 +21,7 @@
software.amazon.awssdk
aws-sdk-java-pom
- 2.31.74-SNAPSHOT
+ 2.31.76-SNAPSHOT
bundle-sdk
jar
diff --git a/bundle/pom.xml b/bundle/pom.xml
index 2fc01995c746..b095bb7b81c4 100644
--- a/bundle/pom.xml
+++ b/bundle/pom.xml
@@ -21,7 +21,7 @@
software.amazon.awssdk
aws-sdk-java-pom
- 2.31.74-SNAPSHOT
+ 2.31.76-SNAPSHOT
bundle
jar
diff --git a/codegen-lite-maven-plugin/pom.xml b/codegen-lite-maven-plugin/pom.xml
index 3b955a6a7c85..c8cb7e848abe 100644
--- a/codegen-lite-maven-plugin/pom.xml
+++ b/codegen-lite-maven-plugin/pom.xml
@@ -22,7 +22,7 @@
software.amazon.awssdk
aws-sdk-java-pom
- 2.31.74-SNAPSHOT
+ 2.31.76-SNAPSHOT
../pom.xml
codegen-lite-maven-plugin
diff --git a/codegen-lite/pom.xml b/codegen-lite/pom.xml
index 894b483707d3..81beb659771e 100644
--- a/codegen-lite/pom.xml
+++ b/codegen-lite/pom.xml
@@ -21,7 +21,7 @@
software.amazon.awssdk
aws-sdk-java-pom
- 2.31.74-SNAPSHOT
+ 2.31.76-SNAPSHOT
codegen-lite
AWS Java SDK :: Code Generator Lite
diff --git a/codegen-maven-plugin/pom.xml b/codegen-maven-plugin/pom.xml
index 50e130c8b967..64fa80df5b50 100644
--- a/codegen-maven-plugin/pom.xml
+++ b/codegen-maven-plugin/pom.xml
@@ -22,7 +22,7 @@
software.amazon.awssdk
aws-sdk-java-pom
- 2.31.74-SNAPSHOT
+ 2.31.76-SNAPSHOT
../pom.xml
codegen-maven-plugin
diff --git a/codegen/pom.xml b/codegen/pom.xml
index a9af7aaae87f..b5b94a594ad0 100644
--- a/codegen/pom.xml
+++ b/codegen/pom.xml
@@ -21,7 +21,7 @@
software.amazon.awssdk
aws-sdk-java-pom
- 2.31.74-SNAPSHOT
+ 2.31.76-SNAPSHOT
codegen
AWS Java SDK :: Code Generator
diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/AsyncClientClass.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/AsyncClientClass.java
index aaa729662c17..9829133551c3 100644
--- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/AsyncClientClass.java
+++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/AsyncClientClass.java
@@ -26,6 +26,7 @@
import static software.amazon.awssdk.codegen.internal.Constant.EVENT_PUBLISHER_PARAM_NAME;
import static software.amazon.awssdk.codegen.poet.client.ClientClassUtils.addS3ArnableFieldCode;
import static software.amazon.awssdk.codegen.poet.client.ClientClassUtils.applySignerOverrideMethod;
+import static software.amazon.awssdk.codegen.poet.client.ClientClassUtils.transformServiceId;
import static software.amazon.awssdk.codegen.poet.client.SyncClientClass.addRequestModifierCode;
import static software.amazon.awssdk.codegen.poet.client.SyncClientClass.getProtocolSpecs;
@@ -229,7 +230,14 @@ private MethodSpec constructor(TypeSpec.Builder classBuilder) {
.addStatement("this.clientHandler = new $T(clientConfiguration)", AwsAsyncClientHandler.class)
.addStatement("this.clientConfiguration = clientConfiguration.toBuilder()"
+ ".option($T.SDK_CLIENT, this)"
- + ".build()", SdkClientOption.class);
+ + ".option($T.API_METADATA, $S + \"#\" + $T.VERSION)"
+ + ".build()",
+ SdkClientOption.class,
+ SdkClientOption.class,
+ transformServiceId(model.getMetadata().getServiceId()),
+ ClassName.get(model.getMetadata().getFullClientInternalPackageName(),
+ "ServiceVersionInfo"));
+
FieldSpec protocolFactoryField = protocolSpec.protocolFactory(model);
if (model.getMetadata().isJsonProtocol()) {
builder.addStatement("this.$N = init($T.builder()).build()", protocolFactoryField.name,
diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/ClientClassUtils.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/ClientClassUtils.java
index 87e8339e54a5..c058c1d7b654 100644
--- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/ClientClassUtils.java
+++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/ClientClassUtils.java
@@ -280,4 +280,9 @@ public static MethodSpec updateRetryStrategyClientConfigurationMethod() {
builder.addStatement("configuration.option($T.CONFIGURED_RETRY_CONFIGURATOR, null)", SdkClientOption.class);
return builder.build();
}
+
+ // According to User Agent 2.0 spec, replace spaces with underscores
+ static String transformServiceId(String serviceId) {
+ return serviceId.replace(" ", "_");
+ }
}
diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/SyncClientClass.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/SyncClientClass.java
index 2695e43f8746..780d15a8298b 100644
--- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/SyncClientClass.java
+++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/SyncClientClass.java
@@ -23,6 +23,7 @@
import static software.amazon.awssdk.codegen.poet.PoetUtils.classNameFromFqcn;
import static software.amazon.awssdk.codegen.poet.client.ClientClassUtils.addS3ArnableFieldCode;
import static software.amazon.awssdk.codegen.poet.client.ClientClassUtils.applySignerOverrideMethod;
+import static software.amazon.awssdk.codegen.poet.client.ClientClassUtils.transformServiceId;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.CodeBlock;
@@ -201,7 +202,13 @@ private MethodSpec constructor() {
.addStatement("this.clientHandler = new $T(clientConfiguration)", protocolSpec.getClientHandlerClass())
.addStatement("this.clientConfiguration = clientConfiguration.toBuilder()"
+ ".option($T.SDK_CLIENT, this)"
- + ".build()", SdkClientOption.class);
+ + ".option($T.API_METADATA, $S + \"#\" + $T.VERSION)"
+ + ".build()",
+ SdkClientOption.class,
+ SdkClientOption.class,
+ transformServiceId(model.getMetadata().getServiceId()),
+ ClassName.get(model.getMetadata().getFullClientInternalPackageName(),
+ "ServiceVersionInfo"));
FieldSpec protocolFactoryField = protocolSpec.protocolFactory(model);
if (model.getMetadata().isJsonProtocol()) {
diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/ServiceVersionInfoSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/ServiceVersionInfoSpec.java
index 00963197bdee..145e482ad899 100644
--- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/ServiceVersionInfoSpec.java
+++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/ServiceVersionInfoSpec.java
@@ -22,6 +22,7 @@
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeSpec;
import javax.lang.model.element.Modifier;
+import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel;
import software.amazon.awssdk.codegen.poet.ClassSpec;
import software.amazon.awssdk.codegen.poet.PoetExtension;
@@ -39,6 +40,7 @@ public TypeSpec poetSpec() {
TypeSpec.Builder builder = TypeSpec.classBuilder("ServiceVersionInfo")
.addModifiers(Modifier.PUBLIC, Modifier.FINAL)
.addAnnotation(PoetUtils.generatedAnnotation())
+ .addAnnotation(SdkInternalApi.class)
.addField(FieldSpec.builder(
String.class, "VERSION", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)
.initializer("$S", SDK_VERSION)
diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/EndpointProviderSpec2.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/EndpointProviderSpec2.java
index bf0cb11f1813..55dbf5358842 100644
--- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/EndpointProviderSpec2.java
+++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/rules2/EndpointProviderSpec2.java
@@ -236,7 +236,7 @@ private void codegenExpr(RuleSetExpression expr, CodeBlock.Builder builder) {
utils.scopesByName(),
useEndpointCaching,
builder);
- expr.accept(visitor);
+ visitor.visitRuleSetExpression(expr);
}
private TypeName ruleResult() {
diff --git a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/client/ServiceVersionInfoSpecTest.java b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/client/ServiceVersionInfoSpecTest.java
index 496a35914030..4fe4c9daf0bb 100644
--- a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/client/ServiceVersionInfoSpecTest.java
+++ b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/client/ServiceVersionInfoSpecTest.java
@@ -31,15 +31,17 @@
public class ServiceVersionInfoSpecTest {
// Fixture test that compares generated ServiceVersionInfo class against expected output.
- // The fixture file uses {{VERSION}} as a placeholder which gets replaced with the current
- // SDK version at test time, since the generated code injects the actual version at build time.
+ // The fixture file uses {{VERSION}} as a placeholder for the SDK version. The placeholder get
+ // replaced with actual value at test time, since the generated code injects the actual
+ // version at build time.
@Test
void testServiceVersionInfoClass() {
String currVersion = VersionInfo.SDK_VERSION;
ClassSpec serviceVersionInfoSpec = new ServiceVersionInfoSpec(ClientTestModels.restJsonServiceModels());
String expectedContent = loadFixtureFile("test-service-version-info-class.java");
- expectedContent = expectedContent.replace("{{VERSION}}", currVersion);
+ expectedContent = expectedContent
+ .replace("{{VERSION}}", currVersion);
String actualContent = generateContent(serviceVersionInfoSpec);
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/specs/test-service-version-info-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/specs/test-service-version-info-class.java
index 62d60b103745..ab582d908e73 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/specs/test-service-version-info-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/specs/test-service-version-info-class.java
@@ -2,8 +2,10 @@
import java.lang.String;
import software.amazon.awssdk.annotations.Generated;
+import software.amazon.awssdk.annotations.SdkInternalApi;
@Generated("software.amazon.awssdk:codegen")
+@SdkInternalApi
public final class ServiceVersionInfo {
/**
* Returns the current version for the AWS SDK in which this class is running.
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java
index 948b39851836..62fc9a6420b1 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java
@@ -58,6 +58,7 @@
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.json.internal.JsonServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.json.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.json.model.APostOperationRequest;
import software.amazon.awssdk.services.json.model.APostOperationResponse;
import software.amazon.awssdk.services.json.model.APostOperationWithOutputRequest;
@@ -140,7 +141,8 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient {
protected DefaultJsonAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "Json_Service" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
this.executor = clientConfiguration.option(SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR);
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java
index 179cda47f8d4..55e919112380 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java
@@ -59,6 +59,7 @@
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.json.internal.JsonServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.json.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.json.model.APostOperationRequest;
import software.amazon.awssdk.services.json.model.APostOperationResponse;
import software.amazon.awssdk.services.json.model.APostOperationWithOutputRequest;
@@ -143,7 +144,9 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient {
protected DefaultJsonAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA,
+ "Json_Service" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsCborProtocolFactory.builder()).build();
this.jsonProtocolFactory = init(AwsJsonProtocolFactory.builder()).build();
this.executor = clientConfiguration.option(SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR);
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java
index ca1e1d24abd1..6af0c4bce214 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java
@@ -64,6 +64,7 @@
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.json.batchmanager.JsonAsyncBatchManager;
import software.amazon.awssdk.services.json.internal.JsonServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.json.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.json.model.APostOperationRequest;
import software.amazon.awssdk.services.json.model.APostOperationResponse;
import software.amazon.awssdk.services.json.model.APostOperationWithOutputRequest;
@@ -153,7 +154,9 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient {
protected DefaultJsonAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA,
+ "Json_Service" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
this.executor = clientConfiguration.option(SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR);
this.executorService = clientConfiguration.option(SdkClientOption.SCHEDULED_EXECUTOR_SERVICE);
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java
index 8c5920371062..2af4fa91155d 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java
@@ -43,6 +43,7 @@
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.json.internal.JsonServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.json.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.json.model.APostOperationRequest;
import software.amazon.awssdk.services.json.model.APostOperationResponse;
import software.amazon.awssdk.services.json.model.APostOperationWithOutputRequest;
@@ -108,7 +109,8 @@ final class DefaultJsonClient implements JsonClient {
protected DefaultJsonClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "Json_Service" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java
index 8a7945259d3e..888fc0332acc 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java
@@ -45,6 +45,7 @@
import software.amazon.awssdk.protocols.query.AwsQueryProtocolFactory;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.query.internal.QueryServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.query.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.query.model.APostOperationRequest;
import software.amazon.awssdk.services.query.model.APostOperationResponse;
import software.amazon.awssdk.services.query.model.APostOperationWithOutputRequest;
@@ -122,7 +123,8 @@ final class DefaultQueryAsyncClient implements QueryAsyncClient {
protected DefaultQueryAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "Query_Service" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init();
this.executorService = clientConfiguration.option(SdkClientOption.SCHEDULED_EXECUTOR_SERVICE);
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java
index 49ddc43017b9..c9fbcb8a1304 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java
@@ -39,6 +39,7 @@
import software.amazon.awssdk.protocols.query.AwsQueryProtocolFactory;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.query.internal.QueryServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.query.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.query.model.APostOperationRequest;
import software.amazon.awssdk.services.query.model.APostOperationResponse;
import software.amazon.awssdk.services.query.model.APostOperationWithOutputRequest;
@@ -113,7 +114,8 @@ final class DefaultQueryClient implements QueryClient {
protected DefaultQueryClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "Query_Service" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init();
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java
index 966f8f0ee206..cd9f7feed73e 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java
@@ -50,6 +50,7 @@
import software.amazon.awssdk.protocols.xml.AwsXmlProtocolFactory;
import software.amazon.awssdk.protocols.xml.XmlOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
+import software.amazon.awssdk.services.xml.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.xml.internal.XmlServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.xml.model.APostOperationRequest;
import software.amazon.awssdk.services.xml.model.APostOperationResponse;
@@ -114,7 +115,8 @@ final class DefaultXmlAsyncClient implements XmlAsyncClient {
protected DefaultXmlAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "Xml_Service" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init();
this.executor = clientConfiguration.option(SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR);
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java
index 7b2a515aa9a4..b96f7fc24865 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java
@@ -39,6 +39,7 @@
import software.amazon.awssdk.protocols.xml.AwsXmlProtocolFactory;
import software.amazon.awssdk.protocols.xml.XmlOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
+import software.amazon.awssdk.services.xml.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.xml.internal.XmlServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.xml.model.APostOperationRequest;
import software.amazon.awssdk.services.xml.model.APostOperationResponse;
@@ -95,7 +96,8 @@ final class DefaultXmlClient implements XmlClient {
protected DefaultXmlClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "Xml_Service" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init();
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java
index a6e467d42300..9622a7daa009 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java
@@ -63,6 +63,7 @@
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.json.internal.JsonServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.json.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.json.model.APostOperationRequest;
import software.amazon.awssdk.services.json.model.APostOperationResponse;
import software.amazon.awssdk.services.json.model.APostOperationWithOutputRequest;
@@ -146,7 +147,8 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient {
protected DefaultJsonAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "Json_Service" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
this.executor = clientConfiguration.option(SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR);
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java
index 4e035d57ed02..629de25187ad 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java
@@ -38,6 +38,7 @@
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.querytojsoncompatible.internal.QueryToJsonCompatibleServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.querytojsoncompatible.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.querytojsoncompatible.model.APostOperationRequest;
import software.amazon.awssdk.services.querytojsoncompatible.model.APostOperationResponse;
import software.amazon.awssdk.services.querytojsoncompatible.model.InvalidInputException;
@@ -57,7 +58,7 @@ final class DefaultQueryToJsonCompatibleAsyncClient implements QueryToJsonCompat
private static final Logger log = LoggerFactory.getLogger(DefaultQueryToJsonCompatibleAsyncClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
- .serviceProtocol(AwsServiceProtocol.AWS_JSON).build();
+ .serviceProtocol(AwsServiceProtocol.AWS_JSON).build();
private final AsyncClientHandler clientHandler;
@@ -67,7 +68,8 @@ final class DefaultQueryToJsonCompatibleAsyncClient implements QueryToJsonCompat
protected DefaultQueryToJsonCompatibleAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "QueryToJsonCompatibleService" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@@ -99,43 +101,43 @@ protected DefaultQueryToJsonCompatibleAsyncClient(SdkClientConfiguration clientC
public CompletableFuture aPostOperation(APostOperationRequest aPostOperationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "QueryToJsonCompatibleService");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
- operationMetadata, APostOperationResponse::builder);
+ operationMetadata, APostOperationResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- case "InvalidInput":
- return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400)
- .exceptionBuilderSupplier(InvalidInputException::builder).build());
- default:
- return Optional.empty();
+ case "InvalidInput":
+ return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400)
+ .exceptionBuilderSupplier(InvalidInputException::builder).build());
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
String hostPrefix = "{StringMember}-foo.";
HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember",
- "aPostOperationRequest");
+ "aPostOperationRequest");
String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember());
CompletableFuture executeFuture = clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata)
- .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest));
+ .execute(new ClientExecutionParams()
+ .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -159,12 +161,12 @@ public final String serviceName() {
private > T init(T builder) {
return builder.clientConfiguration(clientConfiguration)
- .defaultServiceExceptionSupplier(QueryToJsonCompatibleException::builder).protocol(AwsJsonProtocol.AWS_JSON)
- .protocolVersion("1.1").hasAwsQueryCompatible(true);
+ .defaultServiceExceptionSupplier(QueryToJsonCompatibleException::builder).protocol(AwsJsonProtocol.AWS_JSON)
+ .protocolVersion("1.1").hasAwsQueryCompatible(true);
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
- RequestOverrideConfiguration requestOverrideConfiguration) {
+ RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
@@ -208,7 +210,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
return configuration.build();
}
QueryToJsonCompatibleServiceClientConfigurationBuilder serviceConfigBuilder = new QueryToJsonCompatibleServiceClientConfigurationBuilder(
- configuration);
+ configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
@@ -217,7 +219,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
- JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
+ JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper);
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java
index aa52553f0bf0..4397f32d85b5 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java
@@ -34,6 +34,7 @@
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.querytojsoncompatible.internal.QueryToJsonCompatibleServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.querytojsoncompatible.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.querytojsoncompatible.model.APostOperationRequest;
import software.amazon.awssdk.services.querytojsoncompatible.model.APostOperationResponse;
import software.amazon.awssdk.services.querytojsoncompatible.model.InvalidInputException;
@@ -53,7 +54,7 @@ final class DefaultQueryToJsonCompatibleClient implements QueryToJsonCompatibleC
private static final Logger log = Logger.loggerFor(DefaultQueryToJsonCompatibleClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
- .serviceProtocol(AwsServiceProtocol.AWS_JSON).build();
+ .serviceProtocol(AwsServiceProtocol.AWS_JSON).build();
private final SyncClientHandler clientHandler;
@@ -63,7 +64,8 @@ final class DefaultQueryToJsonCompatibleClient implements QueryToJsonCompatibleC
protected DefaultQueryToJsonCompatibleClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "QueryToJsonCompatibleService" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@@ -89,45 +91,45 @@ protected DefaultQueryToJsonCompatibleClient(SdkClientConfiguration clientConfig
*/
@Override
public APostOperationResponse aPostOperation(APostOperationRequest aPostOperationRequest) throws InvalidInputException,
- AwsServiceException, SdkClientException, QueryToJsonCompatibleException {
+ AwsServiceException, SdkClientException, QueryToJsonCompatibleException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
- APostOperationResponse::builder);
+ APostOperationResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- case "InvalidInput":
- return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400)
- .exceptionBuilderSupplier(InvalidInputException::builder).build());
- default:
- return Optional.empty();
+ case "InvalidInput":
+ return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400)
+ .exceptionBuilderSupplier(InvalidInputException::builder).build());
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "QueryToJsonCompatibleService");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation");
String hostPrefix = "{StringMember}-foo.";
HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember",
- "aPostOperationRequest");
+ "aPostOperationRequest");
String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember());
return clientHandler.execute(new ClientExecutionParams()
- .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata)
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration)
- .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector)
- .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)));
+ .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration)
+ .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
@@ -139,7 +141,7 @@ public final String serviceName() {
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
- RequestOverrideConfiguration requestOverrideConfiguration) {
+ RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
@@ -154,7 +156,7 @@ private static List resolveMetricPublishers(SdkClientConfigurat
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
- JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
+ JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper);
}
@@ -188,7 +190,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
return configuration.build();
}
QueryToJsonCompatibleServiceClientConfigurationBuilder serviceConfigBuilder = new QueryToJsonCompatibleServiceClientConfigurationBuilder(
- configuration);
+ configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
@@ -198,8 +200,8 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
private > T init(T builder) {
return builder.clientConfiguration(clientConfiguration)
- .defaultServiceExceptionSupplier(QueryToJsonCompatibleException::builder).protocol(AwsJsonProtocol.AWS_JSON)
- .protocolVersion("1.1").hasAwsQueryCompatible(true);
+ .defaultServiceExceptionSupplier(QueryToJsonCompatibleException::builder).protocol(AwsJsonProtocol.AWS_JSON)
+ .protocolVersion("1.1").hasAwsQueryCompatible(true);
}
@Override
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-batchmanager-async.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-batchmanager-async.java
index 8c13f1420fd1..66136524d4cc 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-batchmanager-async.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-batchmanager-async.java
@@ -40,6 +40,7 @@
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.batchmanagertest.batchmanager.BatchManagerTestAsyncBatchManager;
import software.amazon.awssdk.services.batchmanagertest.internal.BatchManagerTestServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.batchmanagertest.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.batchmanagertest.model.BatchManagerTestException;
import software.amazon.awssdk.services.batchmanagertest.model.SendRequestRequest;
import software.amazon.awssdk.services.batchmanagertest.model.SendRequestResponse;
@@ -57,7 +58,7 @@ final class DefaultBatchManagerTestAsyncClient implements BatchManagerTestAsyncC
private static final Logger log = LoggerFactory.getLogger(DefaultBatchManagerTestAsyncClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
- .serviceProtocol(AwsServiceProtocol.REST_JSON).build();
+ .serviceProtocol(AwsServiceProtocol.REST_JSON).build();
private final AsyncClientHandler clientHandler;
@@ -69,7 +70,8 @@ final class DefaultBatchManagerTestAsyncClient implements BatchManagerTestAsyncC
protected DefaultBatchManagerTestAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "BatchManagerTest" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
this.executorService = clientConfiguration.option(SdkClientOption.SCHEDULED_EXECUTOR_SERVICE);
}
@@ -98,36 +100,36 @@ protected DefaultBatchManagerTestAsyncClient(SdkClientConfiguration clientConfig
public CompletableFuture sendRequest(SendRequestRequest sendRequestRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(sendRequestRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, sendRequestRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "BatchManagerTest");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SendRequest");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
- SendRequestResponse::builder);
+ SendRequestResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- default:
- return Optional.empty();
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
CompletableFuture executeFuture = clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("SendRequest").withProtocolMetadata(protocolMetadata)
- .withMarshaller(new SendRequestRequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .withInput(sendRequestRequest));
+ .execute(new ClientExecutionParams()
+ .withOperationName("SendRequest").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new SendRequestRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(sendRequestRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -156,12 +158,12 @@ public final String serviceName() {
private > T init(T builder) {
return builder.clientConfiguration(clientConfiguration)
- .defaultServiceExceptionSupplier(BatchManagerTestException::builder).protocol(AwsJsonProtocol.REST_JSON)
- .protocolVersion("1.1");
+ .defaultServiceExceptionSupplier(BatchManagerTestException::builder).protocol(AwsJsonProtocol.REST_JSON)
+ .protocolVersion("1.1");
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
- RequestOverrideConfiguration requestOverrideConfiguration) {
+ RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
@@ -205,7 +207,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
return configuration.build();
}
BatchManagerTestServiceClientConfigurationBuilder serviceConfigBuilder = new BatchManagerTestServiceClientConfigurationBuilder(
- configuration);
+ configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
@@ -214,7 +216,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
- JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
+ JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper);
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java
index ae42324a36f6..7a975ac9082e 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java
@@ -64,6 +64,7 @@
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.json.internal.JsonServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.json.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.json.model.APostOperationRequest;
import software.amazon.awssdk.services.json.model.APostOperationResponse;
import software.amazon.awssdk.services.json.model.APostOperationWithOutputRequest;
@@ -149,7 +150,8 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient {
protected DefaultJsonAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "Json_Service" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsCborProtocolFactory.builder()).build();
this.jsonProtocolFactory = init(AwsJsonProtocolFactory.builder()).build();
this.executor = clientConfiguration.option(SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR);
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java
index 7741026207f2..6894514a3d92 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java
@@ -40,6 +40,7 @@
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.json.internal.JsonServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.json.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.json.model.APostOperationRequest;
import software.amazon.awssdk.services.json.model.APostOperationResponse;
import software.amazon.awssdk.services.json.model.APostOperationWithOutputRequest;
@@ -100,7 +101,8 @@ final class DefaultJsonClient implements JsonClient {
protected DefaultJsonClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "Json_Service" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsCborProtocolFactory.builder()).build();
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java
index d1740b039d14..cbd3e0ac3630 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java
@@ -3,6 +3,7 @@
import static software.amazon.awssdk.utils.FunctionalUtils.runAndLogError;
import foo.bar.helloworld.internal.ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder;
+import foo.bar.helloworld.internal.ServiceVersionInfo;
import foo.bar.helloworld.model.OneOperationRequest;
import foo.bar.helloworld.model.OneOperationResponse;
import foo.bar.helloworld.model.ProtocolRestJsonWithCustomPackageException;
@@ -55,7 +56,7 @@ final class DefaultProtocolRestJsonWithCustomPackageAsyncClient implements Proto
private static final Logger log = LoggerFactory.getLogger(DefaultProtocolRestJsonWithCustomPackageAsyncClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
- .serviceProtocol(AwsServiceProtocol.REST_JSON).build();
+ .serviceProtocol(AwsServiceProtocol.REST_JSON).build();
private final AsyncClientHandler clientHandler;
@@ -65,7 +66,8 @@ final class DefaultProtocolRestJsonWithCustomPackageAsyncClient implements Proto
protected DefaultProtocolRestJsonWithCustomPackageAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "AmazonProtocolRestJsonWithCustomPackage" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@@ -93,36 +95,36 @@ protected DefaultProtocolRestJsonWithCustomPackageAsyncClient(SdkClientConfigura
public CompletableFuture oneOperation(OneOperationRequest oneOperationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(oneOperationRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, oneOperationRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AmazonProtocolRestJsonWithCustomPackage");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OneOperation");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
- OneOperationResponse::builder);
+ OneOperationResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- default:
- return Optional.empty();
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
CompletableFuture executeFuture = clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata)
- .withMarshaller(new OneOperationRequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .withInput(oneOperationRequest));
+ .execute(new ClientExecutionParams()
+ .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new OneOperationRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(oneOperationRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -137,7 +139,7 @@ public CompletableFuture oneOperation(OneOperationRequest
@Override
public final ProtocolRestJsonWithCustomPackageServiceClientConfiguration serviceClientConfiguration() {
return new ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder())
- .build();
+ .build();
}
@Override
@@ -147,12 +149,12 @@ public final String serviceName() {
private > T init(T builder) {
return builder.clientConfiguration(clientConfiguration)
- .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomPackageException::builder)
- .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1");
+ .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomPackageException::builder)
+ .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1");
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
- RequestOverrideConfiguration requestOverrideConfiguration) {
+ RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
@@ -196,7 +198,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
return configuration.build();
}
ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder serviceConfigBuilder = new ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder(
- configuration);
+ configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
@@ -205,7 +207,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
- JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
+ JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper);
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java
index e6bad19f4837..86d2c5372f6b 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java
@@ -1,6 +1,7 @@
package foo.bar.helloworld;
import foo.bar.helloworld.internal.ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder;
+import foo.bar.helloworld.internal.ServiceVersionInfo;
import foo.bar.helloworld.model.OneOperationRequest;
import foo.bar.helloworld.model.OneOperationResponse;
import foo.bar.helloworld.model.ProtocolRestJsonWithCustomPackageException;
@@ -51,7 +52,7 @@ final class DefaultProtocolRestJsonWithCustomPackageClient implements ProtocolRe
private static final Logger log = Logger.loggerFor(DefaultProtocolRestJsonWithCustomPackageClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
- .serviceProtocol(AwsServiceProtocol.REST_JSON).build();
+ .serviceProtocol(AwsServiceProtocol.REST_JSON).build();
private final SyncClientHandler clientHandler;
@@ -61,7 +62,8 @@ final class DefaultProtocolRestJsonWithCustomPackageClient implements ProtocolRe
protected DefaultProtocolRestJsonWithCustomPackageClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "AmazonProtocolRestJsonWithCustomPackage" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@@ -83,38 +85,38 @@ protected DefaultProtocolRestJsonWithCustomPackageClient(SdkClientConfiguration
*/
@Override
public OneOperationResponse oneOperation(OneOperationRequest oneOperationRequest) throws AwsServiceException,
- SdkClientException, ProtocolRestJsonWithCustomPackageException {
+ SdkClientException, ProtocolRestJsonWithCustomPackageException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
- OneOperationResponse::builder);
+ OneOperationResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- default:
- return Optional.empty();
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(oneOperationRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, oneOperationRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AmazonProtocolRestJsonWithCustomPackage");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OneOperation");
return clientHandler.execute(new ClientExecutionParams()
- .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata)
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withInput(oneOperationRequest)
- .withMetricCollector(apiCallMetricCollector)
- .withMarshaller(new OneOperationRequestMarshaller(protocolFactory)));
+ .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withInput(oneOperationRequest)
+ .withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new OneOperationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
@@ -126,7 +128,7 @@ public final String serviceName() {
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
- RequestOverrideConfiguration requestOverrideConfiguration) {
+ RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
@@ -141,7 +143,7 @@ private static List resolveMetricPublishers(SdkClientConfigurat
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
- JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
+ JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper);
}
@@ -175,7 +177,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
return configuration.build();
}
ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder serviceConfigBuilder = new ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder(
- configuration);
+ configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
@@ -185,14 +187,14 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
private > T init(T builder) {
return builder.clientConfiguration(clientConfiguration)
- .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomPackageException::builder)
- .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1");
+ .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomPackageException::builder)
+ .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1");
}
@Override
public final ProtocolRestJsonWithCustomPackageServiceClientConfiguration serviceClientConfiguration() {
return new ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder())
- .build();
+ .build();
}
@Override
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java
index 1ecac26efb45..b92034ef589c 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java
@@ -38,6 +38,7 @@
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.protocolrestjsonwithcustomcontenttype.internal.ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.protocolrestjsonwithcustomcontenttype.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.protocolrestjsonwithcustomcontenttype.model.OneOperationRequest;
import software.amazon.awssdk.services.protocolrestjsonwithcustomcontenttype.model.OneOperationResponse;
import software.amazon.awssdk.services.protocolrestjsonwithcustomcontenttype.model.ProtocolRestJsonWithCustomContentTypeException;
@@ -55,7 +56,7 @@ final class DefaultProtocolRestJsonWithCustomContentTypeAsyncClient implements P
private static final Logger log = LoggerFactory.getLogger(DefaultProtocolRestJsonWithCustomContentTypeAsyncClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
- .serviceProtocol(AwsServiceProtocol.REST_JSON).build();
+ .serviceProtocol(AwsServiceProtocol.REST_JSON).build();
private final AsyncClientHandler clientHandler;
@@ -65,7 +66,8 @@ final class DefaultProtocolRestJsonWithCustomContentTypeAsyncClient implements P
protected DefaultProtocolRestJsonWithCustomContentTypeAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "AmazonProtocolRestJsonWithCustomContentType" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@@ -93,36 +95,36 @@ protected DefaultProtocolRestJsonWithCustomContentTypeAsyncClient(SdkClientConfi
public CompletableFuture oneOperation(OneOperationRequest oneOperationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(oneOperationRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, oneOperationRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AmazonProtocolRestJsonWithCustomContentType");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OneOperation");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
- OneOperationResponse::builder);
+ OneOperationResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- default:
- return Optional.empty();
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
CompletableFuture executeFuture = clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata)
- .withMarshaller(new OneOperationRequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .withInput(oneOperationRequest));
+ .execute(new ClientExecutionParams()
+ .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new OneOperationRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(oneOperationRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -137,7 +139,7 @@ public CompletableFuture oneOperation(OneOperationRequest
@Override
public final ProtocolRestJsonWithCustomContentTypeServiceClientConfiguration serviceClientConfiguration() {
return new ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder())
- .build();
+ .build();
}
@Override
@@ -147,12 +149,12 @@ public final String serviceName() {
private > T init(T builder) {
return builder.clientConfiguration(clientConfiguration)
- .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomContentTypeException::builder)
- .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1").contentType("application/json");
+ .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomContentTypeException::builder)
+ .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1").contentType("application/json");
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
- RequestOverrideConfiguration requestOverrideConfiguration) {
+ RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
@@ -196,7 +198,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
return configuration.build();
}
ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder serviceConfigBuilder = new ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder(
- configuration);
+ configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
@@ -205,7 +207,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
- JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
+ JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper);
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java
index b97e2307b4d0..60728a004178 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java
@@ -34,6 +34,7 @@
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.protocolrestjsonwithcustomcontenttype.internal.ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.protocolrestjsonwithcustomcontenttype.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.protocolrestjsonwithcustomcontenttype.model.OneOperationRequest;
import software.amazon.awssdk.services.protocolrestjsonwithcustomcontenttype.model.OneOperationResponse;
import software.amazon.awssdk.services.protocolrestjsonwithcustomcontenttype.model.ProtocolRestJsonWithCustomContentTypeException;
@@ -51,7 +52,7 @@ final class DefaultProtocolRestJsonWithCustomContentTypeClient implements Protoc
private static final Logger log = Logger.loggerFor(DefaultProtocolRestJsonWithCustomContentTypeClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
- .serviceProtocol(AwsServiceProtocol.REST_JSON).build();
+ .serviceProtocol(AwsServiceProtocol.REST_JSON).build();
private final SyncClientHandler clientHandler;
@@ -61,7 +62,11 @@ final class DefaultProtocolRestJsonWithCustomContentTypeClient implements Protoc
protected DefaultProtocolRestJsonWithCustomContentTypeClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration
+ .toBuilder()
+ .option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA,
+ "AmazonProtocolRestJsonWithCustomContentType" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@@ -83,38 +88,38 @@ protected DefaultProtocolRestJsonWithCustomContentTypeClient(SdkClientConfigurat
*/
@Override
public OneOperationResponse oneOperation(OneOperationRequest oneOperationRequest) throws AwsServiceException,
- SdkClientException, ProtocolRestJsonWithCustomContentTypeException {
+ SdkClientException, ProtocolRestJsonWithCustomContentTypeException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
- OneOperationResponse::builder);
+ OneOperationResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- default:
- return Optional.empty();
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(oneOperationRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, oneOperationRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AmazonProtocolRestJsonWithCustomContentType");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OneOperation");
return clientHandler.execute(new ClientExecutionParams()
- .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata)
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withInput(oneOperationRequest)
- .withMetricCollector(apiCallMetricCollector)
- .withMarshaller(new OneOperationRequestMarshaller(protocolFactory)));
+ .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withInput(oneOperationRequest)
+ .withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new OneOperationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
@@ -126,7 +131,7 @@ public final String serviceName() {
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
- RequestOverrideConfiguration requestOverrideConfiguration) {
+ RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
@@ -141,7 +146,7 @@ private static List resolveMetricPublishers(SdkClientConfigurat
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
- JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
+ JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper);
}
@@ -175,7 +180,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
return configuration.build();
}
ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder serviceConfigBuilder = new ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder(
- configuration);
+ configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
@@ -185,14 +190,14 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
private > T init(T builder) {
return builder.clientConfiguration(clientConfiguration)
- .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomContentTypeException::builder)
- .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1").contentType("application/json");
+ .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomContentTypeException::builder)
+ .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1").contentType("application/json");
}
@Override
public final ProtocolRestJsonWithCustomContentTypeServiceClientConfiguration serviceClientConfiguration() {
return new ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder())
- .build();
+ .build();
}
@Override
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java
index 7324f449c25e..137d34e5f377 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java
@@ -44,6 +44,7 @@
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.endpointdiscoverytest.internal.EndpointDiscoveryTestServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.endpointdiscoverytest.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.endpointdiscoverytest.model.DescribeEndpointsRequest;
import software.amazon.awssdk.services.endpointdiscoverytest.model.DescribeEndpointsResponse;
import software.amazon.awssdk.services.endpointdiscoverytest.model.EndpointDiscoveryTestException;
@@ -70,7 +71,7 @@ final class DefaultEndpointDiscoveryTestAsyncClient implements EndpointDiscovery
private static final Logger log = LoggerFactory.getLogger(DefaultEndpointDiscoveryTestAsyncClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
- .serviceProtocol(AwsServiceProtocol.AWS_JSON).build();
+ .serviceProtocol(AwsServiceProtocol.AWS_JSON).build();
private final AsyncClientHandler clientHandler;
@@ -82,11 +83,12 @@ final class DefaultEndpointDiscoveryTestAsyncClient implements EndpointDiscovery
protected DefaultEndpointDiscoveryTestAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "AwsEndpointDiscoveryTest" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
if (clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED)) {
this.endpointDiscoveryCache = EndpointDiscoveryRefreshCache
- .create(EndpointDiscoveryTestAsyncEndpointDiscoveryCacheLoader.create(this));
+ .create(EndpointDiscoveryTestAsyncEndpointDiscoveryCacheLoader.create(this));
}
}
@@ -111,38 +113,38 @@ protected DefaultEndpointDiscoveryTestAsyncClient(SdkClientConfiguration clientC
@Override
public CompletableFuture describeEndpoints(DescribeEndpointsRequest describeEndpointsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeEndpointsRequest,
- this.clientConfiguration);
+ this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEndpointsRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeEndpoints");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
- operationMetadata, DescribeEndpointsResponse::builder);
+ operationMetadata, DescribeEndpointsResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- default:
- return Optional.empty();
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
CompletableFuture executeFuture = clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("DescribeEndpoints").withProtocolMetadata(protocolMetadata)
- .withMarshaller(new DescribeEndpointsRequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .withInput(describeEndpointsRequest));
+ .execute(new ClientExecutionParams()
+ .withOperationName("DescribeEndpoints").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new DescribeEndpointsRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(describeEndpointsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -175,69 +177,69 @@ public CompletableFuture describeEndpoints(DescribeEn
*/
@Override
public CompletableFuture testDiscoveryIdentifiersRequired(
- TestDiscoveryIdentifiersRequiredRequest testDiscoveryIdentifiersRequiredRequest) {
+ TestDiscoveryIdentifiersRequiredRequest testDiscoveryIdentifiersRequiredRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(testDiscoveryIdentifiersRequiredRequest,
- this.clientConfiguration);
+ this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
- testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null));
+ testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TestDiscoveryIdentifiersRequired");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
- .createResponseHandler(operationMetadata, TestDiscoveryIdentifiersRequiredResponse::builder);
+ .createResponseHandler(operationMetadata, TestDiscoveryIdentifiersRequiredResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- default:
- return Optional.empty();
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED);
boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER)
- .isEndpointOverridden();
+ .isEndpointOverridden();
if (endpointOverridden) {
throw new IllegalStateException(
- "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported.");
+ "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported.");
}
if (!endpointDiscoveryEnabled) {
throw new IllegalStateException(
- "This operation requires endpoint discovery, but endpoint discovery was disabled on the client.");
+ "This operation requires endpoint discovery, but endpoint discovery was disabled on the client.");
}
CompletableFuture endpointFuture = CompletableFuture.completedFuture(null);
if (endpointDiscoveryEnabled) {
CompletableFuture extends AwsCredentialsIdentity> identityFuture = testDiscoveryIdentifiersRequiredRequest
- .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider)
- .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER))
- .resolveIdentity();
+ .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider)
+ .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER))
+ .resolveIdentity();
endpointFuture = identityFuture.thenCompose(credentials -> {
EndpointDiscoveryRequest endpointDiscoveryRequest = EndpointDiscoveryRequest
- .builder()
- .required(true)
- .defaultEndpoint(
- clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint())
- .overrideConfiguration(testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null))
- .build();
+ .builder()
+ .required(true)
+ .defaultEndpoint(
+ clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint())
+ .overrideConfiguration(testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null))
+ .build();
return endpointDiscoveryCache.getAsync(credentials.accessKeyId(), endpointDiscoveryRequest);
});
}
CompletableFuture executeFuture = endpointFuture
- .thenCompose(cachedEndpoint -> clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("TestDiscoveryIdentifiersRequired").withProtocolMetadata(protocolMetadata)
- .withMarshaller(new TestDiscoveryIdentifiersRequiredRequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .discoveredEndpoint(cachedEndpoint).withInput(testDiscoveryIdentifiersRequiredRequest)));
+ .thenCompose(cachedEndpoint -> clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("TestDiscoveryIdentifiersRequired").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new TestDiscoveryIdentifiersRequiredRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .discoveredEndpoint(cachedEndpoint).withInput(testDiscoveryIdentifiersRequiredRequest)));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -269,60 +271,60 @@ public CompletableFuture testDiscovery
*/
@Override
public CompletableFuture testDiscoveryOptional(
- TestDiscoveryOptionalRequest testDiscoveryOptionalRequest) {
+ TestDiscoveryOptionalRequest testDiscoveryOptionalRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(testDiscoveryOptionalRequest,
- this.clientConfiguration);
+ this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, testDiscoveryOptionalRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TestDiscoveryOptional");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
- operationMetadata, TestDiscoveryOptionalResponse::builder);
+ operationMetadata, TestDiscoveryOptionalResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- default:
- return Optional.empty();
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED);
boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER)
- .isEndpointOverridden();
+ .isEndpointOverridden();
CompletableFuture endpointFuture = CompletableFuture.completedFuture(null);
if (endpointDiscoveryEnabled) {
CompletableFuture extends AwsCredentialsIdentity> identityFuture = testDiscoveryOptionalRequest
- .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider)
- .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER))
- .resolveIdentity();
+ .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider)
+ .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER))
+ .resolveIdentity();
endpointFuture = identityFuture.thenCompose(credentials -> {
EndpointDiscoveryRequest endpointDiscoveryRequest = EndpointDiscoveryRequest
- .builder()
- .required(false)
- .defaultEndpoint(
- clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint())
- .overrideConfiguration(testDiscoveryOptionalRequest.overrideConfiguration().orElse(null)).build();
+ .builder()
+ .required(false)
+ .defaultEndpoint(
+ clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint())
+ .overrideConfiguration(testDiscoveryOptionalRequest.overrideConfiguration().orElse(null)).build();
return endpointDiscoveryCache.getAsync(credentials.accessKeyId(), endpointDiscoveryRequest);
});
}
CompletableFuture executeFuture = endpointFuture
- .thenCompose(cachedEndpoint -> clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("TestDiscoveryOptional").withProtocolMetadata(protocolMetadata)
- .withMarshaller(new TestDiscoveryOptionalRequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .discoveredEndpoint(cachedEndpoint).withInput(testDiscoveryOptionalRequest)));
+ .thenCompose(cachedEndpoint -> clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("TestDiscoveryOptional").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new TestDiscoveryOptionalRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .discoveredEndpoint(cachedEndpoint).withInput(testDiscoveryOptionalRequest)));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -354,68 +356,68 @@ public CompletableFuture testDiscoveryOptional(
*/
@Override
public CompletableFuture testDiscoveryRequired(
- TestDiscoveryRequiredRequest testDiscoveryRequiredRequest) {
+ TestDiscoveryRequiredRequest testDiscoveryRequiredRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(testDiscoveryRequiredRequest,
- this.clientConfiguration);
+ this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, testDiscoveryRequiredRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TestDiscoveryRequired");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
- operationMetadata, TestDiscoveryRequiredResponse::builder);
+ operationMetadata, TestDiscoveryRequiredResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- default:
- return Optional.empty();
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED);
boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER)
- .isEndpointOverridden();
+ .isEndpointOverridden();
if (endpointOverridden) {
throw new IllegalStateException(
- "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported.");
+ "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported.");
}
if (!endpointDiscoveryEnabled) {
throw new IllegalStateException(
- "This operation requires endpoint discovery, but endpoint discovery was disabled on the client.");
+ "This operation requires endpoint discovery, but endpoint discovery was disabled on the client.");
}
CompletableFuture endpointFuture = CompletableFuture.completedFuture(null);
if (endpointDiscoveryEnabled) {
CompletableFuture extends AwsCredentialsIdentity> identityFuture = testDiscoveryRequiredRequest
- .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider)
- .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER))
- .resolveIdentity();
+ .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider)
+ .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER))
+ .resolveIdentity();
endpointFuture = identityFuture.thenCompose(credentials -> {
EndpointDiscoveryRequest endpointDiscoveryRequest = EndpointDiscoveryRequest
- .builder()
- .required(true)
- .defaultEndpoint(
- clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint())
- .overrideConfiguration(testDiscoveryRequiredRequest.overrideConfiguration().orElse(null)).build();
+ .builder()
+ .required(true)
+ .defaultEndpoint(
+ clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint())
+ .overrideConfiguration(testDiscoveryRequiredRequest.overrideConfiguration().orElse(null)).build();
return endpointDiscoveryCache.getAsync(credentials.accessKeyId(), endpointDiscoveryRequest);
});
}
CompletableFuture executeFuture = endpointFuture
- .thenCompose(cachedEndpoint -> clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("TestDiscoveryRequired").withProtocolMetadata(protocolMetadata)
- .withMarshaller(new TestDiscoveryRequiredRequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .discoveredEndpoint(cachedEndpoint).withInput(testDiscoveryRequiredRequest)));
+ .thenCompose(cachedEndpoint -> clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("TestDiscoveryRequired").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new TestDiscoveryRequiredRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .discoveredEndpoint(cachedEndpoint).withInput(testDiscoveryRequiredRequest)));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -439,12 +441,12 @@ public final String serviceName() {
private > T init(T builder) {
return builder.clientConfiguration(clientConfiguration)
- .defaultServiceExceptionSupplier(EndpointDiscoveryTestException::builder).protocol(AwsJsonProtocol.AWS_JSON)
- .protocolVersion("1.1");
+ .defaultServiceExceptionSupplier(EndpointDiscoveryTestException::builder).protocol(AwsJsonProtocol.AWS_JSON)
+ .protocolVersion("1.1");
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
- RequestOverrideConfiguration requestOverrideConfiguration) {
+ RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
@@ -488,7 +490,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
return configuration.build();
}
EndpointDiscoveryTestServiceClientConfigurationBuilder serviceConfigBuilder = new EndpointDiscoveryTestServiceClientConfigurationBuilder(
- configuration);
+ configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
@@ -497,7 +499,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
- JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
+ JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper);
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java
index a473c2090cdb..a25497e1327b 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java
@@ -41,6 +41,7 @@
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.endpointdiscoverytest.internal.EndpointDiscoveryTestServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.endpointdiscoverytest.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.endpointdiscoverytest.model.DescribeEndpointsRequest;
import software.amazon.awssdk.services.endpointdiscoverytest.model.DescribeEndpointsResponse;
import software.amazon.awssdk.services.endpointdiscoverytest.model.EndpointDiscoveryTestException;
@@ -68,7 +69,7 @@ final class DefaultEndpointDiscoveryTestClient implements EndpointDiscoveryTestC
private static final Logger log = Logger.loggerFor(DefaultEndpointDiscoveryTestClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
- .serviceProtocol(AwsServiceProtocol.AWS_JSON).build();
+ .serviceProtocol(AwsServiceProtocol.AWS_JSON).build();
private final SyncClientHandler clientHandler;
@@ -80,11 +81,12 @@ final class DefaultEndpointDiscoveryTestClient implements EndpointDiscoveryTestC
protected DefaultEndpointDiscoveryTestClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "AwsEndpointDiscoveryTest" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
if (clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED)) {
this.endpointDiscoveryCache = EndpointDiscoveryRefreshCache.create(EndpointDiscoveryTestEndpointDiscoveryCacheLoader
- .create(this));
+ .create(this));
}
}
@@ -104,39 +106,39 @@ protected DefaultEndpointDiscoveryTestClient(SdkClientConfiguration clientConfig
*/
@Override
public DescribeEndpointsResponse describeEndpoints(DescribeEndpointsRequest describeEndpointsRequest)
- throws AwsServiceException, SdkClientException, EndpointDiscoveryTestException {
+ throws AwsServiceException, SdkClientException, EndpointDiscoveryTestException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
- DescribeEndpointsResponse::builder);
+ DescribeEndpointsResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- default:
- return Optional.empty();
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeEndpointsRequest,
- this.clientConfiguration);
+ this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEndpointsRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeEndpoints");
return clientHandler.execute(new ClientExecutionParams()
- .withOperationName("DescribeEndpoints").withProtocolMetadata(protocolMetadata)
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withInput(describeEndpointsRequest)
- .withMetricCollector(apiCallMetricCollector)
- .withMarshaller(new DescribeEndpointsRequestMarshaller(protocolFactory)));
+ .withOperationName("DescribeEndpoints").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withInput(describeEndpointsRequest)
+ .withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new DescribeEndpointsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
@@ -158,62 +160,62 @@ public DescribeEndpointsResponse describeEndpoints(DescribeEndpointsRequest desc
*/
@Override
public TestDiscoveryIdentifiersRequiredResponse testDiscoveryIdentifiersRequired(
- TestDiscoveryIdentifiersRequiredRequest testDiscoveryIdentifiersRequiredRequest) throws AwsServiceException,
- SdkClientException, EndpointDiscoveryTestException {
+ TestDiscoveryIdentifiersRequiredRequest testDiscoveryIdentifiersRequiredRequest) throws AwsServiceException,
+ SdkClientException, EndpointDiscoveryTestException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
- operationMetadata, TestDiscoveryIdentifiersRequiredResponse::builder);
+ operationMetadata, TestDiscoveryIdentifiersRequiredResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- default:
- return Optional.empty();
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED);
boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).isEndpointOverridden();
if (endpointOverridden) {
throw new IllegalStateException(
- "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported.");
+ "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported.");
}
if (!endpointDiscoveryEnabled) {
throw new IllegalStateException(
- "This operation requires endpoint discovery, but endpoint discovery was disabled on the client.");
+ "This operation requires endpoint discovery, but endpoint discovery was disabled on the client.");
}
URI cachedEndpoint = null;
if (endpointDiscoveryEnabled) {
CompletableFuture extends AwsCredentialsIdentity> identityFuture = testDiscoveryIdentifiersRequiredRequest
- .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider)
- .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)).resolveIdentity();
+ .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider)
+ .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)).resolveIdentity();
String key = CompletableFutureUtils.joinLikeSync(identityFuture).accessKeyId();
EndpointDiscoveryRequest endpointDiscoveryRequest = EndpointDiscoveryRequest.builder().required(true)
- .defaultEndpoint(clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint())
- .overrideConfiguration(testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null)).build();
+ .defaultEndpoint(clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint())
+ .overrideConfiguration(testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null)).build();
cachedEndpoint = endpointDiscoveryCache.get(key, endpointDiscoveryRequest);
}
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(testDiscoveryIdentifiersRequiredRequest,
- this.clientConfiguration);
+ this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
- testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null));
+ testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TestDiscoveryIdentifiersRequired");
return clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("TestDiscoveryIdentifiersRequired").withProtocolMetadata(protocolMetadata)
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .discoveredEndpoint(cachedEndpoint).withRequestConfiguration(clientConfiguration)
- .withInput(testDiscoveryIdentifiersRequiredRequest).withMetricCollector(apiCallMetricCollector)
- .withMarshaller(new TestDiscoveryIdentifiersRequiredRequestMarshaller(protocolFactory)));
+ .execute(new ClientExecutionParams()
+ .withOperationName("TestDiscoveryIdentifiersRequired").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .discoveredEndpoint(cachedEndpoint).withRequestConfiguration(clientConfiguration)
+ .withInput(testDiscoveryIdentifiersRequiredRequest).withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new TestDiscoveryIdentifiersRequiredRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
@@ -235,52 +237,52 @@ public TestDiscoveryIdentifiersRequiredResponse testDiscoveryIdentifiersRequired
*/
@Override
public TestDiscoveryOptionalResponse testDiscoveryOptional(TestDiscoveryOptionalRequest testDiscoveryOptionalRequest)
- throws AwsServiceException, SdkClientException, EndpointDiscoveryTestException {
+ throws AwsServiceException, SdkClientException, EndpointDiscoveryTestException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
- operationMetadata, TestDiscoveryOptionalResponse::builder);
+ operationMetadata, TestDiscoveryOptionalResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- default:
- return Optional.empty();
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED);
boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).isEndpointOverridden();
URI cachedEndpoint = null;
if (endpointDiscoveryEnabled) {
CompletableFuture extends AwsCredentialsIdentity> identityFuture = testDiscoveryOptionalRequest
- .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider)
- .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)).resolveIdentity();
+ .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider)
+ .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)).resolveIdentity();
String key = CompletableFutureUtils.joinLikeSync(identityFuture).accessKeyId();
EndpointDiscoveryRequest endpointDiscoveryRequest = EndpointDiscoveryRequest.builder().required(false)
- .defaultEndpoint(clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint())
- .overrideConfiguration(testDiscoveryOptionalRequest.overrideConfiguration().orElse(null)).build();
+ .defaultEndpoint(clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint())
+ .overrideConfiguration(testDiscoveryOptionalRequest.overrideConfiguration().orElse(null)).build();
cachedEndpoint = endpointDiscoveryCache.get(key, endpointDiscoveryRequest);
}
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(testDiscoveryOptionalRequest,
- this.clientConfiguration);
+ this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, testDiscoveryOptionalRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TestDiscoveryOptional");
return clientHandler.execute(new ClientExecutionParams()
- .withOperationName("TestDiscoveryOptional").withProtocolMetadata(protocolMetadata)
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .discoveredEndpoint(cachedEndpoint).withRequestConfiguration(clientConfiguration)
- .withInput(testDiscoveryOptionalRequest).withMetricCollector(apiCallMetricCollector)
- .withMarshaller(new TestDiscoveryOptionalRequestMarshaller(protocolFactory)));
+ .withOperationName("TestDiscoveryOptional").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .discoveredEndpoint(cachedEndpoint).withRequestConfiguration(clientConfiguration)
+ .withInput(testDiscoveryOptionalRequest).withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new TestDiscoveryOptionalRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
@@ -302,60 +304,60 @@ public TestDiscoveryOptionalResponse testDiscoveryOptional(TestDiscoveryOptional
*/
@Override
public TestDiscoveryRequiredResponse testDiscoveryRequired(TestDiscoveryRequiredRequest testDiscoveryRequiredRequest)
- throws AwsServiceException, SdkClientException, EndpointDiscoveryTestException {
+ throws AwsServiceException, SdkClientException, EndpointDiscoveryTestException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
- operationMetadata, TestDiscoveryRequiredResponse::builder);
+ operationMetadata, TestDiscoveryRequiredResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- default:
- return Optional.empty();
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED);
boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).isEndpointOverridden();
if (endpointOverridden) {
throw new IllegalStateException(
- "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported.");
+ "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported.");
}
if (!endpointDiscoveryEnabled) {
throw new IllegalStateException(
- "This operation requires endpoint discovery, but endpoint discovery was disabled on the client.");
+ "This operation requires endpoint discovery, but endpoint discovery was disabled on the client.");
}
URI cachedEndpoint = null;
if (endpointDiscoveryEnabled) {
CompletableFuture extends AwsCredentialsIdentity> identityFuture = testDiscoveryRequiredRequest
- .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider)
- .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)).resolveIdentity();
+ .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider)
+ .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)).resolveIdentity();
String key = CompletableFutureUtils.joinLikeSync(identityFuture).accessKeyId();
EndpointDiscoveryRequest endpointDiscoveryRequest = EndpointDiscoveryRequest.builder().required(true)
- .defaultEndpoint(clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint())
- .overrideConfiguration(testDiscoveryRequiredRequest.overrideConfiguration().orElse(null)).build();
+ .defaultEndpoint(clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint())
+ .overrideConfiguration(testDiscoveryRequiredRequest.overrideConfiguration().orElse(null)).build();
cachedEndpoint = endpointDiscoveryCache.get(key, endpointDiscoveryRequest);
}
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(testDiscoveryRequiredRequest,
- this.clientConfiguration);
+ this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, testDiscoveryRequiredRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TestDiscoveryRequired");
return clientHandler.execute(new ClientExecutionParams()
- .withOperationName("TestDiscoveryRequired").withProtocolMetadata(protocolMetadata)
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .discoveredEndpoint(cachedEndpoint).withRequestConfiguration(clientConfiguration)
- .withInput(testDiscoveryRequiredRequest).withMetricCollector(apiCallMetricCollector)
- .withMarshaller(new TestDiscoveryRequiredRequestMarshaller(protocolFactory)));
+ .withOperationName("TestDiscoveryRequired").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .discoveredEndpoint(cachedEndpoint).withRequestConfiguration(clientConfiguration)
+ .withInput(testDiscoveryRequiredRequest).withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new TestDiscoveryRequiredRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
@@ -367,7 +369,7 @@ public final String serviceName() {
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
- RequestOverrideConfiguration requestOverrideConfiguration) {
+ RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
@@ -382,7 +384,7 @@ private static List resolveMetricPublishers(SdkClientConfigurat
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
- JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
+ JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) {
return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper);
}
@@ -416,7 +418,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
return configuration.build();
}
EndpointDiscoveryTestServiceClientConfigurationBuilder serviceConfigBuilder = new EndpointDiscoveryTestServiceClientConfigurationBuilder(
- configuration);
+ configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
@@ -426,8 +428,8 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request,
private > T init(T builder) {
return builder.clientConfiguration(clientConfiguration)
- .defaultServiceExceptionSupplier(EndpointDiscoveryTestException::builder).protocol(AwsJsonProtocol.AWS_JSON)
- .protocolVersion("1.1");
+ .defaultServiceExceptionSupplier(EndpointDiscoveryTestException::builder).protocol(AwsJsonProtocol.AWS_JSON)
+ .protocolVersion("1.1");
}
@Override
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java
index 65a319c88a89..8cc62fc11b76 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java
@@ -70,6 +70,7 @@
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.json.batchmanager.JsonAsyncBatchManager;
import software.amazon.awssdk.services.json.internal.JsonServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.json.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.json.model.APostOperationRequest;
import software.amazon.awssdk.services.json.model.APostOperationResponse;
import software.amazon.awssdk.services.json.model.APostOperationWithOutputRequest;
@@ -160,7 +161,9 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient {
protected DefaultJsonAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA,
+ "Json_Service" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
this.executor = clientConfiguration.option(SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR);
this.executorService = clientConfiguration.option(SdkClientOption.SCHEDULED_EXECUTOR_SERVICE);
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java
index 36bbe1316c9a..6c3d7b89e49c 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java
@@ -47,6 +47,7 @@
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.json.internal.JsonServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.json.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.json.model.APostOperationRequest;
import software.amazon.awssdk.services.json.model.APostOperationResponse;
import software.amazon.awssdk.services.json.model.APostOperationWithOutputRequest;
@@ -113,7 +114,8 @@ final class DefaultJsonClient implements JsonClient {
protected DefaultJsonClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "Json_Service" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java
index 042d0d6220b8..315cfc92febc 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java
@@ -49,6 +49,7 @@
import software.amazon.awssdk.protocols.query.AwsQueryProtocolFactory;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.query.internal.QueryServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.query.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.query.model.APostOperationRequest;
import software.amazon.awssdk.services.query.model.APostOperationResponse;
import software.amazon.awssdk.services.query.model.APostOperationWithOutputRequest;
@@ -127,7 +128,8 @@ final class DefaultQueryAsyncClient implements QueryAsyncClient {
protected DefaultQueryAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "Query_Service" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init();
this.executorService = clientConfiguration.option(SdkClientOption.SCHEDULED_EXECUTOR_SERVICE);
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java
index 8025c0c0568f..89c434672edb 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java
@@ -42,6 +42,7 @@
import software.amazon.awssdk.protocols.query.AwsQueryProtocolFactory;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.query.internal.QueryServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.query.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.query.model.APostOperationRequest;
import software.amazon.awssdk.services.query.model.APostOperationResponse;
import software.amazon.awssdk.services.query.model.APostOperationWithOutputRequest;
@@ -117,7 +118,8 @@ final class DefaultQueryClient implements QueryClient {
protected DefaultQueryClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "Query_Service" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init();
}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-rpcv2-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-rpcv2-async-client-class.java
index 3f49694dc45d..9ec3cad2ab53 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-rpcv2-async-client-class.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-rpcv2-async-client-class.java
@@ -37,6 +37,7 @@
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.protocols.rpcv2.SmithyRpcV2CborProtocolFactory;
import software.amazon.awssdk.retries.api.RetryStrategy;
+import software.amazon.awssdk.services.smithyrpcv2protocol.internal.ServiceVersionInfo;
import software.amazon.awssdk.services.smithyrpcv2protocol.internal.SmithyRpcV2ProtocolServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.smithyrpcv2protocol.model.ComplexErrorException;
import software.amazon.awssdk.services.smithyrpcv2protocol.model.EmptyInputOutputRequest;
@@ -94,7 +95,7 @@ final class DefaultSmithyRpcV2ProtocolAsyncClient implements SmithyRpcV2Protocol
private static final Logger log = LoggerFactory.getLogger(DefaultSmithyRpcV2ProtocolAsyncClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
- .serviceProtocol(AwsServiceProtocol.SMITHY_RPC_V2_CBOR).build();
+ .serviceProtocol(AwsServiceProtocol.SMITHY_RPC_V2_CBOR).build();
private final AsyncClientHandler clientHandler;
@@ -104,7 +105,8 @@ final class DefaultSmithyRpcV2ProtocolAsyncClient implements SmithyRpcV2Protocol
protected DefaultSmithyRpcV2ProtocolAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
- this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this)
+ .option(SdkClientOption.API_METADATA, "SmithyRpcV2Protocol" + "#" + ServiceVersionInfo.VERSION).build();
this.protocolFactory = init(SmithyRpcV2CborProtocolFactory.builder()).build();
}
@@ -131,47 +133,47 @@ protected DefaultSmithyRpcV2ProtocolAsyncClient(SdkClientConfiguration clientCon
@Override
public CompletableFuture emptyInputOutput(EmptyInputOutputRequest emptyInputOutputRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(emptyInputOutputRequest,
- this.clientConfiguration);
+ this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, emptyInputOutputRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EmptyInputOutput");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
- operationMetadata, EmptyInputOutputResponse::builder);
+ operationMetadata, EmptyInputOutputResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- case "ValidationException":
- return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
- .exceptionBuilderSupplier(ValidationException::builder).build());
- case "InvalidGreeting":
- return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
- .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
- case "ComplexError":
- return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
- .exceptionBuilderSupplier(ComplexErrorException::builder).build());
- default:
- return Optional.empty();
+ case "ValidationException":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
+ .exceptionBuilderSupplier(ValidationException::builder).build());
+ case "InvalidGreeting":
+ return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
+ .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
+ case "ComplexError":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
+ .exceptionBuilderSupplier(ComplexErrorException::builder).build());
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
CompletableFuture executeFuture = clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("EmptyInputOutput").withProtocolMetadata(protocolMetadata)
- .withMarshaller(new EmptyInputOutputRequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .withInput(emptyInputOutputRequest));
+ .execute(new ClientExecutionParams()
+ .withOperationName("EmptyInputOutput").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new EmptyInputOutputRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(emptyInputOutputRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -207,44 +209,44 @@ public CompletableFuture emptyInputOutput(EmptyInputOu
public CompletableFuture float16(Float16Request float16Request) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(float16Request, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, float16Request
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "Float16");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
- Float16Response::builder);
+ Float16Response::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- case "ValidationException":
- return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
- .exceptionBuilderSupplier(ValidationException::builder).build());
- case "InvalidGreeting":
- return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
- .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
- case "ComplexError":
- return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
- .exceptionBuilderSupplier(ComplexErrorException::builder).build());
- default:
- return Optional.empty();
+ case "ValidationException":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
+ .exceptionBuilderSupplier(ValidationException::builder).build());
+ case "InvalidGreeting":
+ return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
+ .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
+ case "ComplexError":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
+ .exceptionBuilderSupplier(ComplexErrorException::builder).build());
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
CompletableFuture executeFuture = clientHandler
- .execute(new ClientExecutionParams().withOperationName("Float16")
- .withProtocolMetadata(protocolMetadata).withMarshaller(new Float16RequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .withInput(float16Request));
+ .execute(new ClientExecutionParams().withOperationName("Float16")
+ .withProtocolMetadata(protocolMetadata).withMarshaller(new Float16RequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(float16Request));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -279,47 +281,47 @@ public CompletableFuture float16(Float16Request float16Request)
@Override
public CompletableFuture fractionalSeconds(FractionalSecondsRequest fractionalSecondsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(fractionalSecondsRequest,
- this.clientConfiguration);
+ this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, fractionalSecondsRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "FractionalSeconds");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
- operationMetadata, FractionalSecondsResponse::builder);
+ operationMetadata, FractionalSecondsResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- case "ValidationException":
- return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
- .exceptionBuilderSupplier(ValidationException::builder).build());
- case "InvalidGreeting":
- return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
- .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
- case "ComplexError":
- return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
- .exceptionBuilderSupplier(ComplexErrorException::builder).build());
- default:
- return Optional.empty();
+ case "ValidationException":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
+ .exceptionBuilderSupplier(ValidationException::builder).build());
+ case "InvalidGreeting":
+ return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
+ .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
+ case "ComplexError":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
+ .exceptionBuilderSupplier(ComplexErrorException::builder).build());
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
CompletableFuture executeFuture = clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("FractionalSeconds").withProtocolMetadata(protocolMetadata)
- .withMarshaller(new FractionalSecondsRequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .withInput(fractionalSecondsRequest));
+ .execute(new ClientExecutionParams()
+ .withOperationName("FractionalSeconds").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new FractionalSecondsRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(fractionalSecondsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -356,47 +358,47 @@ public CompletableFuture fractionalSeconds(Fractional
@Override
public CompletableFuture greetingWithErrors(GreetingWithErrorsRequest greetingWithErrorsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(greetingWithErrorsRequest,
- this.clientConfiguration);
+ this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, greetingWithErrorsRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GreetingWithErrors");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
- operationMetadata, GreetingWithErrorsResponse::builder);
+ operationMetadata, GreetingWithErrorsResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- case "ValidationException":
- return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
- .exceptionBuilderSupplier(ValidationException::builder).build());
- case "InvalidGreeting":
- return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
- .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
- case "ComplexError":
- return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
- .exceptionBuilderSupplier(ComplexErrorException::builder).build());
- default:
- return Optional.empty();
+ case "ValidationException":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
+ .exceptionBuilderSupplier(ValidationException::builder).build());
+ case "InvalidGreeting":
+ return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
+ .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
+ case "ComplexError":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
+ .exceptionBuilderSupplier(ComplexErrorException::builder).build());
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
CompletableFuture executeFuture = clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("GreetingWithErrors").withProtocolMetadata(protocolMetadata)
- .withMarshaller(new GreetingWithErrorsRequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .withInput(greetingWithErrorsRequest));
+ .execute(new ClientExecutionParams()
+ .withOperationName("GreetingWithErrors").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new GreetingWithErrorsRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(greetingWithErrorsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -432,45 +434,45 @@ public CompletableFuture greetingWithErrors(Greeting
public CompletableFuture noInputOutput(NoInputOutputRequest noInputOutputRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(noInputOutputRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, noInputOutputRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "NoInputOutput");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
- NoInputOutputResponse::builder);
+ NoInputOutputResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- case "ValidationException":
- return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
- .exceptionBuilderSupplier(ValidationException::builder).build());
- case "InvalidGreeting":
- return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
- .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
- case "ComplexError":
- return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
- .exceptionBuilderSupplier(ComplexErrorException::builder).build());
- default:
- return Optional.empty();
+ case "ValidationException":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
+ .exceptionBuilderSupplier(ValidationException::builder).build());
+ case "InvalidGreeting":
+ return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
+ .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
+ case "ComplexError":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
+ .exceptionBuilderSupplier(ComplexErrorException::builder).build());
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
CompletableFuture executeFuture = clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("NoInputOutput").withProtocolMetadata(protocolMetadata)
- .withMarshaller(new NoInputOutputRequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .withInput(noInputOutputRequest));
+ .execute(new ClientExecutionParams()
+ .withOperationName("NoInputOutput").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new NoInputOutputRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(noInputOutputRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -505,49 +507,49 @@ public CompletableFuture noInputOutput(NoInputOutputReque
*/
@Override
public CompletableFuture operationWithDefaults(
- OperationWithDefaultsRequest operationWithDefaultsRequest) {
+ OperationWithDefaultsRequest operationWithDefaultsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithDefaultsRequest,
- this.clientConfiguration);
+ this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithDefaultsRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithDefaults");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
- operationMetadata, OperationWithDefaultsResponse::builder);
+ operationMetadata, OperationWithDefaultsResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- case "ValidationException":
- return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
- .exceptionBuilderSupplier(ValidationException::builder).build());
- case "InvalidGreeting":
- return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
- .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
- case "ComplexError":
- return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
- .exceptionBuilderSupplier(ComplexErrorException::builder).build());
- default:
- return Optional.empty();
+ case "ValidationException":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
+ .exceptionBuilderSupplier(ValidationException::builder).build());
+ case "InvalidGreeting":
+ return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
+ .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
+ case "ComplexError":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
+ .exceptionBuilderSupplier(ComplexErrorException::builder).build());
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
CompletableFuture executeFuture = clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("OperationWithDefaults").withProtocolMetadata(protocolMetadata)
- .withMarshaller(new OperationWithDefaultsRequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .withInput(operationWithDefaultsRequest));
+ .execute(new ClientExecutionParams()
+ .withOperationName("OperationWithDefaults").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new OperationWithDefaultsRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(operationWithDefaultsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -581,49 +583,49 @@ public CompletableFuture operationWithDefaults(
*/
@Override
public CompletableFuture optionalInputOutput(
- OptionalInputOutputRequest optionalInputOutputRequest) {
+ OptionalInputOutputRequest optionalInputOutputRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(optionalInputOutputRequest,
- this.clientConfiguration);
+ this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, optionalInputOutputRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OptionalInputOutput");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
- operationMetadata, OptionalInputOutputResponse::builder);
+ operationMetadata, OptionalInputOutputResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- case "ValidationException":
- return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
- .exceptionBuilderSupplier(ValidationException::builder).build());
- case "InvalidGreeting":
- return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
- .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
- case "ComplexError":
- return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
- .exceptionBuilderSupplier(ComplexErrorException::builder).build());
- default:
- return Optional.empty();
+ case "ValidationException":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
+ .exceptionBuilderSupplier(ValidationException::builder).build());
+ case "InvalidGreeting":
+ return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
+ .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
+ case "ComplexError":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
+ .exceptionBuilderSupplier(ComplexErrorException::builder).build());
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
CompletableFuture executeFuture = clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("OptionalInputOutput").withProtocolMetadata(protocolMetadata)
- .withMarshaller(new OptionalInputOutputRequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .withInput(optionalInputOutputRequest));
+ .execute(new ClientExecutionParams()
+ .withOperationName("OptionalInputOutput").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new OptionalInputOutputRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(optionalInputOutputRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -658,47 +660,47 @@ public CompletableFuture optionalInputOutput(
@Override
public CompletableFuture recursiveShapes(RecursiveShapesRequest recursiveShapesRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(recursiveShapesRequest,
- this.clientConfiguration);
+ this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, recursiveShapesRequest
- .overrideConfiguration().orElse(null));
+ .overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
- .create("ApiCall");
+ .create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RecursiveShapes");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
- .isPayloadJson(true).build();
+ .isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
- operationMetadata, RecursiveShapesResponse::builder);
+ operationMetadata, RecursiveShapesResponse::builder);
Function> exceptionMetadataMapper = errorCode -> {
if (errorCode == null) {
return Optional.empty();
}
switch (errorCode) {
- case "ValidationException":
- return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
- .exceptionBuilderSupplier(ValidationException::builder).build());
- case "InvalidGreeting":
- return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
- .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
- case "ComplexError":
- return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
- .exceptionBuilderSupplier(ComplexErrorException::builder).build());
- default:
- return Optional.empty();
+ case "ValidationException":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException")
+ .exceptionBuilderSupplier(ValidationException::builder).build());
+ case "InvalidGreeting":
+ return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting")
+ .exceptionBuilderSupplier(InvalidGreetingException::builder).build());
+ case "ComplexError":
+ return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError")
+ .exceptionBuilderSupplier(ComplexErrorException::builder).build());
+ default:
+ return Optional.empty();
}
};
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
- operationMetadata, exceptionMetadataMapper);
+ operationMetadata, exceptionMetadataMapper);
CompletableFuture executeFuture = clientHandler
- .execute(new ClientExecutionParams()
- .withOperationName("RecursiveShapes").withProtocolMetadata(protocolMetadata)
- .withMarshaller(new RecursiveShapesRequestMarshaller(protocolFactory))
- .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
- .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
- .withInput(recursiveShapesRequest));
+ .execute(new ClientExecutionParams()
+ .withOperationName("RecursiveShapes").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new RecursiveShapesRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(recursiveShapesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
@@ -734,47 +736,47 @@ public CompletableFuture