Skip to content

Commit df9a795

Browse files
committed
fix(breaking): remove "DisplayName" from Owner
This is a breaking change, S3Mock will not be able to read from existing file systems created with older versions. Pretty confusing - "DisplayName" is used all over the place in AWS, but for some reason, it's only removed from the "Owner" data structure. There is no documentation, blog post, etc to be found, just emails sent to account owners. The API for "Owner" still lists "DisplayName", with no deprecation notice. The SDKs also do not contain a deprecation notice. Fixes #2738
1 parent c6c1114 commit df9a795

36 files changed

+105
-108
lines changed

integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/AclIT.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ internal class AclIT : S3TestBase() {
6363
}.also { resp ->
6464
assertThat(resp.sdkHttpResponse().isSuccessful).isTrue()
6565
assertThat(resp.owner().id()).isNotBlank()
66-
assertThat(resp.owner().displayName()).isNotBlank()
6766
assertThat(resp.grants()).hasSize(1)
6867
assertThat(resp.grants().first().permission()).isEqualTo(FULL_CONTROL)
6968
}
@@ -86,7 +85,6 @@ internal class AclIT : S3TestBase() {
8685

8786
acl.owner().also { owner ->
8887
assertThat(owner.id()).isEqualTo(DEFAULT_OWNER.id)
89-
assertThat(owner.displayName()).isEqualTo(DEFAULT_OWNER.displayName)
9088
}
9189

9290
acl.grants().also {
@@ -102,7 +100,6 @@ internal class AclIT : S3TestBase() {
102100
.also { grantee ->
103101
assertThat(grantee).isNotNull
104102
assertThat(grantee.id()).isEqualTo(DEFAULT_OWNER.id)
105-
assertThat(grantee.displayName()).isEqualTo(DEFAULT_OWNER.displayName)
106103
assertThat(grantee.type()).isEqualTo(CANONICAL_USER)
107104
}
108105
}
@@ -126,7 +123,6 @@ internal class AclIT : S3TestBase() {
126123
it.accessControlPolicy {
127124
it.owner {
128125
it.id(userId)
129-
it.displayName(userName)
130126
}
131127
it
132128
.grants(
@@ -150,7 +146,6 @@ internal class AclIT : S3TestBase() {
150146
acl.owner().also {
151147
assertThat(it).isNotNull
152148
assertThat(it.id()).isEqualTo(userId)
153-
assertThat(it.displayName()).isEqualTo(userName)
154149
}
155150

156151
assertThat(acl.grants()).hasSize(1)

integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/BucketIT.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ internal class BucketIT : S3TestBase() {
167167
}
168168
assertThat(it.prefix()).isNull()
169169
assertThat(it.continuationToken()).isNull()
170-
assertThat(it.owner().displayName()).isEqualTo("s3-mock-file-store")
171170
assertThat(it.owner().id()).isEqualTo("79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be")
172171
}
173172
}
@@ -205,7 +204,6 @@ internal class BucketIT : S3TestBase() {
205204
}
206205
assertThat(it.prefix()).isEqualTo(bucketName)
207206
assertThat(it.continuationToken()).isNull()
208-
assertThat(it.owner().displayName()).isEqualTo("s3-mock-file-store")
209207
assertThat(it.owner().id()).isEqualTo("79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be")
210208
}
211209
}
@@ -245,7 +243,6 @@ internal class BucketIT : S3TestBase() {
245243
}
246244
assertThat(it.prefix()).isNull()
247245
assertThat(it.continuationToken()).isNotNull
248-
assertThat(it.owner().displayName()).isEqualTo("s3-mock-file-store")
249246
assertThat(it.owner().id()).isEqualTo("79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be")
250247
}.continuationToken()
251248

@@ -263,7 +260,6 @@ internal class BucketIT : S3TestBase() {
263260
}
264261
assertThat(it.prefix()).isNull()
265262
assertThat(it.continuationToken()).isNull()
266-
assertThat(it.owner().displayName()).isEqualTo("s3-mock-file-store")
267263
assertThat(it.owner().id()).isEqualTo("79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be")
268264
}
269265
}

