Skip to content

Commit

Permalink
Merge branch 'main' of github.com:awslabs/aws-sdk-kotlin into feat-s3…
Browse files Browse the repository at this point in the history
…-express
  • Loading branch information
lauzadis committed Feb 5, 2024
2 parents 441cf26 + 39dbaa2 commit 8fc02cd
Show file tree
Hide file tree
Showing 53 changed files with 5,850 additions and 1,009 deletions.
32 changes: 32 additions & 0 deletions .brazil.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"dependencies": {
"org.jetbrains.kotlin:kotlin-stdlib-common:1.9.*": "KotlinStdlibCommon-1.9.x",
"org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.*": "KotlinStdlibJdk8-1.9.x",
"org.jetbrains.kotlin:kotlin-stdlib:1.9.*": "KotlinStdlib-1.9.x",
"org.jetbrains.kotlinx:atomicfu-jvm:0.23.1": "AtomicfuJvm-0.23.1",
"org.jetbrains.kotlinx:atomicfu:0.23.1": "Atomicfu-0.23.1",
"org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.7.*": "KotlinxCoroutinesCoreJvm-1.7.x",
"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.*": "KotlinxCoroutinesCore-1.7.x",
"org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.7.*": "KotlinxCoroutinesJdk8-1.7.x"
},
"packageHandlingRules": {
"versioning": {
"defaultVersionLayout": "{MAJOR}.0.x"
},
"ignore": [
"aws.sdk.kotlin:bom",
"aws.sdk.kotlin.crt:aws-crt-kotlin-android",
"aws.sdk.kotlin:testing",
"aws.sdk.kotlin:version-catalog"
],
"resolvesConflictDependencies": {
"org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.7.*": [
"KotlinStdlibCommon-1.9.x",
"KotlinStdlibJdk8-1.9.x"
],
"org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.7.*": [
"KotlinStdlibJdk8-1.9.x"
]
}
}
}
70 changes: 70 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,75 @@
# Changelog

## [1.0.50] - 02/05/2024

### Features
* (**glue**) Introduce Catalog Encryption Role within Glue Data Catalog Settings. Introduce SASL/PLAIN as an authentication method for Glue Kafka connections

### Documentation
* (**workspaces**) Added definitions of various WorkSpace states

## [1.0.49] - 02/02/2024

### Features
* (**sagemaker**) Amazon SageMaker Canvas adds GenerativeAiSettings support for CanvasAppSettings.

### Documentation
* (**dynamodb**) Any number of users can execute up to 50 concurrent restores (any type of restore) in a given account.

## [1.0.48] - 02/01/2024

