Skip to content

Commit 84bd8db

Browse files
authored
fix: upgrade S3 model manually for corrections to ReplicationRuleFilter and LifecycleRuleFilter shapes (#1439)
1 parent 7f5f09b commit 84bd8db

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"id": "220eb2c9-2f5b-4ebb-bc30-901bdedc1a4c",
3+
"type": "bugfix",
4+
"description": "⚠️ **IMPORTANT**: Update to the latest S3 model, which correctly models `ReplicationRuleFilter` and `LifecycleRuleFilter` as structures (not unions). This may cause compilation failures in existing code which references these two shapes."
5+
}

codegen/sdk/aws-models/s3.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26084,7 +26084,7 @@
2608426084
}
2608526085
},
2608626086
"com.amazonaws.s3#LifecycleRuleFilter": {
26087-
"type": "union",
26087+
"type": "structure",
2608826088
"members": {
2608926089
"Prefix": {
2609026090
"target": "com.amazonaws.s3#Prefix",
@@ -32311,7 +32311,7 @@
3231132311
}
3231232312
},
3231332313
"com.amazonaws.s3#ReplicationRuleFilter": {
32314-
"type": "union",
32314+
"type": "structure",
3231532315
"members": {
3231632316
"Prefix": {
3231732317
"target": "com.amazonaws.s3#Prefix",

services/s3/e2eTest/src/MutliRegionAccessPointTest.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import aws.sdk.kotlin.e2etest.S3TestUtils.createMultiRegionAccessPoint
88
import aws.sdk.kotlin.e2etest.S3TestUtils.deleteBucketAndAllContents
99
import aws.sdk.kotlin.e2etest.S3TestUtils.deleteMultiRegionAccessPoint
1010
import aws.sdk.kotlin.e2etest.S3TestUtils.getAccountId
11+
import aws.sdk.kotlin.e2etest.S3TestUtils.getBucketWithPrefix
1112
import aws.sdk.kotlin.e2etest.S3TestUtils.getMultiRegionAccessPointArn
12-
import aws.sdk.kotlin.e2etest.S3TestUtils.getTestBucket
1313
import aws.sdk.kotlin.e2etest.S3TestUtils.multiRegionAccessPointWasCreated
1414
import aws.sdk.kotlin.services.s3.S3Client
1515
import aws.sdk.kotlin.services.s3.deleteObject
@@ -27,6 +27,8 @@ import kotlin.test.Test
2727
import kotlin.test.assertEquals
2828
import kotlin.test.assertFailsWith
2929

30+
private const val MRAP_BUCKET_PREFIX = "s3-mrap-test-bucket-"
31+
3032
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
3133
class MutliRegionAccessPointTest {
3234
private val s3West = S3Client { region = "us-west-2" }
@@ -45,8 +47,8 @@ class MutliRegionAccessPointTest {
4547
@BeforeAll
4648
private fun setUp(): Unit = runBlocking {
4749
accountId = getAccountId()
48-
usWestBucket = getTestBucket(s3West, "us-west-2", accountId)
49-
usEastBucket = getTestBucket(s3East, "us-east-2", accountId)
50+
usWestBucket = getBucketWithPrefix(s3West, MRAP_BUCKET_PREFIX, "us-west-2", accountId)
51+
usEastBucket = getBucketWithPrefix(s3East, MRAP_BUCKET_PREFIX, "us-east-2", accountId)
5052

5153
createMultiRegionAccessPoint(
5254
s3Control,

services/s3/e2eTest/src/S3TestUtils.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import aws.sdk.kotlin.services.s3.model.*
1010
import aws.sdk.kotlin.services.s3.model.BucketLocationConstraint
1111
import aws.sdk.kotlin.services.s3.model.ExpirationStatus
1212
import aws.sdk.kotlin.services.s3.model.LifecycleRule
13-
import aws.sdk.kotlin.services.s3.model.LifecycleRuleFilter
1413
import aws.sdk.kotlin.services.s3.paginators.listObjectsV2Paginated
1514
import aws.sdk.kotlin.services.s3.waiters.waitUntilBucketExists
1615
import aws.sdk.kotlin.services.s3.waiters.waitUntilBucketNotExists
@@ -46,11 +45,11 @@ object S3TestUtils {
4645
accountId: String? = null,
4746
): String = getBucketWithPrefix(client, TEST_BUCKET_PREFIX, region, accountId)
4847

49-
private suspend fun getBucketWithPrefix(
48+
suspend fun getBucketWithPrefix(
5049
client: S3Client,
5150
prefix: String,
52-
region: String?,
53-
accountId: String?,
51+
region: String? = null,
52+
accountId: String? = null,
5453
): String = withTimeout(60.seconds) {
5554
val buckets = client.listBuckets()
5655
.buckets
@@ -88,7 +87,7 @@ object S3TestUtils {
8887
rules = listOf(
8988
LifecycleRule {
9089
expiration { days = 1 }
91-
filter = LifecycleRuleFilter.Prefix("")
90+
filter { this.prefix = "" }
9291
status = ExpirationStatus.Enabled
9392
id = "delete-old"
9493
},

0 commit comments

Comments
 (0)