server/src/main/kotlin/com/adobe/testing/s3mock/controller/MultipartController.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import com.adobe.testing.s3mock.dto.CompleteMultipartUploadResult
2323
import com.adobe.testing.s3mock.dto.CopyPartResult
2424
import com.adobe.testing.s3mock.dto.CopySource
2525
import com.adobe.testing.s3mock.dto.InitiateMultipartUploadResult
26+
import com.adobe.testing.s3mock.dto.Initiator
2627
import com.adobe.testing.s3mock.dto.ListMultipartUploadsResult
2728
import com.adobe.testing.s3mock.dto.ListPartsResult
2829
import com.adobe.testing.s3mock.dto.ObjectKey
@@ -382,7 +383,7 @@ class MultipartController(
382383
contentType,
383384
storeHeadersFrom(httpHeaders),
384385
Owner.DEFAULT_OWNER,
385-
Owner.DEFAULT_OWNER,
386+
Initiator.DEFAULT_INITIATOR,
386387
userMetadataFrom(httpHeaders),
387388
encryptionHeaders,
388389
tags,
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2017-2025 Adobe.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.adobe.testing.s3mock.dto
17+
18+
import com.adobe.testing.S3Verified
19+
import com.fasterxml.jackson.annotation.JsonProperty
20+
21+
/**
22+
* [API Reference](https://docs.aws.amazon.com/AmazonS3/latest/API/API_Initiator.html).
23+
*/
24+
@S3Verified(year = 2025)
25+
data class Initiator(
26+
@param:JsonProperty("DisplayName", namespace = "http://s3.amazonaws.com/doc/2006-03-01/")
27+
val displayName: String?,
28+
@param:JsonProperty("ID", namespace = "http://s3.amazonaws.com/doc/2006-03-01/")
29+
val id: String?
30+
) {
31+
companion object {
32+
val DEFAULT_INITIATOR: Initiator =
33+
Initiator("s3-mock-file-store", "79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be")
34+
}
35+
}

server/src/main/kotlin/com/adobe/testing/s3mock/dto/ListPartsResult.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ data class ListPartsResult(
3434
@param:JsonProperty("ChecksumType", namespace = "http://s3.amazonaws.com/doc/2006-03-01/")
3535
val checksumType: ChecksumType?,
3636
@param:JsonProperty("Initiator", namespace = "http://s3.amazonaws.com/doc/2006-03-01/")
37-
val initiator: Owner?,
37+
val initiator: Initiator?,
3838
@param:JsonProperty("IsTruncated", namespace = "http://s3.amazonaws.com/doc/2006-03-01/")
3939
val isTruncated: Boolean,
4040
@param:JsonProperty("Key", namespace = "http://s3.amazonaws.com/doc/2006-03-01/")

server/src/main/kotlin/com/adobe/testing/s3mock/dto/MultipartUpload.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ data class MultipartUpload(
3434
@param:JsonProperty("Initiated", namespace = "http://s3.amazonaws.com/doc/2006-03-01/")
3535
val initiated: Date?,
3636
@param:JsonProperty("Initiator", namespace = "http://s3.amazonaws.com/doc/2006-03-01/")
37-
val initiator: Owner?,
37+
val initiator: Initiator?,
3838
@param:JsonProperty("Key", namespace = "http://s3.amazonaws.com/doc/2006-03-01/")
3939
val key: String,
4040
@param:JsonProperty("Owner", namespace = "http://s3.amazonaws.com/doc/2006-03-01/")

server/src/main/kotlin/com/adobe/testing/s3mock/dto/Owner.kt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,14 @@ import com.fasterxml.jackson.annotation.JsonProperty
2424
*/
2525
@S3Verified(year = 2025)
2626
data class Owner(
27-
@Deprecated("AWS deprecated this field in 2025-05")
28-
@param:JsonProperty("DisplayName", namespace = "http://s3.amazonaws.com/doc/2006-03-01/")
29-
val displayName: String? = null,
3027
@param:JsonProperty("ID", namespace = "http://s3.amazonaws.com/doc/2006-03-01/")
3128
val id: String?
3229
) {
3330
companion object {
3431
/**
3532
* Default owner in S3Mock until support for ownership is implemented.
3633
*/
37-
val DEFAULT_OWNER: Owner =
38-
Owner("s3-mock-file-store", "79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be")
39-
val DEFAULT_OWNER_BUCKET: Owner =
40-
Owner("s3-mock-file-store-bucket", "79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2df")
34+
val DEFAULT_OWNER: Owner = Owner("79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be")
35+
val DEFAULT_OWNER_BUCKET: Owner = Owner("79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2df")
4136
}
4237
}

server/src/main/kotlin/com/adobe/testing/s3mock/service/MultipartService.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import com.adobe.testing.s3mock.dto.CompleteMultipartUploadResult
2222
import com.adobe.testing.s3mock.dto.CompletedPart
2323
import com.adobe.testing.s3mock.dto.CopyPartResult
2424
import com.adobe.testing.s3mock.dto.InitiateMultipartUploadResult
25+
import com.adobe.testing.s3mock.dto.Initiator
2526
import com.adobe.testing.s3mock.dto.ListMultipartUploadsResult
2627
import com.adobe.testing.s3mock.dto.ListPartsResult
2728
import com.adobe.testing.s3mock.dto.MultipartUpload
@@ -189,7 +190,7 @@ open class MultipartService(private val bucketStore: BucketStore, private val mu
189190
contentType: String?,
190191
storeHeaders: Map<String, String>,
191192
owner: Owner,
192-
initiator: Owner,
193+
initiator: Initiator,
193194
userMetadata: Map<String, String>,
194195
encryptionHeaders: Map<String, String>,
195196
tags: List<Tag>?,

server/src/main/kotlin/com/adobe/testing/s3mock/store/MultipartStore.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import com.adobe.testing.s3mock.dto.ChecksumAlgorithm
2121
import com.adobe.testing.s3mock.dto.ChecksumType
2222
import com.adobe.testing.s3mock.dto.CompleteMultipartUploadResult
2323
import com.adobe.testing.s3mock.dto.CompletedPart
24+
import com.adobe.testing.s3mock.dto.Initiator
2425
import com.adobe.testing.s3mock.dto.MultipartUpload
2526
import com.adobe.testing.s3mock.dto.Owner
2627
import com.adobe.testing.s3mock.dto.Part
@@ -64,7 +65,7 @@ open class MultipartStore(private val objectStore: ObjectStore, private val obje
6465
contentType: String?,
6566
storeHeaders: Map<String, String>,
6667
owner: Owner,
67-
initiator: Owner,
68+
initiator: Initiator,
6869
userMetadata: Map<String, String>,
6970
encryptionHeaders: Map<String, String>,
7071
tags: List<Tag>?,

server/src/main/kotlin/com/adobe/testing/s3mock/store/ObjectStore.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ open class ObjectStore(
121121

122122
private fun privateCannedAcl(owner: Owner): AccessControlPolicy {
123123
val grant = Grant(
124-
CanonicalUser(owner.displayName, owner.id),
124+
CanonicalUser(null, owner.id),
125125
Grant.Permission.FULL_CONTROL
126126
)
127127
return AccessControlPolicy(listOf(grant), owner)

0 commit comments

Comments
 (0)