### Features
* (**cognitoidentityprovider**) Added CreateIdentityProvider and UpdateIdentityProvider details for new SAML IdP features
* (**ivs**) This release introduces a new resource Playback Restriction Policy which can be used to geo-restrict or domain-restrict channel stream playback when associated with a channel. New APIs to support this resource were introduced in the form of Create/Delete/Get/Update/List.
* (**managedblockchainquery**) This release adds support for transactions that have not reached finality. It also removes support for the status property from the response of the GetTransaction operation. You can use the confirmationStatus and executionStatus properties to determine the status of the transaction.
* (**mediaconvert**) This release includes support for broadcast-mixed audio description tracks.
* (**neptunegraph**) Adding new APIs in SDK for Amazon Neptune Analytics. These APIs include operations to execute, cancel, list queries and get the graph summary.
* [#476](https://github.com/awslabs/aws-sdk-kotlin/issues/476) Allow full URI path to a localhost metadata service (AwsContainerCredentialsFullUri) to be a host name

### Fixes
* Bump **smithy-kotlin** version to fix an error with serializing maps which use the `Document` type as a value

## [1.0.47] - 01/31/2024

### Features
* (**cloudformation**) CloudFormation IaC generator allows you to scan existing resources in your account and select resources to generate a template for a new or existing CloudFormation stack.
* (**elasticloadbalancingv2**) This release enables unhealthy target draining intervals for Network Load Balancers.
* (**glue**) Update page size limits for GetJobRuns and GetTriggers APIs.
* (**ssm**) This release adds an optional Duration parameter to StateManager Associations. This allows customers to specify how long an apply-only-on-cron association execution should run. Once the specified Duration is out all the ongoing cancellable commands or automations are cancelled.

## [1.0.46] - 01/30/2024

### Features
* (**datazone**) Add new skipDeletionCheck to DeleteDomain. Add new skipDeletionCheck to DeleteProject which also automatically deletes dependent objects

### Documentation
* (**route53**) Update the SDKs for text changes in the APIs.

## [1.0.45] - 01/29/2024

### Features
* (**autoscaling**) EC2 Auto Scaling customers who use attribute based instance-type selection can now intuitively define their Spot instances price protection limit as a percentage of the lowest priced On-Demand instance type.
* (**ec2**) EC2 Fleet customers who use attribute based instance-type selection can now intuitively define their Spot instances price protection limit as a percentage of the lowest priced On-Demand instance type.
* (**mwaa**) This release adds MAINTENANCE environment status for Amazon MWAA environments.
* (**rds**) Introduced support for the InsufficientDBInstanceCapacityFault error in the RDS RestoreDBClusterFromSnapshot and RestoreDBClusterToPointInTime API methods. This provides enhanced error handling, ensuring a more robust experience.

### Documentation
* (**comprehend**) Comprehend PII analysis now supports Spanish input documents.
* (**snowball**) Modified description of createaddress to include direction to add path when providing a JSON file.

## [1.0.44] - 01/26/2024

### Features
* (**connect**) Update list and string length limits for predefined attributes.
* (**inspector2**) This release adds ECR container image scanning based on their lastRecordedPullTime.
* (**sagemaker**) Amazon SageMaker Automatic Model Tuning now provides an API to programmatically delete tuning jobs.

## [1.0.43] - 01/25/2024

### Features
* (**acmpca**) AWS Private CA now supports an option to omit the CDP extension from issued certificates, when CRL revocation is enabled.
* (**lightsail**) This release adds support for IPv6-only instance plans.

## [1.0.42] - 01/24/2024

### Features
Expand Down
2 changes: 2 additions & 0 deletions aws-runtime/aws-config/api/aws-config.api
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public final class aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvide
public fun <init> ()V
public fun <init> (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/http/engine/HttpClientEngine;)V
public synthetic fun <init> (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/http/engine/HttpClientEngine;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/http/engine/HttpClientEngine;Laws/smithy/kotlin/runtime/net/HostResolver;)V
public synthetic fun <init> (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/http/engine/HttpClientEngine;Laws/smithy/kotlin/runtime/net/HostResolver;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun close ()V
public final fun getPlatformProvider ()Laws/smithy/kotlin/runtime/util/PlatformProvider;
public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
Expand Down
2 changes: 1 addition & 1 deletion aws-runtime/aws-config/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import aws.sdk.kotlin.gradle.codegen.smithyKotlinProjectionSrcDir
import org.jetbrains.dokka.gradle.DokkaTaskPartial

plugins {
id("aws.sdk.kotlin.gradle.smithybuild")
alias(libs.plugins.aws.kotlin.repo.tools.smithybuild)
}

description = "Support for AWS configuration"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@ import aws.smithy.kotlin.runtime.client.endpoints.Endpoint
import aws.smithy.kotlin.runtime.collections.Attributes
import aws.smithy.kotlin.runtime.config.resolve
import aws.smithy.kotlin.runtime.http.*
import aws.smithy.kotlin.runtime.http.HttpCall
import aws.smithy.kotlin.runtime.http.engine.DefaultHttpEngine
import aws.smithy.kotlin.runtime.http.engine.HttpClientEngine
import aws.smithy.kotlin.runtime.http.operation.*
import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder
import aws.smithy.kotlin.runtime.http.request.header
import aws.smithy.kotlin.runtime.http.response.HttpResponse
import aws.smithy.kotlin.runtime.io.closeIfCloseable
import aws.smithy.kotlin.runtime.net.Host
import aws.smithy.kotlin.runtime.net.IpV4Addr
import aws.smithy.kotlin.runtime.net.IpV6Addr
import aws.smithy.kotlin.runtime.net.Scheme
import aws.smithy.kotlin.runtime.net.*
import aws.smithy.kotlin.runtime.net.url.Url
import aws.smithy.kotlin.runtime.operation.ExecutionContext
import aws.smithy.kotlin.runtime.retries.policy.RetryDirective
Expand Down Expand Up @@ -60,13 +56,24 @@ private const val PROVIDER_NAME = "EcsContainer"
* @param platformProvider the platform provider
* @param httpClient the [HttpClientEngine] instance to use to make requests. NOTE: This engine's resources and lifetime
* are NOT managed by the provider. Caller is responsible for closing.
*
* @param hostResolver used to resolve hostname from AwsContainerCredentialsFullUri env setting. If not specified falls back to default.
*/
public class EcsCredentialsProvider(
public val platformProvider: PlatformProvider = PlatformProvider.System,
httpClient: HttpClientEngine? = null,
private val hostResolver: HostResolver = HostResolver.Default,
) : CloseableCredentialsProvider {

// Keeping previous constructor as secondary due to backwards compatibility.
public constructor(
platformProvider: PlatformProvider = PlatformProvider.System,
httpClient: HttpClientEngine? = null,
) : this(
platformProvider,
httpClient,
HostResolver.Default,
)

private val manageEngine = httpClient == null
private val httpClient: HttpClientEngine = httpClient ?: DefaultHttpEngine()

Expand Down Expand Up @@ -164,10 +171,24 @@ public class EcsCredentialsProvider(
)
}

// TODO - resolve hostnames
is Host.Domain -> throw ProviderConfigurationException(
"The container credentials full URI ($uri) is specified via hostname which is not currently supported.",
)
is Host.Domain -> {
val hostAddresses = try {
hostResolver.resolve(url.host.toString())
} catch (exception: Throwable) {
throw ProviderConfigurationException(
"The container credentials full URI ($uri) is specified via a hostname whose IP address(es) could not be resolved. ${exception.message}",
exception,
)
}

if (hostAddresses.isNotEmpty() && hostAddresses.all { it.address.isLoopBack }) {
return url
} else {
throw ProviderConfigurationException(
"The container credentials full URI ($uri) is specified via a hostname whose IP address(es) do not resolve to the loopback device.",
)
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import aws.smithy.kotlin.runtime.http.request.url
import aws.smithy.kotlin.runtime.http.response.HttpResponse
import aws.smithy.kotlin.runtime.httptest.TestConnection
import aws.smithy.kotlin.runtime.httptest.buildTestConnection
import aws.smithy.kotlin.runtime.net.HostAddress
import aws.smithy.kotlin.runtime.net.HostResolver
import aws.smithy.kotlin.runtime.net.IpAddr
import aws.smithy.kotlin.runtime.net.url.Url
import aws.smithy.kotlin.runtime.retries.StandardRetryStrategy
import aws.smithy.kotlin.runtime.time.Instant
Expand Down Expand Up @@ -84,6 +87,21 @@ class EcsCredentialsProviderTest {
return builder.build()
}

/**
* Mock resolver that always resolves to loopback address
*/
private object LocalHostResolver : HostResolver {
override suspend fun resolve(hostname: String): List<HostAddress> =
listOf(
HostAddress(
"localhost",
IpAddr.parse("127.0.0.1"),
),
)
override fun reportFailure(addr: HostAddress) { }
override fun purgeCache(addr: HostAddress?) { }
}

@Test
fun testRelativeUri() = runTest {
val engine = buildTestConnection {
Expand Down Expand Up @@ -135,7 +153,42 @@ class EcsCredentialsProviderTest {
val provider = EcsCredentialsProvider(testPlatform, engine)
assertFailsWith<ProviderConfigurationException> {
provider.resolve()
}.message.shouldContain("The container credentials full URI (http://amazonaws.com/full) is specified via hostname which is not currently supported.")
}.message.shouldContain("The container credentials full URI (http://amazonaws.com/full) is specified via a hostname whose IP address(es) do not resolve to the loopback device.")
}

@Test
fun testLocalFullUri() = runTest {
val uri = "http://localhost"
val engine = buildTestConnection {
expect(
ecsRequest(uri),
ecsResponse(),
)
}

val testPlatform = TestPlatformProvider(
env = mapOf(AwsSdkSetting.AwsContainerCredentialsFullUri.envVar to uri),
)

val provider = EcsCredentialsProvider(testPlatform, engine, LocalHostResolver)
val actual = provider.resolve()
assertEquals(expectedCredentials, actual)
engine.assertRequests()
}

@Test
fun testNonexistentFullUri() = runTest {
val uri = "http://amazonaws.net/full"
val engine = TestConnection()

val testPlatform = TestPlatformProvider(
env = mapOf(AwsSdkSetting.AwsContainerCredentialsFullUri.envVar to uri),
)

val provider = EcsCredentialsProvider(testPlatform, engine)
assertFailsWith<ProviderConfigurationException> {
provider.resolve()
}.message.shouldContain("The container credentials full URI (http://amazonaws.net/full) is specified via a hostname whose IP address(es) could not be resolved.")
}

@Test
Expand Down
2 changes: 2 additions & 0 deletions aws-runtime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ description = "AWS client runtime support for generated service clients"
plugins {
alias(libs.plugins.dokka)
alias(libs.plugins.kotlinx.binary.compatibility.validator)
alias(libs.plugins.aws.kotlin.repo.tools.kmp) apply false
jacoco
}

Expand All @@ -28,6 +29,7 @@ subprojects {
apply {
plugin("org.jetbrains.kotlin.multiplatform")
plugin("org.jetbrains.dokka")
plugin(libraries.plugins.aws.kotlin.repo.tools.kmp.get().pluginId)
}

configurePublishing("aws-sdk-kotlin")
Expand Down
50 changes: 50 additions & 0 deletions build-support/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

plugins {
`kotlin-dsl`
`java-gradle-plugin`
alias(libs.plugins.kotlinx.serialization)
}

group = "aws.sdk.kotlin"

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
compileOnly(kotlin("gradle-plugin"))
compileOnly(kotlin("gradle-plugin-api"))

implementation(libs.smithy.model)
implementation(libs.smithy.aws.traits)
implementation(libs.kotlinx.serialization.json)

testImplementation(libs.junit.jupiter)
testImplementation(libs.junit.jupiter.params)
testImplementation(libs.kotlin.test.junit5)
}

gradlePlugin {
plugins {
create("sdk-bootstrap") {
id = "sdk-bootstrap"
implementationClass = "aws.sdk.kotlin.gradle.sdk.Bootstrap"
}
}
}

tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
showStandardStreams = true
showStackTraces = true
showExceptions = true
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}
13 changes: 13 additions & 0 deletions build-support/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
rootProject.name = "build-support"

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
Loading

0 comments on commit 8fc02cd

Please sign in to comment.