From 189af48cd0b7638bc7c1fbafb556c60d82430b71 Mon Sep 17 00:00:00 2001 From: scmacdon Date: Tue, 18 Jun 2024 14:01:48 -0400 Subject: [PATCH] cleaned up kotlin files --- kotlin/services/apigateway/src/test/kotlin/APIGatewayTest.kt | 2 +- .../src/main/kotlin/com/aws/photo/AnalyzePhotos.kt | 2 +- .../src/main/kotlin/com/aws/photo/PhotoApp.kt | 4 ++-- .../src/main/kotlin/com/aws/photo/S3Service.kt | 4 ++-- .../src/main/kotlin/org/example/QueuePayload.kt | 1 - 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/kotlin/services/apigateway/src/test/kotlin/APIGatewayTest.kt b/kotlin/services/apigateway/src/test/kotlin/APIGatewayTest.kt index 8c7c702d7eb..f5908bf0235 100644 --- a/kotlin/services/apigateway/src/test/kotlin/APIGatewayTest.kt +++ b/kotlin/services/apigateway/src/test/kotlin/APIGatewayTest.kt @@ -84,7 +84,7 @@ class APIGatewayTest { @Test @Order(4) - fun DeleteRestApi() = runBlocking { + fun deleteRestApi() = runBlocking { deleteAPI(newApiId) println("Test 6 passed") } diff --git a/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/AnalyzePhotos.kt b/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/AnalyzePhotos.kt index eba674e499c..944306d7563 100644 --- a/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/AnalyzePhotos.kt +++ b/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/AnalyzePhotos.kt @@ -11,7 +11,7 @@ import org.springframework.stereotype.Component @Component class AnalyzePhotos { - suspend fun DetectLabels(bytesVal: ByteArray?, key: String?): MutableList? { + suspend fun detectLabels(bytesVal: ByteArray?, key: String?): MutableList? { // Create an Image object for the source image. val souImage = Image { bytes = bytesVal diff --git a/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/PhotoApp.kt b/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/PhotoApp.kt index 32b2f5c7487..b993c3ce63b 100644 --- a/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/PhotoApp.kt +++ b/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/PhotoApp.kt @@ -54,7 +54,7 @@ class MessageResource { @RequestMapping(value = ["/getimages"], method = [RequestMethod.GET]) @ResponseBody fun getImages(request: HttpServletRequest?, response: HttpServletResponse?): String? = runBlocking { - return@runBlocking s3Service?.ListAllObjects(bucketName) + return@runBlocking s3Service?.listAllObjects(bucketName) } // Generates a report that analyzes photos in a given bucket. @@ -72,7 +72,7 @@ class MessageResource { val keyData = s3Service?.getObjectBytes(bucketName, key) // Analyze the photo. - val item = recService?.DetectLabels(keyData, key) + val item = recService?.detectLabels(keyData, key) if (item != null) { myList.add(item) } diff --git a/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/S3Service.kt b/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/S3Service.kt index 3b13fa25025..29d67cb020d 100644 --- a/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/S3Service.kt +++ b/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/S3Service.kt @@ -44,7 +44,7 @@ class S3Service { } // Returns the names of all images and data within an XML document. - suspend fun ListAllObjects(bucketName: String?): String? { + suspend fun listAllObjects(bucketName: String?): String? { var sizeLg: Long var dateIn: aws.smithy.kotlin.runtime.time.Instant? val bucketItems = mutableListOf() @@ -59,7 +59,7 @@ class S3Service { val myItem = BucketItem() myItem.key = myObject.key myItem.owner = myObject.owner?.displayName.toString() - sizeLg = (myObject.size / 1024) + sizeLg = (myObject.size?.div(1024)!!) myItem.size = (sizeLg.toString()) dateIn = myObject.lastModified myItem.date = dateIn.toString() diff --git a/kotlin/usecases/workflow_sagemaker_lambda/src/main/kotlin/org/example/QueuePayload.kt b/kotlin/usecases/workflow_sagemaker_lambda/src/main/kotlin/org/example/QueuePayload.kt index 86a6074c7ff..94cb6f8a92c 100644 --- a/kotlin/usecases/workflow_sagemaker_lambda/src/main/kotlin/org/example/QueuePayload.kt +++ b/kotlin/usecases/workflow_sagemaker_lambda/src/main/kotlin/org/example/QueuePayload.kt @@ -16,5 +16,4 @@ class QueuePayload { // Getter and Setter methods for arguments fun getArguments(): HashMap? = arguments - }