Skip to content

Commit f84e6e4

Browse files
committed
lint
1 parent 70ed729 commit f84e6e4

File tree

5 files changed

+33
-37
lines changed

5 files changed

+33
-37
lines changed

codegen/aws-sdk-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/sqs/SqsMd5ChecksumValidationIntegration.kt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ class SqsMd5ChecksumValidationIntegration : KotlinIntegration {
3636
namespace = "aws.sdk.kotlin.services.sqs.internal"
3737
}
3838
documentation = """
39-
Specifies when MD5 checksum validation should be performed for SQS messages. This controls the automatic
40-
calculation and validation of checksums during message operations.
41-
42-
Valid values:
43-
- `ALWAYS` (default) - Checksums are calculated and validated for both sending and receiving operations
44-
(SendMessage, SendMessageBatch, and ReceiveMessage)
45-
- `WHEN_SENDING` - Checksums are only calculated and validated during send operations
46-
(SendMessage and SendMessageBatch)
47-
- `WHEN_RECEIVING` - Checksums are only calculated and validated during receive operations
48-
(ReceiveMessage)
49-
- `NEVER` - No checksum calculation or validation is performed
50-
""".trimIndent()
39+
Specifies when MD5 checksum validation should be performed for SQS messages. This controls the automatic
40+
calculation and validation of checksums during message operations.
41+
42+
Valid values:
43+
- `ALWAYS` (default) - Checksums are calculated and validated for both sending and receiving operations
44+
(SendMessage, SendMessageBatch, and ReceiveMessage)
45+
- `WHEN_SENDING` - Checksums are only calculated and validated during send operations
46+
(SendMessage and SendMessageBatch)
47+
- `WHEN_RECEIVING` - Checksums are only calculated and validated during receive operations
48+
(ReceiveMessage)
49+
- `NEVER` - No checksum calculation or validation is performed
50+
""".trimIndent()
5151
}
5252

5353
private val validationScope = buildSymbol {

services/sqs/common/src/aws.sdk.kotlin.services.sqs/SqsMd5ChecksumValidationInterceptor.kt

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package aws.sdk.kotlin.services.sqs
77
import aws.sdk.kotlin.services.sqs.internal.ValidationEnabled
88
import aws.sdk.kotlin.services.sqs.internal.ValidationScope
99
import aws.sdk.kotlin.services.sqs.model.*
10-
import aws.smithy.kotlin.runtime.ClientException
1110
import aws.smithy.kotlin.runtime.client.ResponseInterceptorContext
1211
import aws.smithy.kotlin.runtime.hashing.md5
1312
import aws.smithy.kotlin.runtime.http.interceptors.ChecksumMismatchException
@@ -95,7 +94,7 @@ public class SqsMd5ChecksumValidationInterceptor(
9594
private fun sendMessageOperationMd5Check(
9695
sendMessageRequest: SendMessageRequest,
9796
sendMessageResponse: SendMessageResponse,
98-
logger: Logger
97+
logger: Logger,
9998
) {
10099
if (validationScopes.contains(ValidationScope.MESSAGE_BODY)) {
101100
val messageBodySent = sendMessageRequest.messageBody
@@ -182,7 +181,7 @@ public class SqsMd5ChecksumValidationInterceptor(
182181
private fun sendMessageBatchOperationMd5Check(
183182
sendMessageBatchRequest: SendMessageBatchRequest,
184183
sendMessageBatchResponse: SendMessageBatchResponse,
185-
logger: Logger
184+
logger: Logger,
186185
) {
187186
val idToRequestEntryMap = sendMessageBatchRequest
188187
.entries
@@ -271,7 +270,7 @@ public class SqsMd5ChecksumValidationInterceptor(
271270
!stringListValues.isNullOrEmpty() -> updateForStringListType(buffer, stringListValues)
272271
!binaryListValues.isNullOrEmpty() -> updateForBinaryListType(buffer, binaryListValues)
273272
}
274-
}
273+
}
275274

276275
val payload = buffer.readByteArray()
277276
return payload.md5().toHexString()
@@ -286,22 +285,22 @@ public class SqsMd5ChecksumValidationInterceptor(
286285
.entries
287286
.sortedBy { (name, _) -> name.value }
288287
.forEach { (attributeName, attributeValue) ->
289-
updateLengthAndBytes(buffer, attributeName.value)
288+
updateLengthAndBytes(buffer, attributeName.value)
290289

291-
updateLengthAndBytes(buffer, attributeValue.dataType)
290+
updateLengthAndBytes(buffer, attributeValue.dataType)
292291

293-
val stringValue = attributeValue.stringValue
294-
val binaryValue = attributeValue.binaryValue
295-
val stringListValues = attributeValue.stringListValues
296-
val binaryListValues = attributeValue.binaryListValues
292+
val stringValue = attributeValue.stringValue
293+
val binaryValue = attributeValue.binaryValue
294+
val stringListValues = attributeValue.stringListValues
295+
val binaryListValues = attributeValue.binaryListValues
297296

298-
when {
299-
stringValue != null -> updateForStringType(buffer, stringValue)
300-
binaryValue != null -> updateForBinaryType(buffer, binaryValue)
301-
!stringListValues.isNullOrEmpty() -> updateForStringListType(buffer, stringListValues)
302-
!binaryListValues.isNullOrEmpty() -> updateForBinaryListType(buffer, binaryListValues)
297+
when {
298+
stringValue != null -> updateForStringType(buffer, stringValue)
299+
binaryValue != null -> updateForBinaryType(buffer, binaryValue)
300+
!stringListValues.isNullOrEmpty() -> updateForStringListType(buffer, stringListValues)
301+
!binaryListValues.isNullOrEmpty() -> updateForBinaryListType(buffer, binaryListValues)
302+
}
303303
}
304-
}
305304

306305
val payload = buffer.readByteArray()
307306
return payload.md5().toHexString()

services/sqs/common/src/aws.sdk.kotlin.services.sqs/internal/FinalizeSqsConfig.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ internal suspend fun finalizeSqsConfig(
1717
) {
1818
val activeProfile = sharedConfig.get().activeProfile
1919
builder.config.checksumValidationEnabled = builder.config.checksumValidationEnabled
20-
?: SqsSettings.checksumValidationEnabled.resolve(provider)
20+
?: SqsSetting.checksumValidationEnabled.resolve(provider)
2121
?: activeProfile.checksumValidationEnabled
2222
?: ValidationEnabled.NEVER // TODO: MD5 checksum validation is temporarily disabled. Set default to ALWAYS in next minor version
2323

2424
builder.config.checksumValidationScopes = builder.config.checksumValidationScopes.ifEmpty {
25-
SqsSettings.checksumValidationScopes.resolve(provider)
25+
SqsSetting.checksumValidationScopes.resolve(provider)
2626
?: activeProfile.checksumValidationScopes
2727
?: ValidationScope.entries.toSet()
2828
}

services/sqs/common/src/aws.sdk.kotlin.services.sqs/internal/SqsSettings.kt renamed to services/sqs/common/src/aws.sdk.kotlin.services.sqs/internal/SqsSetting.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import aws.smithy.kotlin.runtime.config.*
99
/**
1010
* SQS specific system settings
1111
*/
12-
internal object SqsSettings {
12+
internal object SqsSetting {
1313
/**
1414
* Configure when MD5 checksum validation is performed for SQS operations.
1515
*

services/sqs/e2eTest/src/SqsTestUtils.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import aws.sdk.kotlin.services.sqs.paginators.listQueuesPaginated
1111
import aws.sdk.kotlin.services.sqs.paginators.queueUrls
1212
import kotlinx.coroutines.flow.firstOrNull
1313
import kotlinx.coroutines.withTimeout
14-
import java.net.URI
1514
import java.util.*
1615
import kotlin.time.Duration.Companion.seconds
1716

@@ -37,8 +36,6 @@ object SqsTestUtils {
3736
prefix: String,
3837
region: String? = null,
3938
): String = withTimeout(60.seconds) {
40-
//val queueUrls = client.listQueues().queueUrls
41-
4239
var matchingQueueUrl = client
4340
.listQueuesPaginated { queueNamePrefix = prefix }
4441
.queueUrls()
@@ -62,10 +59,10 @@ object SqsTestUtils {
6259
try {
6360
println("Purging Sqs queue: $queueUrl")
6461

65-
client.purgeQueue (
62+
client.purgeQueue(
6663
PurgeQueueRequest {
6764
this.queueUrl = queueUrl
68-
}
65+
},
6966
)
7067

7168
println("Queue purged successfully.")
@@ -75,7 +72,7 @@ object SqsTestUtils {
7572
client.deleteQueue(
7673
DeleteQueueRequest {
7774
this.queueUrl = queueUrl
78-
}
75+
},
7976
)
8077

8178
println("Queue deleted successfully.")

0 commit comments

Comments
 (0)