From b587ba23fde3c336dcbb3ac0663b5528aff9f08c Mon Sep 17 00:00:00 2001 From: Ken Gilmer Date: Tue, 19 Oct 2021 16:43:40 -0700 Subject: [PATCH 1/2] Add ECS credential provider --- .../credentials/EcsCredentialsProvider.kt | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvider.kt diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvider.kt new file mode 100644 index 00000000000..890e8112d44 --- /dev/null +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvider.kt @@ -0,0 +1,27 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +package aws.sdk.kotlin.runtime.auth.credentials + +import aws.sdk.kotlin.crt.auth.credentials.build +import aws.sdk.kotlin.runtime.crt.SdkDefaultIO +import aws.sdk.kotlin.crt.auth.credentials.EcsCredentialsProvider as EcsCredentialsProviderCrt + +/** + * A provider that gets credentials from an ECS environment + */ +public class EcsCredentialsProvider public constructor( + host: String? = null, + pathAndQuery: String? = null, + authToken: String? = null, +) : CrtCredentialsProvider { + override val crtProvider: EcsCredentialsProviderCrt = EcsCredentialsProviderCrt.build { + clientBootstrap = SdkDefaultIO.ClientBootstrap + tlsContext = SdkDefaultIO.TlsContext + this.host = host + this.pathAndQuery = pathAndQuery + this.authToken = authToken + } +} From aa31e61cb428e01b47a044bd18063472f029129f Mon Sep 17 00:00:00 2001 From: Ken Gilmer Date: Tue, 19 Oct 2021 16:56:03 -0700 Subject: [PATCH 2/2] Add docs --- .../kotlin/runtime/auth/credentials/EcsCredentialsProvider.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvider.kt index 890e8112d44..4b2caec6a50 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvider.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvider.kt @@ -11,6 +11,10 @@ import aws.sdk.kotlin.crt.auth.credentials.EcsCredentialsProvider as EcsCredenti /** * A provider that gets credentials from an ECS environment + * + * @param host The host component of the URL to query credentials from + * @param pathAndQuery The path and query components of the URI, concatenated, to query credentials from + * @param authToken The token to pass to ECS credential service */ public class EcsCredentialsProvider public constructor( host: String? = null,