From 216f4b7aad4ef022ab0e3435bee599227700bc39 Mon Sep 17 00:00:00 2001 From: Jason Quesenberry Date: Mon, 17 Jun 2024 13:32:26 -0700 Subject: [PATCH 1/3] Kotlin: linting with the intellij standard. --- .github/linters/ktlint_config | 16 +- kotlin/services/apigateway/build.gradle.kts | 2 +- .../com/kotlin/gateway/CreateDeployment.kt | 94 +- .../com/kotlin/gateway/CreateRestApi.kt | 90 +- .../com/kotlin/gateway/DeleteRestApi.kt | 85 +- .../kotlin/com/kotlin/gateway/GetAPIKeys.kt | 49 +- .../com/kotlin/gateway/GetDeployments.kt | 90 +- .../kotlin/com/kotlin/gateway/GetMethod.kt | 110 ++- .../kotlin/com/kotlin/gateway/GetStages.kt | 88 +- .../src/test/kotlin/APIGatewayTest.kt | 7 +- kotlin/services/appsync/build.gradle.kts | 2 +- .../com/example/appsync/CreateDataSource.kt | 2 +- .../com/example/appsync/DeleteApiKey.kt | 2 +- .../com/example/appsync/DeleteDataSource.kt | 2 +- kotlin/services/athena/build.gradle.kts | 2 +- .../kotlin/athena/CreateNamedQueryExample.kt | 98 +- .../kotlin/athena/DeleteNamedQueryExample.kt | 80 +- .../kotlin/athena/ListNamedQueryExample.kt | 56 +- .../athena/ListQueryExecutionsExample.kt | 56 +- .../com/kotlin/athena/StartQueryExample.kt | 240 ++--- .../athena/src/test/kotlin/AthenaTest.kt | 7 +- kotlin/services/autoscale/build.gradle.kts | 2 +- .../autoscaling/AutoScalingScenario.kt | 4 +- kotlin/services/bedrock/build.gradle.kts | 2 +- .../services/cloudformation/build.gradle.kts | 2 +- kotlin/services/cloudtrail/build.gradle.kts | 2 +- .../com/kotlin/cloudtrail/CreateTrail.kt | 2 +- .../kotlin/cloudtrail/PutEventSelectors.kt | 2 +- kotlin/services/cloudwatch/build.gradle.kts | 2 +- .../kotlin/cloudwatch/CloudWatchScenario.kt | 10 +- .../com/kotlin/cloudwatch/CreateAlarm.kt | 2 +- .../cloudwatch/CreateSubscriptionFilter.kt | 2 +- .../cloudwatch/DeleteSubscriptionFilter.kt | 2 +- .../com/kotlin/cloudwatch/GetLogEvents.kt | 2 +- .../com/kotlin/cloudwatch/PutLogEvents.kt | 2 +- .../com/kotlin/cloudwatch/PutMetricAlarm.kt | 2 +- .../kotlin/com/kotlin/cloudwatch/PutRule.kt | 2 +- kotlin/services/codepipeline/build.gradle.kts | 2 +- .../com/kotlin/pipeline/CreatePipeline.kt | 2 +- kotlin/services/cognito/build.gradle.kts | 2 +- .../kotlin/com/kotlin/cognito/CognitoMVP.kt | 14 +- .../kotlin/com/kotlin/cognito/CreateUser.kt | 2 +- .../kotlin/com/kotlin/cognito/SignUpUser.kt | 6 +- kotlin/services/comprehend/build.gradle.kts | 2 +- .../comprehend/DocumentClassifierDemo.kt | 2 +- kotlin/services/dynamodb/build.gradle.kts | 2 +- .../kotlin/com/kotlin/dynamodb/CreateTable.kt | 2 +- .../kotlin/com/kotlin/dynamodb/DeleteItem.kt | 2 +- .../com/kotlin/dynamodb/DynamoDBPartiQ.kt | 10 +- .../kotlin/com/kotlin/dynamodb/GetItem.kt | 2 +- .../kotlin/com/kotlin/dynamodb/PutItem.kt | 2 +- .../kotlin/com/kotlin/dynamodb/QueryTable.kt | 2 +- .../kotlin/com/kotlin/dynamodb/Scenario.kt | 10 +- .../com/kotlin/dynamodb/ScenarioPartiQ.kt | 6 +- .../kotlin/dynamodb/ScenarioPartiQLBatch.kt | 2 +- .../kotlin/com/kotlin/dynamodb/UpdateItem.kt | 2 +- .../dynamodb/src/test/kotlin/DynamoDB.kt | 2 +- kotlin/services/ec2/build.gradle.kts | 2 +- .../kotlin/com/kotlin/ec2/CreateInstance.kt | 2 +- .../com/kotlin/ec2/CreateSecurityGroup.kt | 2 +- .../com/kotlin/ec2/DescribeAddresses.kt | 2 +- .../main/kotlin/com/kotlin/ec2/EC2Scenario.kt | 8 +- kotlin/services/ecs/build.gradle.kts | 2 +- .../kotlin/com/kotlin/ecs/CreateService.kt | 2 +- .../kotlin/com/kotlin/ecs/DeleteService.kt | 2 +- .../com/kotlin/ecs/ListTaskDefinitions.kt | 2 +- .../kotlin/com/kotlin/ecs/UpdateService.kt | 2 +- .../elasticbeanstalk/build.gradle.kts | 2 +- .../com/aws/example/CreateEnvironment.kt | 2 +- kotlin/services/emr/build.gradle.kts | 2 +- .../main/kotlin/com/kotlin/emr/AddSteps.kt | 2 +- .../kotlin/com/kotlin/emr/CreateCluster.kt | 2 +- .../com/kotlin/emr/CreateSparkCluster.kt | 2 +- kotlin/services/eventbridge/build.gradle.kts | 2 +- .../kotlin/eventbridge/CreateRuleSchedule.kt | 4 +- .../com/kotlin/eventbridge/EventbridgeMVP.kt | 18 +- kotlin/services/firehose/build.gradle.kts | 2 +- .../kotlin/firehose/CreateDeliveryStream.kt | 2 +- .../kotlin/com/kotlin/firehose/PutRecord.kt | 2 +- .../kotlin/com/kotlin/firehose/StockTrade.kt | 6 +- .../kotlin/firehose/StockTradeGenerator.kt | 2 +- kotlin/services/forecast/build.gradle.kts | 2 +- .../com/kotlin/forecast/CreateForecast.kt | 2 +- kotlin/services/glue/build.gradle.kts | 2 +- .../kotlin/com/kotlin/glue/CreateCrawler.kt | 2 +- .../main/kotlin/com/kotlin/glue/GetJobRun.kt | 2 +- .../kotlin/com/kotlin/glue/GlueScenario.kt | 6 +- kotlin/services/iam/build.gradle.kts | 2 +- .../kotlin/com/kotlin/iam/AttachRolePolicy.kt | 4 +- .../kotlin/com/kotlin/iam/DeleteAccessKey.kt | 2 +- .../kotlin/com/kotlin/iam/DetachRolePolicy.kt | 2 +- .../main/kotlin/com/kotlin/iam/IAMScenario.kt | 10 +- .../main/kotlin/com/kotlin/iam/UpdateUser.kt | 2 +- kotlin/services/iot/build.gradle.kts | 2 +- .../kotlin/com/example/iot/IotScenario.kt | 20 +- kotlin/services/kendra/build.gradle.kts | 2 +- .../kendra/CreateIndexAndDataSourceExample.kt | 8 +- .../com/example/kendra/DeleteDataSource.kt | 2 +- .../example/kendra/ListDataSourceSyncJobs.kt | 2 +- .../kotlin/com/example/kendra/QueryIndex.kt | 2 +- kotlin/services/keyspaces/build.gradle.kts | 2 +- .../com/example/keyspace/ScenarioKeyspaces.kt | 28 +- kotlin/services/kinesis/build.gradle.kts | 2 +- .../com/kotlin/kinesis/AddDataShards.kt | 2 +- .../kotlin/com/kotlin/kinesis/GetRecords.kt | 2 +- .../kotlin/com/kotlin/kinesis/StockTrade.kt | 4 +- .../com/kotlin/kinesis/StockTradeGenerator.kt | 2 +- .../com/kotlin/kinesis/StockTradesWriter.kt | 2 +- kotlin/services/kms/build.gradle.kts | 2 +- .../main/kotlin/com/kotlin/kms/CreateAlias.kt | 2 +- .../main/kotlin/com/kotlin/kms/CreateGrant.kt | 2 +- .../kotlin/com/kotlin/kms/EncryptDataKey.kt | 2 +- .../main/kotlin/com/kotlin/kms/RevokeGrant.kt | 2 +- kotlin/services/lambda/build.gradle.kts | 2 +- .../com/kotlin/lambda/CreateFunction.kt | 2 +- .../com/kotlin/lambda/GetAccountSettings.kt | 2 +- .../com/kotlin/lambda/LambdaScenario.kt | 6 +- kotlin/services/lex/build.gradle.kts | 2 +- .../main/kotlin/com/kotlin/lex/GetIntent.kt | 2 +- .../main/kotlin/com/kotlin/lex/PostText.kt | 2 +- .../src/main/kotlin/com/kotlin/lex/PutBot.kt | 2 +- kotlin/services/mediaconvert/build.gradle.kts | 2 +- .../com/kotlin/mediaconvert/CreateJob.kt | 10 +- .../kotlin/com/kotlin/mediaconvert/GetJob.kt | 2 +- kotlin/services/mediastore/build.gradle.kts | 2 +- kotlin/services/opensearch/build.gradle.kts | 2 +- kotlin/services/personalize/build.gradle.kts | 2 +- .../com/kotlin/personalize/CreateCampaign.kt | 2 +- .../com/kotlin/personalize/CreateSolution.kt | 2 +- .../kotlin/personalize/GetRecommendations.kt | 2 +- kotlin/services/pinpoint/build.gradle.kts | 2 +- .../com/kotlin/pinpoint/AddExampleEndpoint.kt | 2 +- .../kotlin/com/kotlin/pinpoint/CreateApp.kt | 2 +- .../com/kotlin/pinpoint/CreateCampaign.kt | 4 +- .../com/kotlin/pinpoint/CreateSegment.kt | 2 +- .../kotlin/com/kotlin/pinpoint/DeleteApp.kt | 2 +- .../com/kotlin/pinpoint/DeleteEndpoint.kt | 2 +- .../com/kotlin/pinpoint/ListEndpointIds.kt | 4 +- .../com/kotlin/pinpoint/ListSegments.kt | 2 +- .../com/kotlin/pinpoint/LookUpEndpoint.kt | 4 +- .../com/kotlin/pinpoint/SendEmailMessage.kt | 2 +- .../kotlin/com/kotlin/pinpoint/SendMessage.kt | 4 +- kotlin/services/polly/build.gradle.kts | 2 +- .../kotlin/com/kotlin/polly/DescribeVoices.kt | 2 +- .../main/kotlin/com/kotlin/polly/PollyDemo.kt | 2 +- kotlin/services/rds/build.gradle.kts | 2 +- .../kotlin/com/kotlin/rds/AuroraScenario.kt | 14 +- .../kotlin/com/kotlin/rds/CreateDBInstance.kt | 2 +- .../kotlin/com/kotlin/rds/CreateDBSnapshot.kt | 2 +- .../kotlin/com/kotlin/rds/ModifyDBInstance.kt | 2 +- .../main/kotlin/com/kotlin/rds/RDSScenario.kt | 12 +- .../services/rds/src/test/kotlin/RDSTest.kt | 2 +- kotlin/services/redshift/build.gradle.kts | 2 +- .../kotlin/redshift/CreateAndModifyCluster.kt | 4 +- .../kotlin/com/kotlin/redshift/ListEvents.kt | 2 +- .../src/test/kotlin/RedshiftKotlinTest.kt | 2 +- kotlin/services/rekognition/build.gradle.kts | 2 +- .../rekognition/AddFacesToCollection.kt | 2 +- .../com/kotlin/rekognition/CompareFaces.kt | 2 +- .../rekognition/DeleteFacesFromCollection.kt | 2 +- .../com/kotlin/rekognition/DetectPPE.kt | 2 +- .../kotlin/rekognition/VideoDetectFaces.kt | 2 +- .../rekognition/VideoDetectInappropriate.kt | 2 +- kotlin/services/route53/build.gradle.kts | 2 +- .../com/kotlin/route/Route53Scenario.kt | 2 +- kotlin/services/s3/build.gradle.kts | 2 +- .../main/kotlin/com/kotlin/s3/CopyObject.kt | 2 +- .../kotlin/com/kotlin/s3/DeleteObjects.kt | 2 +- .../src/main/kotlin/com/kotlin/s3/GetAcl.kt | 2 +- .../kotlin/com/kotlin/s3/GetObjectData.kt | 2 +- .../main/kotlin/com/kotlin/s3/MrapExample.kt | 30 +- .../com/kotlin/s3/PresigningExamples.kt | 24 +- .../main/kotlin/com/kotlin/s3/PutObject.kt | 2 +- .../main/kotlin/com/kotlin/s3/S3Operations.kt | 8 +- .../src/main/kotlin/com/kotlin/s3/SetAcl.kt | 2 +- .../kotlin/com/kotlin/s3/SetBucketPolicy.kt | 4 +- .../test/kotlin/com/kotlin/s3/PresignTests.kt | 2 +- kotlin/services/sagemaker/build.gradle.kts | 4 +- .../kotlin/com/kotlin/sage/CreateModel.kt | 2 +- .../com/kotlin/sage/CreateTrainingJob.kt | 2 +- .../com/kotlin/sage/CreateTransformJob.kt | 2 +- .../services/secrets-manager/build.gradle.kts | 2 +- kotlin/services/ses/build.gradle.kts | 2 +- .../com/example/ses/SendMessageEmail.kt | 2 +- .../example/ses/SendMessageEmailAttachment.kt | 2 +- kotlin/services/sns/build.gradle.kts | 2 +- .../main/kotlin/com/kotlin/sns/DeleteTag.kt | 2 +- .../kotlin/com/kotlin/sns/PublishTextSMS.kt | 2 +- .../kotlin/com/kotlin/sns/PublishTopic.kt | 2 +- .../com/kotlin/sns/SetTopicAttributes.kt | 2 +- .../kotlin/com/kotlin/sns/SubscribeEmail.kt | 2 +- .../kotlin/com/kotlin/sns/SubscribeLambda.kt | 2 +- .../kotlin/com/kotlin/sns/SubscribeTextSMS.kt | 2 +- kotlin/services/sqs/build.gradle.kts | 2 +- .../kotlin/com/kotlin/sqs/RemoveQueueTag.kt | 2 +- .../kotlin/com/kotlin/sqs/SendMessages.kt | 2 +- .../services/stepfunctions/build.gradle.kts | 2 +- .../stepfunctions/StepFunctionsScenario.kt | 8 +- kotlin/services/sts/build.gradle.kts | 2 +- .../main/kotlin/com/kotlin/sts/AssumeRole.kt | 2 +- kotlin/services/support/build.gradle.kts | 2 +- .../com/example/support/SupportScenario.kt | 4 +- kotlin/services/textract/build.gradle.kts | 2 +- .../kotlin/textract/DetectDocumentTextS3.kt | 2 +- .../kotlin/textract/StartDocumentAnalysis.kt | 4 +- kotlin/services/translate/build.gradle.kts | 2 +- .../com/kotlin/translate/BatchTranslation.kt | 2 +- kotlin/services/xray/build.gradle.kts | 2 +- .../kotlin/com/example/sqs/MessageData.kt | 20 +- .../com/example/sqs/SendReceiveMessages.kt | 240 ++--- .../kotlin/com/example/photo/LabelCount.kt | 12 +- .../kotlin/com/example/photo/WorkCount.kt | 4 +- .../com/example/photo/handlers/GetHandler.kt | 12 +- .../example/photo/handlers/UploadHandler.kt | 16 +- .../kotlin/com/aws/photo/AnalyzePhotos.kt | 83 +- .../main/kotlin/com/aws/photo/BucketItem.kt | 24 +- .../src/main/kotlin/com/aws/photo/PhotoApp.kt | 12 +- .../main/kotlin/com/aws/photo/S3Service.kt | 354 ++++---- .../src/main/kotlin/com/aws/photo/WorkItem.kt | 20 +- .../main/kotlin/com/aws/photo/WriteExcel.kt | 318 +++---- .../src/main/kotlin/com/aws/rest/App.kt | 184 ++-- .../kotlin/com/aws/rest/RedshiftService.kt | 852 +++++++++--------- .../main/kotlin/com/aws/rest/SendMessage.kt | 110 +-- .../src/main/kotlin/com/aws/rest/WorkItem.kt | 28 +- .../kotlin/com/example/awsapp/Database.kt | 7 +- .../kotlin/com/example/awsapp/MainActivity.kt | 23 +- .../kotlin/com/example/awsapp/SendMessage.kt | 1 - .../src/main/kotlin/com/aws/rest/App.kt | 186 ++-- .../kotlin/com/aws/rest/DynamoDBService.kt | 680 +++++++------- .../main/kotlin/com/aws/rest/SendMessage.kt | 112 +-- .../src/main/kotlin/com/aws/rest/WorkItem.kt | 28 +- .../src/test/kotlin/DynamoDBTest.kt | 178 ++-- .../com/example/demo/DemoApplication.kt | 184 ++-- .../kotlin/com/example/demo/SendMessage.kt | 128 +-- .../main/kotlin/com/example/demo/WorkItem.kt | 28 +- .../com/example/demo/WorkItemRepository.kt | 662 +++++++------- .../main/kotlin/com/aws/kotlin/SnsService.kt | 358 ++++---- .../kotlin/com/aws/kotlin/SubApplication.kt | 134 ++- .../com/example/androidsubpub/MainActivity.kt | 247 +++-- .../topics_and_queues/build.gradle.kts | 2 +- .../kotlin/com/example/sns/SNSWorkflow.kt | 12 +- .../main/kotlin/org/example/QueuePayload.kt | 16 +- .../workflow_sagemaker_pipes/build.gradle.kts | 2 +- .../com/example/sage/SagemakerWorkflow.kt | 4 +- .../src/test/kotlin/KotlinTest.kt | 2 +- 245 files changed, 3521 insertions(+), 3568 deletions(-) diff --git a/.github/linters/ktlint_config b/.github/linters/ktlint_config index a3511d93f5a..f51359acb84 100644 --- a/.github/linters/ktlint_config +++ b/.github/linters/ktlint_config @@ -1,3 +1,17 @@ +root = true + +[*] +charset = utf-8 +insert_final_newline = true +trim_trailing_whitespace = true + [*.{kt,kts}] -ktlint_code_style = ktlint_official +indent_size = 4 +ij_kotlin_packages_to_use_import_on_demand = unset +ij_kotlin_name_count_to_use_star_import = 999 +ij_kotlin_name_count_to_use_star_import_for_members = 999 +ktlint_code_style=intellij_idea ktlint_standard_no-consecutive-comments = disabled + +[*.{yml,yaml}] +indent_size = 2 diff --git a/kotlin/services/apigateway/build.gradle.kts b/kotlin/services/apigateway/build.gradle.kts index c66333f8a15..96b473cfbc8 100644 --- a/kotlin/services/apigateway/build.gradle.kts +++ b/kotlin/services/apigateway/build.gradle.kts @@ -36,7 +36,7 @@ dependencies { implementation("com.fasterxml.jackson.core:jackson-databind:2.14.2") implementation("com.google.code.gson:gson:2.10") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/CreateDeployment.kt b/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/CreateDeployment.kt index 2fa374c3705..2199d3a83c7 100644 --- a/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/CreateDeployment.kt +++ b/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/CreateDeployment.kt @@ -1,48 +1,46 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.kotlin.gateway - -// snippet-start:[apigateway.kotlin.create_deployment.import] -import aws.sdk.kotlin.services.apigateway.ApiGatewayClient -import aws.sdk.kotlin.services.apigateway.model.CreateDeploymentRequest -import kotlin.system.exitProcess -// snippet-end:[apigateway.kotlin.create_deployment.import] - -suspend fun main(args:Array) { - - val usage = """ - Usage: - - - Where: - restApiId - The string identifier of the associated RestApi. (for example, xxxx99ewyg). - stageName - The name of the stage. - """ - - if (args.size != 2) { - println(usage) - exitProcess(0) - } - - val restApiId = args[0] - val stageName = args[1] - createNewDeployment(restApiId, stageName) -} - -// snippet-start:[apigateway.kotlin.create_deployment.main] -suspend fun createNewDeployment(restApiIdVal: String?, stageNameVal: String?): String? { - - val request = CreateDeploymentRequest { - restApiId = restApiIdVal - description = "Created using the AWS API Gateway Kotlin API" - stageName = stageNameVal - } - - ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> - val response = apiGateway.createDeployment(request) - println("The id of the deployment is " + response.id) - return response.id - } - } -// snippet-end:[apigateway.kotlin.create_deployment.main] \ No newline at end of file +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.kotlin.gateway + +// snippet-start:[apigateway.kotlin.create_deployment.import] +import aws.sdk.kotlin.services.apigateway.ApiGatewayClient +import aws.sdk.kotlin.services.apigateway.model.CreateDeploymentRequest +import kotlin.system.exitProcess +// snippet-end:[apigateway.kotlin.create_deployment.import] + +suspend fun main(args: Array) { + val usage = """ + Usage: + + + Where: + restApiId - The string identifier of the associated RestApi. (for example, xxxx99ewyg). + stageName - The name of the stage. + """ + + if (args.size != 2) { + println(usage) + exitProcess(0) + } + + val restApiId = args[0] + val stageName = args[1] + createNewDeployment(restApiId, stageName) +} + +// snippet-start:[apigateway.kotlin.create_deployment.main] +suspend fun createNewDeployment(restApiIdVal: String?, stageNameVal: String?): String? { + val request = CreateDeploymentRequest { + restApiId = restApiIdVal + description = "Created using the AWS API Gateway Kotlin API" + stageName = stageNameVal + } + + ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> + val response = apiGateway.createDeployment(request) + println("The id of the deployment is " + response.id) + return response.id + } +} +// snippet-end:[apigateway.kotlin.create_deployment.main] diff --git a/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/CreateRestApi.kt b/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/CreateRestApi.kt index 8f1ce04ea4b..b2b32a9e1f3 100644 --- a/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/CreateRestApi.kt +++ b/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/CreateRestApi.kt @@ -1,46 +1,44 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.kotlin.gateway - -// snippet-start:[apigateway.kotlin.create_api.import] -import aws.sdk.kotlin.services.apigateway.ApiGatewayClient -import aws.sdk.kotlin.services.apigateway.model.CreateRestApiRequest -import kotlin.system.exitProcess -// snippet-end:[apigateway.kotlin.create_api.import] - -suspend fun main(args:Array) { - - val usage = """ - Usage: - - - Where: - restApiId - The string identifier of an existing RestApi. (for example, xxxx99ewyg). - - """ - - if (args.size != 1) { - println(usage) - exitProcess(0) - } - - val restApiId = args[0] - createAPI(restApiId) -} - -// snippet-start:[apigateway.kotlin.create_api.main] -suspend fun createAPI(restApiName: String?): String? { - - val request = CreateRestApiRequest { - description = "Created using the Gateway Kotlin API" - name = restApiName - } - - ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> - val response = apiGateway.createRestApi(request) - println("The id of the new api is ${response.id}") - return response.id - } -} -// snippet-end:[apigateway.kotlin.create_api.main] \ No newline at end of file +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.kotlin.gateway + +// snippet-start:[apigateway.kotlin.create_api.import] +import aws.sdk.kotlin.services.apigateway.ApiGatewayClient +import aws.sdk.kotlin.services.apigateway.model.CreateRestApiRequest +import kotlin.system.exitProcess +// snippet-end:[apigateway.kotlin.create_api.import] + +suspend fun main(args: Array) { + val usage = """ + Usage: + + + Where: + restApiId - The string identifier of an existing RestApi. (for example, xxxx99ewyg). + + """ + + if (args.size != 1) { + println(usage) + exitProcess(0) + } + + val restApiId = args[0] + createAPI(restApiId) +} + +// snippet-start:[apigateway.kotlin.create_api.main] +suspend fun createAPI(restApiName: String?): String? { + val request = CreateRestApiRequest { + description = "Created using the Gateway Kotlin API" + name = restApiName + } + + ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> + val response = apiGateway.createRestApi(request) + println("The id of the new api is ${response.id}") + return response.id + } +} +// snippet-end:[apigateway.kotlin.create_api.main] diff --git a/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/DeleteRestApi.kt b/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/DeleteRestApi.kt index 369f51dfaa0..4a10f14d9ce 100644 --- a/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/DeleteRestApi.kt +++ b/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/DeleteRestApi.kt @@ -1,44 +1,41 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.kotlin.gateway - -// snippet-start:[apigateway.kotlin.delete_api.import] -import aws.sdk.kotlin.services.apigateway.ApiGatewayClient -import aws.sdk.kotlin.services.apigateway.model.DeleteRestApiRequest -import kotlin.system.exitProcess -// snippet-end:[apigateway.kotlin.delete_api.import] - - -suspend fun main(args:Array) { - - val usage = """ - Usage: - - - Where: - restApiId - The string identifier of an existing RestApi. (for example, xxxx99ewyg). - """ - - if (args.size != 1) { - println(usage) - exitProcess(1) - } - - val restApiId = args[0] - deleteAPI(restApiId) -} - -// snippet-start:[apigateway.kotlin.delete_api.main] -suspend fun deleteAPI(restApiIdVal: String?) { - - val request = DeleteRestApiRequest { - restApiId = restApiIdVal - } - - ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> - apiGateway.deleteRestApi(request) - println("The API was successfully deleted") - } -} -// snippet-end:[apigateway.kotlin.delete_api.main] \ No newline at end of file +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.kotlin.gateway + +// snippet-start:[apigateway.kotlin.delete_api.import] +import aws.sdk.kotlin.services.apigateway.ApiGatewayClient +import aws.sdk.kotlin.services.apigateway.model.DeleteRestApiRequest +import kotlin.system.exitProcess +// snippet-end:[apigateway.kotlin.delete_api.import] + +suspend fun main(args: Array) { + val usage = """ + Usage: + + + Where: + restApiId - The string identifier of an existing RestApi. (for example, xxxx99ewyg). + """ + + if (args.size != 1) { + println(usage) + exitProcess(1) + } + + val restApiId = args[0] + deleteAPI(restApiId) +} + +// snippet-start:[apigateway.kotlin.delete_api.main] +suspend fun deleteAPI(restApiIdVal: String?) { + val request = DeleteRestApiRequest { + restApiId = restApiIdVal + } + + ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> + apiGateway.deleteRestApi(request) + println("The API was successfully deleted") + } +} +// snippet-end:[apigateway.kotlin.delete_api.main] diff --git a/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetAPIKeys.kt b/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetAPIKeys.kt index 7ae509f34cf..9636e534790 100644 --- a/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetAPIKeys.kt +++ b/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetAPIKeys.kt @@ -1,25 +1,24 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.kotlin.gateway - -// snippet-start:[apigateway.kotlin.get_apikeys.import] -import aws.sdk.kotlin.services.apigateway.ApiGatewayClient -import aws.sdk.kotlin.services.apigateway.model.GetApiKeysRequest -// snippet-end:[apigateway.kotlin.get_apikeys.import] - -suspend fun main() { - getKeys() - } - -// snippet-start:[apigateway.kotlin.get_apikeys.main] -suspend fun getKeys() { - - ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> - val response = apiGateway.getApiKeys(GetApiKeysRequest { }) - response.items?.forEach { key -> - println("Key is $key") - } - } -} -// snippet-end:[apigateway.kotlin.get_apikeys.main] \ No newline at end of file +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.kotlin.gateway + +// snippet-start:[apigateway.kotlin.get_apikeys.import] +import aws.sdk.kotlin.services.apigateway.ApiGatewayClient +import aws.sdk.kotlin.services.apigateway.model.GetApiKeysRequest +// snippet-end:[apigateway.kotlin.get_apikeys.import] + +suspend fun main() { + getKeys() +} + +// snippet-start:[apigateway.kotlin.get_apikeys.main] +suspend fun getKeys() { + ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> + val response = apiGateway.getApiKeys(GetApiKeysRequest { }) + response.items?.forEach { key -> + println("Key is $key") + } + } +} +// snippet-end:[apigateway.kotlin.get_apikeys.main] diff --git a/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetDeployments.kt b/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetDeployments.kt index 25f6342a46e..50bcd51294c 100644 --- a/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetDeployments.kt +++ b/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetDeployments.kt @@ -1,46 +1,44 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.kotlin.gateway - -// snippet-start:[apigateway.kotlin.get_deployments.import] -import aws.sdk.kotlin.services.apigateway.ApiGatewayClient -import aws.sdk.kotlin.services.apigateway.model.GetDeploymentsRequest -import kotlin.system.exitProcess -// snippet-end:[apigateway.kotlin.get_deployments.import] - -suspend fun main(args:Array) { - - val usage = """ - Usage: - - - Where: - restApiId - The string identifier of an existing RestApi. (for example, xxxx99ewyg). - """ - - if (args.size != 1) { - println(usage) - exitProcess(1) - } - - val restApiId = args[0] - getAllDeployments(restApiId) -} - -// snippet-start:[apigateway.kotlin.get_deployments.main] -suspend fun getAllDeployments(restApiIdVal: String?) { - - val request = GetDeploymentsRequest { - restApiId = restApiIdVal - } - - ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> - val response = apiGateway.getDeployments(request) - response.items?.forEach { deployment -> - println("The deployment id is ${deployment.id}") - println("The deployment description is ${deployment.description}") - } - } -} -// snippet-end:[apigateway.kotlin.get_deployments.main] \ No newline at end of file +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.kotlin.gateway + +// snippet-start:[apigateway.kotlin.get_deployments.import] +import aws.sdk.kotlin.services.apigateway.ApiGatewayClient +import aws.sdk.kotlin.services.apigateway.model.GetDeploymentsRequest +import kotlin.system.exitProcess +// snippet-end:[apigateway.kotlin.get_deployments.import] + +suspend fun main(args: Array) { + val usage = """ + Usage: + + + Where: + restApiId - The string identifier of an existing RestApi. (for example, xxxx99ewyg). + """ + + if (args.size != 1) { + println(usage) + exitProcess(1) + } + + val restApiId = args[0] + getAllDeployments(restApiId) +} + +// snippet-start:[apigateway.kotlin.get_deployments.main] +suspend fun getAllDeployments(restApiIdVal: String?) { + val request = GetDeploymentsRequest { + restApiId = restApiIdVal + } + + ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> + val response = apiGateway.getDeployments(request) + response.items?.forEach { deployment -> + println("The deployment id is ${deployment.id}") + println("The deployment description is ${deployment.description}") + } + } +} +// snippet-end:[apigateway.kotlin.get_deployments.main] diff --git a/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetMethod.kt b/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetMethod.kt index ffe7127d412..c4228ec9676 100644 --- a/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetMethod.kt +++ b/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetMethod.kt @@ -1,56 +1,54 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.kotlin.gateway - -// snippet-start:[apigateway.kotlin.get_method.import] -import aws.sdk.kotlin.services.apigateway.ApiGatewayClient -import aws.sdk.kotlin.services.apigateway.model.GetMethodRequest -import kotlin.system.exitProcess -// snippet-end:[apigateway.kotlin.get_method.import] - - -suspend fun main(args:Array) { - - val usage = """ - Usage: - - - Where: - restApiId - The string identifier of an existing RestApi. (for example, xxxx99ewyg). - resourceId - The string identifier of an resource. (for example, xxxx99ewyg). - httpMethod - The HTTP method. (for example, GET). - """ - - if (args.size != 3) { - println(usage) - exitProcess(0) - } - - val restApiId = args[0] - val resourceId = args[1] - val httpMethod = args[2] - getSpecificMethod(restApiId, resourceId, httpMethod) -} - -// snippet-start:[apigateway.kotlin.get_method.main] -suspend fun getSpecificMethod(restApiIdVal: String?, resourceIdVal: String?, httpMethodVal: String? ) { - - val methodRequest = GetMethodRequest { - httpMethod = httpMethodVal - restApiId = restApiIdVal - resourceId = resourceIdVal - } - - ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> - val response = apiGateway.getMethod(methodRequest) - - // Retrieve a method response associated with a given HTTP status code. - val details = response.methodResponses - if (details != null) { - for ((key, value) in details) - println("Key is $key and Value is $value") - } - } -} -// snippet-end:[apigateway.kotlin.get_method.main] \ No newline at end of file +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.kotlin.gateway + +// snippet-start:[apigateway.kotlin.get_method.import] +import aws.sdk.kotlin.services.apigateway.ApiGatewayClient +import aws.sdk.kotlin.services.apigateway.model.GetMethodRequest +import kotlin.system.exitProcess +// snippet-end:[apigateway.kotlin.get_method.import] + +suspend fun main(args: Array) { + val usage = """ + Usage: + + + Where: + restApiId - The string identifier of an existing RestApi. (for example, xxxx99ewyg). + resourceId - The string identifier of an resource. (for example, xxxx99ewyg). + httpMethod - The HTTP method. (for example, GET). + """ + + if (args.size != 3) { + println(usage) + exitProcess(0) + } + + val restApiId = args[0] + val resourceId = args[1] + val httpMethod = args[2] + getSpecificMethod(restApiId, resourceId, httpMethod) +} + +// snippet-start:[apigateway.kotlin.get_method.main] +suspend fun getSpecificMethod(restApiIdVal: String?, resourceIdVal: String?, httpMethodVal: String?) { + val methodRequest = GetMethodRequest { + httpMethod = httpMethodVal + restApiId = restApiIdVal + resourceId = resourceIdVal + } + + ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> + val response = apiGateway.getMethod(methodRequest) + + // Retrieve a method response associated with a given HTTP status code. + val details = response.methodResponses + if (details != null) { + for ((key, value) in details) { + println("Key is $key and Value is $value") + } + } + } +} +// snippet-end:[apigateway.kotlin.get_method.main] diff --git a/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetStages.kt b/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetStages.kt index 1692d138b7d..7fe5e30586b 100644 --- a/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetStages.kt +++ b/kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetStages.kt @@ -1,45 +1,43 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.kotlin.gateway - -// snippet-start:[apigateway.kotlin.get_stages.import] -import aws.sdk.kotlin.services.apigateway.ApiGatewayClient -import aws.sdk.kotlin.services.apigateway.model.GetStagesRequest -import kotlin.system.exitProcess -// snippet-end:[apigateway.kotlin.get_stages.import] - -suspend fun main(args:Array) { - - val usage = """ - Usage: - - - Where: - restApiId - The string identifier of an existing RestApi. (for example, xxxx99ewyg). - """ - - if (args.size != 1) { - println(usage) - exitProcess(0) - } - - val restApiId = args[0] - getAllStages(restApiId) -} - -// snippet-start:[apigateway.kotlin.get_stages.main] -suspend fun getAllStages(restApiIdVal: String?) { - - val stagesRequest = GetStagesRequest { - restApiId = restApiIdVal - } - - ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> - val response = apiGateway.getStages(stagesRequest) - response.item?.forEach { stage -> - println("Stage name is ${stage.stageName}") - } - } -} -// snippet-end:[apigateway.kotlin.get_stages.main] \ No newline at end of file +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.kotlin.gateway + +// snippet-start:[apigateway.kotlin.get_stages.import] +import aws.sdk.kotlin.services.apigateway.ApiGatewayClient +import aws.sdk.kotlin.services.apigateway.model.GetStagesRequest +import kotlin.system.exitProcess +// snippet-end:[apigateway.kotlin.get_stages.import] + +suspend fun main(args: Array) { + val usage = """ + Usage: + + + Where: + restApiId - The string identifier of an existing RestApi. (for example, xxxx99ewyg). + """ + + if (args.size != 1) { + println(usage) + exitProcess(0) + } + + val restApiId = args[0] + getAllStages(restApiId) +} + +// snippet-start:[apigateway.kotlin.get_stages.main] +suspend fun getAllStages(restApiIdVal: String?) { + val stagesRequest = GetStagesRequest { + restApiId = restApiIdVal + } + + ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> + val response = apiGateway.getStages(stagesRequest) + response.item?.forEach { stage -> + println("Stage name is ${stage.stageName}") + } + } +} +// snippet-end:[apigateway.kotlin.get_stages.main] diff --git a/kotlin/services/apigateway/src/test/kotlin/APIGatewayTest.kt b/kotlin/services/apigateway/src/test/kotlin/APIGatewayTest.kt index a2b260bac7f..8c7c702d7eb 100644 --- a/kotlin/services/apigateway/src/test/kotlin/APIGatewayTest.kt +++ b/kotlin/services/apigateway/src/test/kotlin/APIGatewayTest.kt @@ -58,7 +58,7 @@ class APIGatewayTest { httpMethod = prop.getProperty("httpMethod") restApiName = prop.getProperty("restApiName") stageName = prop.getProperty("stageName") - */ + */ } @Test @@ -94,7 +94,10 @@ class APIGatewayTest { val valueRequest = GetSecretValueRequest { secretId = secretName } - SecretsManagerClient { region = "us-east-1"; credentialsProvider = EnvironmentCredentialsProvider() }.use { secretClient -> + SecretsManagerClient { + region = "us-east-1" + credentialsProvider = EnvironmentCredentialsProvider() + }.use { secretClient -> val valueResponse = secretClient.getSecretValue(valueRequest) return valueResponse.secretString.toString() } diff --git a/kotlin/services/appsync/build.gradle.kts b/kotlin/services/appsync/build.gradle.kts index 00ea35f4256..df71aa24005 100644 --- a/kotlin/services/appsync/build.gradle.kts +++ b/kotlin/services/appsync/build.gradle.kts @@ -38,7 +38,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/appsync/src/main/kotlin/com/example/appsync/CreateDataSource.kt b/kotlin/services/appsync/src/main/kotlin/com/example/appsync/CreateDataSource.kt index 71349588c09..60540eeae36 100644 --- a/kotlin/services/appsync/src/main/kotlin/com/example/appsync/CreateDataSource.kt +++ b/kotlin/services/appsync/src/main/kotlin/com/example/appsync/CreateDataSource.kt @@ -49,7 +49,7 @@ suspend fun createDS( dsName: String, dsRole: String, apiVal: String, - tableNameVal: String + tableNameVal: String, ): String? { val config = DynamodbDataSourceConfig { diff --git a/kotlin/services/appsync/src/main/kotlin/com/example/appsync/DeleteApiKey.kt b/kotlin/services/appsync/src/main/kotlin/com/example/appsync/DeleteApiKey.kt index 279c7370fab..c2197944895 100644 --- a/kotlin/services/appsync/src/main/kotlin/com/example/appsync/DeleteApiKey.kt +++ b/kotlin/services/appsync/src/main/kotlin/com/example/appsync/DeleteApiKey.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[appsync.kotlin.del_key.main] suspend fun deleteKey( keyIdVal: String?, - apiIdVal: String? + apiIdVal: String?, ) { val apiKeyRequest = DeleteApiKeyRequest { diff --git a/kotlin/services/appsync/src/main/kotlin/com/example/appsync/DeleteDataSource.kt b/kotlin/services/appsync/src/main/kotlin/com/example/appsync/DeleteDataSource.kt index 9a210dc3ec5..bca1adc5c29 100644 --- a/kotlin/services/appsync/src/main/kotlin/com/example/appsync/DeleteDataSource.kt +++ b/kotlin/services/appsync/src/main/kotlin/com/example/appsync/DeleteDataSource.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[appsync.kotlin.del_ds.main] suspend fun deleteDS( apiIdVal: String?, - dsName: String? + dsName: String?, ) { val request = DeleteDataSourceRequest { diff --git a/kotlin/services/athena/build.gradle.kts b/kotlin/services/athena/build.gradle.kts index 9f22d57d0bb..e1fbffb801a 100644 --- a/kotlin/services/athena/build.gradle.kts +++ b/kotlin/services/athena/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/CreateNamedQueryExample.kt b/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/CreateNamedQueryExample.kt index f161fdf6880..15afc05f86a 100644 --- a/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/CreateNamedQueryExample.kt +++ b/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/CreateNamedQueryExample.kt @@ -1,49 +1,49 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.kotlin.athena - -// snippet-start:[athena.kotlin.CreateNamedQueryExample.import] -import aws.sdk.kotlin.services.athena.AthenaClient -import aws.sdk.kotlin.services.athena.model.CreateNamedQueryRequest -import kotlin.system.exitProcess -// snippet-end:[athena.kotlin.CreateNamedQueryExample.import] - -suspend fun main(args: Array) { - val usage = """ - Usage: - - - Where: - queryString - The query string to use (for example, "SELECT * FROM mydatabase"; ). - namedQuery - The name of the query to create. - database - The name of the database to use (for example, mydatabase). - """ - - if (args.size != 3) { - println(usage) - exitProcess(0) - } - - val queryString = args[0] - val namedQuery = args[1] - val database = args[2] - val id = createNamedQuery(queryString, namedQuery, database) - println("The query ID is $id") -} - -// snippet-start:[athena.kotlin.CreateNamedQueryExample.main] -suspend fun createNamedQuery(queryStringVal: String, namedQuery: String, databaseVal: String): String? { - AthenaClient { region = "us-west-2" }.use { athenaClient -> - val resp = athenaClient.createNamedQuery( - CreateNamedQueryRequest { - database = databaseVal - queryString = queryStringVal - description = "Created via the AWS SDK for Kotlin" - this.name = namedQuery - } - ) - return resp.namedQueryId - } -} -// snippet-end:[athena.kotlin.CreateNamedQueryExample.main] +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.kotlin.athena + +// snippet-start:[athena.kotlin.CreateNamedQueryExample.import] +import aws.sdk.kotlin.services.athena.AthenaClient +import aws.sdk.kotlin.services.athena.model.CreateNamedQueryRequest +import kotlin.system.exitProcess +// snippet-end:[athena.kotlin.CreateNamedQueryExample.import] + +suspend fun main(args: Array) { + val usage = """ + Usage: + + + Where: + queryString - The query string to use (for example, "SELECT * FROM mydatabase"; ). + namedQuery - The name of the query to create. + database - The name of the database to use (for example, mydatabase). + """ + + if (args.size != 3) { + println(usage) + exitProcess(0) + } + + val queryString = args[0] + val namedQuery = args[1] + val database = args[2] + val id = createNamedQuery(queryString, namedQuery, database) + println("The query ID is $id") +} + +// snippet-start:[athena.kotlin.CreateNamedQueryExample.main] +suspend fun createNamedQuery(queryStringVal: String, namedQuery: String, databaseVal: String): String? { + AthenaClient { region = "us-west-2" }.use { athenaClient -> + val resp = athenaClient.createNamedQuery( + CreateNamedQueryRequest { + database = databaseVal + queryString = queryStringVal + description = "Created via the AWS SDK for Kotlin" + this.name = namedQuery + }, + ) + return resp.namedQueryId + } +} +// snippet-end:[athena.kotlin.CreateNamedQueryExample.main] diff --git a/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/DeleteNamedQueryExample.kt b/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/DeleteNamedQueryExample.kt index db9ca093e96..21d22e949b0 100644 --- a/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/DeleteNamedQueryExample.kt +++ b/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/DeleteNamedQueryExample.kt @@ -1,40 +1,40 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.kotlin.athena - -// snippet-start:[athena.kotlin.DeleteNamedQueryExample.import] -import aws.sdk.kotlin.services.athena.AthenaClient -import aws.sdk.kotlin.services.athena.model.DeleteNamedQueryRequest -import kotlin.system.exitProcess -// snippet-end:[athena.kotlin.DeleteNamedQueryExample.import] - -suspend fun main(args: Array) { - val usage = """ - Usage: - - - Where: - queryId - The id of the Amazon Athena query (for example, b34e7780-903b-4842-9d2c-6c99bebc82aa). - """ - - if (args.size != 1) { - println(usage) - exitProcess(0) - } - val queryId = args[0] - deleteQueryName(queryId) -} - -// snippet-start:[athena.kotlin.DeleteNamedQueryExample.main] -suspend fun deleteQueryName(sampleNamedQueryId: String?) { - val request = DeleteNamedQueryRequest { - namedQueryId = sampleNamedQueryId - } - - AthenaClient { region = "us-west-2" }.use { athenaClient -> - athenaClient.deleteNamedQuery(request) - println("$sampleNamedQueryId was deleted!") - } -} -// snippet-end:[athena.kotlin.DeleteNamedQueryExample.main] +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.kotlin.athena + +// snippet-start:[athena.kotlin.DeleteNamedQueryExample.import] +import aws.sdk.kotlin.services.athena.AthenaClient +import aws.sdk.kotlin.services.athena.model.DeleteNamedQueryRequest +import kotlin.system.exitProcess +// snippet-end:[athena.kotlin.DeleteNamedQueryExample.import] + +suspend fun main(args: Array) { + val usage = """ + Usage: + + + Where: + queryId - The id of the Amazon Athena query (for example, b34e7780-903b-4842-9d2c-6c99bebc82aa). + """ + + if (args.size != 1) { + println(usage) + exitProcess(0) + } + val queryId = args[0] + deleteQueryName(queryId) +} + +// snippet-start:[athena.kotlin.DeleteNamedQueryExample.main] +suspend fun deleteQueryName(sampleNamedQueryId: String?) { + val request = DeleteNamedQueryRequest { + namedQueryId = sampleNamedQueryId + } + + AthenaClient { region = "us-west-2" }.use { athenaClient -> + athenaClient.deleteNamedQuery(request) + println("$sampleNamedQueryId was deleted!") + } +} +// snippet-end:[athena.kotlin.DeleteNamedQueryExample.main] diff --git a/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/ListNamedQueryExample.kt b/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/ListNamedQueryExample.kt index 3b3ec700fb9..cb45abdf376 100644 --- a/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/ListNamedQueryExample.kt +++ b/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/ListNamedQueryExample.kt @@ -1,28 +1,28 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.kotlin.athena - -// snippet-start:[athena.kotlin.ListNamedQueryExample.import] -import aws.sdk.kotlin.services.athena.AthenaClient -import aws.sdk.kotlin.services.athena.model.ListNamedQueriesRequest -// snippet-end:[athena.kotlin.ListNamedQueryExample.import] - -suspend fun main() { - listNamedQueries() -} - -// snippet-start:[athena.kotlin.ListNamedQueryExample.main] -suspend fun listNamedQueries() { - val request = ListNamedQueriesRequest { - this.maxResults = 10 - } - - AthenaClient { region = "us-west-2" }.use { athenaClient -> - val responses = athenaClient.listNamedQueries(request) - responses.namedQueryIds?.forEach { queries -> - println("Retrieved account alias $queries") - } - } -} -// snippet-end:[athena.kotlin.ListNamedQueryExample.main] +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.kotlin.athena + +// snippet-start:[athena.kotlin.ListNamedQueryExample.import] +import aws.sdk.kotlin.services.athena.AthenaClient +import aws.sdk.kotlin.services.athena.model.ListNamedQueriesRequest +// snippet-end:[athena.kotlin.ListNamedQueryExample.import] + +suspend fun main() { + listNamedQueries() +} + +// snippet-start:[athena.kotlin.ListNamedQueryExample.main] +suspend fun listNamedQueries() { + val request = ListNamedQueriesRequest { + this.maxResults = 10 + } + + AthenaClient { region = "us-west-2" }.use { athenaClient -> + val responses = athenaClient.listNamedQueries(request) + responses.namedQueryIds?.forEach { queries -> + println("Retrieved account alias $queries") + } + } +} +// snippet-end:[athena.kotlin.ListNamedQueryExample.main] diff --git a/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/ListQueryExecutionsExample.kt b/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/ListQueryExecutionsExample.kt index 8e0dd111f0b..73d7e3d4051 100644 --- a/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/ListQueryExecutionsExample.kt +++ b/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/ListQueryExecutionsExample.kt @@ -1,28 +1,28 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.kotlin.athena - -// snippet-start:[athena.kotlin.ListNamedQueryExecutionsExample.import] -import aws.sdk.kotlin.services.athena.AthenaClient -import aws.sdk.kotlin.services.athena.model.ListQueryExecutionsRequest -// snippet-end:[athena.kotlin.ListNamedQueryExecutionsExample.import] - -suspend fun main() { - listQueryIds() -} - -// snippet-start:[athena.kotlin.ListNamedQueryExecutionsExample.main] -suspend fun listQueryIds() { - val request = ListQueryExecutionsRequest { - maxResults = 10 - } - - AthenaClient { region = "us-west-2" }.use { athenaClient -> - val response = athenaClient.listQueryExecutions(request) - response.queryExecutionIds?.forEach { queries -> - println("The value is $queries") - } - } -} -// snippet-end:[athena.kotlin.ListNamedQueryExecutionsExample.main] +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.kotlin.athena + +// snippet-start:[athena.kotlin.ListNamedQueryExecutionsExample.import] +import aws.sdk.kotlin.services.athena.AthenaClient +import aws.sdk.kotlin.services.athena.model.ListQueryExecutionsRequest +// snippet-end:[athena.kotlin.ListNamedQueryExecutionsExample.import] + +suspend fun main() { + listQueryIds() +} + +// snippet-start:[athena.kotlin.ListNamedQueryExecutionsExample.main] +suspend fun listQueryIds() { + val request = ListQueryExecutionsRequest { + maxResults = 10 + } + + AthenaClient { region = "us-west-2" }.use { athenaClient -> + val response = athenaClient.listQueryExecutions(request) + response.queryExecutionIds?.forEach { queries -> + println("The value is $queries") + } + } +} +// snippet-end:[athena.kotlin.ListNamedQueryExecutionsExample.main] diff --git a/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/StartQueryExample.kt b/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/StartQueryExample.kt index 9af293064ea..8d02deec260 100644 --- a/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/StartQueryExample.kt +++ b/kotlin/services/athena/src/main/kotlin/com/kotlin/athena/StartQueryExample.kt @@ -1,120 +1,120 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.kotlin.athena - -// snippet-start:[athena.kotlin.StartQueryExample.import] -import aws.sdk.kotlin.services.athena.AthenaClient -import aws.sdk.kotlin.services.athena.model.GetQueryExecutionRequest -import aws.sdk.kotlin.services.athena.model.GetQueryResultsRequest -import aws.sdk.kotlin.services.athena.model.QueryExecutionContext -import aws.sdk.kotlin.services.athena.model.QueryExecutionState -import aws.sdk.kotlin.services.athena.model.ResultConfiguration -import aws.sdk.kotlin.services.athena.model.Row -import aws.sdk.kotlin.services.athena.model.StartQueryExecutionRequest -import kotlinx.coroutines.delay -import kotlin.system.exitProcess -// snippet-end:[athena.kotlin.StartQueryExample.import] - -suspend fun main(args: Array) { - val usage = """ - Usage: - - - Where: - queryString - The query string to use (for example, "SELECT * FROM mydatabase"; ). - database - The name of the database to use (for example, mydatabase ). - outputLocation - The output location (for example, the name of an Amazon S3 bucket - s3://mybucket). - - """ - - if (args.size != 3) { - println(usage) - exitProcess(0) - } - - val queryString = args[0] - val database = args[1] - val outputLocation = args[2] - val queryExecutionId = submitAthenaQuery(queryString, database, outputLocation) - waitForQueryToComplete(queryExecutionId) - processResultRows(queryExecutionId) -} - -// snippet-start:[athena.kotlin.StartQueryExample.main] -suspend fun submitAthenaQuery(queryStringVal: String, databaseVal: String, outputLocationVal: String): String? { - // The QueryExecutionContext allows us to set the database. - val queryExecutionContextOb = QueryExecutionContext { - database = databaseVal - } - - // The result configuration specifies where the results of the query should go. - val resultConfigurationOb = ResultConfiguration { - outputLocation = outputLocationVal - } - - val request = StartQueryExecutionRequest { - queryString = queryStringVal - queryExecutionContext = queryExecutionContextOb - resultConfiguration = resultConfigurationOb - } - - AthenaClient { region = "us-west-2" }.use { athenaClient -> - val response = athenaClient.startQueryExecution(request) - return response.queryExecutionId - } -} - -// Wait for an Amazon Athena query to complete, fail or to be cancelled. -suspend fun waitForQueryToComplete(queryExecutionIdVal: String?) { - var isQueryStillRunning = true - while (isQueryStillRunning) { - val request = GetQueryExecutionRequest { - queryExecutionId = queryExecutionIdVal - } - - AthenaClient { region = "us-west-2" }.use { athenaClient -> - val response = athenaClient.getQueryExecution(request) - val queryState = response.queryExecution?.status?.state.toString() - if (queryState == QueryExecutionState.Succeeded.toString()) { - isQueryStillRunning = false - } else { - // Sleep an amount of time before retrying again. - delay(1000) - } - println("The current status is: $queryState") - } - } -} - -// This code retrieves the results of a query. -suspend fun processResultRows(queryExecutionIdVal: String?) { - val request = GetQueryResultsRequest { - queryExecutionId = queryExecutionIdVal - } - AthenaClient { region = "us-west-2" }.use { athenaClient -> - val getQueryResultsResults = athenaClient.getQueryResults(request) - val results = getQueryResultsResults.resultSet - for (result in listOf(results)) { - val columnInfoList = result?.resultSetMetadata?.columnInfo - val response = result?.rows - if (response != null) { - if (columnInfoList != null) { - processRow(response) - } - } - } - } -} - -private fun processRow(row: List) { - for (myRow in row) { - val allData = myRow.data - if (allData != null) { - for (data in allData) { - println("The value of the column is " + data.varCharValue) - } - } - } -} -// snippet-end:[athena.kotlin.StartQueryExample.main] +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.kotlin.athena + +// snippet-start:[athena.kotlin.StartQueryExample.import] +import aws.sdk.kotlin.services.athena.AthenaClient +import aws.sdk.kotlin.services.athena.model.GetQueryExecutionRequest +import aws.sdk.kotlin.services.athena.model.GetQueryResultsRequest +import aws.sdk.kotlin.services.athena.model.QueryExecutionContext +import aws.sdk.kotlin.services.athena.model.QueryExecutionState +import aws.sdk.kotlin.services.athena.model.ResultConfiguration +import aws.sdk.kotlin.services.athena.model.Row +import aws.sdk.kotlin.services.athena.model.StartQueryExecutionRequest +import kotlinx.coroutines.delay +import kotlin.system.exitProcess +// snippet-end:[athena.kotlin.StartQueryExample.import] + +suspend fun main(args: Array) { + val usage = """ + Usage: + + + Where: + queryString - The query string to use (for example, "SELECT * FROM mydatabase"; ). + database - The name of the database to use (for example, mydatabase ). + outputLocation - The output location (for example, the name of an Amazon S3 bucket - s3://mybucket). + + """ + + if (args.size != 3) { + println(usage) + exitProcess(0) + } + + val queryString = args[0] + val database = args[1] + val outputLocation = args[2] + val queryExecutionId = submitAthenaQuery(queryString, database, outputLocation) + waitForQueryToComplete(queryExecutionId) + processResultRows(queryExecutionId) +} + +// snippet-start:[athena.kotlin.StartQueryExample.main] +suspend fun submitAthenaQuery(queryStringVal: String, databaseVal: String, outputLocationVal: String): String? { + // The QueryExecutionContext allows us to set the database. + val queryExecutionContextOb = QueryExecutionContext { + database = databaseVal + } + + // The result configuration specifies where the results of the query should go. + val resultConfigurationOb = ResultConfiguration { + outputLocation = outputLocationVal + } + + val request = StartQueryExecutionRequest { + queryString = queryStringVal + queryExecutionContext = queryExecutionContextOb + resultConfiguration = resultConfigurationOb + } + + AthenaClient { region = "us-west-2" }.use { athenaClient -> + val response = athenaClient.startQueryExecution(request) + return response.queryExecutionId + } +} + +// Wait for an Amazon Athena query to complete, fail or to be cancelled. +suspend fun waitForQueryToComplete(queryExecutionIdVal: String?) { + var isQueryStillRunning = true + while (isQueryStillRunning) { + val request = GetQueryExecutionRequest { + queryExecutionId = queryExecutionIdVal + } + + AthenaClient { region = "us-west-2" }.use { athenaClient -> + val response = athenaClient.getQueryExecution(request) + val queryState = response.queryExecution?.status?.state.toString() + if (queryState == QueryExecutionState.Succeeded.toString()) { + isQueryStillRunning = false + } else { + // Sleep an amount of time before retrying again. + delay(1000) + } + println("The current status is: $queryState") + } + } +} + +// This code retrieves the results of a query. +suspend fun processResultRows(queryExecutionIdVal: String?) { + val request = GetQueryResultsRequest { + queryExecutionId = queryExecutionIdVal + } + AthenaClient { region = "us-west-2" }.use { athenaClient -> + val getQueryResultsResults = athenaClient.getQueryResults(request) + val results = getQueryResultsResults.resultSet + for (result in listOf(results)) { + val columnInfoList = result?.resultSetMetadata?.columnInfo + val response = result?.rows + if (response != null) { + if (columnInfoList != null) { + processRow(response) + } + } + } + } +} + +private fun processRow(row: List) { + for (myRow in row) { + val allData = myRow.data + if (allData != null) { + for (data in allData) { + println("The value of the column is " + data.varCharValue) + } + } + } +} +// snippet-end:[athena.kotlin.StartQueryExample.main] diff --git a/kotlin/services/athena/src/test/kotlin/AthenaTest.kt b/kotlin/services/athena/src/test/kotlin/AthenaTest.kt index 242428b0dc6..3ed67ee37e7 100644 --- a/kotlin/services/athena/src/test/kotlin/AthenaTest.kt +++ b/kotlin/services/athena/src/test/kotlin/AthenaTest.kt @@ -53,7 +53,7 @@ class AthenaTest { queryString = prop.getProperty("queryString") database = prop.getProperty("database") outputLocation = prop.getProperty("outputLocation") - */ + */ } @Test @@ -99,7 +99,10 @@ class AthenaTest { val valueRequest = GetSecretValueRequest { secretId = secretName } - SecretsManagerClient { region = "us-east-1"; credentialsProvider = EnvironmentCredentialsProvider() }.use { secretClient -> + SecretsManagerClient { + region = "us-east-1" + credentialsProvider = EnvironmentCredentialsProvider() + }.use { secretClient -> val valueResponse = secretClient.getSecretValue(valueRequest) return valueResponse.secretString.toString() } diff --git a/kotlin/services/autoscale/build.gradle.kts b/kotlin/services/autoscale/build.gradle.kts index 05fb3940039..7a60f9db76e 100644 --- a/kotlin/services/autoscale/build.gradle.kts +++ b/kotlin/services/autoscale/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/autoscale/src/main/kotlin/com/example/autoscaling/AutoScalingScenario.kt b/kotlin/services/autoscale/src/main/kotlin/com/example/autoscaling/AutoScalingScenario.kt index 02b1b870474..fa2480ecb4f 100644 --- a/kotlin/services/autoscale/src/main/kotlin/com/example/autoscaling/AutoScalingScenario.kt +++ b/kotlin/services/autoscale/src/main/kotlin/com/example/autoscaling/AutoScalingScenario.kt @@ -206,7 +206,7 @@ suspend fun setDesiredCapacity(groupName: String) { suspend fun updateAutoScalingGroup( groupName: String, launchTemplateNameVal: String, - serviceLinkedRoleARNVal: String + serviceLinkedRoleARNVal: String, ) { val templateSpecification = LaunchTemplateSpecification { @@ -239,7 +239,7 @@ suspend fun createAutoScalingGroup( groupName: String, launchTemplateNameVal: String, serviceLinkedRoleARNVal: String, - vpcZoneIdVal: String + vpcZoneIdVal: String, ) { val templateSpecification = LaunchTemplateSpecification { diff --git a/kotlin/services/bedrock/build.gradle.kts b/kotlin/services/bedrock/build.gradle.kts index a5bb49ad270..c94806e063f 100644 --- a/kotlin/services/bedrock/build.gradle.kts +++ b/kotlin/services/bedrock/build.gradle.kts @@ -26,7 +26,7 @@ dependencies { implementation("aws.sdk.kotlin:sts:0.33.1-beta") testImplementation("org.junit.jupiter:junit-jupiter:5.10.0") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/cloudformation/build.gradle.kts b/kotlin/services/cloudformation/build.gradle.kts index 8ecb557e1a7..1dc9c01ce78 100644 --- a/kotlin/services/cloudformation/build.gradle.kts +++ b/kotlin/services/cloudformation/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/cloudtrail/build.gradle.kts b/kotlin/services/cloudtrail/build.gradle.kts index e225137e976..a4dc36dc59e 100644 --- a/kotlin/services/cloudtrail/build.gradle.kts +++ b/kotlin/services/cloudtrail/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/cloudtrail/src/main/kotlin/com/kotlin/cloudtrail/CreateTrail.kt b/kotlin/services/cloudtrail/src/main/kotlin/com/kotlin/cloudtrail/CreateTrail.kt index 00a2f778c17..c7f667024e0 100644 --- a/kotlin/services/cloudtrail/src/main/kotlin/com/kotlin/cloudtrail/CreateTrail.kt +++ b/kotlin/services/cloudtrail/src/main/kotlin/com/kotlin/cloudtrail/CreateTrail.kt @@ -32,7 +32,7 @@ suspend fun main(args: Array) { // snippet-start:[cloudtrail.kotlin.create_trail.main] suspend fun createNewTrail( trailName: String, - s3BucketNameVal: String + s3BucketNameVal: String, ) { val request = CreateTrailRequest { diff --git a/kotlin/services/cloudtrail/src/main/kotlin/com/kotlin/cloudtrail/PutEventSelectors.kt b/kotlin/services/cloudtrail/src/main/kotlin/com/kotlin/cloudtrail/PutEventSelectors.kt index 64ecb4420e1..7d3396d6da5 100644 --- a/kotlin/services/cloudtrail/src/main/kotlin/com/kotlin/cloudtrail/PutEventSelectors.kt +++ b/kotlin/services/cloudtrail/src/main/kotlin/com/kotlin/cloudtrail/PutEventSelectors.kt @@ -42,7 +42,7 @@ suspend fun setSelector(trailNameVal: String?) { PutEventSelectorsRequest { trailName = trailNameVal eventSelectors = listOf(selector) - } + }, ) } } diff --git a/kotlin/services/cloudwatch/build.gradle.kts b/kotlin/services/cloudwatch/build.gradle.kts index c33ed81b052..8a3484df187 100644 --- a/kotlin/services/cloudwatch/build.gradle.kts +++ b/kotlin/services/cloudwatch/build.gradle.kts @@ -40,7 +40,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt index 50a824eb7ba..e98571a3e5a 100644 --- a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt +++ b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt @@ -413,7 +413,7 @@ suspend fun addAnomalyDetector(fileName: String?) { // snippet-start:[cloudwatch.kotlin.scenario.get.alarm.history.main] suspend fun getAlarmHistory( fileName: String, - date: String + date: String, ) { // Read values from the JSON file. val parser = JsonFactory().createParser(File(fileName)) @@ -551,7 +551,7 @@ suspend fun getCustomMetricData(fileName: String) { val date2 = nowDate.plus(hours, ChronoUnit.HOURS).plus( minutes, - ChronoUnit.MINUTES + ChronoUnit.MINUTES, ) val met = @@ -661,7 +661,7 @@ suspend fun createAlarm(fileName: String): String { // snippet-start:[cloudwatch.kotlin.scenario.add.metric.dashboard.main] suspend fun addMetricToDashboard( fileNameVal: String, - dashboardNameVal: String + dashboardNameVal: String, ) { val dashboardRequest = PutDashboardRequest { @@ -728,7 +728,7 @@ suspend fun listDashboards() { // snippet-start:[cloudwatch.kotlin.scenario.create.dashboard.main] suspend fun createDashboardWithMetrics( dashboardNameVal: String, - fileNameVal: String + fileNameVal: String, ) { val dashboardRequest = PutDashboardRequest { @@ -804,7 +804,7 @@ suspend fun getAndDisplayMetricStatistics( metVal: String, metricOption: String, date: String, - myDimension: Dimension + myDimension: Dimension, ) { val start = Instant.parse(date) val endDate = Instant.now() diff --git a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/CreateAlarm.kt b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/CreateAlarm.kt index 88bb06b9cb0..ce510b15685 100644 --- a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/CreateAlarm.kt +++ b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/CreateAlarm.kt @@ -45,7 +45,7 @@ suspend fun main(args: Array) { // snippet-start:[cloudwatch.kotlin.create_alarm.main] suspend fun putAlarm( alarmNameVal: String, - instanceIdVal: String + instanceIdVal: String, ) { val dimension = Dimension { diff --git a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/CreateSubscriptionFilter.kt b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/CreateSubscriptionFilter.kt index 9619e862fae..145e13e11fb 100644 --- a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/CreateSubscriptionFilter.kt +++ b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/CreateSubscriptionFilter.kt @@ -46,7 +46,7 @@ suspend fun putSubFilters( filter: String, pattern: String, logGroup: String, - functionArn: String + functionArn: String, ) { val request = PutSubscriptionFilterRequest { diff --git a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/DeleteSubscriptionFilter.kt b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/DeleteSubscriptionFilter.kt index 58513286fc1..ccc2ccdbe89 100644 --- a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/DeleteSubscriptionFilter.kt +++ b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/DeleteSubscriptionFilter.kt @@ -41,7 +41,7 @@ suspend fun main(args: Array) { // snippet-start:[cloudwatch.kotlin.delete_subscription_filter.main] suspend fun deleteSubFilter( filter: String?, - logGroup: String? + logGroup: String?, ) { val request = DeleteSubscriptionFilterRequest { diff --git a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/GetLogEvents.kt b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/GetLogEvents.kt index 3a8fd3f9483..b9ae231101b 100644 --- a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/GetLogEvents.kt +++ b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/GetLogEvents.kt @@ -40,7 +40,7 @@ suspend fun main(args: Array) { // snippet-start:[cloudwatch.kotlin.get_logs.main] suspend fun getCWLogEvents( logGroupNameVal: String, - logStreamNameVal: String + logStreamNameVal: String, ) { val request = GetLogEventsRequest { diff --git a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/PutLogEvents.kt b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/PutLogEvents.kt index 8422fc34f62..41dbf433942 100644 --- a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/PutLogEvents.kt +++ b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/PutLogEvents.kt @@ -43,7 +43,7 @@ suspend fun main(args: Array) { // snippet-start:[cloudwatch.kotlin.put_log_events.main] suspend fun putCWLogEvents( logGroupNameVal: String, - streamNameVal: String + streamNameVal: String, ) { lateinit var describeLogStreamsResponse: DescribeLogStreamsResponse val request = diff --git a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/PutMetricAlarm.kt b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/PutMetricAlarm.kt index efbec888e58..9a6ed8f8e3a 100644 --- a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/PutMetricAlarm.kt +++ b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/PutMetricAlarm.kt @@ -44,7 +44,7 @@ suspend fun main(args: Array) { // snippet-start:[cloudwatch.kotlin.put_metric_alarm.main] suspend fun putMetricAlarm( alarmNameVal: String, - instanceIdVal: String + instanceIdVal: String, ) { val dimensionOb = Dimension { diff --git a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/PutRule.kt b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/PutRule.kt index b69f093d5c0..87c0da5f3b2 100644 --- a/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/PutRule.kt +++ b/kotlin/services/cloudwatch/src/main/kotlin/com/kotlin/cloudwatch/PutRule.kt @@ -41,7 +41,7 @@ suspend fun main(args: Array) { // snippet-start:[cloudwatch.kotlin.put_rule.main] suspend fun putCWRule( ruleNameVal: String, - roleArnVal: String + roleArnVal: String, ) { val request = PutRuleRequest { diff --git a/kotlin/services/codepipeline/build.gradle.kts b/kotlin/services/codepipeline/build.gradle.kts index 16487824a9c..b52524bfc71 100644 --- a/kotlin/services/codepipeline/build.gradle.kts +++ b/kotlin/services/codepipeline/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/codepipeline/src/main/kotlin/com/kotlin/pipeline/CreatePipeline.kt b/kotlin/services/codepipeline/src/main/kotlin/com/kotlin/pipeline/CreatePipeline.kt index 11cd4254b98..f3c7306c4f9 100644 --- a/kotlin/services/codepipeline/src/main/kotlin/com/kotlin/pipeline/CreatePipeline.kt +++ b/kotlin/services/codepipeline/src/main/kotlin/com/kotlin/pipeline/CreatePipeline.kt @@ -48,7 +48,7 @@ suspend fun createNewPipeline( nameVal: String, roleArnVal: String, s3Bucket: String, - s3OuputBucket: String + s3OuputBucket: String, ) { val actionTypeSource = ActionTypeId { diff --git a/kotlin/services/cognito/build.gradle.kts b/kotlin/services/cognito/build.gradle.kts index 9898ee76cb0..b57f2aaf83d 100644 --- a/kotlin/services/cognito/build.gradle.kts +++ b/kotlin/services/cognito/build.gradle.kts @@ -36,7 +36,7 @@ dependencies { implementation("com.google.code.gson:gson:2.10") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/cognito/src/main/kotlin/com/kotlin/cognito/CognitoMVP.kt b/kotlin/services/cognito/src/main/kotlin/com/kotlin/cognito/CognitoMVP.kt index db6ed6ac318..d5cabaf98cb 100644 --- a/kotlin/services/cognito/src/main/kotlin/com/kotlin/cognito/CognitoMVP.kt +++ b/kotlin/services/cognito/src/main/kotlin/com/kotlin/cognito/CognitoMVP.kt @@ -113,7 +113,7 @@ suspend fun checkAuthMethod( clientIdVal: String, userNameVal: String, passwordVal: String, - userPoolIdVal: String + userPoolIdVal: String, ): AdminInitiateAuthResponse { val authParas = mutableMapOf() authParas["USERNAME"] = userNameVal @@ -138,7 +138,7 @@ suspend fun checkAuthMethod( // snippet-start:[cognito.kotlin.confirm.resend.mvp.main] suspend fun resendConfirmationCode( clientIdVal: String?, - userNameVal: String? + userNameVal: String?, ) { val codeRequest = ResendConfirmationCodeRequest { @@ -159,7 +159,7 @@ suspend fun adminRespondToAuthChallenge( userName: String, clientIdVal: String?, mfaCode: String, - sessionVal: String? + sessionVal: String?, ) { println("SOFTWARE_TOKEN_MFA challenge is generated") val challengeResponsesOb = mutableMapOf() @@ -185,7 +185,7 @@ suspend fun adminRespondToAuthChallenge( // Verify the TOTP and register for MFA. suspend fun verifyTOTP( sessionVal: String?, - codeVal: String? + codeVal: String?, ) { val tokenRequest = VerifySoftwareTokenRequest { @@ -221,7 +221,7 @@ suspend fun getSecretForAppMFA(sessionVal: String?): String? { suspend fun confirmSignUp( clientIdVal: String?, codeVal: String?, - userNameVal: String? + userNameVal: String?, ) { val signUpRequest = ConfirmSignUpRequest { @@ -240,7 +240,7 @@ suspend fun confirmSignUp( // snippet-start:[cognito.kotlin.confirm.getuser.mvp.main] suspend fun getAdminUser( userNameVal: String?, - poolIdVal: String? + poolIdVal: String?, ) { val userRequest = AdminGetUserRequest { @@ -260,7 +260,7 @@ suspend fun signUp( clientIdVal: String?, userNameVal: String?, passwordVal: String?, - emailVal: String? + emailVal: String?, ) { val userAttrs = AttributeType { diff --git a/kotlin/services/cognito/src/main/kotlin/com/kotlin/cognito/CreateUser.kt b/kotlin/services/cognito/src/main/kotlin/com/kotlin/cognito/CreateUser.kt index 8f80be242fb..53c0c6eea7c 100644 --- a/kotlin/services/cognito/src/main/kotlin/com/kotlin/cognito/CreateUser.kt +++ b/kotlin/services/cognito/src/main/kotlin/com/kotlin/cognito/CreateUser.kt @@ -46,7 +46,7 @@ suspend fun createNewUser( userPoolId: String, name: String, email: String, - password: String + password: String, ) { val attType = AttributeType { diff --git a/kotlin/services/cognito/src/main/kotlin/com/kotlin/cognito/SignUpUser.kt b/kotlin/services/cognito/src/main/kotlin/com/kotlin/cognito/SignUpUser.kt index e5ee801160d..7c6e88a1dc9 100644 --- a/kotlin/services/cognito/src/main/kotlin/com/kotlin/cognito/SignUpUser.kt +++ b/kotlin/services/cognito/src/main/kotlin/com/kotlin/cognito/SignUpUser.kt @@ -54,7 +54,7 @@ suspend fun signUp( secretKey: String, userName: String, passwordVal: String, - email: String + email: String, ) { val attributeType = AttributeType { @@ -83,13 +83,13 @@ suspend fun signUp( fun calculateSecretHash( userPoolClientId: String, userPoolClientSecret: String, - userName: String + userName: String, ): String { val macSha256Algorithm = "HmacSHA256" val signingKey = SecretKeySpec( userPoolClientSecret.toByteArray(StandardCharsets.UTF_8), - macSha256Algorithm + macSha256Algorithm, ) try { val mac = Mac.getInstance(macSha256Algorithm) diff --git a/kotlin/services/comprehend/build.gradle.kts b/kotlin/services/comprehend/build.gradle.kts index 3ed063260b5..3b798201a6c 100644 --- a/kotlin/services/comprehend/build.gradle.kts +++ b/kotlin/services/comprehend/build.gradle.kts @@ -37,7 +37,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/comprehend/src/main/kotlin/com/kotlin/comprehend/DocumentClassifierDemo.kt b/kotlin/services/comprehend/src/main/kotlin/com/kotlin/comprehend/DocumentClassifierDemo.kt index 6a1b7e13d15..a164c1be25b 100644 --- a/kotlin/services/comprehend/src/main/kotlin/com/kotlin/comprehend/DocumentClassifierDemo.kt +++ b/kotlin/services/comprehend/src/main/kotlin/com/kotlin/comprehend/DocumentClassifierDemo.kt @@ -46,7 +46,7 @@ suspend fun main(args: Array) { suspend fun createDocumentClassifier( dataAccessRoleArnVal: String, s3UriVal: String, - documentClassifierNameVal: String + documentClassifierNameVal: String, ) { val config = DocumentClassifierInputDataConfig { diff --git a/kotlin/services/dynamodb/build.gradle.kts b/kotlin/services/dynamodb/build.gradle.kts index 6aaa407f274..7afc034c5c3 100644 --- a/kotlin/services/dynamodb/build.gradle.kts +++ b/kotlin/services/dynamodb/build.gradle.kts @@ -39,7 +39,7 @@ dependencies { implementation("com.google.code.gson:gson:2.10.1") implementation("com.googlecode.json-simple:json-simple:1.1.1") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/CreateTable.kt b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/CreateTable.kt index 6eb8a857562..586d2984376 100644 --- a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/CreateTable.kt +++ b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/CreateTable.kt @@ -48,7 +48,7 @@ suspend fun main(args: Array) { // snippet-start:[dynamodb.kotlin.create_table.main] suspend fun createNewTable( tableNameVal: String, - key: String + key: String, ): String? { val attDef = AttributeDefinition { diff --git a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/DeleteItem.kt b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/DeleteItem.kt index 9ac7d1f65c6..0a19b110a3f 100644 --- a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/DeleteItem.kt +++ b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/DeleteItem.kt @@ -44,7 +44,7 @@ suspend fun main(args: Array) { suspend fun deleteDynamoDBItem( tableNameVal: String, keyName: String, - keyVal: String + keyVal: String, ) { val keyToGet = mutableMapOf() keyToGet[keyName] = AttributeValue.S(keyVal) diff --git a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/DynamoDBPartiQ.kt b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/DynamoDBPartiQ.kt index 2a3928acf5a..5b0950743a5 100644 --- a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/DynamoDBPartiQ.kt +++ b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/DynamoDBPartiQ.kt @@ -39,7 +39,7 @@ suspend fun main() { executeStatementRequest( ddb, "UPDATE Music SET AwardsWon=1 SET AwardDetail={'Grammys':[2020, 2018]} where Artist=? and SongTitle=?", - parameters + parameters, ) if (response != null) { processResults(response) @@ -49,7 +49,7 @@ suspend fun main() { executeStatementRequest( ddb, "UPDATE Music SET AwardDetail.Grammys =LIST_APPEND(AwardDetail.Grammys,[2016]) where Artist=? and SongTitle=?", - parameters + parameters, ) if (response != null) { processResults(response) @@ -65,7 +65,7 @@ suspend fun main() { executeStatementRequest( ddb, "UPDATE Music SET AwardDetail.Grammys =list_append(AwardDetail.Grammys,[2016]) where Artist=? and SongTitle=?", - parameters + parameters, ) if (response != null) { processResults(response) @@ -91,7 +91,7 @@ suspend fun main() { executeStatementRequest( ddb, "UPDATE Music SET BandMembers =set_add(BandMembers, <<'newmember'>>) where Artist=? and SongTitle=?", - parameters + parameters, ) if (response != null) { processResults(response) @@ -103,7 +103,7 @@ suspend fun main() { suspend fun executeStatementRequest( ddb: DynamoDbClient, statementVal: String, - parametersVal: List + parametersVal: List, ): ExecuteStatementResponse? { val request = ExecuteStatementRequest { diff --git a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/GetItem.kt b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/GetItem.kt index 871a92f1c5d..9d617d2c233 100644 --- a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/GetItem.kt +++ b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/GetItem.kt @@ -44,7 +44,7 @@ suspend fun main(args: Array) { suspend fun getSpecificItem( tableNameVal: String, keyName: String, - keyVal: String + keyVal: String, ) { val keyToGet = mutableMapOf() keyToGet[keyName] = AttributeValue.S(keyVal) diff --git a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/PutItem.kt b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/PutItem.kt index 4ac82becf0e..454d6a2e7e8 100644 --- a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/PutItem.kt +++ b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/PutItem.kt @@ -63,7 +63,7 @@ suspend fun putItemInTable( awards: String, awardVal: String, songTitle: String, - songTitleVal: String + songTitleVal: String, ) { val itemValues = mutableMapOf() diff --git a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/QueryTable.kt b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/QueryTable.kt index a7036a2e3f5..6d9c127fcc1 100644 --- a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/QueryTable.kt +++ b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/QueryTable.kt @@ -49,7 +49,7 @@ suspend fun queryDynTable( tableNameVal: String, partitionKeyName: String, partitionKeyVal: String, - partitionAlias: String + partitionAlias: String, ): Int { val attrNameAlias = mutableMapOf() attrNameAlias[partitionAlias] = partitionKeyName diff --git a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/Scenario.kt b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/Scenario.kt index 04bc4e056e2..f8b3c25f547 100644 --- a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/Scenario.kt +++ b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/Scenario.kt @@ -67,7 +67,7 @@ suspend fun main(args: Array) { // snippet-start:[dynamodb.kotlin.scenario.create_table.main] suspend fun createScenarioTable( tableNameVal: String, - key: String + key: String, ) { val attDef = AttributeDefinition { @@ -123,7 +123,7 @@ suspend fun createScenarioTable( // Load data into the table. suspend fun loadData( tableName: String, - fileName: String + fileName: String, ) { val parser = JsonFactory().createParser(File(fileName)) val rootNode = ObjectMapper().readTree(parser) @@ -149,7 +149,7 @@ suspend fun putMovie( tableNameVal: String, year: Int, title: String, - info: String + info: String, ) { val itemValues = mutableMapOf() val strVal = year.toString() @@ -175,7 +175,7 @@ suspend fun putMovie( suspend fun getMovie( tableNameVal: String, keyName: String, - keyVal: String + keyVal: String, ) { val keyToGet = mutableMapOf() keyToGet[keyName] = AttributeValue.N(keyVal) @@ -213,7 +213,7 @@ suspend fun deletIssuesTable(tableNameVal: String) { suspend fun queryMovieTable( tableNameVal: String, partitionKeyName: String, - partitionAlias: String + partitionAlias: String, ): Int { val attrNameAlias = mutableMapOf() attrNameAlias[partitionAlias] = "year" diff --git a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/ScenarioPartiQ.kt b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/ScenarioPartiQ.kt index 95705980e57..17d451e0804 100644 --- a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/ScenarioPartiQ.kt +++ b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/ScenarioPartiQ.kt @@ -75,7 +75,7 @@ suspend fun main(args: Array) { suspend fun createTablePartiQL( ddb: DynamoDbClient, tableNameVal: String, - key: String + key: String, ) { val attDef = AttributeDefinition { @@ -125,7 +125,7 @@ suspend fun createTablePartiQL( suspend fun loadDataPartiQL( ddb: DynamoDbClient, - fileName: String + fileName: String, ) { val sqlStatement = "INSERT INTO MoviesPartiQ VALUE {'year':?, 'title' : ?, 'info' : ?}" val parser = JsonFactory().createParser(File(fileName)) @@ -208,7 +208,7 @@ suspend fun deleteTablePartiQL(tableNameVal: String) { suspend fun executeStatementPartiQL( ddb: DynamoDbClient, statementVal: String, - parametersVal: List + parametersVal: List, ): ExecuteStatementResponse { val request = ExecuteStatementRequest { diff --git a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/ScenarioPartiQLBatch.kt b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/ScenarioPartiQLBatch.kt index a342b8fa751..5341828eb16 100644 --- a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/ScenarioPartiQLBatch.kt +++ b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/ScenarioPartiQLBatch.kt @@ -49,7 +49,7 @@ suspend fun main() { suspend fun createTablePartiQLBatch( ddb: DynamoDbClient, tableNameVal: String, - key: String + key: String, ) { val attDef = AttributeDefinition { diff --git a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/UpdateItem.kt b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/UpdateItem.kt index 0de4d630df9..be649fbb227 100644 --- a/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/UpdateItem.kt +++ b/kotlin/services/dynamodb/src/main/kotlin/com/kotlin/dynamodb/UpdateItem.kt @@ -53,7 +53,7 @@ suspend fun updateTableItem( keyName: String, keyVal: String, name: String, - updateVal: String + updateVal: String, ) { val itemKey = mutableMapOf() itemKey[keyName] = AttributeValue.S(keyVal) diff --git a/kotlin/services/dynamodb/src/test/kotlin/DynamoDB.kt b/kotlin/services/dynamodb/src/test/kotlin/DynamoDB.kt index c1f4ed8b4ca..28ccbb33f2b 100644 --- a/kotlin/services/dynamodb/src/test/kotlin/DynamoDB.kt +++ b/kotlin/services/dynamodb/src/test/kotlin/DynamoDB.kt @@ -128,7 +128,7 @@ class DynamoDB { awards, awardVal, songTitle, - songTitleVal + songTitleVal, ) println("Test 3 passed") } diff --git a/kotlin/services/ec2/build.gradle.kts b/kotlin/services/ec2/build.gradle.kts index d0f3178ebe7..d764ee73b7a 100644 --- a/kotlin/services/ec2/build.gradle.kts +++ b/kotlin/services/ec2/build.gradle.kts @@ -37,7 +37,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/CreateInstance.kt b/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/CreateInstance.kt index 3afc0346c75..4e61e5729b5 100644 --- a/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/CreateInstance.kt +++ b/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/CreateInstance.kt @@ -43,7 +43,7 @@ suspend fun main(args: Array) { // snippet-start:[ec2.kotlin.create_instance.main] suspend fun createEC2Instance( name: String, - amiId: String + amiId: String, ): String? { val request = RunInstancesRequest { diff --git a/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/CreateSecurityGroup.kt b/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/CreateSecurityGroup.kt index 5895f5e5d1d..5693f267a45 100644 --- a/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/CreateSecurityGroup.kt +++ b/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/CreateSecurityGroup.kt @@ -46,7 +46,7 @@ suspend fun main(args: Array) { suspend fun createEC2SecurityGroup( groupNameVal: String?, groupDescVal: String?, - vpcIdVal: String? + vpcIdVal: String?, ): String? { val request = CreateSecurityGroupRequest { diff --git a/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/DescribeAddresses.kt b/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/DescribeAddresses.kt index cf1fd0c508f..9c65a74a313 100644 --- a/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/DescribeAddresses.kt +++ b/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/DescribeAddresses.kt @@ -26,7 +26,7 @@ suspend fun describeEC2Address() { val response = ec2.describeAddresses(DescribeAddressesRequest {}) response.addresses?.forEach { address -> println( - "Found address with public IP ${address.publicIp}, domain is ${address.domain}, allocation id ${address.allocationId} and NIC id: ${address.networkInterfaceId} " + "Found address with public IP ${address.publicIp}, domain is ${address.domain}, allocation id ${address.allocationId} and NIC id: ${address.networkInterfaceId} ", ) } } diff --git a/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/EC2Scenario.kt b/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/EC2Scenario.kt index 628195e36ba..665ade8d7e6 100644 --- a/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/EC2Scenario.kt +++ b/kotlin/services/ec2/src/main/kotlin/com/kotlin/ec2/EC2Scenario.kt @@ -289,7 +289,7 @@ suspend fun disassociateAddressSc(associationIdVal: String?) { // snippet-start:[ec2.kotlin.associate_address.main] suspend fun associateAddressSc( instanceIdVal: String?, - allocationIdVal: String? + allocationIdVal: String?, ): String? { val associateRequest = AssociateAddressRequest { @@ -397,7 +397,7 @@ suspend fun runInstanceSc( instanceTypeVal: String, keyNameVal: String, groupNameVal: String, - amiIdVal: String + amiIdVal: String, ): String { val runRequest = RunInstancesRequest { @@ -509,7 +509,7 @@ suspend fun createEC2SecurityGroupSc( groupNameVal: String?, groupDescVal: String?, vpcIdVal: String?, - myIpAddress: String? + myIpAddress: String?, ): String? { val request = CreateSecurityGroupRequest { @@ -564,7 +564,7 @@ suspend fun describeEC2KeysSc() { suspend fun createKeyPairSc( keyNameVal: String, - fileNameVal: String + fileNameVal: String, ) { val request = CreateKeyPairRequest { diff --git a/kotlin/services/ecs/build.gradle.kts b/kotlin/services/ecs/build.gradle.kts index 8f454793abe..5c84d3828aa 100644 --- a/kotlin/services/ecs/build.gradle.kts +++ b/kotlin/services/ecs/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") implementation("com.google.code.gson:gson:2.10") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/CreateService.kt b/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/CreateService.kt index 29abe01a5e9..24c596dcd78 100644 --- a/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/CreateService.kt +++ b/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/CreateService.kt @@ -53,7 +53,7 @@ suspend fun createNewService( serviceNameVal: String, securityGroupsVal: String, subnetsVal: String, - taskDefinitionVal: String + taskDefinitionVal: String, ): String? { val vpcConfiguration = AwsVpcConfiguration { diff --git a/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/DeleteService.kt b/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/DeleteService.kt index 93d419c75bb..18f7d74f2c1 100644 --- a/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/DeleteService.kt +++ b/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/DeleteService.kt @@ -40,7 +40,7 @@ suspend fun main(args: Array) { // snippet-start:[ecs.kotlin.delete_service.main] suspend fun deleteSpecificService( clusterName: String?, - serviceArn: String? + serviceArn: String?, ) { val request = DeleteServiceRequest { diff --git a/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/ListTaskDefinitions.kt b/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/ListTaskDefinitions.kt index 26b576ae45c..4ab5dd39716 100644 --- a/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/ListTaskDefinitions.kt +++ b/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/ListTaskDefinitions.kt @@ -41,7 +41,7 @@ suspend fun main(args: Array) { // snippet-start:[ecs.kotlin.list_tasks.main] suspend fun getAllTasks( clusterArn: String, - taskId: String + taskId: String, ) { val request = DescribeTasksRequest { diff --git a/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/UpdateService.kt b/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/UpdateService.kt index a8e7d30718e..b15d7fe6de0 100644 --- a/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/UpdateService.kt +++ b/kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/UpdateService.kt @@ -40,7 +40,7 @@ suspend fun main(args: Array) { // snippet-start:[ecs.kotlin.update_service.main] suspend fun updateSpecificService( clusterName: String?, - serviceArn: String? + serviceArn: String?, ) { val request = UpdateServiceRequest { diff --git a/kotlin/services/elasticbeanstalk/build.gradle.kts b/kotlin/services/elasticbeanstalk/build.gradle.kts index aa17d9009bc..3ebf39a5304 100644 --- a/kotlin/services/elasticbeanstalk/build.gradle.kts +++ b/kotlin/services/elasticbeanstalk/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/elasticbeanstalk/src/main/kotlin/com/aws/example/CreateEnvironment.kt b/kotlin/services/elasticbeanstalk/src/main/kotlin/com/aws/example/CreateEnvironment.kt index 999f888875c..7fb5e66d5d1 100644 --- a/kotlin/services/elasticbeanstalk/src/main/kotlin/com/aws/example/CreateEnvironment.kt +++ b/kotlin/services/elasticbeanstalk/src/main/kotlin/com/aws/example/CreateEnvironment.kt @@ -41,7 +41,7 @@ suspend fun main(args: Array) { // snippet-start:[eb.kotlin.create_env.main] suspend fun createEBEnvironment( envName: String?, - appName: String? + appName: String?, ): String { val setting1 = ConfigurationOptionSetting { diff --git a/kotlin/services/emr/build.gradle.kts b/kotlin/services/emr/build.gradle.kts index 423b3e5b6e8..f15411d7126 100644 --- a/kotlin/services/emr/build.gradle.kts +++ b/kotlin/services/emr/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/emr/src/main/kotlin/com/kotlin/emr/AddSteps.kt b/kotlin/services/emr/src/main/kotlin/com/kotlin/emr/AddSteps.kt index ca6b1147602..bd62eca637e 100644 --- a/kotlin/services/emr/src/main/kotlin/com/kotlin/emr/AddSteps.kt +++ b/kotlin/services/emr/src/main/kotlin/com/kotlin/emr/AddSteps.kt @@ -45,7 +45,7 @@ suspend fun main(args: Array) { suspend fun addNewStep( jobFlowIdVal: String?, jarVal: String?, - myClass: String? + myClass: String?, ) { val jarStepConfig = HadoopJarStepConfig { diff --git a/kotlin/services/emr/src/main/kotlin/com/kotlin/emr/CreateCluster.kt b/kotlin/services/emr/src/main/kotlin/com/kotlin/emr/CreateCluster.kt index ee01cdb8f00..d25f035268e 100644 --- a/kotlin/services/emr/src/main/kotlin/com/kotlin/emr/CreateCluster.kt +++ b/kotlin/services/emr/src/main/kotlin/com/kotlin/emr/CreateCluster.kt @@ -57,7 +57,7 @@ suspend fun createAppCluster( myClassVal: String?, keysVal: String?, logUriVal: String?, - nameVal: String? + nameVal: String?, ): String? { val jarStepConfig = HadoopJarStepConfig { diff --git a/kotlin/services/emr/src/main/kotlin/com/kotlin/emr/CreateSparkCluster.kt b/kotlin/services/emr/src/main/kotlin/com/kotlin/emr/CreateSparkCluster.kt index fbb660f0974..c01345b4eae 100644 --- a/kotlin/services/emr/src/main/kotlin/com/kotlin/emr/CreateSparkCluster.kt +++ b/kotlin/services/emr/src/main/kotlin/com/kotlin/emr/CreateSparkCluster.kt @@ -56,7 +56,7 @@ suspend fun createSparkCluster( myClass: String?, keysVal: String?, logUriVal: String?, - nameVal: String? + nameVal: String?, ): String? { val jarStepConfig = HadoopJarStepConfig { diff --git a/kotlin/services/eventbridge/build.gradle.kts b/kotlin/services/eventbridge/build.gradle.kts index 1795c3a6c69..b0ddbf2683a 100644 --- a/kotlin/services/eventbridge/build.gradle.kts +++ b/kotlin/services/eventbridge/build.gradle.kts @@ -37,7 +37,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/eventbridge/src/main/kotlin/com/kotlin/eventbridge/CreateRuleSchedule.kt b/kotlin/services/eventbridge/src/main/kotlin/com/kotlin/eventbridge/CreateRuleSchedule.kt index 3b2729692f3..f03405da061 100644 --- a/kotlin/services/eventbridge/src/main/kotlin/com/kotlin/eventbridge/CreateRuleSchedule.kt +++ b/kotlin/services/eventbridge/src/main/kotlin/com/kotlin/eventbridge/CreateRuleSchedule.kt @@ -49,7 +49,7 @@ suspend fun main(args: Array) { // snippet-start:[eventbridge.kotlin._create_schedule_rule.main] suspend fun createScRule( ruleName: String?, - cronExpression: String? + cronExpression: String?, ) { val ruleRequest = PutRuleRequest { @@ -72,7 +72,7 @@ suspend fun putRuleTarget( ruleName: String?, lambdaARN: String, json: String?, - targetId: String + targetId: String, ) { val lambdaTarget = Target { diff --git a/kotlin/services/eventbridge/src/main/kotlin/com/kotlin/eventbridge/EventbridgeMVP.kt b/kotlin/services/eventbridge/src/main/kotlin/com/kotlin/eventbridge/EventbridgeMVP.kt index 54c4edc3c67..a6ae565b0f0 100644 --- a/kotlin/services/eventbridge/src/main/kotlin/com/kotlin/eventbridge/EventbridgeMVP.kt +++ b/kotlin/services/eventbridge/src/main/kotlin/com/kotlin/eventbridge/EventbridgeMVP.kt @@ -248,7 +248,7 @@ suspend fun cleanupResources( topicArn: String?, eventRuleName: String?, bucketName: String?, - roleName: String? + roleName: String?, ) { println("Removing all targets from the event rule.") deleteTargetsFromRule(eventRuleName) @@ -296,7 +296,7 @@ suspend fun deleteS3Bucket(bucketName: String?) { toDelete.add( ObjectIdentifier { key = myValue.key - } + }, ) } } @@ -407,7 +407,7 @@ suspend fun triggerCustomRule(email: String) { // snippet-start:[eventbridge.kotlin._put_target.custom.transform.main] suspend fun updateCustomRuleTargetWithTransform( topicArn: String?, - ruleName: String? + ruleName: String?, ) { val targetId = UUID.randomUUID().toString() @@ -459,7 +459,7 @@ suspend fun updateToCustomRule(ruleName: String?) { // Update an Amazon S3 object created rule with a transform on the target. suspend fun updateSnsEventRule( topicArn: String?, - ruleName: String? + ruleName: String?, ) { val targetId = UUID.randomUUID().toString() val myMap = mutableMapOf() @@ -507,7 +507,7 @@ suspend fun checkRule(eventRuleName: String?) { // snippet-start:[eventbridge.kotlin.disable.rule.main] suspend fun changeRuleState( eventRuleName: String, - isEnabled: Boolean? + isEnabled: Boolean?, ) { if (!isEnabled!!) { println("Disabling the rule: $eventRuleName") @@ -593,7 +593,7 @@ suspend fun addSnsEventRule( topicArn: String?, topicName: String, eventRuleName: String, - bucketName: String + bucketName: String, ) { val targetID = UUID.randomUUID().toString() val myTarget = @@ -621,7 +621,7 @@ suspend fun addSnsEventRule( suspend fun subEmail( topicArnVal: String?, - email: String? + email: String?, ) { val request = SubscribeRequest { @@ -691,7 +691,7 @@ suspend fun listRules() { suspend fun addEventRule( roleArnVal: String?, bucketName: String, - eventRuleName: String? + eventRuleName: String?, ) { val pattern = """{ "source": ["aws.s3"], @@ -778,7 +778,7 @@ suspend fun checkBucket(bucketName: String?): Boolean { suspend fun createIAMRole( rolenameVal: String?, - polJSON: String? + polJSON: String?, ): String? { val request = CreateRoleRequest { diff --git a/kotlin/services/firehose/build.gradle.kts b/kotlin/services/firehose/build.gradle.kts index c83e5d89958..937d8ec3a90 100644 --- a/kotlin/services/firehose/build.gradle.kts +++ b/kotlin/services/firehose/build.gradle.kts @@ -36,7 +36,7 @@ dependencies { implementation("com.fasterxml.jackson.core:jackson-databind:2.14.2") implementation("com.google.code.gson:gson:2.10") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/CreateDeliveryStream.kt b/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/CreateDeliveryStream.kt index a54ca3287cd..2c49c6323e3 100644 --- a/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/CreateDeliveryStream.kt +++ b/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/CreateDeliveryStream.kt @@ -46,7 +46,7 @@ suspend fun main(args: Array) { suspend fun createStream( bucketARNVal: String?, roleARNVal: String?, - streamName: String? + streamName: String?, ) { val destinationConfiguration = ExtendedS3DestinationConfiguration { diff --git a/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/PutRecord.kt b/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/PutRecord.kt index d58e4cd4786..6591bf5bdaa 100644 --- a/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/PutRecord.kt +++ b/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/PutRecord.kt @@ -40,7 +40,7 @@ suspend fun main(args: Array) { // snippet-start:[firehose.kotlin.put_record.main] suspend fun putSingleRecord( textValue: String, - streamName: String? + streamName: String?, ) { val bytes = textValue.toByteArray() diff --git a/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/StockTrade.kt b/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/StockTrade.kt index 9855ed6fabd..1ab545f293f 100644 --- a/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/StockTrade.kt +++ b/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/StockTrade.kt @@ -16,7 +16,7 @@ class StockTrade( tradeType: TradeType?, price: Double, quantity: Long, - id: Long + id: Long, ) { companion object { private val JSON = ObjectMapper() @@ -31,7 +31,7 @@ class StockTrade( */ enum class TradeType { BUY, - SELL + SELL, } var tickerSymbol: String? = tickerSymbol @@ -63,6 +63,6 @@ class StockTrade( tradeType, quantity, tickerSymbol, - price + price, ) } diff --git a/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/StockTradeGenerator.kt b/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/StockTradeGenerator.kt index 048c9935a72..967dc13f807 100644 --- a/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/StockTradeGenerator.kt +++ b/kotlin/services/firehose/src/main/kotlin/com/kotlin/firehose/StockTradeGenerator.kt @@ -84,6 +84,6 @@ class StockTradeGenerator { private class StockPrice( var tickerSymbol: String, - var price: Double + var price: Double, ) } diff --git a/kotlin/services/forecast/build.gradle.kts b/kotlin/services/forecast/build.gradle.kts index 14fc0d2c3e1..6f962cb5c73 100644 --- a/kotlin/services/forecast/build.gradle.kts +++ b/kotlin/services/forecast/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/forecast/src/main/kotlin/com/kotlin/forecast/CreateForecast.kt b/kotlin/services/forecast/src/main/kotlin/com/kotlin/forecast/CreateForecast.kt index 33bfb7d06a6..7f4abd7ca97 100644 --- a/kotlin/services/forecast/src/main/kotlin/com/kotlin/forecast/CreateForecast.kt +++ b/kotlin/services/forecast/src/main/kotlin/com/kotlin/forecast/CreateForecast.kt @@ -41,7 +41,7 @@ suspend fun main(args: Array) { // snippet-start:[forecast.kotlin.create_forecast.main] suspend fun createNewForecast( name: String?, - predictorArnVal: String? + predictorArnVal: String?, ): String? { val request = CreateForecastRequest { diff --git a/kotlin/services/glue/build.gradle.kts b/kotlin/services/glue/build.gradle.kts index be1558b6831..792fc5eb9fe 100644 --- a/kotlin/services/glue/build.gradle.kts +++ b/kotlin/services/glue/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/glue/src/main/kotlin/com/kotlin/glue/CreateCrawler.kt b/kotlin/services/glue/src/main/kotlin/com/kotlin/glue/CreateCrawler.kt index 8acd4b07e27..e87a23fe0a3 100644 --- a/kotlin/services/glue/src/main/kotlin/com/kotlin/glue/CreateCrawler.kt +++ b/kotlin/services/glue/src/main/kotlin/com/kotlin/glue/CreateCrawler.kt @@ -51,7 +51,7 @@ suspend fun createGlueCrawler( s3Path: String?, cron: String?, dbName: String?, - crawlerName: String + crawlerName: String, ) { val s3Target = S3Target { diff --git a/kotlin/services/glue/src/main/kotlin/com/kotlin/glue/GetJobRun.kt b/kotlin/services/glue/src/main/kotlin/com/kotlin/glue/GetJobRun.kt index 12f1f792327..87b1c779567 100644 --- a/kotlin/services/glue/src/main/kotlin/com/kotlin/glue/GetJobRun.kt +++ b/kotlin/services/glue/src/main/kotlin/com/kotlin/glue/GetJobRun.kt @@ -40,7 +40,7 @@ suspend fun main(args: Array) { // snippet-start:[glue.kotlin.get_job.main] suspend fun getGlueJobRun( jobNameVal: String?, - runIdVal: String? + runIdVal: String?, ) { val request = GetJobRunRequest { diff --git a/kotlin/services/glue/src/main/kotlin/com/kotlin/glue/GlueScenario.kt b/kotlin/services/glue/src/main/kotlin/com/kotlin/glue/GlueScenario.kt index bfc9073629a..cc8f1248fd5 100644 --- a/kotlin/services/glue/src/main/kotlin/com/kotlin/glue/GlueScenario.kt +++ b/kotlin/services/glue/src/main/kotlin/com/kotlin/glue/GlueScenario.kt @@ -90,7 +90,7 @@ suspend fun main(args: Array) { suspend fun createDatabase( dbName: String?, - locationUriVal: String? + locationUriVal: String?, ) { val input = DatabaseInput { @@ -115,7 +115,7 @@ suspend fun createCrawler( s3Path: String?, cron: String?, dbName: String?, - crawlerName: String + crawlerName: String, ) { val s3Target = S3Target { @@ -215,7 +215,7 @@ suspend fun startJob(jobNameVal: String?) { suspend fun createJob( jobName: String, iam: String?, - scriptLocationVal: String? + scriptLocationVal: String?, ) { val commandOb = JobCommand { diff --git a/kotlin/services/iam/build.gradle.kts b/kotlin/services/iam/build.gradle.kts index 61bda2a2e86..8febd761f60 100644 --- a/kotlin/services/iam/build.gradle.kts +++ b/kotlin/services/iam/build.gradle.kts @@ -38,7 +38,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/AttachRolePolicy.kt b/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/AttachRolePolicy.kt index 5f6f5d264a7..b1d6b6aacc0 100644 --- a/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/AttachRolePolicy.kt +++ b/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/AttachRolePolicy.kt @@ -41,7 +41,7 @@ suspend fun main(args: Array) { // snippet-start:[iam.kotlin.attach_role_policy.main] suspend fun attachIAMRolePolicy( roleNameVal: String, - policyArnVal: String + policyArnVal: String, ) { val request = ListAttachedRolePoliciesRequest { @@ -73,7 +73,7 @@ suspend fun attachIAMRolePolicy( fun checkList( attachedPolicies: List, - policyArnVal: String + policyArnVal: String, ): Int { for (policy in attachedPolicies) { val polArn = policy.policyArn.toString() diff --git a/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/DeleteAccessKey.kt b/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/DeleteAccessKey.kt index fd2af227b9c..64ff59e55a6 100644 --- a/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/DeleteAccessKey.kt +++ b/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/DeleteAccessKey.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[iam.kotlin.delete_access_key.main] suspend fun deleteKey( userNameVal: String, - accessKey: String + accessKey: String, ) { val request = DeleteAccessKeyRequest { diff --git a/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/DetachRolePolicy.kt b/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/DetachRolePolicy.kt index 61b1cff8360..4ed9ecdb5d2 100644 --- a/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/DetachRolePolicy.kt +++ b/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/DetachRolePolicy.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[iam.kotlin.detach_role_policy.main] suspend fun detachPolicy( roleNameVal: String, - policyArnVal: String + policyArnVal: String, ) { val request = DetachRolePolicyRequest { diff --git a/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/IAMScenario.kt b/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/IAMScenario.kt index 0511a0fd672..99e278f74ff 100644 --- a/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/IAMScenario.kt +++ b/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/IAMScenario.kt @@ -132,7 +132,7 @@ suspend fun createPolicy(policyNameVal: String?): String { suspend fun createRole( rolenameVal: String?, - fileLocation: String? + fileLocation: String?, ): String? { val jsonObject = fileLocation?.let { readJsonSimpleDemo(it) } as JSONObject @@ -151,7 +151,7 @@ suspend fun createRole( suspend fun attachRolePolicy( roleNameVal: String, - policyArnVal: String + policyArnVal: String, ) { val request = ListAttachedRolePoliciesRequest { @@ -183,7 +183,7 @@ suspend fun attachRolePolicy( fun checkMyList( attachedPolicies: List, - policyArnVal: String + policyArnVal: String, ): Int { for (policy in attachedPolicies) { val polArn = policy.policyArn.toString() @@ -199,7 +199,7 @@ fun checkMyList( suspend fun assumeGivenRole( roleArnVal: String?, roleSessionNameVal: String?, - bucketName: String + bucketName: String, ) { val stsClient = StsClient { @@ -249,7 +249,7 @@ suspend fun assumeGivenRole( suspend fun deleteRole( roleNameVal: String, - polArn: String + polArn: String, ) { val iam = IamClient { region = "AWS_GLOBAL" } diff --git a/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/UpdateUser.kt b/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/UpdateUser.kt index 9a7f6cbe95d..3f6160aa3fa 100644 --- a/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/UpdateUser.kt +++ b/kotlin/services/iam/src/main/kotlin/com/kotlin/iam/UpdateUser.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[iam.kotlin.update_user.main] suspend fun updateIAMUser( curName: String?, - newName: String? + newName: String?, ) { val request = UpdateUserRequest { diff --git a/kotlin/services/iot/build.gradle.kts b/kotlin/services/iot/build.gradle.kts index ee0eb229aff..9892e3970d2 100644 --- a/kotlin/services/iot/build.gradle.kts +++ b/kotlin/services/iot/build.gradle.kts @@ -36,7 +36,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/iot/src/main/kotlin/com/example/iot/IotScenario.kt b/kotlin/services/iot/src/main/kotlin/com/example/iot/IotScenario.kt index 458d0412ca3..ad9917fde76 100644 --- a/kotlin/services/iot/src/main/kotlin/com/example/iot/IotScenario.kt +++ b/kotlin/services/iot/src/main/kotlin/com/example/iot/IotScenario.kt @@ -79,7 +79,7 @@ suspend fun main(args: Array) { It utilizes the AWS SDK for Kotlin and incorporates functionality for creating and managing IoT things, certificates, rules, shadows, and performing searches. The program aims to showcase AWS IoT capabilities and provides a comprehensive example for developers working with AWS IoT in a Kotlin environment. - """.trimIndent() + """.trimIndent(), ) print("Press Enter to continue...") @@ -91,7 +91,7 @@ suspend fun main(args: Array) { println( """ An AWS IoT thing represents a virtual entity in the AWS IoT service that can be associated with a physical device. - """.trimIndent() + """.trimIndent(), ) // Prompt the user for input. print("Enter thing name: ") @@ -105,7 +105,7 @@ suspend fun main(args: Array) { println( """ A device certificate performs a role in securing the communication between devices (things) and the AWS IoT platform. - """.trimIndent() + """.trimIndent(), ) print("Do you want to create a certificate for $thingName? (y/n)") @@ -126,7 +126,7 @@ suspend fun main(args: Array) { """ IoT thing attributes, represented as key-value pairs, offer a pivotal advantage in facilitating efficient data management and retrieval within the AWS IoT ecosystem. - """.trimIndent() + """.trimIndent(), ) print("Press Enter to continue...") scanner.nextLine() @@ -138,7 +138,7 @@ suspend fun main(args: Array) { println( """ An IoT Endpoint refers to a specific URL or Uniform Resource Locator that serves as the entry point for communication between IoT devices and the AWS IoT service. - """.trimIndent() + """.trimIndent(), ) print("Press Enter to continue...") scanner.nextLine() @@ -164,7 +164,7 @@ suspend fun main(args: Array) { of a physical device or thing. The thing shadow allows you to synchronize and control the state of a device between the cloud and the device itself. and the AWS IoT service. For example, you can write and retrieve JSON data from a thing shadow. - """.trimIndent() + """.trimIndent(), ) print("Press Enter to continue...") scanner.nextLine() @@ -184,7 +184,7 @@ suspend fun main(args: Array) { """ Creates a rule that is an administrator-level action. Any user who has permission to create rules will be able to access data processed by the rule. - """.trimIndent() + """.trimIndent(), ) print("Enter Rule name: ") val ruleName = scanner.nextLine() @@ -277,7 +277,7 @@ private fun extractCertificateId(certificateArn: String): String? { // snippet-start:[iot.kotlin.detach.thing.main] suspend fun detachThingPrincipal( thingNameVal: String, - certificateArn: String + certificateArn: String, ) { val thingPrincipalRequest = DetachThingPrincipalRequest { @@ -332,7 +332,7 @@ suspend fun listIoTRules() { suspend fun createIoTRule( roleARNVal: String?, ruleNameVal: String?, - action: String? + action: String?, ) { val sqlVal = "SELECT * FROM '$TOPIC '" val action1 = @@ -476,7 +476,7 @@ suspend fun updateShawdowThing(thingNameVal: String?) { // snippet-start:[iot.kotlin.attach.thing.main] suspend fun attachCertificateToThing( thingNameVal: String?, - certificateArn: String? + certificateArn: String?, ) { val principalRequest = AttachThingPrincipalRequest { diff --git a/kotlin/services/kendra/build.gradle.kts b/kotlin/services/kendra/build.gradle.kts index 8e283437878..1b424d340b9 100644 --- a/kotlin/services/kendra/build.gradle.kts +++ b/kotlin/services/kendra/build.gradle.kts @@ -37,7 +37,7 @@ dependencies { implementation("com.google.code.gson:gson:2.10") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/kendra/src/main/kotlin/com/example/kendra/CreateIndexAndDataSourceExample.kt b/kotlin/services/kendra/src/main/kotlin/com/example/kendra/CreateIndexAndDataSourceExample.kt index a3870b11647..370d824bed7 100644 --- a/kotlin/services/kendra/src/main/kotlin/com/example/kendra/CreateIndexAndDataSourceExample.kt +++ b/kotlin/services/kendra/src/main/kotlin/com/example/kendra/CreateIndexAndDataSourceExample.kt @@ -66,7 +66,7 @@ suspend fun main(args: Array) { suspend fun createIndex( indexDescription: String, indexName: String, - indexRoleArn: String + indexRoleArn: String, ): String { println("Creating an index named $indexName") val createIndexRequest = @@ -105,7 +105,7 @@ suspend fun createDataSource( dataSourceName: String?, dataSourceDescription: String?, indexIdVal: String?, - dataSourceRoleArn: String? + dataSourceRoleArn: String?, ): String { println("Creating an S3 data source") @@ -155,7 +155,7 @@ suspend fun createDataSource( // snippet-start:[kendra.kotlin.start.datasource.main] suspend fun startDataSource( indexIdVal: String?, - dataSourceId: String? + dataSourceId: String?, ) { println("Synchronize the data source $dataSourceId") val startDataSourceSyncJobRequest = @@ -167,7 +167,7 @@ suspend fun startDataSource( KendraClient { region = "us-east-1" }.use { kendra -> val startDataSourceSyncJobResponse = kendra.startDataSourceSyncJob(startDataSourceSyncJobRequest) println( - "Waiting for the data source to sync with the index $indexIdVal for execution ID ${startDataSourceSyncJobResponse.executionId}" + "Waiting for the data source to sync with the index $indexIdVal for execution ID ${startDataSourceSyncJobResponse.executionId}", ) } println("Index setup is complete") diff --git a/kotlin/services/kendra/src/main/kotlin/com/example/kendra/DeleteDataSource.kt b/kotlin/services/kendra/src/main/kotlin/com/example/kendra/DeleteDataSource.kt index 67a10c2837e..014cc65737f 100644 --- a/kotlin/services/kendra/src/main/kotlin/com/example/kendra/DeleteDataSource.kt +++ b/kotlin/services/kendra/src/main/kotlin/com/example/kendra/DeleteDataSource.kt @@ -41,7 +41,7 @@ suspend fun main(args: Array) { // snippet-start:[kendra.kotlin.delete.datasource.main] suspend fun deleteSpecificDataSource( indexIdVal: String?, - dataSourceId: String + dataSourceId: String, ) { val dataSourceRequest = DeleteDataSourceRequest { diff --git a/kotlin/services/kendra/src/main/kotlin/com/example/kendra/ListDataSourceSyncJobs.kt b/kotlin/services/kendra/src/main/kotlin/com/example/kendra/ListDataSourceSyncJobs.kt index df64270e747..d0872b4b0b9 100644 --- a/kotlin/services/kendra/src/main/kotlin/com/example/kendra/ListDataSourceSyncJobs.kt +++ b/kotlin/services/kendra/src/main/kotlin/com/example/kendra/ListDataSourceSyncJobs.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[kendra.kotlin.list.sync.main] suspend fun listSyncJobs( indexIdVal: String?, - dataSourceId: String? + dataSourceId: String?, ) { val jobsRequest = ListDataSourceSyncJobsRequest { diff --git a/kotlin/services/kendra/src/main/kotlin/com/example/kendra/QueryIndex.kt b/kotlin/services/kendra/src/main/kotlin/com/example/kendra/QueryIndex.kt index c03acc141b9..958faed8263 100644 --- a/kotlin/services/kendra/src/main/kotlin/com/example/kendra/QueryIndex.kt +++ b/kotlin/services/kendra/src/main/kotlin/com/example/kendra/QueryIndex.kt @@ -41,7 +41,7 @@ suspend fun main(args: Array) { // snippet-start:[kendra.kotlin.query.index.main] suspend fun querySpecificIndex( indexIdVal: String?, - text: String? + text: String?, ) { val queryRequest = QueryRequest { diff --git a/kotlin/services/keyspaces/build.gradle.kts b/kotlin/services/keyspaces/build.gradle.kts index 586e29faa64..a2771f4f4ef 100644 --- a/kotlin/services/keyspaces/build.gradle.kts +++ b/kotlin/services/keyspaces/build.gradle.kts @@ -37,7 +37,7 @@ dependencies { implementation("com.fasterxml.jackson.core:jackson-core:2.14.2") implementation("com.fasterxml.jackson.core:jackson-databind:2.14.2") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/keyspaces/src/main/kotlin/com/example/keyspace/ScenarioKeyspaces.kt b/kotlin/services/keyspaces/src/main/kotlin/com/example/keyspace/ScenarioKeyspaces.kt index 3c1ad7ae7dc..b3548b1997e 100644 --- a/kotlin/services/keyspaces/src/main/kotlin/com/example/keyspace/ScenarioKeyspaces.kt +++ b/kotlin/services/keyspaces/src/main/kotlin/com/example/keyspace/ScenarioKeyspaces.kt @@ -224,7 +224,7 @@ suspend fun deleteKeyspace(keyspaceNameVal: String?) { suspend fun checkTableDelete( keyspaceNameVal: String?, - tableNameVal: String? + tableNameVal: String?, ) { var status: String var response: GetTableResponse @@ -253,7 +253,7 @@ suspend fun checkTableDelete( // snippet-start:[keyspace.kotlin.scenario.delete.table.main] suspend fun deleteTable( keyspaceNameVal: String?, - tableNameVal: String? + tableNameVal: String?, ) { val tableRequest = DeleteTableRequest { @@ -269,7 +269,7 @@ suspend fun deleteTable( suspend fun checkRestoredTable( keyspaceNameVal: String?, - tableNameVal: String? + tableNameVal: String?, ) { var tableStatus = false var status: String @@ -306,7 +306,7 @@ suspend fun checkRestoredTable( // snippet-start:[keyspace.kotlin.scenario.restore.table.main] suspend fun restoreTable( keyspaceName: String?, - utc: ZonedDateTime + utc: ZonedDateTime, ) { // Create an aws.smithy.kotlin.runtime.time.Instant value. val timeStamp = @@ -330,7 +330,7 @@ suspend fun restoreTable( fun getWatchedData( session: CqlSession, - keyspaceName: String + keyspaceName: String, ) { val resultSet = session.execute("SELECT * FROM \"$keyspaceName\".\"MovieKotlin\" WHERE watched = true ALLOW FILTERING;") resultSet.forEach { item: Row -> @@ -344,7 +344,7 @@ fun updateRecord( session: CqlSession, keySpace: String, titleUpdate: String?, - yearUpdate: Int + yearUpdate: Int, ) { val sqlStatement = "UPDATE \"$keySpace\".\"MovieKotlin\" SET watched=true WHERE title = :k0 AND year = :k1;" @@ -356,7 +356,7 @@ fun updateRecord( .boundStatementBuilder() .setString("k0", titleUpdate) .setInt("k1", yearUpdate) - .build() + .build(), ) val batchStatement = builder.build() session.execute(batchStatement) @@ -365,7 +365,7 @@ fun updateRecord( // snippet-start:[keyspace.kotlin.scenario.update.table.main] suspend fun updateTable( keySpace: String?, - tableNameVal: String? + tableNameVal: String?, ) { val def = ColumnDefinition { @@ -388,7 +388,7 @@ suspend fun updateTable( fun getSpecificMovie( session: CqlSession, - keyspaceName: String + keyspaceName: String, ) { val resultSet = session.execute("SELECT * FROM \"$keyspaceName\".\"MovieKotlin\" WHERE title = 'The Family' ALLOW FILTERING ;") @@ -403,7 +403,7 @@ fun getSpecificMovie( // Get records from the Movie table. fun getMovieData( session: CqlSession, - keyspaceName: String + keyspaceName: String, ) { val resultSet = session.execute("SELECT * FROM \"$keyspaceName\".\"MovieKotlin\";") resultSet.forEach { item: Row -> @@ -417,7 +417,7 @@ fun getMovieData( fun loadData( session: CqlSession, fileName: String, - keySpace: String + keySpace: String, ) { val sqlStatement = "INSERT INTO \"$keySpace\".\"MovieKotlin\" (title, year, plot) values (:k0, :k1, :k2)" @@ -447,7 +447,7 @@ fun loadData( .setString("k0", title) .setInt("k1", year) .setString("k2", info) - .build() + .build(), ) val batchStatement = builder.build() @@ -477,7 +477,7 @@ suspend fun listTables(keyspaceNameVal: String?) { // snippet-start:[keyspace.kotlin.scenario.get.table.main] suspend fun checkTable( keyspaceNameVal: String?, - tableNameVal: String? + tableNameVal: String?, ) { var tableStatus = false var status: String @@ -512,7 +512,7 @@ suspend fun checkTable( // snippet-start:[keyspace.kotlin.scenario.create.table.main] suspend fun createTable( keySpaceVal: String?, - tableNameVal: String? + tableNameVal: String?, ) { // Set the columns. val defTitle = diff --git a/kotlin/services/kinesis/build.gradle.kts b/kotlin/services/kinesis/build.gradle.kts index a55507e4c70..12a5cd6b41f 100644 --- a/kotlin/services/kinesis/build.gradle.kts +++ b/kotlin/services/kinesis/build.gradle.kts @@ -34,7 +34,7 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") implementation("com.fasterxml.jackson.core:jackson-databind:2.14.0") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/AddDataShards.kt b/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/AddDataShards.kt index dc6a3dffc5d..664694c8c95 100644 --- a/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/AddDataShards.kt +++ b/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/AddDataShards.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[kinesis.kotlin.AddDataShards.main] suspend fun addShards( name: String?, - goalShards: Int + goalShards: Int, ) { val request = UpdateShardCountRequest { diff --git a/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/GetRecords.kt b/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/GetRecords.kt index 15abb2a8705..f8ee5ed582d 100644 --- a/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/GetRecords.kt +++ b/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/GetRecords.kt @@ -62,7 +62,7 @@ suspend fun getStockTrades(streamNameVal: String?) { streamName = streamNameVal shardIteratorType = ShardIteratorType.fromValue("TRIM_HORIZON") shardId = id - } + }, ) shardIteratorVal = shardIteratorResult.shardIterator.toString() diff --git a/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/StockTrade.kt b/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/StockTrade.kt index cd5911698d8..ef6c9d3a706 100644 --- a/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/StockTrade.kt +++ b/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/StockTrade.kt @@ -32,7 +32,7 @@ class StockTrade { */ enum class TradeType { BUY, - SELL + SELL, } var tickerSymbol: String? = null @@ -75,6 +75,6 @@ class StockTrade { tradeType, quantity, tickerSymbol, - price + price, ) } diff --git a/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/StockTradeGenerator.kt b/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/StockTradeGenerator.kt index ed483753818..7a07163216c 100644 --- a/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/StockTradeGenerator.kt +++ b/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/StockTradeGenerator.kt @@ -82,6 +82,6 @@ class StockTradeGenerator { private class StockPrice constructor( var tickerSymbol: String, - var price: Double + var price: Double, ) } diff --git a/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/StockTradesWriter.kt b/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/StockTradesWriter.kt index 01692fafad0..b807079639a 100644 --- a/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/StockTradesWriter.kt +++ b/kotlin/services/kinesis/src/main/kotlin/com/kotlin/kinesis/StockTradesWriter.kt @@ -52,7 +52,7 @@ suspend fun setStockData(streamName: String) { private suspend fun sendStockTrade( trade: StockTrade, - streamNameVal: String + streamNameVal: String, ) { val bytes = trade.toJsonAsBytes() diff --git a/kotlin/services/kms/build.gradle.kts b/kotlin/services/kms/build.gradle.kts index be3c44a8425..7807a201e2f 100644 --- a/kotlin/services/kms/build.gradle.kts +++ b/kotlin/services/kms/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/CreateAlias.kt b/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/CreateAlias.kt index e44f1b32d2b..aafbc783617 100644 --- a/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/CreateAlias.kt +++ b/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/CreateAlias.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[kms.kotlin_create_alias.main] suspend fun createCustomAlias( targetKeyIdVal: String?, - aliasNameVal: String? + aliasNameVal: String?, ) { val request = CreateAliasRequest { diff --git a/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/CreateGrant.kt b/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/CreateGrant.kt index c641b567318..aa251d50683 100644 --- a/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/CreateGrant.kt +++ b/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/CreateGrant.kt @@ -44,7 +44,7 @@ suspend fun main(args: Array) { suspend fun createNewGrant( keyIdVal: String?, granteePrincipalVal: String?, - operation: String + operation: String, ): String? { val operationOb = GrantOperation.fromValue(operation) val grantOperationList = ArrayList() diff --git a/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/EncryptDataKey.kt b/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/EncryptDataKey.kt index 53b17eef303..cb7478eee19 100644 --- a/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/EncryptDataKey.kt +++ b/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/EncryptDataKey.kt @@ -63,7 +63,7 @@ suspend fun encryptData(keyIdValue: String): ByteArray? { suspend fun decryptData( encryptedDataVal: ByteArray?, keyIdVal: String?, - path: String + path: String, ) { val decryptRequest = DecryptRequest { diff --git a/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/RevokeGrant.kt b/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/RevokeGrant.kt index 5dc0420ed5a..d2b4046a9bb 100644 --- a/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/RevokeGrant.kt +++ b/kotlin/services/kms/src/main/kotlin/com/kotlin/kms/RevokeGrant.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[kms.kotlin_revoke_grant.main] suspend fun revokeKeyGrant( keyIdVal: String?, - grantIdVal: String? + grantIdVal: String?, ) { val request = RevokeGrantRequest { diff --git a/kotlin/services/lambda/build.gradle.kts b/kotlin/services/lambda/build.gradle.kts index 593eab99a99..dcc5a825436 100644 --- a/kotlin/services/lambda/build.gradle.kts +++ b/kotlin/services/lambda/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/lambda/src/main/kotlin/com/kotlin/lambda/CreateFunction.kt b/kotlin/services/lambda/src/main/kotlin/com/kotlin/lambda/CreateFunction.kt index 3f4f4a5c355..b3639985113 100644 --- a/kotlin/services/lambda/src/main/kotlin/com/kotlin/lambda/CreateFunction.kt +++ b/kotlin/services/lambda/src/main/kotlin/com/kotlin/lambda/CreateFunction.kt @@ -53,7 +53,7 @@ suspend fun createNewFunction( s3BucketName: String, myS3Key: String, myHandler: String, - myRole: String + myRole: String, ): String? { val functionCode = FunctionCode { diff --git a/kotlin/services/lambda/src/main/kotlin/com/kotlin/lambda/GetAccountSettings.kt b/kotlin/services/lambda/src/main/kotlin/com/kotlin/lambda/GetAccountSettings.kt index fd033a55d7f..7309d9883c8 100644 --- a/kotlin/services/lambda/src/main/kotlin/com/kotlin/lambda/GetAccountSettings.kt +++ b/kotlin/services/lambda/src/main/kotlin/com/kotlin/lambda/GetAccountSettings.kt @@ -26,7 +26,7 @@ suspend fun getSettings() { LambdaClient { region = "us-west-2" }.use { awsLambda -> val response = awsLambda.getAccountSettings(GetAccountSettingsRequest { }) println( - "Total code size for your account is ${response.accountLimit?.totalCodeSize} bytes" + "Total code size for your account is ${response.accountLimit?.totalCodeSize} bytes", ) } } diff --git a/kotlin/services/lambda/src/main/kotlin/com/kotlin/lambda/LambdaScenario.kt b/kotlin/services/lambda/src/main/kotlin/com/kotlin/lambda/LambdaScenario.kt index ed13ff0930b..ee938abceb8 100644 --- a/kotlin/services/lambda/src/main/kotlin/com/kotlin/lambda/LambdaScenario.kt +++ b/kotlin/services/lambda/src/main/kotlin/com/kotlin/lambda/LambdaScenario.kt @@ -102,7 +102,7 @@ suspend fun createScFunction( s3BucketName: String, myS3Key: String, myHandler: String, - myRole: String + myRole: String, ): String { val functionCode = FunctionCode { @@ -175,7 +175,7 @@ suspend fun invokeFunctionSc(functionNameVal: String) { suspend fun updateFunctionCode( functionNameVal: String?, bucketName: String?, - key: String? + key: String?, ) { val functionCodeRequest = UpdateFunctionCodeRequest { @@ -196,7 +196,7 @@ suspend fun updateFunctionCode( suspend fun updateFunctionConfiguration( functionNameVal: String?, - handlerVal: String? + handlerVal: String?, ) { val configurationRequest = UpdateFunctionConfigurationRequest { diff --git a/kotlin/services/lex/build.gradle.kts b/kotlin/services/lex/build.gradle.kts index e7f3be002c1..f34dced5b31 100644 --- a/kotlin/services/lex/build.gradle.kts +++ b/kotlin/services/lex/build.gradle.kts @@ -37,7 +37,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/lex/src/main/kotlin/com/kotlin/lex/GetIntent.kt b/kotlin/services/lex/src/main/kotlin/com/kotlin/lex/GetIntent.kt index c0b479dc89e..b3a2a07e11e 100644 --- a/kotlin/services/lex/src/main/kotlin/com/kotlin/lex/GetIntent.kt +++ b/kotlin/services/lex/src/main/kotlin/com/kotlin/lex/GetIntent.kt @@ -42,7 +42,7 @@ suspend fun main(args: Array) { // snippet-start:[lex.kotlin.get_intent.main] suspend fun getSpecificIntent( intentName: String?, - intentVersion: String? + intentVersion: String?, ) { val request = GetIntentRequest { diff --git a/kotlin/services/lex/src/main/kotlin/com/kotlin/lex/PostText.kt b/kotlin/services/lex/src/main/kotlin/com/kotlin/lex/PostText.kt index 4099cfc8be3..0c12a03e7bc 100644 --- a/kotlin/services/lex/src/main/kotlin/com/kotlin/lex/PostText.kt +++ b/kotlin/services/lex/src/main/kotlin/com/kotlin/lex/PostText.kt @@ -47,7 +47,7 @@ suspend fun main(args: Array) { suspend fun getText( text: String, botNameVal: String, - botAliasVal: String + botAliasVal: String, ): String? { val userIdVal = "chatbot-demo" val sessionAttributesVal = mutableMapOf() diff --git a/kotlin/services/lex/src/main/kotlin/com/kotlin/lex/PutBot.kt b/kotlin/services/lex/src/main/kotlin/com/kotlin/lex/PutBot.kt index 3e8f63de9d5..4c604ef2972 100644 --- a/kotlin/services/lex/src/main/kotlin/com/kotlin/lex/PutBot.kt +++ b/kotlin/services/lex/src/main/kotlin/com/kotlin/lex/PutBot.kt @@ -51,7 +51,7 @@ suspend fun main(args: Array) { suspend fun createBot( botNameVal: String?, intentNameVal: String?, - intentVersionVal: String? + intentVersionVal: String?, ) { // Create an Intent object for the bot. val weatherIntent = diff --git a/kotlin/services/mediaconvert/build.gradle.kts b/kotlin/services/mediaconvert/build.gradle.kts index 67da63f6f50..1e3b0b69ac1 100644 --- a/kotlin/services/mediaconvert/build.gradle.kts +++ b/kotlin/services/mediaconvert/build.gradle.kts @@ -36,7 +36,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/mediaconvert/src/main/kotlin/com/kotlin/mediaconvert/CreateJob.kt b/kotlin/services/mediaconvert/src/main/kotlin/com/kotlin/mediaconvert/CreateJob.kt index 346f84dea07..2ba637c7754 100644 --- a/kotlin/services/mediaconvert/src/main/kotlin/com/kotlin/mediaconvert/CreateJob.kt +++ b/kotlin/services/mediaconvert/src/main/kotlin/com/kotlin/mediaconvert/CreateJob.kt @@ -138,7 +138,7 @@ suspend fun main(args: Array) { suspend fun createMediaJob( mcClient: MediaConvertClient, mcRoleARN: String, - fileInputVal: String + fileInputVal: String, ): String? { val s3path = fileInputVal.substring(0, fileInputVal.lastIndexOf('/') + 1) + "javasdk/out/" val fileOutput = s3path + "index" @@ -304,7 +304,7 @@ suspend fun createMediaJob( audioDescriptionBroadcasterMix = AacAudioDescriptionBroadcasterMix.Normal } } - } + }, ) } @@ -368,7 +368,7 @@ suspend fun createMediaJob( } } } - } + }, ) } @@ -399,7 +399,7 @@ suspend fun createMediaJob( fileInput = fileInputVal outputGroups = listOf(appleHLS, thumbs, fileMp4) - } + }, ) } @@ -425,7 +425,7 @@ fun createOutput( qvbrQualityLevelVal: Int, originWidth: Int, originHeight: Int, - targetWidth: Int + targetWidth: Int, ): Output? { val targetHeight = ( (originHeight * targetWidth / originWidth).toFloat().roundToInt() - diff --git a/kotlin/services/mediaconvert/src/main/kotlin/com/kotlin/mediaconvert/GetJob.kt b/kotlin/services/mediaconvert/src/main/kotlin/com/kotlin/mediaconvert/GetJob.kt index a19e699f7ce..53b3357fba5 100644 --- a/kotlin/services/mediaconvert/src/main/kotlin/com/kotlin/mediaconvert/GetJob.kt +++ b/kotlin/services/mediaconvert/src/main/kotlin/com/kotlin/mediaconvert/GetJob.kt @@ -41,7 +41,7 @@ suspend fun main(args: Array) { // snippet-start:[mediaconvert.kotlin.get_job.main] suspend fun getSpecificJob( mcClient: MediaConvertClient, - jobId: String? + jobId: String?, ) { val describeEndpoints = DescribeEndpointsRequest { diff --git a/kotlin/services/mediastore/build.gradle.kts b/kotlin/services/mediastore/build.gradle.kts index ca4906a15b8..6a2b24d1874 100644 --- a/kotlin/services/mediastore/build.gradle.kts +++ b/kotlin/services/mediastore/build.gradle.kts @@ -32,7 +32,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/opensearch/build.gradle.kts b/kotlin/services/opensearch/build.gradle.kts index 756f48997a9..a5ba54dcddd 100644 --- a/kotlin/services/opensearch/build.gradle.kts +++ b/kotlin/services/opensearch/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { implementation("com.fasterxml.jackson.core:jackson-databind:2.14.2") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/personalize/build.gradle.kts b/kotlin/services/personalize/build.gradle.kts index 29de3707ca9..8605242f23c 100644 --- a/kotlin/services/personalize/build.gradle.kts +++ b/kotlin/services/personalize/build.gradle.kts @@ -36,7 +36,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/personalize/src/main/kotlin/com/kotlin/personalize/CreateCampaign.kt b/kotlin/services/personalize/src/main/kotlin/com/kotlin/personalize/CreateCampaign.kt index 8e206b98fb9..ae49f335b2c 100644 --- a/kotlin/services/personalize/src/main/kotlin/com/kotlin/personalize/CreateCampaign.kt +++ b/kotlin/services/personalize/src/main/kotlin/com/kotlin/personalize/CreateCampaign.kt @@ -41,7 +41,7 @@ suspend fun main(args: Array) { // snippet-start:[personalize.kotlin.create_campaign.main] suspend fun createPersonalCompaign( solutionVersionArnVal: String?, - campaignName: String? + campaignName: String?, ): String? { val request = CreateCampaignRequest { diff --git a/kotlin/services/personalize/src/main/kotlin/com/kotlin/personalize/CreateSolution.kt b/kotlin/services/personalize/src/main/kotlin/com/kotlin/personalize/CreateSolution.kt index a65a8db2724..6abef71a3d0 100644 --- a/kotlin/services/personalize/src/main/kotlin/com/kotlin/personalize/CreateSolution.kt +++ b/kotlin/services/personalize/src/main/kotlin/com/kotlin/personalize/CreateSolution.kt @@ -44,7 +44,7 @@ suspend fun main(args: Array) { suspend fun createPersonalizeSolution( datasetGroupArnVal: String?, solutionName: String?, - recipeArnVal: String? + recipeArnVal: String?, ): String? { val request = CreateSolutionRequest { diff --git a/kotlin/services/personalize/src/main/kotlin/com/kotlin/personalize/GetRecommendations.kt b/kotlin/services/personalize/src/main/kotlin/com/kotlin/personalize/GetRecommendations.kt index a6002c300a9..8996b9f3a0a 100644 --- a/kotlin/services/personalize/src/main/kotlin/com/kotlin/personalize/GetRecommendations.kt +++ b/kotlin/services/personalize/src/main/kotlin/com/kotlin/personalize/GetRecommendations.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[personalize.kotlin.get_recommendations.main] suspend fun getRecs( campaignArnVal: String?, - userIdVal: String? + userIdVal: String?, ) { val request = GetRecommendationsRequest { diff --git a/kotlin/services/pinpoint/build.gradle.kts b/kotlin/services/pinpoint/build.gradle.kts index eb100c3161f..5b08a81f4d8 100644 --- a/kotlin/services/pinpoint/build.gradle.kts +++ b/kotlin/services/pinpoint/build.gradle.kts @@ -37,7 +37,7 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") implementation("com.google.code.gson:gson:2.10.1") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/AddExampleEndpoint.kt b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/AddExampleEndpoint.kt index c8eba6da8bb..1df10604e99 100644 --- a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/AddExampleEndpoint.kt +++ b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/AddExampleEndpoint.kt @@ -80,7 +80,7 @@ suspend fun updateEndpointsViaBatch(applicationIdVal: String?) { UpdateEndpointsBatchRequest { applicationId = applicationIdVal endpointBatchRequest = endpointList - } + }, ) println("Update endpoint result ${result.messageBody?.message}") } diff --git a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/CreateApp.kt b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/CreateApp.kt index c20cb9f3ba8..e009b929a0f 100644 --- a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/CreateApp.kt +++ b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/CreateApp.kt @@ -48,7 +48,7 @@ suspend fun createApplication(applicationName: String?): String? { pinpoint.createApp( CreateAppRequest { createApplicationRequest = createApplicationRequestOb - } + }, ) return result.applicationResponse?.id } diff --git a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/CreateCampaign.kt b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/CreateCampaign.kt index eacf0cf9f2c..7ee07fac9b3 100644 --- a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/CreateCampaign.kt +++ b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/CreateCampaign.kt @@ -45,7 +45,7 @@ suspend fun main(args: Array) { // snippet-start:[pinpoint.kotlin.createcampaign.main] suspend fun createPinCampaign( appId: String, - segmentIdVal: String + segmentIdVal: String, ) { val scheduleOb = Schedule { @@ -79,7 +79,7 @@ suspend fun createPinCampaign( CreateCampaignRequest { applicationId = appId writeCampaignRequest = writeCampaign - } + }, ) println("Campaign ID is ${result.campaignResponse?.id}") } diff --git a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/CreateSegment.kt b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/CreateSegment.kt index a9f63b82fc3..481fb65abf1 100644 --- a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/CreateSegment.kt +++ b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/CreateSegment.kt @@ -90,7 +90,7 @@ suspend fun createPinpointSegment(applicationIdVal: String?): String? { CreateSegmentRequest { applicationId = applicationIdVal writeSegmentRequest = writeSegmentRequestOb - } + }, ) println("Segment ID is ${createSegmentResult.segmentResponse?.id}") return createSegmentResult.segmentResponse?.id diff --git a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/DeleteApp.kt b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/DeleteApp.kt index 4a2360096b9..4b793f61b14 100644 --- a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/DeleteApp.kt +++ b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/DeleteApp.kt @@ -41,7 +41,7 @@ suspend fun deletePinApp(appId: String?) { pinpoint.deleteApp( DeleteAppRequest { applicationId = appId - } + }, ) val appName = result.applicationResponse?.name println("Application $appName has been deleted.") diff --git a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/DeleteEndpoint.kt b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/DeleteEndpoint.kt index de3932642f2..553e63185ea 100644 --- a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/DeleteEndpoint.kt +++ b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/DeleteEndpoint.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[pinpoint.kotlin.deleteendpoint.main] suspend fun deletePinEncpoint( appIdVal: String?, - endpointIdVal: String? + endpointIdVal: String?, ) { val deleteEndpointRequest = DeleteEndpointRequest { diff --git a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/ListEndpointIds.kt b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/ListEndpointIds.kt index c777ca80bbf..d37c47aed3f 100644 --- a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/ListEndpointIds.kt +++ b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/ListEndpointIds.kt @@ -38,7 +38,7 @@ suspend fun main(args: Array) { suspend fun listAllEndpoints( applicationIdVal: String?, - userIdVal: String? + userIdVal: String?, ) { PinpointClient { region = "us-east-1" }.use { pinpoint -> @@ -47,7 +47,7 @@ suspend fun listAllEndpoints( GetUserEndpointsRequest { userId = userIdVal applicationId = applicationIdVal - } + }, ) response.endpointsResponse?.item?.forEach { endpoint -> println("The channel type is ${endpoint.channelType}") diff --git a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/ListSegments.kt b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/ListSegments.kt index d1639ae2550..d7f91695213 100644 --- a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/ListSegments.kt +++ b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/ListSegments.kt @@ -41,7 +41,7 @@ suspend fun listSegs(appId: String?) { pinpoint.getSegments( GetSegmentsRequest { applicationId = appId - } + }, ) response.segmentsResponse?.item?.forEach { segment -> println("Segement id is ${segment.id}") diff --git a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/LookUpEndpoint.kt b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/LookUpEndpoint.kt index 7cc96e39f2b..11c82d6bd21 100644 --- a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/LookUpEndpoint.kt +++ b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/LookUpEndpoint.kt @@ -40,7 +40,7 @@ suspend fun main(args: Array) { // snippet-start:[pinpoint.kotlin.lookup.main] suspend fun lookupPinpointEndpoint( appId: String?, - endpoint: String? + endpoint: String?, ) { PinpointClient { region = "us-west-2" }.use { pinpoint -> val result = @@ -48,7 +48,7 @@ suspend fun lookupPinpointEndpoint( GetEndpointRequest { applicationId = appId endpointId = endpoint - } + }, ) val endResponse = result.endpointResponse diff --git a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/SendEmailMessage.kt b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/SendEmailMessage.kt index b1c05eb2bdc..29507295134 100644 --- a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/SendEmailMessage.kt +++ b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/SendEmailMessage.kt @@ -57,7 +57,7 @@ suspend fun main(args: Array) { suspend fun sendEmail( subjectVal: String?, senderAddress: String, - toAddressVal: String + toAddressVal: String, ) { var content = Content { diff --git a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/SendMessage.kt b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/SendMessage.kt index de0544b11b6..d4490d20193 100644 --- a/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/SendMessage.kt +++ b/kotlin/services/pinpoint/src/main/kotlin/com/kotlin/pinpoint/SendMessage.kt @@ -52,7 +52,7 @@ suspend fun sendSMSMessage( message: String, appId: String, originationNumberVal: String, - destinationNumberVal: String + destinationNumberVal: String, ) { // The type of SMS message that you want to send. If you plan to send // time-sensitive content, specify TRANSACTIONAL. If you plan to send @@ -99,7 +99,7 @@ suspend fun sendSMSMessage( SendMessagesRequest { applicationId = appId messageRequest = msgReq - } + }, ) println("The SMS message was successfully sent to $destinationNumberVal") } diff --git a/kotlin/services/polly/build.gradle.kts b/kotlin/services/polly/build.gradle.kts index 81c5ffcaab6..8564452b663 100644 --- a/kotlin/services/polly/build.gradle.kts +++ b/kotlin/services/polly/build.gradle.kts @@ -34,7 +34,7 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") implementation("com.googlecode.soundlibs:jlayer:1.0.1.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/polly/src/main/kotlin/com/kotlin/polly/DescribeVoices.kt b/kotlin/services/polly/src/main/kotlin/com/kotlin/polly/DescribeVoices.kt index 912e1eec947..153b390f721 100644 --- a/kotlin/services/polly/src/main/kotlin/com/kotlin/polly/DescribeVoices.kt +++ b/kotlin/services/polly/src/main/kotlin/com/kotlin/polly/DescribeVoices.kt @@ -28,7 +28,7 @@ suspend fun describeVoice() { polly.describeVoices( DescribeVoicesRequest { languageCode = LanguageCode.fromValue("en-US") - } + }, ) val voices = enUsVoicesResult.voices if (voices != null) { diff --git a/kotlin/services/polly/src/main/kotlin/com/kotlin/polly/PollyDemo.kt b/kotlin/services/polly/src/main/kotlin/com/kotlin/polly/PollyDemo.kt index f82937cc530..57fed55050b 100644 --- a/kotlin/services/polly/src/main/kotlin/com/kotlin/polly/PollyDemo.kt +++ b/kotlin/services/polly/src/main/kotlin/com/kotlin/polly/PollyDemo.kt @@ -48,7 +48,7 @@ suspend fun talkPolly() { text = sample voiceId = voice?.id outputFormat = OutputFormat.Mp3 - } + }, ) { resp -> // inside this block you can access `resp` and play the audio stream. diff --git a/kotlin/services/rds/build.gradle.kts b/kotlin/services/rds/build.gradle.kts index df0d1640ed4..2f966f33191 100644 --- a/kotlin/services/rds/build.gradle.kts +++ b/kotlin/services/rds/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } tasks.test { diff --git a/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/AuroraScenario.kt b/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/AuroraScenario.kt index 3fa12cb3c37..3988c3ff92b 100644 --- a/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/AuroraScenario.kt +++ b/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/AuroraScenario.kt @@ -154,7 +154,7 @@ suspend fun main(args: Array) { @Throws(InterruptedException::class) suspend fun deleteDBClusterGroup( dbClusterGroupName: String, - clusterDBARN: String + clusterDBARN: String, ) { var isDataDel = false var didFind: Boolean @@ -230,7 +230,7 @@ suspend fun deleteDBInstance(dbInstanceIdentifierVal: String) { // snippet-start:[rds.kotlin.scenario.cluster.wait.snapshot.main] suspend fun waitSnapshotReady( dbSnapshotIdentifier: String?, - dbInstanceClusterIdentifier: String? + dbInstanceClusterIdentifier: String?, ) { var snapshotReady = false var snapshotReadyStr: String @@ -266,7 +266,7 @@ suspend fun waitSnapshotReady( // snippet-start:[rds.kotlin.scenario.cluster.create.snapshot.main] suspend fun createDBClusterSnapshot( dbInstanceClusterIdentifier: String?, - dbSnapshotIdentifier: String? + dbSnapshotIdentifier: String?, ) { val snapshotRequest = CreateDbClusterSnapshotRequest { @@ -315,7 +315,7 @@ suspend fun waitDBAuroraInstanceReady(dbInstanceIdentifierVal: String?) { suspend fun createDBInstanceCluster( dbInstanceIdentifierVal: String?, dbInstanceClusterIdentifierVal: String?, - instanceClassVal: String? + instanceClassVal: String?, ): String? { val instanceRequest = CreateDbInstanceRequest { @@ -389,7 +389,7 @@ suspend fun createDBCluster( dbName: String?, dbClusterIdentifierVal: String?, userName: String?, - password: String? + password: String?, ): String? { val clusterRequest = CreateDbClusterRequest { @@ -455,7 +455,7 @@ suspend fun modifyDBClusterParas(dClusterGroupName: String?) { // snippet-start:[rds.kotlin.scenario.des.params.main] suspend fun describeDbClusterParameters( dbCLusterGroupName: String?, - flag: Int + flag: Int, ) { val dbParameterGroupsRequest: DescribeDbClusterParametersRequest dbParameterGroupsRequest = @@ -510,7 +510,7 @@ suspend fun describeDbClusterParameterGroups(dbClusterGroupName: String?) { // snippet-start:[rds.kotlin.scenario.create.params.groups.main] suspend fun createDBClusterParameterGroup( dbClusterGroupNameVal: String?, - dbParameterGroupFamilyVal: String? + dbParameterGroupFamilyVal: String?, ) { val groupRequest = CreateDbClusterParameterGroupRequest { diff --git a/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/CreateDBInstance.kt b/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/CreateDBInstance.kt index 82946aefaf9..ef51764c66f 100644 --- a/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/CreateDBInstance.kt +++ b/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/CreateDBInstance.kt @@ -57,7 +57,7 @@ suspend fun createDatabaseInstance( dbInstanceIdentifierVal: String?, dbNamedbVal: String?, masterUsernameVal: String?, - masterUserPasswordVal: String? + masterUserPasswordVal: String?, ) { val instanceRequest = CreateDbInstanceRequest { diff --git a/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/CreateDBSnapshot.kt b/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/CreateDBSnapshot.kt index 5cd43a761ab..8a6cf286d60 100644 --- a/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/CreateDBSnapshot.kt +++ b/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/CreateDBSnapshot.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[rds.kotlin.create_snap.main] suspend fun createSnapshot( dbInstanceIdentifierVal: String?, - dbSnapshotIdentifierVal: String? + dbSnapshotIdentifierVal: String?, ) { val snapshotRequest = CreateDbSnapshotRequest { diff --git a/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/ModifyDBInstance.kt b/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/ModifyDBInstance.kt index 340c328786b..37226b63bc6 100644 --- a/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/ModifyDBInstance.kt +++ b/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/ModifyDBInstance.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[rds.kotlin.modify_instance.main] suspend fun updateIntance( dbInstanceIdentifierVal: String?, - masterUserPasswordVal: String? + masterUserPasswordVal: String?, ) { val request = ModifyDbInstanceRequest { diff --git a/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/RDSScenario.kt b/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/RDSScenario.kt index 1f452531cae..9a2d63e85f5 100644 --- a/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/RDSScenario.kt +++ b/kotlin/services/rds/src/main/kotlin/com/kotlin/rds/RDSScenario.kt @@ -142,7 +142,7 @@ suspend fun main(args: Array) { // snippet-start:[rds.kotlin.scenario.del_paragroup.main] suspend fun deleteParaGroup( dbGroupName: String, - dbARN: String + dbARN: String, ) { var isDataDel = false var didFind: Boolean @@ -204,7 +204,7 @@ suspend fun deleteDbInstance(dbInstanceIdentifierVal: String) { // Waits until the snapshot instance is available. suspend fun waitForSnapshotReady( dbInstanceIdentifierVal: String?, - dbSnapshotIdentifierVal: String? + dbSnapshotIdentifierVal: String?, ) { var snapshotReady = false var snapshotReadyStr: String @@ -241,7 +241,7 @@ suspend fun waitForSnapshotReady( // Create an Amazon RDS snapshot. suspend fun createDbSnapshot( dbInstanceIdentifierVal: String?, - dbSnapshotIdentifierVal: String? + dbSnapshotIdentifierVal: String?, ) { val snapshotRequest = CreateDbSnapshotRequest { @@ -297,7 +297,7 @@ suspend fun createDatabaseInstance( dbInstanceIdentifierVal: String?, dbNameVal: String?, masterUsernameVal: String?, - masterUserPasswordVal: String? + masterUserPasswordVal: String?, ): String? { val instanceRequest = CreateDbInstanceRequest { @@ -391,7 +391,7 @@ suspend fun modifyDBParas(dbGroupName: String) { // Retrieve parameters in the group. suspend fun describeDbParameters( dbGroupName: String?, - flag: Int + flag: Int, ) { val dbParameterGroupsRequest: DescribeDbParametersRequest dbParameterGroupsRequest = @@ -450,7 +450,7 @@ suspend fun describeDbParameterGroups(dbGroupName: String?) { // Create a parameter group. suspend fun createDBParameterGroup( dbGroupName: String?, - dbParameterGroupFamilyVal: String? + dbParameterGroupFamilyVal: String?, ) { val groupRequest = CreateDbParameterGroupRequest { diff --git a/kotlin/services/rds/src/test/kotlin/RDSTest.kt b/kotlin/services/rds/src/test/kotlin/RDSTest.kt index 570d0c89b8a..d7d6d7f7833 100644 --- a/kotlin/services/rds/src/test/kotlin/RDSTest.kt +++ b/kotlin/services/rds/src/test/kotlin/RDSTest.kt @@ -191,7 +191,7 @@ class RDSTest { dbInstanceIdentifierSc, dbNameSc, masterUsername, - masterUserPassword + masterUserPassword, ) println("The ARN of the new database is $dbARN") diff --git a/kotlin/services/redshift/build.gradle.kts b/kotlin/services/redshift/build.gradle.kts index 65a2a627018..d3d4f953fad 100644 --- a/kotlin/services/redshift/build.gradle.kts +++ b/kotlin/services/redshift/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/redshift/src/main/kotlin/com/kotlin/redshift/CreateAndModifyCluster.kt b/kotlin/services/redshift/src/main/kotlin/com/kotlin/redshift/CreateAndModifyCluster.kt index 3fbf9e5e7f7..ca0ccae9fb1 100644 --- a/kotlin/services/redshift/src/main/kotlin/com/kotlin/redshift/CreateAndModifyCluster.kt +++ b/kotlin/services/redshift/src/main/kotlin/com/kotlin/redshift/CreateAndModifyCluster.kt @@ -57,7 +57,7 @@ suspend fun main(args: Array) { suspend fun createCluster( clusterId: String?, masterUsernameVal: String?, - masterUserPasswordVal: String? + masterUserPasswordVal: String?, ) { val clusterRequest = CreateClusterRequest { @@ -120,7 +120,7 @@ suspend fun modifyCluster(clusterId: String?) { RedshiftClient { region = "us-west-2" }.use { redshiftClient -> val clusterResponse = redshiftClient.modifyCluster(modifyClusterRequest) println( - "The modified cluster was successfully modified and has ${clusterResponse.cluster?.preferredMaintenanceWindow} as the maintenance window" + "The modified cluster was successfully modified and has ${clusterResponse.cluster?.preferredMaintenanceWindow} as the maintenance window", ) } } diff --git a/kotlin/services/redshift/src/main/kotlin/com/kotlin/redshift/ListEvents.kt b/kotlin/services/redshift/src/main/kotlin/com/kotlin/redshift/ListEvents.kt index 9ffb680ae15..edde917b432 100644 --- a/kotlin/services/redshift/src/main/kotlin/com/kotlin/redshift/ListEvents.kt +++ b/kotlin/services/redshift/src/main/kotlin/com/kotlin/redshift/ListEvents.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[redshift.kotlin._events.main] suspend fun listRedShiftEvents( clusterId: String?, - eventSourceType: String + eventSourceType: String, ) { val request = DescribeEventsRequest { diff --git a/kotlin/services/redshift/src/test/kotlin/RedshiftKotlinTest.kt b/kotlin/services/redshift/src/test/kotlin/RedshiftKotlinTest.kt index 4fc4ac52519..c5eb7d963ec 100644 --- a/kotlin/services/redshift/src/test/kotlin/RedshiftKotlinTest.kt +++ b/kotlin/services/redshift/src/test/kotlin/RedshiftKotlinTest.kt @@ -68,7 +68,7 @@ class RedshiftKotlinTest { com.kotlin.redshift .getSecretValues(secretName) .toString(), - User::class.java + User::class.java, ) val username = user.username val userPassword = user.password diff --git a/kotlin/services/rekognition/build.gradle.kts b/kotlin/services/rekognition/build.gradle.kts index b44199b78a9..621ba57b5af 100644 --- a/kotlin/services/rekognition/build.gradle.kts +++ b/kotlin/services/rekognition/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" kotlinOptions.freeCompilerArgs += "-Xlint:-deprecation" } diff --git a/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/AddFacesToCollection.kt b/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/AddFacesToCollection.kt index 60073869593..a6bf7ec22b2 100644 --- a/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/AddFacesToCollection.kt +++ b/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/AddFacesToCollection.kt @@ -42,7 +42,7 @@ suspend fun main(args: Array) { // snippet-start:[rekognition.kotlin.add_faces_collection.main] suspend fun addToCollection( collectionIdVal: String?, - sourceImage: String + sourceImage: String, ) { val souImage = Image { diff --git a/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/CompareFaces.kt b/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/CompareFaces.kt index 8017004d9af..77e27c57ed9 100644 --- a/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/CompareFaces.kt +++ b/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/CompareFaces.kt @@ -43,7 +43,7 @@ suspend fun main(args: Array) { suspend fun compareTwoFaces( similarityThresholdVal: Float, sourceImageVal: String, - targetImageVal: String + targetImageVal: String, ) { val sourceBytes = (File(sourceImageVal).readBytes()) val targetBytes = (File(targetImageVal).readBytes()) diff --git a/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/DeleteFacesFromCollection.kt b/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/DeleteFacesFromCollection.kt index 86fac09ee37..9420b55ed9f 100644 --- a/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/DeleteFacesFromCollection.kt +++ b/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/DeleteFacesFromCollection.kt @@ -37,7 +37,7 @@ suspend fun main(args: Array) { // snippet-start:[rekognition.kotlin.delete_faces_collection.main] suspend fun deleteFacesCollection( collectionIdVal: String?, - faceIdVal: String + faceIdVal: String, ) { val deleteFacesRequest = DeleteFacesRequest { diff --git a/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/DetectPPE.kt b/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/DetectPPE.kt index 143f341ef6f..8da51c9ab81 100644 --- a/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/DetectPPE.kt +++ b/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/DetectPPE.kt @@ -81,7 +81,7 @@ suspend fun displayGear(sourceImage: String) { for (item: EquipmentDetection in equipmentDetections) { println("Item ${item.type} - confidence: ${item.confidence}") println( - "Covers body part: ${item.coversBodyPart?.value} - confidence is ${item.coversBodyPart?.confidence}" + "Covers body part: ${item.coversBodyPart?.value} - confidence is ${item.coversBodyPart?.confidence}", ) println("\t\tBounding Box") val box = item.boundingBox diff --git a/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/VideoDetectFaces.kt b/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/VideoDetectFaces.kt index 03e9ef1e867..68073d965da 100644 --- a/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/VideoDetectFaces.kt +++ b/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/VideoDetectFaces.kt @@ -63,7 +63,7 @@ suspend fun main(args: Array) { suspend fun startFaceDetection( channelVal: NotificationChannel?, bucketVal: String, - videoVal: String + videoVal: String, ) { val s3Obj = S3Object { diff --git a/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/VideoDetectInappropriate.kt b/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/VideoDetectInappropriate.kt index 0f25087367a..1d86649ab7d 100644 --- a/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/VideoDetectInappropriate.kt +++ b/kotlin/services/rekognition/src/main/kotlin/com/kotlin/rekognition/VideoDetectInappropriate.kt @@ -63,7 +63,7 @@ suspend fun main(args: Array) { suspend fun startModerationDetection( channel: NotificationChannel?, bucketVal: String?, - videoVal: String? + videoVal: String?, ) { val s3Obj = S3Object { diff --git a/kotlin/services/route53/build.gradle.kts b/kotlin/services/route53/build.gradle.kts index 884239348c1..51f7ca26de0 100644 --- a/kotlin/services/route53/build.gradle.kts +++ b/kotlin/services/route53/build.gradle.kts @@ -37,7 +37,7 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" kotlinOptions.freeCompilerArgs += "-Xlint:-deprecation" } diff --git a/kotlin/services/route53/src/main/kotlin/com/kotlin/route/Route53Scenario.kt b/kotlin/services/route53/src/main/kotlin/com/kotlin/route/Route53Scenario.kt index 7f96d54e479..fdd800b6eb8 100644 --- a/kotlin/services/route53/src/main/kotlin/com/kotlin/route/Route53Scenario.kt +++ b/kotlin/services/route53/src/main/kotlin/com/kotlin/route/Route53Scenario.kt @@ -172,7 +172,7 @@ suspend fun requestDomainRegistration( emailVal: String?, firstNameVal: String?, lastNameVal: String?, - cityVal: String? + cityVal: String?, ): String? { val contactDetail = ContactDetail { diff --git a/kotlin/services/s3/build.gradle.kts b/kotlin/services/s3/build.gradle.kts index 2de9cc7ffab..2de9daf041a 100644 --- a/kotlin/services/s3/build.gradle.kts +++ b/kotlin/services/s3/build.gradle.kts @@ -48,7 +48,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" kotlinOptions.freeCompilerArgs += "-Xlint:-deprecation" } diff --git a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/CopyObject.kt b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/CopyObject.kt index 15255a03f24..facfba60cd2 100644 --- a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/CopyObject.kt +++ b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/CopyObject.kt @@ -46,7 +46,7 @@ suspend fun main(args: Array) { suspend fun copyBucketObject( fromBucket: String, objectKey: String, - toBucket: String + toBucket: String, ) { var encodedUrl = "" try { diff --git a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/DeleteObjects.kt b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/DeleteObjects.kt index 22533e16957..02e68e9a6b3 100644 --- a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/DeleteObjects.kt +++ b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/DeleteObjects.kt @@ -41,7 +41,7 @@ suspend fun main(args: Array) { // snippet-start:[s3.kotlin.delete_objects.main] suspend fun deleteBucketObjects( bucketName: String, - objectName: String + objectName: String, ) { val objectId = ObjectIdentifier { diff --git a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/GetAcl.kt b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/GetAcl.kt index 1dc5e87ad62..d35dfda1034 100644 --- a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/GetAcl.kt +++ b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/GetAcl.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[s3.kotlin.get_acl.main] suspend fun getBucketACL( objectKey: String, - bucketName: String + bucketName: String, ) { val request = GetObjectAclRequest { diff --git a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/GetObjectData.kt b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/GetObjectData.kt index 520c7ff6101..2efbc7f8ac0 100644 --- a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/GetObjectData.kt +++ b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/GetObjectData.kt @@ -44,7 +44,7 @@ suspend fun main(args: Array) { suspend fun getObjectBytes( bucketName: String, keyName: String, - path: String + path: String, ) { val request = GetObjectRequest { diff --git a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/MrapExample.kt b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/MrapExample.kt index 510b05a6e67..f432f64b523 100644 --- a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/MrapExample.kt +++ b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/MrapExample.kt @@ -76,7 +76,7 @@ class MrapExample { accountIdParam: String, bucketName1: String, bucketName2: String, - mrapName: String + mrapName: String, ): String { println("Creating MRAP ...") val createMrapResponse: CreateMultiRegionAccessPointResponse = @@ -91,7 +91,7 @@ class MrapExample { }, Region { bucket = bucketName2 - } + }, ) } } @@ -108,7 +108,7 @@ class MrapExample { input = GetMultiRegionAccessPointRequest { accountId = accountIdParam name = mrapName - } + }, ) val mrapAlias = getMrapResponse.accessPoint?.alias return "arn:aws:s3::$accountIdParam:accesspoint/$mrapAlias" @@ -119,7 +119,7 @@ class MrapExample { suspend fun deleteMrap( s3Control: S3ControlClient, accountIdParam: String, - mrapName: String + mrapName: String, ) { println("Deleting MRAP ...") val deleteMrapResponse: DeleteMultiRegionAccessPointResponse = @@ -129,7 +129,7 @@ class MrapExample { details { name = mrapName } - } + }, ) val requestToken: String? = deleteMrapResponse.requestTokenArn @@ -146,7 +146,7 @@ class MrapExample { s3: S3Client, mrapArn: String, keyName: String, - stringToPut: String + stringToPut: String, ) { s3.putObject { bucket = mrapArn @@ -165,7 +165,7 @@ class MrapExample { suspend fun getObjectFromMrap( s3: S3Client, mrapArn: String, - keyName: String + keyName: String, ): String? { val request = GetObjectRequest { bucket = mrapArn // Use the ARN instead of the bucket name for object operations. @@ -187,7 +187,7 @@ class MrapExample { suspend fun deleteObjectUsingMrap( s3: S3Client, mrapArn: String, - keyName: String + keyName: String, ) { s3.deleteObject { bucket = mrapArn @@ -227,14 +227,14 @@ class MrapExample { suspend fun setUpTwoBuckets( s3: S3Client, bucketName1: String, - bucketName2: String + bucketName2: String, ) { println("Create two buckets in different regions.") // The shared aws config file configures the default Region to be us-east-1. s3.createBucket( CreateBucketRequest { bucket = bucketName1 - } + }, ) s3.waitUntilBucketExists { bucket = bucketName1 @@ -251,7 +251,7 @@ class MrapExample { createBucketConfiguration = CreateBucketConfiguration { locationConstraint = BucketLocationConstraint.UsWest1 } - } + }, ) s3West.waitUntilBucketExists { bucket = bucketName2 @@ -273,14 +273,14 @@ class MrapExample { s3Control: S3ControlClient, requestToken: String, accountIdParam: String, - timeBetweenChecks: Duration = 1.minutes + timeBetweenChecks: Duration = 1.minutes, ) { var describeResponse: DescribeMultiRegionAccessPointOperationResponse describeResponse = s3Control.describeMultiRegionAccessPointOperation( input = DescribeMultiRegionAccessPointOperationRequest { accountId = accountIdParam requestTokenArn = requestToken - } + }, ) var status: String? = describeResponse.asyncOperation?.requestStatus @@ -290,7 +290,7 @@ class MrapExample { input = DescribeMultiRegionAccessPointOperationRequest { accountId = accountIdParam requestTokenArn = requestToken - } + }, ) status = describeResponse.asyncOperation?.requestStatus println(status) @@ -301,7 +301,7 @@ class MrapExample { suspend fun cleanupBuckets( s3: S3Client, bucketName1: String, - bucketName2: String + bucketName2: String, ) { s3.deleteBucket { bucket = bucketName1 } s3.waitUntilBucketNotExists { bucket = bucketName1 } diff --git a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/PresigningExamples.kt b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/PresigningExamples.kt index 38ac783f6ae..9c8b1c7b935 100644 --- a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/PresigningExamples.kt +++ b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/PresigningExamples.kt @@ -62,7 +62,7 @@ fun main(): Unit = suspend fun getObjectPresigned( s3: S3Client, bucketName: String, - keyName: String + keyName: String, ): String { // Create a GetObjectRequest. val unsignedRequest = @@ -86,7 +86,7 @@ suspend fun putObjectPresigned( s3: S3Client, bucketName: String, keyName: String, - content: String + content: String, ) { // Create a PutObjectRequest. val unsignedRequest = @@ -120,7 +120,7 @@ suspend fun putObjectPresigned( suspend fun getObjectPresignedMoreOptions( s3: S3Client, bucketName: String, - keyName: String + keyName: String, ): HttpRequest { // Create a GetObjectRequest. val unsignedRequest = @@ -143,19 +143,19 @@ suspend fun getObjectPresignedMoreOptions( suspend fun cleanup( s3: S3Client, - bucketName: String + bucketName: String, ) { deleteBucket(s3, bucketName) } suspend fun deleteBucket( s3: S3Client, - bucketName: String + bucketName: String, ) { s3.deleteBucket( DeleteBucketRequest { bucket = bucketName - } + }, ) s3.waitUntilBucketNotExists { bucket = bucketName } @@ -164,13 +164,13 @@ suspend fun deleteBucket( suspend fun deleteObject( s3: S3Client, bucketName: String, - keyName: String + keyName: String, ) { s3.deleteObject( DeleteObjectRequest { bucket = bucketName key = keyName - } + }, ) s3.waitUntilObjectNotExists { @@ -181,12 +181,12 @@ suspend fun deleteObject( suspend fun setUp( s3: S3Client, - bucketName: String + bucketName: String, ) { s3.createBucket( CreateBucketRequest { bucket = bucketName - } + }, ) s3.waitUntilBucketExists { bucket = bucketName } } @@ -195,14 +195,14 @@ suspend fun putObject( s3: S3Client, bucketName: String, keyName: String, - contents: String + contents: String, ) { s3.putObject( PutObjectRequest { bucket = bucketName key = keyName body = ByteStream.fromString(contents) - } + }, ) s3.waitUntilObjectExists { bucket = bucketName diff --git a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/PutObject.kt b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/PutObject.kt index eb1eabfaee5..c61dad5903d 100644 --- a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/PutObject.kt +++ b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/PutObject.kt @@ -44,7 +44,7 @@ suspend fun main(args: Array) { suspend fun putS3Object( bucketName: String, objectKey: String, - objectPath: String + objectPath: String, ) { val metadataVal = mutableMapOf() metadataVal["myVal"] = "test" diff --git a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/S3Operations.kt b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/S3Operations.kt index 4bf6397d17c..70047cca78e 100644 --- a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/S3Operations.kt +++ b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/S3Operations.kt @@ -95,7 +95,7 @@ suspend fun createBucket(bucketName: String) { suspend fun putObject( bucketName: String, objectKey: String, - objectPath: String + objectPath: String, ) { val metadataVal = mutableMapOf() metadataVal["myVal"] = "test" @@ -117,7 +117,7 @@ suspend fun putObject( suspend fun getObjectFromMrap( bucketName: String, keyName: String, - path: String + path: String, ) { val request = GetObjectRequest { @@ -153,7 +153,7 @@ suspend fun listBucketObs(bucketName: String) { suspend fun copyBucketOb( fromBucket: String, objectKey: String, - toBucket: String + toBucket: String, ) { var encodedUrl = "" try { @@ -175,7 +175,7 @@ suspend fun copyBucketOb( suspend fun deleteBucketObs( bucketName: String, - objectName: String + objectName: String, ) { val objectId = ObjectIdentifier { diff --git a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/SetAcl.kt b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/SetAcl.kt index ab46c987ae6..30875402211 100644 --- a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/SetAcl.kt +++ b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/SetAcl.kt @@ -45,7 +45,7 @@ suspend fun main(args: Array) { // snippet-start:[s3.kotlin.set_acl.main] suspend fun setBucketAcl( bucketName: String, - idVal: String + idVal: String, ) { val myGrant = Grantee { diff --git a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/SetBucketPolicy.kt b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/SetBucketPolicy.kt index 6c23e0e9db2..6d4a85766c0 100644 --- a/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/SetBucketPolicy.kt +++ b/kotlin/services/s3/src/main/kotlin/com/kotlin/s3/SetBucketPolicy.kt @@ -43,7 +43,7 @@ suspend fun main(args: Array) { // snippet-start:[s3.kotlin.set_bucket_policy.main] suspend fun setPolicy( bucketName: String, - polText: String + polText: String, ) { val policyText = getBucketPolicyFromFile(polText) println("Setting policy:") @@ -71,7 +71,7 @@ fun getBucketPolicyFromFile(policyFile: String): String { val lines = Files.readAllLines( Paths.get(policyFile), - Charset.forName("UTF-8") + Charset.forName("UTF-8"), ) for (line in lines) { fileText.append(line) diff --git a/kotlin/services/s3/src/test/kotlin/com/kotlin/s3/PresignTests.kt b/kotlin/services/s3/src/test/kotlin/com/kotlin/s3/PresignTests.kt index a51a9533c50..f6f186e8d14 100644 --- a/kotlin/services/s3/src/test/kotlin/com/kotlin/s3/PresignTests.kt +++ b/kotlin/services/s3/src/test/kotlin/com/kotlin/s3/PresignTests.kt @@ -79,7 +79,7 @@ class PresignTests { GetObjectRequest { bucket = bucketName key = keyName - } + }, ) { resp -> val respString = resp.body?.decodeToString() respString diff --git a/kotlin/services/sagemaker/build.gradle.kts b/kotlin/services/sagemaker/build.gradle.kts index ce3425e8101..b0a9cd8fc24 100644 --- a/kotlin/services/sagemaker/build.gradle.kts +++ b/kotlin/services/sagemaker/build.gradle.kts @@ -35,11 +35,11 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" kotlinOptions.freeCompilerArgs += "-Xlint:-deprecation" } diff --git a/kotlin/services/sagemaker/src/main/kotlin/com/kotlin/sage/CreateModel.kt b/kotlin/services/sagemaker/src/main/kotlin/com/kotlin/sage/CreateModel.kt index 7aad05079f1..45e7a24324b 100644 --- a/kotlin/services/sagemaker/src/main/kotlin/com/kotlin/sage/CreateModel.kt +++ b/kotlin/services/sagemaker/src/main/kotlin/com/kotlin/sage/CreateModel.kt @@ -48,7 +48,7 @@ suspend fun createSagemakerModel( dataUrl: String, imageVal: String, modelNameVal: String, - executionRoleArnVal: String + executionRoleArnVal: String, ) { val containerDefinition = ContainerDefinition { diff --git a/kotlin/services/sagemaker/src/main/kotlin/com/kotlin/sage/CreateTrainingJob.kt b/kotlin/services/sagemaker/src/main/kotlin/com/kotlin/sage/CreateTrainingJob.kt index ba110615eaf..a7bd3625fd1 100644 --- a/kotlin/services/sagemaker/src/main/kotlin/com/kotlin/sage/CreateTrainingJob.kt +++ b/kotlin/services/sagemaker/src/main/kotlin/com/kotlin/sage/CreateTrainingJob.kt @@ -66,7 +66,7 @@ suspend fun trainJob( roleArnVal: String?, s3OutputPathVal: String?, channelNameVal: String?, - trainingImageVal: String? + trainingImageVal: String?, ) { val s3DataSourceOb = S3DataSource { diff --git a/kotlin/services/sagemaker/src/main/kotlin/com/kotlin/sage/CreateTransformJob.kt b/kotlin/services/sagemaker/src/main/kotlin/com/kotlin/sage/CreateTransformJob.kt index 7fc639beec6..6b98763f5f7 100644 --- a/kotlin/services/sagemaker/src/main/kotlin/com/kotlin/sage/CreateTransformJob.kt +++ b/kotlin/services/sagemaker/src/main/kotlin/com/kotlin/sage/CreateTransformJob.kt @@ -53,7 +53,7 @@ suspend fun transformJob( s3UriVal: String?, s3OutputPathVal: String?, modelNameVal: String?, - transformJobNameVal: String? + transformJobNameVal: String?, ) { val s3DataSourceOb = TransformS3DataSource { diff --git a/kotlin/services/secrets-manager/build.gradle.kts b/kotlin/services/secrets-manager/build.gradle.kts index e5569b0cc2d..099e81082d1 100644 --- a/kotlin/services/secrets-manager/build.gradle.kts +++ b/kotlin/services/secrets-manager/build.gradle.kts @@ -36,7 +36,7 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" kotlinOptions.freeCompilerArgs += "-Xlint:-deprecation" } diff --git a/kotlin/services/ses/build.gradle.kts b/kotlin/services/ses/build.gradle.kts index 87fd827a7de..c56fba2b209 100644 --- a/kotlin/services/ses/build.gradle.kts +++ b/kotlin/services/ses/build.gradle.kts @@ -39,7 +39,7 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" kotlinOptions.freeCompilerArgs += "-Xlint:-deprecation" } diff --git a/kotlin/services/ses/src/main/kotlin/com/example/ses/SendMessageEmail.kt b/kotlin/services/ses/src/main/kotlin/com/example/ses/SendMessageEmail.kt index f12bbd37d0c..a9783138632 100644 --- a/kotlin/services/ses/src/main/kotlin/com/example/ses/SendMessageEmail.kt +++ b/kotlin/services/ses/src/main/kotlin/com/example/ses/SendMessageEmail.kt @@ -55,7 +55,7 @@ suspend fun send( sender: String?, recipient: String, subjectVal: String?, - bodyHTML: String? + bodyHTML: String?, ) { val destinationOb = Destination { diff --git a/kotlin/services/ses/src/main/kotlin/com/example/ses/SendMessageEmailAttachment.kt b/kotlin/services/ses/src/main/kotlin/com/example/ses/SendMessageEmailAttachment.kt index 10b8ea3ae0a..cdd882cbb07 100644 --- a/kotlin/services/ses/src/main/kotlin/com/example/ses/SendMessageEmailAttachment.kt +++ b/kotlin/services/ses/src/main/kotlin/com/example/ses/SendMessageEmailAttachment.kt @@ -74,7 +74,7 @@ suspend fun sendemailAttachment( subject: String, bodyText: String, bodyHTML: String, - fileLocation: String + fileLocation: String, ) { val theFile = File(fileLocation) val fileContent = Files.readAllBytes(theFile.toPath()) diff --git a/kotlin/services/sns/build.gradle.kts b/kotlin/services/sns/build.gradle.kts index 0d7ce614e36..3e83260c257 100644 --- a/kotlin/services/sns/build.gradle.kts +++ b/kotlin/services/sns/build.gradle.kts @@ -37,7 +37,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" kotlinOptions.freeCompilerArgs += "-Xlint:-deprecation" } diff --git a/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/DeleteTag.kt b/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/DeleteTag.kt index 09aaa2560a2..a6df4749247 100644 --- a/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/DeleteTag.kt +++ b/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/DeleteTag.kt @@ -40,7 +40,7 @@ suspend fun main(args: Array) { // snippet-start:[sns.kotlin.delete_tags.main] suspend fun removeTag( topicArn: String, - tagKey: String + tagKey: String, ) { val resourceRequest = UntagResourceRequest { diff --git a/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/PublishTextSMS.kt b/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/PublishTextSMS.kt index 4087b273216..96d5a5514ec 100644 --- a/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/PublishTextSMS.kt +++ b/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/PublishTextSMS.kt @@ -40,7 +40,7 @@ suspend fun main(args: Array) { // snippet-start:[sns.kotlin.PublishTextSMS.main] suspend fun pubTextSMS( messageVal: String?, - phoneNumberVal: String? + phoneNumberVal: String?, ) { val request = PublishRequest { diff --git a/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/PublishTopic.kt b/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/PublishTopic.kt index 75ed597051a..5d21885110e 100644 --- a/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/PublishTopic.kt +++ b/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/PublishTopic.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[sns.kotlin.PublishTopic.main] suspend fun pubTopic( topicArnVal: String, - messageVal: String + messageVal: String, ) { val request = PublishRequest { diff --git a/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SetTopicAttributes.kt b/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SetTopicAttributes.kt index 57aa847b0e6..b71f6240ae3 100644 --- a/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SetTopicAttributes.kt +++ b/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SetTopicAttributes.kt @@ -42,7 +42,7 @@ suspend fun main(args: Array) { suspend fun setTopAttr( attribute: String?, topicArnVal: String?, - value: String? + value: String?, ) { val request = SetTopicAttributesRequest { diff --git a/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SubscribeEmail.kt b/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SubscribeEmail.kt index edb7b87edb4..dc200120490 100644 --- a/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SubscribeEmail.kt +++ b/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SubscribeEmail.kt @@ -40,7 +40,7 @@ suspend fun main(args: Array) { // snippet-start:[sns.kotlin.SubscribeEmail.main] suspend fun subEmail( topicArnVal: String, - email: String + email: String, ): String { val request = SubscribeRequest { diff --git a/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SubscribeLambda.kt b/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SubscribeLambda.kt index 0f5633afe06..fc6715c57a0 100644 --- a/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SubscribeLambda.kt +++ b/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SubscribeLambda.kt @@ -39,7 +39,7 @@ suspend fun main(args: Array) { // snippet-start:[sns.kotlin.SubscribeLambda.main] suspend fun subLambda( topicArnVal: String?, - lambdaArn: String? + lambdaArn: String?, ) { val request = SubscribeRequest { diff --git a/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SubscribeTextSMS.kt b/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SubscribeTextSMS.kt index 3b5a0244a94..a1fc26412ca 100644 --- a/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SubscribeTextSMS.kt +++ b/kotlin/services/sns/src/main/kotlin/com/kotlin/sns/SubscribeTextSMS.kt @@ -40,7 +40,7 @@ suspend fun main(args: Array) { // snippet-start:[sns.kotlin.SubscribeTextSMS.main] suspend fun subTextSNS( topicArnVal: String?, - phoneNumber: String? + phoneNumber: String?, ) { val request = SubscribeRequest { diff --git a/kotlin/services/sqs/build.gradle.kts b/kotlin/services/sqs/build.gradle.kts index 1fa93bfd17f..0ff57c2cb94 100644 --- a/kotlin/services/sqs/build.gradle.kts +++ b/kotlin/services/sqs/build.gradle.kts @@ -38,7 +38,7 @@ dependencies { implementation("com.fasterxml.jackson.core:jackson-core:2.14.2") implementation("com.fasterxml.jackson.core:jackson-databind:2.14.2") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" kotlinOptions.freeCompilerArgs += "-Xlint:-deprecation" } diff --git a/kotlin/services/sqs/src/main/kotlin/com/kotlin/sqs/RemoveQueueTag.kt b/kotlin/services/sqs/src/main/kotlin/com/kotlin/sqs/RemoveQueueTag.kt index 39982fc3d20..51b38c16366 100644 --- a/kotlin/services/sqs/src/main/kotlin/com/kotlin/sqs/RemoveQueueTag.kt +++ b/kotlin/services/sqs/src/main/kotlin/com/kotlin/sqs/RemoveQueueTag.kt @@ -40,7 +40,7 @@ suspend fun main(args: Array) { // snippet-start:[sqs.kotlin.remove_tag.main] suspend fun removeTag( queueNameVal: String, - tagName: String + tagName: String, ) { val urlRequest = GetQueueUrlRequest { diff --git a/kotlin/services/sqs/src/main/kotlin/com/kotlin/sqs/SendMessages.kt b/kotlin/services/sqs/src/main/kotlin/com/kotlin/sqs/SendMessages.kt index 8460d9e387c..61bf0b7205e 100644 --- a/kotlin/services/sqs/src/main/kotlin/com/kotlin/sqs/SendMessages.kt +++ b/kotlin/services/sqs/src/main/kotlin/com/kotlin/sqs/SendMessages.kt @@ -43,7 +43,7 @@ suspend fun main(args: Array) { // snippet-start:[sqs.kotlin.send_messages.main] suspend fun sendMessages( queueUrlVal: String, - message: String + message: String, ) { println("Sending multiple messages") println("\nSend message") diff --git a/kotlin/services/stepfunctions/build.gradle.kts b/kotlin/services/stepfunctions/build.gradle.kts index f0bae2c9907..ff7e17570b5 100644 --- a/kotlin/services/stepfunctions/build.gradle.kts +++ b/kotlin/services/stepfunctions/build.gradle.kts @@ -38,7 +38,7 @@ dependencies { implementation("com.fasterxml.jackson.core:jackson-databind:2.14.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" kotlinOptions.freeCompilerArgs += "-Xlint:-deprecation" } diff --git a/kotlin/services/stepfunctions/src/main/kotlin/com/kotlin/stepfunctions/StepFunctionsScenario.kt b/kotlin/services/stepfunctions/src/main/kotlin/com/kotlin/stepfunctions/StepFunctionsScenario.kt index d90e8cbb586..ed356ab8a01 100644 --- a/kotlin/services/stepfunctions/src/main/kotlin/com/kotlin/stepfunctions/StepFunctionsScenario.kt +++ b/kotlin/services/stepfunctions/src/main/kotlin/com/kotlin/stepfunctions/StepFunctionsScenario.kt @@ -276,7 +276,7 @@ suspend fun describeExe(executionArnVal: String?) { // snippet-start:[stepfunctions.kotlin.task_success.main] suspend fun sendTaskSuccess( token: String?, - json: String? + json: String?, ) { val successRequest = SendTaskSuccessRequest { @@ -308,7 +308,7 @@ suspend fun getActivityTask(actArn: String?): List { // snippet-start:[stepfunctions.kotlin.start_execute.main] suspend fun startWorkflow( stateMachineArnVal: String?, - jsonEx: String? + jsonEx: String?, ): String? { val uuid = UUID.randomUUID() val uuidValue = uuid.toString() @@ -345,7 +345,7 @@ suspend fun describeStateMachine(stateMachineArnVal: String?) { suspend fun createMachine( roleARNVal: String?, stateMachineName: String?, - jsonVal: String? + jsonVal: String?, ): String? { val machineRequest = CreateStateMachineRequest { @@ -364,7 +364,7 @@ suspend fun createMachine( suspend fun createIAMRole( roleNameVal: String?, - polJSON: String? + polJSON: String?, ): String? { val request = CreateRoleRequest { diff --git a/kotlin/services/sts/build.gradle.kts b/kotlin/services/sts/build.gradle.kts index 2205eacc2b6..348cb9da5e8 100644 --- a/kotlin/services/sts/build.gradle.kts +++ b/kotlin/services/sts/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" kotlinOptions.freeCompilerArgs += "-Xlint:-deprecation" } diff --git a/kotlin/services/sts/src/main/kotlin/com/kotlin/sts/AssumeRole.kt b/kotlin/services/sts/src/main/kotlin/com/kotlin/sts/AssumeRole.kt index 7368acc7972..cd3287bcc48 100644 --- a/kotlin/services/sts/src/main/kotlin/com/kotlin/sts/AssumeRole.kt +++ b/kotlin/services/sts/src/main/kotlin/com/kotlin/sts/AssumeRole.kt @@ -56,7 +56,7 @@ suspend fun main(args: Array) { // snippet-start:[sts.kotlin.assume_role.main] suspend fun assumeGivenRole( roleArnVal: String?, - roleSessionNameVal: String? + roleSessionNameVal: String?, ) { val roleRequest = AssumeRoleRequest { diff --git a/kotlin/services/support/build.gradle.kts b/kotlin/services/support/build.gradle.kts index 3e8629d5fcc..10255a89550 100644 --- a/kotlin/services/support/build.gradle.kts +++ b/kotlin/services/support/build.gradle.kts @@ -33,6 +33,6 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/services/support/src/main/kotlin/com/example/support/SupportScenario.kt b/kotlin/services/support/src/main/kotlin/com/example/support/SupportScenario.kt index 2251658312a..521185d3d4f 100644 --- a/kotlin/services/support/src/main/kotlin/com/example/support/SupportScenario.kt +++ b/kotlin/services/support/src/main/kotlin/com/example/support/SupportScenario.kt @@ -178,7 +178,7 @@ suspend fun listCommunications(caseIdVal: String?): String? { // snippet-start:[support.kotlin.add.attach.case.main] suspend fun addAttachSupportCase( caseIdVal: String?, - attachmentSetIdVal: String? + attachmentSetIdVal: String?, ) { val caseRequest = AddCommunicationToCaseRequest { @@ -247,7 +247,7 @@ suspend fun getOpenCase() { // snippet-start:[support.kotlin.create.case.main] suspend fun createSupportCase( sevCatListVal: List, - sevLevelVal: String + sevLevelVal: String, ): String? { val serCode = sevCatListVal[0] val caseCategory = sevCatListVal[1] diff --git a/kotlin/services/textract/build.gradle.kts b/kotlin/services/textract/build.gradle.kts index 1ab42e8f618..224dbb0ef99 100644 --- a/kotlin/services/textract/build.gradle.kts +++ b/kotlin/services/textract/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" kotlinOptions.freeCompilerArgs += "-Xlint:-deprecation" } diff --git a/kotlin/services/textract/src/main/kotlin/com/kotlin/textract/DetectDocumentTextS3.kt b/kotlin/services/textract/src/main/kotlin/com/kotlin/textract/DetectDocumentTextS3.kt index 0da3b629d9e..beb0fe9fa23 100644 --- a/kotlin/services/textract/src/main/kotlin/com/kotlin/textract/DetectDocumentTextS3.kt +++ b/kotlin/services/textract/src/main/kotlin/com/kotlin/textract/DetectDocumentTextS3.kt @@ -41,7 +41,7 @@ suspend fun main(args: Array) { // snippet-start:[textract.kotlin._detect_s3_text.main] suspend fun detectDocTextS3( bucketName: String?, - docName: String? + docName: String?, ) { val s3ObjectOb = S3Object { diff --git a/kotlin/services/textract/src/main/kotlin/com/kotlin/textract/StartDocumentAnalysis.kt b/kotlin/services/textract/src/main/kotlin/com/kotlin/textract/StartDocumentAnalysis.kt index f1aad258409..ee0a67506db 100644 --- a/kotlin/services/textract/src/main/kotlin/com/kotlin/textract/StartDocumentAnalysis.kt +++ b/kotlin/services/textract/src/main/kotlin/com/kotlin/textract/StartDocumentAnalysis.kt @@ -44,7 +44,7 @@ suspend fun main(args: Array) { // snippet-start:[textract.kotlin._start_doc_analysis.main] suspend fun startDocAnalysisS3( bucketName: String?, - docName: String? + docName: String?, ) { val myList = mutableListOf() myList.add(FeatureType.Tables) @@ -79,7 +79,7 @@ suspend fun startDocAnalysisS3( private suspend fun getJobResults( textractClient: TextractClient, - jobIdVal: String? + jobIdVal: String?, ): String { var finished = false var index = 0 diff --git a/kotlin/services/translate/build.gradle.kts b/kotlin/services/translate/build.gradle.kts index fb8ffd71547..2e03d8329ca 100644 --- a/kotlin/services/translate/build.gradle.kts +++ b/kotlin/services/translate/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" kotlinOptions.freeCompilerArgs += "-Xlint:-deprecation" } diff --git a/kotlin/services/translate/src/main/kotlin/com/kotlin/translate/BatchTranslation.kt b/kotlin/services/translate/src/main/kotlin/com/kotlin/translate/BatchTranslation.kt index 1be1a9c5831..35d63a55f5c 100644 --- a/kotlin/services/translate/src/main/kotlin/com/kotlin/translate/BatchTranslation.kt +++ b/kotlin/services/translate/src/main/kotlin/com/kotlin/translate/BatchTranslation.kt @@ -49,7 +49,7 @@ suspend fun translateDocuments( s3UriVal: String?, s3UriOutVal: String?, jobNameVal: String?, - dataAccessRoleArnVal: String? + dataAccessRoleArnVal: String?, ): String? { val sleepTime: Long = 5 val dataConfig = diff --git a/kotlin/services/xray/build.gradle.kts b/kotlin/services/xray/build.gradle.kts index 7dea6213c06..980ebfb26b9 100644 --- a/kotlin/services/xray/build.gradle.kts +++ b/kotlin/services/xray/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" kotlinOptions.freeCompilerArgs += "-Xlint:-deprecation" } diff --git a/kotlin/usecases/creating_message_application/src/main/kotlin/com/example/sqs/MessageData.kt b/kotlin/usecases/creating_message_application/src/main/kotlin/com/example/sqs/MessageData.kt index 98e7d164e34..367252f1718 100644 --- a/kotlin/usecases/creating_message_application/src/main/kotlin/com/example/sqs/MessageData.kt +++ b/kotlin/usecases/creating_message_application/src/main/kotlin/com/example/sqs/MessageData.kt @@ -1,10 +1,10 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.example.sqs - -class MessageData { - var id: String? = null - var body: String? = null - var name: String? = null -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.example.sqs + +class MessageData { + var id: String? = null + var body: String? = null + var name: String? = null +} diff --git a/kotlin/usecases/creating_message_application/src/main/kotlin/com/example/sqs/SendReceiveMessages.kt b/kotlin/usecases/creating_message_application/src/main/kotlin/com/example/sqs/SendReceiveMessages.kt index 1b457b6a105..6c8fc25c977 100644 --- a/kotlin/usecases/creating_message_application/src/main/kotlin/com/example/sqs/SendReceiveMessages.kt +++ b/kotlin/usecases/creating_message_application/src/main/kotlin/com/example/sqs/SendReceiveMessages.kt @@ -1,120 +1,120 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.example.sqs - -import aws.sdk.kotlin.services.comprehend.ComprehendClient -import aws.sdk.kotlin.services.comprehend.model.DetectDominantLanguageRequest -import aws.sdk.kotlin.services.sqs.SqsClient -import aws.sdk.kotlin.services.sqs.model.GetQueueUrlRequest -import aws.sdk.kotlin.services.sqs.model.MessageAttributeValue -import aws.sdk.kotlin.services.sqs.model.PurgeQueueRequest -import aws.sdk.kotlin.services.sqs.model.ReceiveMessageRequest -import aws.sdk.kotlin.services.sqs.model.SendMessageRequest -import org.springframework.stereotype.Component - -@Component -class SendReceiveMessages { - private val queueNameVal = "Message.fifo" - - // Purges the queue. - suspend fun purgeMyQueue() { - var queueUrlVal: String - val getQueueRequest = GetQueueUrlRequest { - queueName = queueNameVal - } - SqsClient { region = "us-west-2" }.use { sqsClient -> - queueUrlVal = sqsClient.getQueueUrl(getQueueRequest).queueUrl.toString() - val queueRequest = PurgeQueueRequest { - queueUrl = queueUrlVal - } - sqsClient.purgeQueue(queueRequest) - } - } - - // Retrieves messages from the FIFO queue. - suspend fun getMessages(): List? { - val attr: MutableList = ArrayList() - attr.add("Name") - - val getQueueRequest = GetQueueUrlRequest { - queueName = queueNameVal - } - - SqsClient { region = "us-west-2" }.use { sqsClient -> - val queueUrlVal = sqsClient.getQueueUrl(getQueueRequest).queueUrl - - val receiveRequest = ReceiveMessageRequest { - queueUrl = queueUrlVal - maxNumberOfMessages = 10 - waitTimeSeconds = 20 - messageAttributeNames = attr - } - - val messages = sqsClient.receiveMessage(receiveRequest).messages - var myMessage: MessageData - val allMessages = mutableListOf() - - // Push the messages to a list. - if (messages != null) { - for (m in messages) { - myMessage = MessageData() - myMessage.body = m.body - myMessage.id = m.messageId - val map = m.messageAttributes - val `val` = map?.get("Name") - if (`val` != null) { - myMessage.name = `val`.stringValue - } - allMessages.add(myMessage) - } - } - return allMessages - } - } - - // Adds a new message to the FIFO queue. - suspend fun processMessage(msg: MessageData) { - val attributeValue = MessageAttributeValue { - stringValue = msg.name - dataType = "String" - } - - val myMap: MutableMap = HashMap() - myMap["Name"] = attributeValue - - val getQueueRequest = GetQueueUrlRequest { - queueName = queueNameVal - } - - // Get the language code of the incoming message. - var lanCode = "" - val request = DetectDominantLanguageRequest { - text = msg.body - } - - ComprehendClient { region = "us-west-2" }.use { comClient -> - val resp = comClient.detectDominantLanguage(request) - val allLanList = resp.languages - if (allLanList != null) { - for (lang in allLanList) { - println("Language is " + lang.languageCode) - lanCode = lang.languageCode.toString() - } - } - } - - // Send the message to the FIFO queue. - SqsClient { region = "us-west-2" }.use { sqsClient -> - val queueUrlVal: String? = sqsClient.getQueueUrl(getQueueRequest).queueUrl - val sendMsgRequest = SendMessageRequest { - queueUrl = queueUrlVal - messageAttributes = myMap - messageGroupId = "GroupA_$lanCode" - messageDeduplicationId = msg.id - messageBody = msg.body - } - sqsClient.sendMessage(sendMsgRequest) - } - } -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.example.sqs + +import aws.sdk.kotlin.services.comprehend.ComprehendClient +import aws.sdk.kotlin.services.comprehend.model.DetectDominantLanguageRequest +import aws.sdk.kotlin.services.sqs.SqsClient +import aws.sdk.kotlin.services.sqs.model.GetQueueUrlRequest +import aws.sdk.kotlin.services.sqs.model.MessageAttributeValue +import aws.sdk.kotlin.services.sqs.model.PurgeQueueRequest +import aws.sdk.kotlin.services.sqs.model.ReceiveMessageRequest +import aws.sdk.kotlin.services.sqs.model.SendMessageRequest +import org.springframework.stereotype.Component + +@Component +class SendReceiveMessages { + private val queueNameVal = "Message.fifo" + + // Purges the queue. + suspend fun purgeMyQueue() { + var queueUrlVal: String + val getQueueRequest = GetQueueUrlRequest { + queueName = queueNameVal + } + SqsClient { region = "us-west-2" }.use { sqsClient -> + queueUrlVal = sqsClient.getQueueUrl(getQueueRequest).queueUrl.toString() + val queueRequest = PurgeQueueRequest { + queueUrl = queueUrlVal + } + sqsClient.purgeQueue(queueRequest) + } + } + + // Retrieves messages from the FIFO queue. + suspend fun getMessages(): List? { + val attr: MutableList = ArrayList() + attr.add("Name") + + val getQueueRequest = GetQueueUrlRequest { + queueName = queueNameVal + } + + SqsClient { region = "us-west-2" }.use { sqsClient -> + val queueUrlVal = sqsClient.getQueueUrl(getQueueRequest).queueUrl + + val receiveRequest = ReceiveMessageRequest { + queueUrl = queueUrlVal + maxNumberOfMessages = 10 + waitTimeSeconds = 20 + messageAttributeNames = attr + } + + val messages = sqsClient.receiveMessage(receiveRequest).messages + var myMessage: MessageData + val allMessages = mutableListOf() + + // Push the messages to a list. + if (messages != null) { + for (m in messages) { + myMessage = MessageData() + myMessage.body = m.body + myMessage.id = m.messageId + val map = m.messageAttributes + val `val` = map?.get("Name") + if (`val` != null) { + myMessage.name = `val`.stringValue + } + allMessages.add(myMessage) + } + } + return allMessages + } + } + + // Adds a new message to the FIFO queue. + suspend fun processMessage(msg: MessageData) { + val attributeValue = MessageAttributeValue { + stringValue = msg.name + dataType = "String" + } + + val myMap: MutableMap = HashMap() + myMap["Name"] = attributeValue + + val getQueueRequest = GetQueueUrlRequest { + queueName = queueNameVal + } + + // Get the language code of the incoming message. + var lanCode = "" + val request = DetectDominantLanguageRequest { + text = msg.body + } + + ComprehendClient { region = "us-west-2" }.use { comClient -> + val resp = comClient.detectDominantLanguage(request) + val allLanList = resp.languages + if (allLanList != null) { + for (lang in allLanList) { + println("Language is " + lang.languageCode) + lanCode = lang.languageCode.toString() + } + } + } + + // Send the message to the FIFO queue. + SqsClient { region = "us-west-2" }.use { sqsClient -> + val queueUrlVal: String? = sqsClient.getQueueUrl(getQueueRequest).queueUrl + val sendMsgRequest = SendMessageRequest { + queueUrl = queueUrlVal + messageAttributes = myMap + messageGroupId = "GroupA_$lanCode" + messageDeduplicationId = msg.id + messageBody = msg.body + } + sqsClient.sendMessage(sendMsgRequest) + } + } +} diff --git a/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/LabelCount.kt b/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/LabelCount.kt index 366586de706..8e6facd487e 100644 --- a/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/LabelCount.kt +++ b/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/LabelCount.kt @@ -12,21 +12,15 @@ class LabelCount { this.key = key } - fun getKey(): String? { - return key - } + fun getKey(): String? = key fun setName(name: String?) { this.name = name } - fun getName(): String? { - return name - } + fun getName(): String? = name - fun getCount(): Int { - return count - } + fun getCount(): Int = count fun setCount(count: Int) { this.count = count diff --git a/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/WorkCount.kt b/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/WorkCount.kt index 33ca3f8bb32..94774327c42 100644 --- a/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/WorkCount.kt +++ b/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/WorkCount.kt @@ -6,9 +6,7 @@ package com.example.photo class WorkCount { private var count = 0 - fun getCount(): Int { - return count - } + fun getCount(): Int = count fun setCount(count: Int) { this.count = count diff --git a/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/handlers/GetHandler.kt b/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/handlers/GetHandler.kt index 71cd8ef5c62..2db794340b1 100644 --- a/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/handlers/GetHandler.kt +++ b/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/handlers/GetHandler.kt @@ -31,11 +31,9 @@ class GetHandler : RequestHandler? { - - // Create an Image object for the source image. - val souImage = Image { - bytes = bytesVal - } - - val detectLabelsRequest = DetectLabelsRequest { - image = souImage - maxLabels = 10 - } - - RekognitionClient { region = "us-west-2" }.use { rekClient -> - val response = rekClient.detectLabels(detectLabelsRequest) - - // Write the results to a WorkItem instance. - val list = mutableListOf() - println("Detected labels for the given photo") - response.labels?.forEach { label -> - val item = WorkItem() - item.key = key // identifies the photo. - item.confidence = label.confidence.toString() - item.name = label.name - list.add(item) - } - return list - } - } -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.aws.photo + +import aws.sdk.kotlin.services.rekognition.RekognitionClient +import aws.sdk.kotlin.services.rekognition.model.DetectLabelsRequest +import aws.sdk.kotlin.services.rekognition.model.Image +import org.springframework.stereotype.Component + +@Component +class AnalyzePhotos { + + suspend fun DetectLabels(bytesVal: ByteArray?, key: String?): MutableList? { + // Create an Image object for the source image. + val souImage = Image { + bytes = bytesVal + } + + val detectLabelsRequest = DetectLabelsRequest { + image = souImage + maxLabels = 10 + } + + RekognitionClient { region = "us-west-2" }.use { rekClient -> + val response = rekClient.detectLabels(detectLabelsRequest) + + // Write the results to a WorkItem instance. + val list = mutableListOf() + println("Detected labels for the given photo") + response.labels?.forEach { label -> + val item = WorkItem() + item.key = key // identifies the photo. + item.confidence = label.confidence.toString() + item.name = label.name + list.add(item) + } + return list + } + } +} diff --git a/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/BucketItem.kt b/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/BucketItem.kt index 8e84d9d725a..7adbf9f3a3d 100644 --- a/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/BucketItem.kt +++ b/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/BucketItem.kt @@ -1,12 +1,12 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.aws.photo - -class BucketItem { - - var key: String? = null - var owner: String? = null - var date: String? = null - var size: String? = null -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.aws.photo + +class BucketItem { + + var key: String? = null + var owner: String? = null + var date: String? = null + var size: String? = null +} 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 d1b4ebfea3f..32b2f5c7487 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 @@ -43,19 +43,13 @@ class MessageResource { var excel: WriteExcel? = null @GetMapping("/process") - fun process(): String { - return "process" - } + fun process(): String = "process" @GetMapping("/photo") - fun photo(): String { - return "upload" - } + fun photo(): String = "upload" @GetMapping("/") - fun root(): String { - return "index" - } + fun root(): String = "index" @RequestMapping(value = ["/getimages"], method = [RequestMethod.GET]) @ResponseBody 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 454b9ab9d58..3b13fa25025 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 @@ -1,177 +1,177 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.aws.photo - -import aws.sdk.kotlin.services.s3.S3Client -import aws.sdk.kotlin.services.s3.model.GetObjectRequest -import aws.sdk.kotlin.services.s3.model.ListObjectsRequest -import aws.sdk.kotlin.services.s3.model.PutObjectRequest -import aws.smithy.kotlin.runtime.content.ByteStream -import aws.smithy.kotlin.runtime.content.toByteArray -import org.springframework.stereotype.Component -import org.w3c.dom.Document -import java.io.StringWriter -import javax.xml.parsers.DocumentBuilderFactory -import javax.xml.parsers.ParserConfigurationException -import javax.xml.transform.TransformerConfigurationException -import javax.xml.transform.TransformerException -import javax.xml.transform.TransformerFactory -import javax.xml.transform.dom.DOMSource -import javax.xml.transform.stream.StreamResult -import kotlin.system.exitProcess - -@Component -class S3Service { - var myBytes: ByteArray? = null - - // Returns the names of all images in the given bucket. - suspend fun listBucketObjects(bucketName: String?): List<*>? { - var keyName: String - val keys = mutableListOf() - val listObjects = ListObjectsRequest { - bucket = bucketName - } - - S3Client { region = "us-west-2" }.use { s3Client -> - val response = s3Client.listObjects(listObjects) - response.contents?.forEach { myObject -> - keyName = myObject.key.toString() - keys.add(keyName) - } - return keys - } - } - - // Returns the names of all images and data within an XML document. - suspend fun ListAllObjects(bucketName: String?): String? { - var sizeLg: Long - var dateIn: aws.smithy.kotlin.runtime.time.Instant? - val bucketItems = mutableListOf() - - val listObjects = ListObjectsRequest { - bucket = bucketName - } - - S3Client { region = "us-west-2" }.use { s3Client -> - val res = s3Client.listObjects(listObjects) - res.contents?.forEach { myObject -> - val myItem = BucketItem() - myItem.key = myObject.key - myItem.owner = myObject.owner?.displayName.toString() - sizeLg = (myObject.size / 1024) - myItem.size = (sizeLg.toString()) - dateIn = myObject.lastModified - myItem.date = dateIn.toString() - - // Push the items to the list. - bucketItems.add(myItem) - } - return convertToString(toXml(bucketItems)) - } - } - - // Places an image into an Amazon S3 bucket. - suspend fun putObject(data: ByteArray, bucketName: String?, objectKey: String?): String? { - val request = PutObjectRequest { - bucket = bucketName - key = objectKey - body = ByteStream.fromBytes(data) - } - - S3Client { region = "us-west-2" }.use { s3Client -> - val response = s3Client.putObject(request) - return response.eTag - } - } - - // Get the byte[] from this Amazon S3 object. - suspend fun getObjectBytes(bucketName: String?, keyName: String?): ByteArray? { - val objectRequest = GetObjectRequest { - key = keyName - bucket = bucketName - } - - S3Client { region = "us-west-2" }.use { s3Client -> - s3Client.getObject(objectRequest) { resp -> - myBytes = resp.body?.toByteArray() - } - return myBytes - } - } - - // Convert items into XML to pass back to the view. - private fun toXml(itemList: List): Document { - try { - val factory = DocumentBuilderFactory.newInstance() - factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true) - val builder = factory.newDocumentBuilder() - val doc = builder.newDocument() - - // Start building the XML. - val root = doc.createElement("Items") - doc.appendChild(root) - - // Get the elements from the collection. - val custCount = itemList.size - - // Iterate through the collection. - for (index in 0 until custCount) { - // Get the WorkItem object from the collection. - val myItem = itemList[index] - val item = doc.createElement("Item") - root.appendChild(item) - - // Set Key. - val id = doc.createElement("Key") - id.appendChild(doc.createTextNode(myItem.key)) - item.appendChild(id) - - // Set Owner. - val name = doc.createElement("Owner") - name.appendChild(doc.createTextNode(myItem.owner)) - item.appendChild(name) - - // Set Date. - val date = doc.createElement("Date") - date.appendChild(doc.createTextNode(myItem.date)) - item.appendChild(date) - - // Set Size. - val desc = doc.createElement("Size") - desc.appendChild(doc.createTextNode(myItem.size)) - item.appendChild(desc) - } - return doc - } catch (e: ParserConfigurationException) { - e.printStackTrace() - exitProcess(0) - } - } - - private fun convertToString(xml: Document?): String? { - try { - val transformerFactory = getSecureTransformerFactory() - val transformer = transformerFactory?.newTransformer() - val result = StreamResult(StringWriter()) - val source = DOMSource(xml) - if (transformer != null) { - transformer.transform(source, result) - } - return result.writer.toString() - } catch (ex: TransformerException) { - ex.printStackTrace() - } - return null - } - - private fun getSecureTransformerFactory(): TransformerFactory? { - val transformerFactory: TransformerFactory = TransformerFactory.newInstance() - try { - transformerFactory.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true) - } catch (e: TransformerConfigurationException) { - e.printStackTrace() - } - return transformerFactory - } -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.aws.photo + +import aws.sdk.kotlin.services.s3.S3Client +import aws.sdk.kotlin.services.s3.model.GetObjectRequest +import aws.sdk.kotlin.services.s3.model.ListObjectsRequest +import aws.sdk.kotlin.services.s3.model.PutObjectRequest +import aws.smithy.kotlin.runtime.content.ByteStream +import aws.smithy.kotlin.runtime.content.toByteArray +import org.springframework.stereotype.Component +import org.w3c.dom.Document +import java.io.StringWriter +import javax.xml.parsers.DocumentBuilderFactory +import javax.xml.parsers.ParserConfigurationException +import javax.xml.transform.TransformerConfigurationException +import javax.xml.transform.TransformerException +import javax.xml.transform.TransformerFactory +import javax.xml.transform.dom.DOMSource +import javax.xml.transform.stream.StreamResult +import kotlin.system.exitProcess + +@Component +class S3Service { + var myBytes: ByteArray? = null + + // Returns the names of all images in the given bucket. + suspend fun listBucketObjects(bucketName: String?): List<*>? { + var keyName: String + val keys = mutableListOf() + val listObjects = ListObjectsRequest { + bucket = bucketName + } + + S3Client { region = "us-west-2" }.use { s3Client -> + val response = s3Client.listObjects(listObjects) + response.contents?.forEach { myObject -> + keyName = myObject.key.toString() + keys.add(keyName) + } + return keys + } + } + + // Returns the names of all images and data within an XML document. + suspend fun ListAllObjects(bucketName: String?): String? { + var sizeLg: Long + var dateIn: aws.smithy.kotlin.runtime.time.Instant? + val bucketItems = mutableListOf() + + val listObjects = ListObjectsRequest { + bucket = bucketName + } + + S3Client { region = "us-west-2" }.use { s3Client -> + val res = s3Client.listObjects(listObjects) + res.contents?.forEach { myObject -> + val myItem = BucketItem() + myItem.key = myObject.key + myItem.owner = myObject.owner?.displayName.toString() + sizeLg = (myObject.size / 1024) + myItem.size = (sizeLg.toString()) + dateIn = myObject.lastModified + myItem.date = dateIn.toString() + + // Push the items to the list. + bucketItems.add(myItem) + } + return convertToString(toXml(bucketItems)) + } + } + + // Places an image into an Amazon S3 bucket. + suspend fun putObject(data: ByteArray, bucketName: String?, objectKey: String?): String? { + val request = PutObjectRequest { + bucket = bucketName + key = objectKey + body = ByteStream.fromBytes(data) + } + + S3Client { region = "us-west-2" }.use { s3Client -> + val response = s3Client.putObject(request) + return response.eTag + } + } + + // Get the byte[] from this Amazon S3 object. + suspend fun getObjectBytes(bucketName: String?, keyName: String?): ByteArray? { + val objectRequest = GetObjectRequest { + key = keyName + bucket = bucketName + } + + S3Client { region = "us-west-2" }.use { s3Client -> + s3Client.getObject(objectRequest) { resp -> + myBytes = resp.body?.toByteArray() + } + return myBytes + } + } + + // Convert items into XML to pass back to the view. + private fun toXml(itemList: List): Document { + try { + val factory = DocumentBuilderFactory.newInstance() + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true) + val builder = factory.newDocumentBuilder() + val doc = builder.newDocument() + + // Start building the XML. + val root = doc.createElement("Items") + doc.appendChild(root) + + // Get the elements from the collection. + val custCount = itemList.size + + // Iterate through the collection. + for (index in 0 until custCount) { + // Get the WorkItem object from the collection. + val myItem = itemList[index] + val item = doc.createElement("Item") + root.appendChild(item) + + // Set Key. + val id = doc.createElement("Key") + id.appendChild(doc.createTextNode(myItem.key)) + item.appendChild(id) + + // Set Owner. + val name = doc.createElement("Owner") + name.appendChild(doc.createTextNode(myItem.owner)) + item.appendChild(name) + + // Set Date. + val date = doc.createElement("Date") + date.appendChild(doc.createTextNode(myItem.date)) + item.appendChild(date) + + // Set Size. + val desc = doc.createElement("Size") + desc.appendChild(doc.createTextNode(myItem.size)) + item.appendChild(desc) + } + return doc + } catch (e: ParserConfigurationException) { + e.printStackTrace() + exitProcess(0) + } + } + + private fun convertToString(xml: Document?): String? { + try { + val transformerFactory = getSecureTransformerFactory() + val transformer = transformerFactory?.newTransformer() + val result = StreamResult(StringWriter()) + val source = DOMSource(xml) + if (transformer != null) { + transformer.transform(source, result) + } + return result.writer.toString() + } catch (ex: TransformerException) { + ex.printStackTrace() + } + return null + } + + private fun getSecureTransformerFactory(): TransformerFactory? { + val transformerFactory: TransformerFactory = TransformerFactory.newInstance() + try { + transformerFactory.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true) + } catch (e: TransformerConfigurationException) { + e.printStackTrace() + } + return transformerFactory + } +} diff --git a/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/WorkItem.kt b/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/WorkItem.kt index f8a3c2b820d..a0c9d15e49a 100644 --- a/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/WorkItem.kt +++ b/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/WorkItem.kt @@ -1,10 +1,10 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.aws.photo - -class WorkItem { - var key: String? = null - var name: String? = null - var confidence: String? = null -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.aws.photo + +class WorkItem { + var key: String? = null + var name: String? = null + var confidence: String? = null +} diff --git a/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/WriteExcel.kt b/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/WriteExcel.kt index 45a16db9c44..2a1a0a8b27b 100644 --- a/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/WriteExcel.kt +++ b/kotlin/usecases/creating_photo_analyzer_app/src/main/kotlin/com/aws/photo/WriteExcel.kt @@ -1,159 +1,159 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.aws.photo - -import jxl.CellView -import jxl.Workbook -import jxl.WorkbookSettings -import jxl.format.UnderlineStyle -import jxl.write.Label -import jxl.write.Number -import jxl.write.WritableCellFormat -import jxl.write.WritableFont -import jxl.write.WritableSheet -import jxl.write.WriteException -import org.springframework.stereotype.Component -import java.io.ByteArrayInputStream -import java.io.ByteArrayOutputStream -import java.io.IOException -import java.io.InputStream -import java.io.OutputStream -import java.util.Locale - -@Component -class WriteExcel { - private var timesBoldUnderline: WritableCellFormat? = null - private var times: WritableCellFormat? = null - - // Returns an InputStream that represents the Excel Report. - fun exportExcel(list: List>): InputStream? { - try { - return write(list) - } catch (e: WriteException) { - e.printStackTrace() - } catch (e: IOException) { - e.printStackTrace() - } - return null - } - - // Generates the report and returns an inputstream. - @Throws(IOException::class, WriteException::class) - fun write(list: List>): InputStream { - val os: OutputStream = ByteArrayOutputStream() - val wbSettings = WorkbookSettings() - wbSettings.locale = Locale("en", "EN") - - // Create a Workbook - pass the OutputStream. - val workbook = Workbook.createWorkbook(os, wbSettings) - val size = list.size - for (i in 0 until size) { - // Get the WorkItem from each list. - val innerList = list[i] - val wi = innerList[i] as WorkItem - workbook.createSheet(wi.key.toString() + " Sheet ", 0) - val excelSheet = workbook.getSheet(0) - createLabel(excelSheet) - createContent(excelSheet, innerList) - } - - // Close the workbook. - workbook.write() - workbook.close() - - // Get an inputStram that represents the Report. - val stream: ByteArrayOutputStream = os as ByteArrayOutputStream - val myBytes = stream.toByteArray() - return ByteArrayInputStream(myBytes) - } - - // Create Headings in the Excel spreadsheet. - @Throws(WriteException::class) - private fun createLabel(sheet: WritableSheet) { - // Create a times font. - val times10pt = WritableFont(WritableFont.TIMES, 10) - // Define the cell format. - times = WritableCellFormat(times10pt) - // Lets automatically wrap the cells. - times!!.wrap = true - val times10ptBoldUnderline = WritableFont( - WritableFont.TIMES, - 10, - WritableFont.BOLD, - false, - UnderlineStyle.SINGLE - ) - timesBoldUnderline = WritableCellFormat(times10ptBoldUnderline) - timesBoldUnderline!!.wrap = true - val cv = CellView() - cv.format = times - cv.format = timesBoldUnderline - cv.isAutosize = true - - // Write a few headers. - addCaption(sheet, 0, 0, "Photo") - addCaption(sheet, 1, 0, "Label") - addCaption(sheet, 2, 0, "Confidence") - } - - // Write the Work Item Data to the Excel Report. - @Throws(WriteException::class) - private fun createContent(sheet: WritableSheet, list: List<*>): Int { - val size = list.size - for (i in 0 until size) { - val wi = list[i] as WorkItem - val key = wi.key - val label = wi.name - val confidence = wi.confidence - - // First column. - addLabel(sheet, 0, i + 2, key.toString()) - - // Second column. - addLabel(sheet, 1, i + 2, label.toString()) - - // Third column. - addLabel(sheet, 2, i + 2, confidence.toString()) - } - return size - } - - @Throws(WriteException::class) - private fun addCaption(sheet: WritableSheet, column: Int, row: Int, s: String) { - val label: Label - label = Label(column, row, s, timesBoldUnderline) - val cc = countString(s) - sheet.setColumnView(column, cc) - sheet.addCell(label) - } - - @Throws(WriteException::class) - private fun addNumber( - sheet: WritableSheet, - column: Int, - row: Int, - integer: Int - ) { - val number: Number - number = Number(column, row, integer.toDouble(), times) - sheet.addCell(number) - } - - @Throws(WriteException::class) - private fun addLabel(sheet: WritableSheet, column: Int, row: Int, s: String) { - val label: Label - label = Label(column, row, s, times) - val cc = countString(s) - if (cc > 200) sheet.setColumnView(column, 150) else sheet.setColumnView(column, cc + 6) - sheet.addCell(label) - } - - private fun countString(ss: String): Int { - var count = 0 - for (i in 0 until ss.length) { - if (ss[i] != ' ') count++ - } - return count - } -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.aws.photo + +import jxl.CellView +import jxl.Workbook +import jxl.WorkbookSettings +import jxl.format.UnderlineStyle +import jxl.write.Label +import jxl.write.Number +import jxl.write.WritableCellFormat +import jxl.write.WritableFont +import jxl.write.WritableSheet +import jxl.write.WriteException +import org.springframework.stereotype.Component +import java.io.ByteArrayInputStream +import java.io.ByteArrayOutputStream +import java.io.IOException +import java.io.InputStream +import java.io.OutputStream +import java.util.Locale + +@Component +class WriteExcel { + private var timesBoldUnderline: WritableCellFormat? = null + private var times: WritableCellFormat? = null + + // Returns an InputStream that represents the Excel Report. + fun exportExcel(list: List>): InputStream? { + try { + return write(list) + } catch (e: WriteException) { + e.printStackTrace() + } catch (e: IOException) { + e.printStackTrace() + } + return null + } + + // Generates the report and returns an inputstream. + @Throws(IOException::class, WriteException::class) + fun write(list: List>): InputStream { + val os: OutputStream = ByteArrayOutputStream() + val wbSettings = WorkbookSettings() + wbSettings.locale = Locale("en", "EN") + + // Create a Workbook - pass the OutputStream. + val workbook = Workbook.createWorkbook(os, wbSettings) + val size = list.size + for (i in 0 until size) { + // Get the WorkItem from each list. + val innerList = list[i] + val wi = innerList[i] as WorkItem + workbook.createSheet(wi.key.toString() + " Sheet ", 0) + val excelSheet = workbook.getSheet(0) + createLabel(excelSheet) + createContent(excelSheet, innerList) + } + + // Close the workbook. + workbook.write() + workbook.close() + + // Get an inputStram that represents the Report. + val stream: ByteArrayOutputStream = os as ByteArrayOutputStream + val myBytes = stream.toByteArray() + return ByteArrayInputStream(myBytes) + } + + // Create Headings in the Excel spreadsheet. + @Throws(WriteException::class) + private fun createLabel(sheet: WritableSheet) { + // Create a times font. + val times10pt = WritableFont(WritableFont.TIMES, 10) + // Define the cell format. + times = WritableCellFormat(times10pt) + // Lets automatically wrap the cells. + times!!.wrap = true + val times10ptBoldUnderline = WritableFont( + WritableFont.TIMES, + 10, + WritableFont.BOLD, + false, + UnderlineStyle.SINGLE, + ) + timesBoldUnderline = WritableCellFormat(times10ptBoldUnderline) + timesBoldUnderline!!.wrap = true + val cv = CellView() + cv.format = times + cv.format = timesBoldUnderline + cv.isAutosize = true + + // Write a few headers. + addCaption(sheet, 0, 0, "Photo") + addCaption(sheet, 1, 0, "Label") + addCaption(sheet, 2, 0, "Confidence") + } + + // Write the Work Item Data to the Excel Report. + @Throws(WriteException::class) + private fun createContent(sheet: WritableSheet, list: List<*>): Int { + val size = list.size + for (i in 0 until size) { + val wi = list[i] as WorkItem + val key = wi.key + val label = wi.name + val confidence = wi.confidence + + // First column. + addLabel(sheet, 0, i + 2, key.toString()) + + // Second column. + addLabel(sheet, 1, i + 2, label.toString()) + + // Third column. + addLabel(sheet, 2, i + 2, confidence.toString()) + } + return size + } + + @Throws(WriteException::class) + private fun addCaption(sheet: WritableSheet, column: Int, row: Int, s: String) { + val label: Label + label = Label(column, row, s, timesBoldUnderline) + val cc = countString(s) + sheet.setColumnView(column, cc) + sheet.addCell(label) + } + + @Throws(WriteException::class) + private fun addNumber( + sheet: WritableSheet, + column: Int, + row: Int, + integer: Int, + ) { + val number: Number + number = Number(column, row, integer.toDouble(), times) + sheet.addCell(number) + } + + @Throws(WriteException::class) + private fun addLabel(sheet: WritableSheet, column: Int, row: Int, s: String) { + val label: Label + label = Label(column, row, s, times) + val cc = countString(s) + if (cc > 200) sheet.setColumnView(column, 150) else sheet.setColumnView(column, cc + 6) + sheet.addCell(label) + } + + private fun countString(ss: String): Int { + var count = 0 + for (i in 0 until ss.length) { + if (ss[i] != ' ') count++ + } + return count + } +} diff --git a/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/App.kt b/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/App.kt index 2c89815e214..43dcdafe220 100644 --- a/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/App.kt +++ b/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/App.kt @@ -1,92 +1,92 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.aws.rest - -import kotlinx.coroutines.runBlocking -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.autoconfigure.SpringBootApplication -import org.springframework.boot.runApplication -import org.springframework.http.HttpStatus -import org.springframework.web.bind.annotation.CrossOrigin -import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.PostMapping -import org.springframework.web.bind.annotation.PutMapping -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.ResponseStatus -import org.springframework.web.bind.annotation.RestController -import java.io.IOException - -@SpringBootApplication -open class App - -fun main(args: Array) { - runApplication(*args) -} - -@CrossOrigin(origins = ["*"]) -@RestController -class MessageResource { - - @Autowired - private lateinit var redshiftService: RedshiftService - - @Autowired - private lateinit var sendMsg: SendMessage - - // Add a new item. - @PostMapping("api/items") - fun addItems(@RequestBody payLoad: Map): String = runBlocking { - val nameVal = "user" - val guideVal = payLoad.get("guide").toString() - val descriptionVal = payLoad.get("description").toString() - val statusVal = payLoad.get("status").toString() - - // Create a Work Item object. - val myWork = WorkItem() - myWork.guide = guideVal - myWork.description = descriptionVal - myWork.status = statusVal - myWork.name = nameVal - val id = redshiftService.injestNewSubmission(myWork) - return@runBlocking "Item $id added successfully!" - } - - // Retrieve items. - @GetMapping("api/items") - fun getItems(@RequestParam(required = false) archived: String?): MutableList = runBlocking { - val list: MutableList - if (archived != null) { - list = redshiftService.getData(archived) - } else { - list = redshiftService.getData("") - } - return@runBlocking list - } - - // Flip an item from Active to Archive. - @PutMapping("api/items/{id}:archive") - @ResponseStatus(value = HttpStatus.NO_CONTENT) - fun modUser(@PathVariable id: String) = runBlocking { - redshiftService.flipItemArchive(id) - return@runBlocking - } - - // Send a report through Amazon SES. - @PostMapping("api/items:report") - @ResponseStatus(value = HttpStatus.NO_CONTENT) - fun sendReport(@RequestBody body: Map) = runBlocking { - val email = body.get("email") - val xml = redshiftService.getDataXML() - try { - if (email != null && xml != null) { - sendMsg.send(email, xml) - } - } catch (e: IOException) { - e.stackTrace - } - return@runBlocking - } -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.aws.rest + +import kotlinx.coroutines.runBlocking +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.autoconfigure.SpringBootApplication +import org.springframework.boot.runApplication +import org.springframework.http.HttpStatus +import org.springframework.web.bind.annotation.CrossOrigin +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.PutMapping +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.ResponseStatus +import org.springframework.web.bind.annotation.RestController +import java.io.IOException + +@SpringBootApplication +open class App + +fun main(args: Array) { + runApplication(*args) +} + +@CrossOrigin(origins = ["*"]) +@RestController +class MessageResource { + + @Autowired + private lateinit var redshiftService: RedshiftService + + @Autowired + private lateinit var sendMsg: SendMessage + + // Add a new item. + @PostMapping("api/items") + fun addItems(@RequestBody payLoad: Map): String = runBlocking { + val nameVal = "user" + val guideVal = payLoad.get("guide").toString() + val descriptionVal = payLoad.get("description").toString() + val statusVal = payLoad.get("status").toString() + + // Create a Work Item object. + val myWork = WorkItem() + myWork.guide = guideVal + myWork.description = descriptionVal + myWork.status = statusVal + myWork.name = nameVal + val id = redshiftService.injestNewSubmission(myWork) + return@runBlocking "Item $id added successfully!" + } + + // Retrieve items. + @GetMapping("api/items") + fun getItems(@RequestParam(required = false) archived: String?): MutableList = runBlocking { + val list: MutableList + if (archived != null) { + list = redshiftService.getData(archived) + } else { + list = redshiftService.getData("") + } + return@runBlocking list + } + + // Flip an item from Active to Archive. + @PutMapping("api/items/{id}:archive") + @ResponseStatus(value = HttpStatus.NO_CONTENT) + fun modUser(@PathVariable id: String) = runBlocking { + redshiftService.flipItemArchive(id) + return@runBlocking + } + + // Send a report through Amazon SES. + @PostMapping("api/items:report") + @ResponseStatus(value = HttpStatus.NO_CONTENT) + fun sendReport(@RequestBody body: Map) = runBlocking { + val email = body.get("email") + val xml = redshiftService.getDataXML() + try { + if (email != null && xml != null) { + sendMsg.send(email, xml) + } + } catch (e: IOException) { + e.stackTrace + } + return@runBlocking + } +} diff --git a/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/RedshiftService.kt b/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/RedshiftService.kt index 8bcca864ed3..4d67cb0eddb 100644 --- a/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/RedshiftService.kt +++ b/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/RedshiftService.kt @@ -1,426 +1,426 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.aws.rest - -import aws.sdk.kotlin.services.redshiftdata.RedshiftDataClient -import aws.sdk.kotlin.services.redshiftdata.model.DescribeStatementRequest -import aws.sdk.kotlin.services.redshiftdata.model.ExecuteStatementRequest -import aws.sdk.kotlin.services.redshiftdata.model.Field -import aws.sdk.kotlin.services.redshiftdata.model.GetStatementResultRequest -import aws.sdk.kotlin.services.redshiftdata.model.SqlParameter -import kotlinx.coroutines.delay -import org.springframework.stereotype.Component -import org.w3c.dom.Document -import java.io.StringWriter -import java.sql.Date -import java.text.SimpleDateFormat -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import javax.xml.parsers.DocumentBuilderFactory -import javax.xml.parsers.ParserConfigurationException -import javax.xml.transform.TransformerException -import javax.xml.transform.TransformerFactory -import javax.xml.transform.dom.DOMSource -import javax.xml.transform.stream.StreamResult -import kotlin.collections.ArrayList - -@Component -class RedshiftService { - // Update these values to reflect your environment. - private val databaseVal = "dev" - private val dbUserVal = "awsuser" - private val clusterId = "redshift-cluster-1" - - fun param(nameVal: String, valueVal: Boolean): SqlParameter { - val myPar = SqlParameter { - name = nameVal - value = valueVal.toString() - } - return myPar - } - - fun param2(nameVal: String, valueVal: String): SqlParameter { - val myPar = SqlParameter { - name = nameVal - value = valueVal - } - return myPar - } - - // Inject a new submission. - suspend fun injestNewSubmission(item: WorkItem): String { - val name = item.name - val guide = item.guide - val description = item.description - val status = item.status - val arc = "0" - - // Generate the work item ID. - val uuid = UUID.randomUUID() - val workId = uuid.toString() - - // Date conversion. - SimpleDateFormat("yyyy-MM-dd") - val dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss") - val now = LocalDateTime.now() - val sDate1 = dtf.format(now) - val date1 = SimpleDateFormat("yyyy/MM/dd").parse(sDate1) - val sqlDate = Date(date1.time) - - // Inject an item into the database. - val sqlStatement = - "INSERT INTO work (idwork, username, date, description, guide, status, archive) VALUES" + - "(:idwork, :username, :date, :description, :guide, :status, :arch);" - - val parametersVal = listOf( - param2("arch", arc), - param2("username", name.toString()), - param2("status", status.toString()), - param2("date", sqlDate.toString()), - param2("description", description.toString()), - param2("guide", guide.toString()), - param2("idwork", workId) - ) - - val statementRequest = ExecuteStatementRequest { - clusterIdentifier = clusterId - database = databaseVal - dbUser = dbUserVal - sql = sqlStatement - parameters = parametersVal - } - - RedshiftDataClient { region = "us-west-2" }.use { redshiftDataClient -> - redshiftDataClient.executeStatement(statementRequest) - return workId - } - } - - // Return items from the work table. - suspend fun getData(status: String): MutableList { - val isArc: Boolean - val statementRequest: ExecuteStatementRequest - val sqlStatement: String - if (status.compareTo("true") == 0) { - sqlStatement = "SELECT idwork, date, description, guide, status, username, archive FROM work WHERE archive = :arch ;" - isArc = true - val parametersVal = listOf(param("arch", isArc)) - statementRequest = ExecuteStatementRequest { - this.clusterIdentifier = clusterId - this.database = databaseVal - this.dbUser = dbUserVal - this.parameters = parametersVal - sql = sqlStatement - } - } else if (status.compareTo("false") == 0) { - sqlStatement = "SELECT idwork, date, description, guide, status, username, archive FROM work WHERE archive = :arch ;" - isArc = false - val parametersVal = listOf(param("arch", isArc)) - statementRequest = ExecuteStatementRequest { - this.clusterIdentifier = clusterId - this.database = databaseVal - this.dbUser = dbUserVal - this.parameters = parametersVal - sql = sqlStatement - } - } else { - sqlStatement = "SELECT idwork, date, description, guide, status, username, archive FROM work ;" - statementRequest = ExecuteStatementRequest { - this.clusterIdentifier = clusterId - this.database = databaseVal - this.dbUser = dbUserVal - sql = sqlStatement - } - } - - val id = performSQLStatement(statementRequest) - println("The identifier of the statement is $id") - checkStatement(id) - return getResults(id) - } - - // Return items from the work table. - suspend fun getDataXML(): String? { - val sqlStatement = "SELECT idwork, date, description, guide, status, username, archive " + - "FROM work WHERE archive = :arch ;" - val isArc = false - val parametersVal = listOf(param("arch", isArc)) - val statementRequest = ExecuteStatementRequest { - this.clusterIdentifier = clusterId - this.database = databaseVal - this.dbUser = dbUserVal - this.parameters = parametersVal - sql = sqlStatement - } - val id = performSQLStatement(statementRequest) - println("The identifier of the statement is $id") - checkStatement(id) - return getResultsXML(id) - } - - // Returns items. - suspend fun getResults(statementId: String?): MutableList { - val records = mutableListOf() - val resultRequest = GetStatementResultRequest { - id = statementId - } - - RedshiftDataClient { region = "us-west-2" }.use { redshiftDataClient -> - val response = redshiftDataClient.getStatementResult(resultRequest) - var workItem: WorkItem - var index: Int - - // Iterate through the List. - val dataList: List>? = response.records - var value: String - if (dataList != null) { - for (list in dataList) { - workItem = WorkItem() - index = 0 - for (field in list) { - when (index) { - 0 -> { - value = parseValue(field) - workItem.id = value - } - 1 -> { - value = parseValue(field) - workItem.date = value - } - 2 -> { - value = parseValue(field) - workItem.description = value - } - 3 -> { - value = parseValue(field) - workItem.guide = value - } - 4 -> { - value = parseValue(field) - workItem.status = value - } - 5 -> { - value = parseValue(field) - workItem.name = value - } - 6 -> { - value = parseBooleanValue(field) - workItem.archived = value != "false" - } - } - index++ - } - - // Push the object to the List. - records.add(workItem) - } - } - return records - } - } - - // Returns open items within XML. - suspend fun getResultsXML(statementId: String?): String? { - val records: MutableList = ArrayList() - val resultRequest = GetStatementResultRequest { - id = statementId - } - RedshiftDataClient { region = "us-west-2" }.use { redshiftDataClient -> - val response = redshiftDataClient.getStatementResult(resultRequest) - var workItem: WorkItem - var index: Int - - // Iterate through the List element where each element is a List object. - val dataList: List>? = response.records - var value: String - if (dataList != null) { - for (list in dataList) { - workItem = WorkItem() - index = 0 - for (field in list) { - when (index) { - 0 -> { - value = parseValue(field) - workItem.id = value - } - 1 -> { - value = parseValue(field) - workItem.date = value - } - 2 -> { - value = parseValue(field) - workItem.description = value - } - 3 -> { - value = parseValue(field) - workItem.guide = value - } - 4 -> { - value = parseValue(field) - workItem.status = value - } - 5 -> { - value = parseValue(field) - workItem.name = value - } - } - - // Increment the index. - index++ - } - - // Push the object to the List. - records.add(workItem) - } - } - return toXml(records)?.let { convertToString(it) } - } - } - - // Update the work table. - suspend fun flipItemArchive(id: String) { - val arc = "1" - // Specify the SQL statement to query data. - val sqlStatement = "update work set archive = (:arch) where idwork =(:id);" - val parametersVal = listOf( - param2("arch", arc), - param2("id", id) - ) - val statementRequest = ExecuteStatementRequest { - clusterIdentifier = clusterId - database = databaseVal - dbUser = dbUserVal - sql = sqlStatement - parameters = parametersVal - } - - RedshiftDataClient { region = "us-west-2" }.use { redshiftDataClient -> - redshiftDataClient.executeStatement(statementRequest) - } - } - - // Convert Work item data into XML. - private fun toXml(itemList: MutableList): Document? { - try { - val factory = DocumentBuilderFactory.newInstance() - val builder = factory.newDocumentBuilder() - val doc = builder.newDocument() - - // Start building the XML. - val root = doc.createElement("Items") - doc.appendChild(root) - - // Get the elements from the collection. - val custCount = itemList.size - - // Iterate through the collection. - for (index in 0 until custCount) { - // Get the WorkItem object from the collection. - val myItem = itemList[index] - val item = doc.createElement("Item") - root.appendChild(item) - - // Set Id. - val id = doc.createElement("Id") - id.appendChild(doc.createTextNode(myItem.id)) - item.appendChild(id) - - // Set Name. - val name = doc.createElement("Name") - name.appendChild(doc.createTextNode(myItem.name)) - item.appendChild(name) - - // Set Date. - val date = doc.createElement("Date") - date.appendChild(doc.createTextNode(myItem.date)) - item.appendChild(date) - - // Set Description. - val desc = doc.createElement("Description") - desc.appendChild(doc.createTextNode(myItem.description)) - item.appendChild(desc) - - // Set Guide. - val guide = doc.createElement("Guide") - guide.appendChild(doc.createTextNode(myItem.guide)) - item.appendChild(guide) - - // Set Status. - val status = doc.createElement("Status") - status.appendChild(doc.createTextNode(myItem.status)) - item.appendChild(status) - } - return doc - } catch (e: ParserConfigurationException) { - e.printStackTrace() - } - return null - } - - private fun convertToString(xml: Document): String? { - try { - val transformer = TransformerFactory.newInstance().newTransformer() - val result = StreamResult(StringWriter()) - val source = DOMSource(xml) - transformer.transform(source, result) - return result.writer.toString() - } catch (ex: TransformerException) { - ex.printStackTrace() - } - return null - } - - // Return the String value of the field. - fun parseValue(myField: Field): String { - val ss = myField.toString() - if ("StringValue" in ss) { - var str = ss.substringAfterLast("=") - str = str.substring(0, str.length - 1) - return str - } - return "" - } - - fun parseBooleanValue(myField: Field): String { - val ss = myField.toString() - if ("BooleanValue" in ss) { - var str = ss.substringAfterLast("=") - str = str.substring(0, str.length - 1) - return str - } - return "" - } - - suspend fun performSQLStatement(statementRequest: ExecuteStatementRequest): String? { - RedshiftDataClient { region = "us-west-2" }.use { redshiftDataClient -> - val response = redshiftDataClient.executeStatement(statementRequest) - return response.id - } - } - - suspend fun checkStatement(sqlId: String?) { - val statementRequest = DescribeStatementRequest { - id = sqlId - } - - // Wait until the sql statement processing is finished. - var finished = false - var status: String - RedshiftDataClient { region = "us-west-2" }.use { redshiftDataClient -> - while (!finished) { - val response = redshiftDataClient.describeStatement(statementRequest) - status = response.status.toString() - println("...$status") - - if (status.compareTo("FINISHED") == 0) { - finished = true - } else { - delay(500) - } - } - } - println("The statement is finished!") - } -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.aws.rest + +import aws.sdk.kotlin.services.redshiftdata.RedshiftDataClient +import aws.sdk.kotlin.services.redshiftdata.model.DescribeStatementRequest +import aws.sdk.kotlin.services.redshiftdata.model.ExecuteStatementRequest +import aws.sdk.kotlin.services.redshiftdata.model.Field +import aws.sdk.kotlin.services.redshiftdata.model.GetStatementResultRequest +import aws.sdk.kotlin.services.redshiftdata.model.SqlParameter +import kotlinx.coroutines.delay +import org.springframework.stereotype.Component +import org.w3c.dom.Document +import java.io.StringWriter +import java.sql.Date +import java.text.SimpleDateFormat +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter +import java.util.UUID +import javax.xml.parsers.DocumentBuilderFactory +import javax.xml.parsers.ParserConfigurationException +import javax.xml.transform.TransformerException +import javax.xml.transform.TransformerFactory +import javax.xml.transform.dom.DOMSource +import javax.xml.transform.stream.StreamResult +import kotlin.collections.ArrayList + +@Component +class RedshiftService { + // Update these values to reflect your environment. + private val databaseVal = "dev" + private val dbUserVal = "awsuser" + private val clusterId = "redshift-cluster-1" + + fun param(nameVal: String, valueVal: Boolean): SqlParameter { + val myPar = SqlParameter { + name = nameVal + value = valueVal.toString() + } + return myPar + } + + fun param2(nameVal: String, valueVal: String): SqlParameter { + val myPar = SqlParameter { + name = nameVal + value = valueVal + } + return myPar + } + + // Inject a new submission. + suspend fun injestNewSubmission(item: WorkItem): String { + val name = item.name + val guide = item.guide + val description = item.description + val status = item.status + val arc = "0" + + // Generate the work item ID. + val uuid = UUID.randomUUID() + val workId = uuid.toString() + + // Date conversion. + SimpleDateFormat("yyyy-MM-dd") + val dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss") + val now = LocalDateTime.now() + val sDate1 = dtf.format(now) + val date1 = SimpleDateFormat("yyyy/MM/dd").parse(sDate1) + val sqlDate = Date(date1.time) + + // Inject an item into the database. + val sqlStatement = + "INSERT INTO work (idwork, username, date, description, guide, status, archive) VALUES" + + "(:idwork, :username, :date, :description, :guide, :status, :arch);" + + val parametersVal = listOf( + param2("arch", arc), + param2("username", name.toString()), + param2("status", status.toString()), + param2("date", sqlDate.toString()), + param2("description", description.toString()), + param2("guide", guide.toString()), + param2("idwork", workId), + ) + + val statementRequest = ExecuteStatementRequest { + clusterIdentifier = clusterId + database = databaseVal + dbUser = dbUserVal + sql = sqlStatement + parameters = parametersVal + } + + RedshiftDataClient { region = "us-west-2" }.use { redshiftDataClient -> + redshiftDataClient.executeStatement(statementRequest) + return workId + } + } + + // Return items from the work table. + suspend fun getData(status: String): MutableList { + val isArc: Boolean + val statementRequest: ExecuteStatementRequest + val sqlStatement: String + if (status.compareTo("true") == 0) { + sqlStatement = "SELECT idwork, date, description, guide, status, username, archive FROM work WHERE archive = :arch ;" + isArc = true + val parametersVal = listOf(param("arch", isArc)) + statementRequest = ExecuteStatementRequest { + this.clusterIdentifier = clusterId + this.database = databaseVal + this.dbUser = dbUserVal + this.parameters = parametersVal + sql = sqlStatement + } + } else if (status.compareTo("false") == 0) { + sqlStatement = "SELECT idwork, date, description, guide, status, username, archive FROM work WHERE archive = :arch ;" + isArc = false + val parametersVal = listOf(param("arch", isArc)) + statementRequest = ExecuteStatementRequest { + this.clusterIdentifier = clusterId + this.database = databaseVal + this.dbUser = dbUserVal + this.parameters = parametersVal + sql = sqlStatement + } + } else { + sqlStatement = "SELECT idwork, date, description, guide, status, username, archive FROM work ;" + statementRequest = ExecuteStatementRequest { + this.clusterIdentifier = clusterId + this.database = databaseVal + this.dbUser = dbUserVal + sql = sqlStatement + } + } + + val id = performSQLStatement(statementRequest) + println("The identifier of the statement is $id") + checkStatement(id) + return getResults(id) + } + + // Return items from the work table. + suspend fun getDataXML(): String? { + val sqlStatement = "SELECT idwork, date, description, guide, status, username, archive " + + "FROM work WHERE archive = :arch ;" + val isArc = false + val parametersVal = listOf(param("arch", isArc)) + val statementRequest = ExecuteStatementRequest { + this.clusterIdentifier = clusterId + this.database = databaseVal + this.dbUser = dbUserVal + this.parameters = parametersVal + sql = sqlStatement + } + val id = performSQLStatement(statementRequest) + println("The identifier of the statement is $id") + checkStatement(id) + return getResultsXML(id) + } + + // Returns items. + suspend fun getResults(statementId: String?): MutableList { + val records = mutableListOf() + val resultRequest = GetStatementResultRequest { + id = statementId + } + + RedshiftDataClient { region = "us-west-2" }.use { redshiftDataClient -> + val response = redshiftDataClient.getStatementResult(resultRequest) + var workItem: WorkItem + var index: Int + + // Iterate through the List. + val dataList: List>? = response.records + var value: String + if (dataList != null) { + for (list in dataList) { + workItem = WorkItem() + index = 0 + for (field in list) { + when (index) { + 0 -> { + value = parseValue(field) + workItem.id = value + } + 1 -> { + value = parseValue(field) + workItem.date = value + } + 2 -> { + value = parseValue(field) + workItem.description = value + } + 3 -> { + value = parseValue(field) + workItem.guide = value + } + 4 -> { + value = parseValue(field) + workItem.status = value + } + 5 -> { + value = parseValue(field) + workItem.name = value + } + 6 -> { + value = parseBooleanValue(field) + workItem.archived = value != "false" + } + } + index++ + } + + // Push the object to the List. + records.add(workItem) + } + } + return records + } + } + + // Returns open items within XML. + suspend fun getResultsXML(statementId: String?): String? { + val records: MutableList = ArrayList() + val resultRequest = GetStatementResultRequest { + id = statementId + } + RedshiftDataClient { region = "us-west-2" }.use { redshiftDataClient -> + val response = redshiftDataClient.getStatementResult(resultRequest) + var workItem: WorkItem + var index: Int + + // Iterate through the List element where each element is a List object. + val dataList: List>? = response.records + var value: String + if (dataList != null) { + for (list in dataList) { + workItem = WorkItem() + index = 0 + for (field in list) { + when (index) { + 0 -> { + value = parseValue(field) + workItem.id = value + } + 1 -> { + value = parseValue(field) + workItem.date = value + } + 2 -> { + value = parseValue(field) + workItem.description = value + } + 3 -> { + value = parseValue(field) + workItem.guide = value + } + 4 -> { + value = parseValue(field) + workItem.status = value + } + 5 -> { + value = parseValue(field) + workItem.name = value + } + } + + // Increment the index. + index++ + } + + // Push the object to the List. + records.add(workItem) + } + } + return toXml(records)?.let { convertToString(it) } + } + } + + // Update the work table. + suspend fun flipItemArchive(id: String) { + val arc = "1" + // Specify the SQL statement to query data. + val sqlStatement = "update work set archive = (:arch) where idwork =(:id);" + val parametersVal = listOf( + param2("arch", arc), + param2("id", id), + ) + val statementRequest = ExecuteStatementRequest { + clusterIdentifier = clusterId + database = databaseVal + dbUser = dbUserVal + sql = sqlStatement + parameters = parametersVal + } + + RedshiftDataClient { region = "us-west-2" }.use { redshiftDataClient -> + redshiftDataClient.executeStatement(statementRequest) + } + } + + // Convert Work item data into XML. + private fun toXml(itemList: MutableList): Document? { + try { + val factory = DocumentBuilderFactory.newInstance() + val builder = factory.newDocumentBuilder() + val doc = builder.newDocument() + + // Start building the XML. + val root = doc.createElement("Items") + doc.appendChild(root) + + // Get the elements from the collection. + val custCount = itemList.size + + // Iterate through the collection. + for (index in 0 until custCount) { + // Get the WorkItem object from the collection. + val myItem = itemList[index] + val item = doc.createElement("Item") + root.appendChild(item) + + // Set Id. + val id = doc.createElement("Id") + id.appendChild(doc.createTextNode(myItem.id)) + item.appendChild(id) + + // Set Name. + val name = doc.createElement("Name") + name.appendChild(doc.createTextNode(myItem.name)) + item.appendChild(name) + + // Set Date. + val date = doc.createElement("Date") + date.appendChild(doc.createTextNode(myItem.date)) + item.appendChild(date) + + // Set Description. + val desc = doc.createElement("Description") + desc.appendChild(doc.createTextNode(myItem.description)) + item.appendChild(desc) + + // Set Guide. + val guide = doc.createElement("Guide") + guide.appendChild(doc.createTextNode(myItem.guide)) + item.appendChild(guide) + + // Set Status. + val status = doc.createElement("Status") + status.appendChild(doc.createTextNode(myItem.status)) + item.appendChild(status) + } + return doc + } catch (e: ParserConfigurationException) { + e.printStackTrace() + } + return null + } + + private fun convertToString(xml: Document): String? { + try { + val transformer = TransformerFactory.newInstance().newTransformer() + val result = StreamResult(StringWriter()) + val source = DOMSource(xml) + transformer.transform(source, result) + return result.writer.toString() + } catch (ex: TransformerException) { + ex.printStackTrace() + } + return null + } + + // Return the String value of the field. + fun parseValue(myField: Field): String { + val ss = myField.toString() + if ("StringValue" in ss) { + var str = ss.substringAfterLast("=") + str = str.substring(0, str.length - 1) + return str + } + return "" + } + + fun parseBooleanValue(myField: Field): String { + val ss = myField.toString() + if ("BooleanValue" in ss) { + var str = ss.substringAfterLast("=") + str = str.substring(0, str.length - 1) + return str + } + return "" + } + + suspend fun performSQLStatement(statementRequest: ExecuteStatementRequest): String? { + RedshiftDataClient { region = "us-west-2" }.use { redshiftDataClient -> + val response = redshiftDataClient.executeStatement(statementRequest) + return response.id + } + } + + suspend fun checkStatement(sqlId: String?) { + val statementRequest = DescribeStatementRequest { + id = sqlId + } + + // Wait until the sql statement processing is finished. + var finished = false + var status: String + RedshiftDataClient { region = "us-west-2" }.use { redshiftDataClient -> + while (!finished) { + val response = redshiftDataClient.describeStatement(statementRequest) + status = response.status.toString() + println("...$status") + + if (status.compareTo("FINISHED") == 0) { + finished = true + } else { + delay(500) + } + } + } + println("The statement is finished!") + } +} diff --git a/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/SendMessage.kt b/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/SendMessage.kt index 07657416522..72b140ce3f4 100644 --- a/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/SendMessage.kt +++ b/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/SendMessage.kt @@ -1,55 +1,55 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.aws.rest - -import aws.sdk.kotlin.services.ses.SesClient -import aws.sdk.kotlin.services.ses.model.Body -import aws.sdk.kotlin.services.ses.model.Content -import aws.sdk.kotlin.services.ses.model.Destination -import aws.sdk.kotlin.services.ses.model.Message -import aws.sdk.kotlin.services.ses.model.SendEmailRequest -import org.springframework.stereotype.Component - -@Component -class SendMessage { - - suspend fun send(recipient: String, strValue: String) { - val bodyHTML = ( - "" + "" + "" + "

Amazon database Items!

" + - "" + "" + "" - ) - - val destinationOb = Destination { - toAddresses = listOf(recipient) - } - - val contentOb = Content { - data = bodyHTML - } - - val subOb = Content { - data = "Item Report" - } - - val bodyOb = Body { - html = contentOb - } - - val msgOb = Message { - subject = subOb - body = bodyOb - } - - val emailRequest = SendEmailRequest { - destination = destinationOb - message = msgOb - source = "scmacdon@amazon.com" - } - - SesClient { region = "us-east-1" }.use { sesClient -> - println("Attempting to send an email through Amazon SES using the AWS SDK for Kotlin...") - sesClient.sendEmail(emailRequest) - } - } -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.aws.rest + +import aws.sdk.kotlin.services.ses.SesClient +import aws.sdk.kotlin.services.ses.model.Body +import aws.sdk.kotlin.services.ses.model.Content +import aws.sdk.kotlin.services.ses.model.Destination +import aws.sdk.kotlin.services.ses.model.Message +import aws.sdk.kotlin.services.ses.model.SendEmailRequest +import org.springframework.stereotype.Component + +@Component +class SendMessage { + + suspend fun send(recipient: String, strValue: String) { + val bodyHTML = ( + "" + "" + "" + "

Amazon database Items!

" + + "" + "" + "" + ) + + val destinationOb = Destination { + toAddresses = listOf(recipient) + } + + val contentOb = Content { + data = bodyHTML + } + + val subOb = Content { + data = "Item Report" + } + + val bodyOb = Body { + html = contentOb + } + + val msgOb = Message { + subject = subOb + body = bodyOb + } + + val emailRequest = SendEmailRequest { + destination = destinationOb + message = msgOb + source = "scmacdon@amazon.com" + } + + SesClient { region = "us-east-1" }.use { sesClient -> + println("Attempting to send an email through Amazon SES using the AWS SDK for Kotlin...") + sesClient.sendEmail(emailRequest) + } + } +} diff --git a/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/WorkItem.kt b/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/WorkItem.kt index 52264187b9a..83ecf33eb33 100644 --- a/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/WorkItem.kt +++ b/kotlin/usecases/creating_redshift_application/src/main/kotlin/com/aws/rest/WorkItem.kt @@ -1,14 +1,14 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.aws.rest - -class WorkItem { - var id: String? = null - var name: String? = null - var guide: String? = null - var date: String? = null - var description: String? = null - var status: String? = null - var archived: Boolean? = null -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.aws.rest + +class WorkItem { + var id: String? = null + var name: String? = null + var guide: String? = null + var date: String? = null + var description: String? = null + var status: String? = null + var archived: Boolean? = null +} diff --git a/kotlin/usecases/first_android_app/src/main/kotlin/com/example/awsapp/Database.kt b/kotlin/usecases/first_android_app/src/main/kotlin/com/example/awsapp/Database.kt index 53bdeee487b..bc3684058f8 100644 --- a/kotlin/usecases/first_android_app/src/main/kotlin/com/example/awsapp/Database.kt +++ b/kotlin/usecases/first_android_app/src/main/kotlin/com/example/awsapp/Database.kt @@ -5,8 +5,8 @@ package com.example.awsapp import aws.sdk.kotlin.services.dynamodb.DynamoDbClient import aws.sdk.kotlin.services.dynamodb.model.AttributeValue -import aws.sdk.kotlin.services.dynamodb.model.PutItemRequest import aws.sdk.kotlin.services.dynamodb.model.DynamoDbException +import aws.sdk.kotlin.services.dynamodb.model.PutItemRequest import kotlin.system.exitProcess class Database { @@ -29,20 +29,19 @@ class Database { // Add all content to the table. itemValues[key] = AttributeValue.S(keyVal) - itemValues[moneyTotal] = AttributeValue.S(moneyTotalValue) + itemValues[moneyTotal] = AttributeValue.S(moneyTotalValue) itemValues[name] = AttributeValue.S(nameValue) itemValues[email] = AttributeValue.S(emailVal) itemValues[date] = AttributeValue.S(dateVal) val request = PutItemRequest { - tableName=tableNameVal + tableName = tableNameVal item = itemValues } try { ddb.putItem(request) println(" A new item was placed into $tableNameVal.") - } catch (ex: DynamoDbException) { println(ex.message) ddb.close() diff --git a/kotlin/usecases/first_android_app/src/main/kotlin/com/example/awsapp/MainActivity.kt b/kotlin/usecases/first_android_app/src/main/kotlin/com/example/awsapp/MainActivity.kt index 51258347b3c..0341d8813b4 100644 --- a/kotlin/usecases/first_android_app/src/main/kotlin/com/example/awsapp/MainActivity.kt +++ b/kotlin/usecases/first_android_app/src/main/kotlin/com/example/awsapp/MainActivity.kt @@ -3,14 +3,14 @@ package com.example.awsapp +import android.os.Bundle +import android.widget.EditText +import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import aws.sdk.kotlin.runtime.auth.credentials.StaticCredentialsProvider import aws.sdk.kotlin.services.dynamodb.DynamoDbClient import aws.sdk.kotlin.services.sns.SnsClient import kotlinx.coroutines.runBlocking -import android.os.Bundle -import android.widget.EditText -import android.widget.Toast import java.util.* class MainActivity : AppCompatActivity() { @@ -19,11 +19,10 @@ class MainActivity : AppCompatActivity() { setContentView(R.layout.activity_main) } - fun submitData() = runBlocking{ - - val dollarField: EditText = findViewById(R.id.dollarText) - val nameField: EditText = findViewById(R.id.personName) - val emailField: EditText = findViewById(R.id.emailAddress) + fun submitData() = runBlocking { + val dollarField: EditText = findViewById(R.id.dollarText) + val nameField: EditText = findViewById(R.id.personName) + val emailField: EditText = findViewById(R.id.emailAddress) val dateField: EditText = findViewById(R.id.editDate) val data = Database() @@ -33,7 +32,7 @@ class MainActivity : AppCompatActivity() { secretAccessKey = "" } - val ddb = DynamoDbClient{ + val ddb = DynamoDbClient { region = "us-east-1" credentialsProvider = staticCredentials } @@ -56,7 +55,7 @@ class MainActivity : AppCompatActivity() { showToast("Item added") // Notify user. - val snsClient = SnsClient{ + val snsClient = SnsClient { region = "us-east-1" credentialsProvider = staticCredentials } @@ -64,10 +63,10 @@ class MainActivity : AppCompatActivity() { val sendMSG = SendMessage() val mobileNum = "" val message = "Item $uuid was added!" - sendMSG.pubTextSMS( snsClient,message, mobileNum ) + sendMSG.pubTextSMS(snsClient, message, mobileNum) } - fun showToast(value:String){ + fun showToast(value: String) { val toast = Toast.makeText(applicationContext, value, Toast.LENGTH_SHORT) toast.setMargin(50f, 50f) toast.show() diff --git a/kotlin/usecases/first_android_app/src/main/kotlin/com/example/awsapp/SendMessage.kt b/kotlin/usecases/first_android_app/src/main/kotlin/com/example/awsapp/SendMessage.kt index 384a1ac3b0e..51a65bf462e 100644 --- a/kotlin/usecases/first_android_app/src/main/kotlin/com/example/awsapp/SendMessage.kt +++ b/kotlin/usecases/first_android_app/src/main/kotlin/com/example/awsapp/SendMessage.kt @@ -19,7 +19,6 @@ class SendMessage { val result = snsClient.publish(request) println("${result.messageId} message sent.") - } catch (e: SnsException) { println(e.message) snsClient.close() diff --git a/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/App.kt b/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/App.kt index e59270d91ab..403e46b8387 100644 --- a/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/App.kt +++ b/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/App.kt @@ -1,93 +1,93 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.aws.rest - -import kotlinx.coroutines.runBlocking -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.autoconfigure.SpringBootApplication -import org.springframework.boot.runApplication -import org.springframework.http.HttpStatus -import org.springframework.web.bind.annotation.CrossOrigin -import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.PostMapping -import org.springframework.web.bind.annotation.PutMapping -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.ResponseStatus -import org.springframework.web.bind.annotation.RestController -import java.io.IOException - -@SpringBootApplication -open class App - -fun main(args: Array) { - runApplication(*args) -} - -@CrossOrigin(origins = ["*"]) -@RestController -class MessageResource { - - @Autowired - private lateinit var dbService: DynamoDBService - - @Autowired - private lateinit var sendMsg: SendMessage - - // Add a new item to the Amazon DynamoDB database. - @PostMapping("api/items") - fun addItems(@RequestBody payLoad: Map): String = runBlocking { - val nameVal = "user" - val guideVal = payLoad.get("guide").toString() - val descriptionVal = payLoad.get("description").toString() - val statusVal = payLoad.get("status").toString() - - // Create a Work Item object. - val myWork = WorkItem() - myWork.guide = guideVal - myWork.description = descriptionVal - myWork.status = statusVal - myWork.name = nameVal - val id = dbService.putItemInTable(myWork) - return@runBlocking "Item $id added successfully!" - } - - // Retrieve items. - @GetMapping("api/items") - fun getItems(@RequestParam(required = false) archived: String?): MutableList = runBlocking { - val list: MutableList - if (archived == "false") { - list = dbService.getOpenItems(false) - } else if (archived == "true") { - list = dbService.getOpenItems(true) - } else { - list = dbService.getAllItems() - } - return@runBlocking list - } - - // Flip an item from Active to Archive. - @PutMapping("api/items/{id}:archive") - @ResponseStatus(value = HttpStatus.NO_CONTENT) - fun modUser(@PathVariable id: String) = runBlocking { - dbService.archiveItemEC(id) - return@runBlocking - } - - @PostMapping("api/items:report") - @ResponseStatus(value = HttpStatus.NO_CONTENT) - fun sendReport(@RequestBody body: Map) = runBlocking { - val email = body.get("email") - val xml = dbService.getOpenReport(false) - try { - if (email != null) { - sendMsg.send(email, xml) - } - } catch (e: IOException) { - e.stackTrace - } - return@runBlocking - } -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.aws.rest + +import kotlinx.coroutines.runBlocking +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.autoconfigure.SpringBootApplication +import org.springframework.boot.runApplication +import org.springframework.http.HttpStatus +import org.springframework.web.bind.annotation.CrossOrigin +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.PutMapping +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.ResponseStatus +import org.springframework.web.bind.annotation.RestController +import java.io.IOException + +@SpringBootApplication +open class App + +fun main(args: Array) { + runApplication(*args) +} + +@CrossOrigin(origins = ["*"]) +@RestController +class MessageResource { + + @Autowired + private lateinit var dbService: DynamoDBService + + @Autowired + private lateinit var sendMsg: SendMessage + + // Add a new item to the Amazon DynamoDB database. + @PostMapping("api/items") + fun addItems(@RequestBody payLoad: Map): String = runBlocking { + val nameVal = "user" + val guideVal = payLoad.get("guide").toString() + val descriptionVal = payLoad.get("description").toString() + val statusVal = payLoad.get("status").toString() + + // Create a Work Item object. + val myWork = WorkItem() + myWork.guide = guideVal + myWork.description = descriptionVal + myWork.status = statusVal + myWork.name = nameVal + val id = dbService.putItemInTable(myWork) + return@runBlocking "Item $id added successfully!" + } + + // Retrieve items. + @GetMapping("api/items") + fun getItems(@RequestParam(required = false) archived: String?): MutableList = runBlocking { + val list: MutableList + if (archived == "false") { + list = dbService.getOpenItems(false) + } else if (archived == "true") { + list = dbService.getOpenItems(true) + } else { + list = dbService.getAllItems() + } + return@runBlocking list + } + + // Flip an item from Active to Archive. + @PutMapping("api/items/{id}:archive") + @ResponseStatus(value = HttpStatus.NO_CONTENT) + fun modUser(@PathVariable id: String) = runBlocking { + dbService.archiveItemEC(id) + return@runBlocking + } + + @PostMapping("api/items:report") + @ResponseStatus(value = HttpStatus.NO_CONTENT) + fun sendReport(@RequestBody body: Map) = runBlocking { + val email = body.get("email") + val xml = dbService.getOpenReport(false) + try { + if (email != null) { + sendMsg.send(email, xml) + } + } catch (e: IOException) { + e.stackTrace + } + return@runBlocking + } +} diff --git a/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/DynamoDBService.kt b/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/DynamoDBService.kt index 5078b37579c..8704454eb0d 100644 --- a/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/DynamoDBService.kt +++ b/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/DynamoDBService.kt @@ -1,340 +1,340 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.aws.rest -import aws.sdk.kotlin.services.dynamodb.DynamoDbClient -import aws.sdk.kotlin.services.dynamodb.model.AttributeAction -import aws.sdk.kotlin.services.dynamodb.model.AttributeValue -import aws.sdk.kotlin.services.dynamodb.model.AttributeValueUpdate -import aws.sdk.kotlin.services.dynamodb.model.PutItemRequest -import aws.sdk.kotlin.services.dynamodb.model.ScanRequest -import aws.sdk.kotlin.services.dynamodb.model.UpdateItemRequest -import org.springframework.stereotype.Component -import org.w3c.dom.Document -import java.io.StringWriter -import java.text.SimpleDateFormat -import java.util.Calendar -import java.util.UUID -import javax.xml.parsers.DocumentBuilderFactory -import javax.xml.parsers.ParserConfigurationException -import javax.xml.transform.TransformerException -import javax.xml.transform.TransformerFactory -import javax.xml.transform.dom.DOMSource -import javax.xml.transform.stream.StreamResult -import kotlin.collections.HashMap - -/* -Before running this code example, create an Amazon DynamoDB table named Work with a primary key named id. -*/ -@Component -class DynamoDBService { - - // Archive an item. - suspend fun archiveItemEC(id: String) { - val tableNameVal = "Work" - val itemKey = mutableMapOf() - itemKey["id"] = AttributeValue.S(id) - - val updatedValues = mutableMapOf() - updatedValues["archive"] = AttributeValueUpdate { - value = AttributeValue.N("1") - action = AttributeAction.Put - } - - val request = UpdateItemRequest { - tableName = tableNameVal - key = itemKey - attributeUpdates = updatedValues - } - - DynamoDbClient { region = "us-east-1" }.use { dynamoDBClient -> - dynamoDBClient.updateItem(request) - } - } - - // Get items from the Amazon DynamoDB table. - suspend fun getOpenItems(myArc: Boolean): MutableList { - val tableNameVal = "Work" - val myList = mutableListOf() - val myMap = HashMap() - myMap["#archive2"] = "archive" - val myExMap = mutableMapOf() - if (myArc) { - myExMap[":val"] = AttributeValue.N("1") - } else { - myExMap[":val"] = AttributeValue.N("0") - } - - val scanRequest = ScanRequest { - expressionAttributeNames = myMap - expressionAttributeValues = myExMap - tableName = tableNameVal - filterExpression = "#archive2 = :val" - } - - DynamoDbClient { region = "us-east-1" }.use { dynamoDBClient -> - val response = dynamoDBClient.scan(scanRequest) - for (item in response.items!!) { - val keys = item.keys - val myItem = WorkItem() - for (key in keys) { - when (key) { - "date" -> { - myItem.date = splitMyString(item[key].toString()) - } - - "status" -> { - myItem.status = splitMyString(item[key].toString()) - } - - "username" -> { - myItem.name = "user" - } - - "archive" -> { - myItem.arc = splitMyString(item[key].toString()) - } - - "description" -> { - myItem.description = splitMyString(item[key].toString()) - } - "id" -> { - myItem.id = splitMyString(item[key].toString()) - } - else -> { - myItem.guide = splitMyString(item[key].toString()) - myList.add(myItem) - } - } - } - } - return myList - } - } - - // Get items from the Amazon DynamoDB table. - suspend fun getAllItems(): MutableList { - val tableNameVal = "Work" - val myList = mutableListOf() - val scanRequest = ScanRequest { - tableName = tableNameVal - } - - DynamoDbClient { region = "us-east-1" }.use { dynamoDBClient -> - val response = dynamoDBClient.scan(scanRequest) - for (item in response.items!!) { - val keys = item.keys - val myItem = WorkItem() - - for (key in keys) { - when (key) { - "date" -> { - myItem.date = splitMyString(item[key].toString()) - } - - "status" -> { - myItem.status = splitMyString(item[key].toString()) - } - - "username" -> { - myItem.name = "user" - } - - "archive" -> { - myItem.arc = splitMyString(item[key].toString()) - } - - "description" -> { - myItem.description = splitMyString(item[key].toString()) - } - "id" -> { - myItem.id = splitMyString(item[key].toString()) - } - else -> { - myItem.guide = splitMyString(item[key].toString()) - myList.add(myItem) - } - } - } - } - return myList - } - } - - // Get items to go into the email report. - suspend fun getOpenReport(myArc: Boolean): String? { - val tableNameVal = "Work" - val myList = mutableListOf() - val myMap = HashMap() - myMap.put("#archive2", "archive") - val myExMap = mutableMapOf() - if (myArc) { - myExMap.put(":val", AttributeValue.N("1")) - } else { - myExMap.put(":val", AttributeValue.N("0")) - } - - val scanRequest = ScanRequest { - expressionAttributeNames = myMap - expressionAttributeValues = myExMap - tableName = tableNameVal - filterExpression = "#archive2 = :val" - } - - DynamoDbClient { region = "us-east-1" }.use { dynamoDBClient -> - val response = dynamoDBClient.scan(scanRequest) - for (item in response.items!!) { - val keys = item.keys - val myItem = WorkItem() - - for (key in keys) { - when (key) { - "date" -> { - myItem.date = splitMyString(item[key].toString()) - } - - "status" -> { - myItem.status = splitMyString(item[key].toString()) - } - - "username" -> { - myItem.name = "user" - } - - "archive" -> { - myItem.arc = splitMyString(item[key].toString()) - } - - "description" -> { - myItem.description = splitMyString(item[key].toString()) - } - "id" -> { - myItem.id = splitMyString(item[key].toString()) - } - else -> { - myItem.guide = splitMyString(item[key].toString()) - myList.add(myItem) - } - } - } - } - return toXml(myList)?.let { convertToString(it) } - } - } - - // Put an item into an Amazon DynamoDB table. - suspend fun putItemInTable(itemOb: WorkItem): String { - val tableNameVal = "Work" - - // Get all the values to store in the Amazon DynamoDB table. - val myGuid = UUID.randomUUID().toString() - val user = itemOb.name - val desc = itemOb.description - val status = itemOb.status - val guide = itemOb.guide - - val date = Calendar.getInstance().time - val formatter = SimpleDateFormat.getDateTimeInstance() - val formatedDate = formatter.format(date) - - // Add the data to the DynamoDB table. - val itemValues = mutableMapOf() - itemValues["id"] = AttributeValue.S(myGuid) - itemValues["username"] = AttributeValue.S(user.toString()) - itemValues["archive"] = AttributeValue.N("0") - itemValues["date"] = AttributeValue.S(formatedDate) - itemValues["description"] = AttributeValue.S(desc.toString()) - itemValues["guide"] = AttributeValue.S(guide.toString()) - itemValues["status"] = AttributeValue.S(status.toString()) - - val request = PutItemRequest { - tableName = tableNameVal - item = itemValues - } - - DynamoDbClient { region = "us-east-1" }.use { dynamoDBClient -> - dynamoDBClient.putItem(request) - return myGuid - } - } -} - -// Split the item[key] value. -fun splitMyString(str: String): String { - val del1 = "=" - val del2 = ")" - val parts = str.split(del1, del2) - val myVal = parts[1] - return myVal -} - -// Convert Work item data into XML to pass back to the view. -private fun toXml(itemList: MutableList): Document? { - try { - val factory = DocumentBuilderFactory.newInstance() - val builder = factory.newDocumentBuilder() - val doc = builder.newDocument() - - // Start building the XML. - val root = doc.createElement("Items") - doc.appendChild(root) - - // Get the elements from the collection. - val custCount = itemList.size - - // Iterate through the collection. - for (index in 0 until custCount) { - // Get the WorkItem object from the collection. - val myItem = itemList[index] - val item = doc.createElement("Item") - root.appendChild(item) - - // Set Id. - val id = doc.createElement("Id") - id.appendChild(doc.createTextNode(myItem.id)) - item.appendChild(id) - - // Set Name. - val name = doc.createElement("Name") - name.appendChild(doc.createTextNode(myItem.name)) - item.appendChild(name) - - // Set Date. - val date = doc.createElement("Date") - date.appendChild(doc.createTextNode(myItem.date)) - item.appendChild(date) - - // Set Description. - val desc = doc.createElement("Description") - desc.appendChild(doc.createTextNode(myItem.description)) - item.appendChild(desc) - - // Set Guide. - val guide = doc.createElement("Guide") - guide.appendChild(doc.createTextNode(myItem.guide)) - item.appendChild(guide) - - // Set Status. - val status = doc.createElement("Status") - status.appendChild(doc.createTextNode(myItem.status)) - item.appendChild(status) - } - return doc - } catch (e: ParserConfigurationException) { - e.printStackTrace() - } - return null -} - -private fun convertToString(xml: Document): String? { - try { - val transformer = TransformerFactory.newInstance().newTransformer() - val result = StreamResult(StringWriter()) - val source = DOMSource(xml) - transformer.transform(source, result) - return result.writer.toString() - } catch (ex: TransformerException) { - ex.printStackTrace() - } - return null -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.aws.rest +import aws.sdk.kotlin.services.dynamodb.DynamoDbClient +import aws.sdk.kotlin.services.dynamodb.model.AttributeAction +import aws.sdk.kotlin.services.dynamodb.model.AttributeValue +import aws.sdk.kotlin.services.dynamodb.model.AttributeValueUpdate +import aws.sdk.kotlin.services.dynamodb.model.PutItemRequest +import aws.sdk.kotlin.services.dynamodb.model.ScanRequest +import aws.sdk.kotlin.services.dynamodb.model.UpdateItemRequest +import org.springframework.stereotype.Component +import org.w3c.dom.Document +import java.io.StringWriter +import java.text.SimpleDateFormat +import java.util.Calendar +import java.util.UUID +import javax.xml.parsers.DocumentBuilderFactory +import javax.xml.parsers.ParserConfigurationException +import javax.xml.transform.TransformerException +import javax.xml.transform.TransformerFactory +import javax.xml.transform.dom.DOMSource +import javax.xml.transform.stream.StreamResult +import kotlin.collections.HashMap + +/* +Before running this code example, create an Amazon DynamoDB table named Work with a primary key named id. +*/ +@Component +class DynamoDBService { + + // Archive an item. + suspend fun archiveItemEC(id: String) { + val tableNameVal = "Work" + val itemKey = mutableMapOf() + itemKey["id"] = AttributeValue.S(id) + + val updatedValues = mutableMapOf() + updatedValues["archive"] = AttributeValueUpdate { + value = AttributeValue.N("1") + action = AttributeAction.Put + } + + val request = UpdateItemRequest { + tableName = tableNameVal + key = itemKey + attributeUpdates = updatedValues + } + + DynamoDbClient { region = "us-east-1" }.use { dynamoDBClient -> + dynamoDBClient.updateItem(request) + } + } + + // Get items from the Amazon DynamoDB table. + suspend fun getOpenItems(myArc: Boolean): MutableList { + val tableNameVal = "Work" + val myList = mutableListOf() + val myMap = HashMap() + myMap["#archive2"] = "archive" + val myExMap = mutableMapOf() + if (myArc) { + myExMap[":val"] = AttributeValue.N("1") + } else { + myExMap[":val"] = AttributeValue.N("0") + } + + val scanRequest = ScanRequest { + expressionAttributeNames = myMap + expressionAttributeValues = myExMap + tableName = tableNameVal + filterExpression = "#archive2 = :val" + } + + DynamoDbClient { region = "us-east-1" }.use { dynamoDBClient -> + val response = dynamoDBClient.scan(scanRequest) + for (item in response.items!!) { + val keys = item.keys + val myItem = WorkItem() + for (key in keys) { + when (key) { + "date" -> { + myItem.date = splitMyString(item[key].toString()) + } + + "status" -> { + myItem.status = splitMyString(item[key].toString()) + } + + "username" -> { + myItem.name = "user" + } + + "archive" -> { + myItem.arc = splitMyString(item[key].toString()) + } + + "description" -> { + myItem.description = splitMyString(item[key].toString()) + } + "id" -> { + myItem.id = splitMyString(item[key].toString()) + } + else -> { + myItem.guide = splitMyString(item[key].toString()) + myList.add(myItem) + } + } + } + } + return myList + } + } + + // Get items from the Amazon DynamoDB table. + suspend fun getAllItems(): MutableList { + val tableNameVal = "Work" + val myList = mutableListOf() + val scanRequest = ScanRequest { + tableName = tableNameVal + } + + DynamoDbClient { region = "us-east-1" }.use { dynamoDBClient -> + val response = dynamoDBClient.scan(scanRequest) + for (item in response.items!!) { + val keys = item.keys + val myItem = WorkItem() + + for (key in keys) { + when (key) { + "date" -> { + myItem.date = splitMyString(item[key].toString()) + } + + "status" -> { + myItem.status = splitMyString(item[key].toString()) + } + + "username" -> { + myItem.name = "user" + } + + "archive" -> { + myItem.arc = splitMyString(item[key].toString()) + } + + "description" -> { + myItem.description = splitMyString(item[key].toString()) + } + "id" -> { + myItem.id = splitMyString(item[key].toString()) + } + else -> { + myItem.guide = splitMyString(item[key].toString()) + myList.add(myItem) + } + } + } + } + return myList + } + } + + // Get items to go into the email report. + suspend fun getOpenReport(myArc: Boolean): String? { + val tableNameVal = "Work" + val myList = mutableListOf() + val myMap = HashMap() + myMap.put("#archive2", "archive") + val myExMap = mutableMapOf() + if (myArc) { + myExMap.put(":val", AttributeValue.N("1")) + } else { + myExMap.put(":val", AttributeValue.N("0")) + } + + val scanRequest = ScanRequest { + expressionAttributeNames = myMap + expressionAttributeValues = myExMap + tableName = tableNameVal + filterExpression = "#archive2 = :val" + } + + DynamoDbClient { region = "us-east-1" }.use { dynamoDBClient -> + val response = dynamoDBClient.scan(scanRequest) + for (item in response.items!!) { + val keys = item.keys + val myItem = WorkItem() + + for (key in keys) { + when (key) { + "date" -> { + myItem.date = splitMyString(item[key].toString()) + } + + "status" -> { + myItem.status = splitMyString(item[key].toString()) + } + + "username" -> { + myItem.name = "user" + } + + "archive" -> { + myItem.arc = splitMyString(item[key].toString()) + } + + "description" -> { + myItem.description = splitMyString(item[key].toString()) + } + "id" -> { + myItem.id = splitMyString(item[key].toString()) + } + else -> { + myItem.guide = splitMyString(item[key].toString()) + myList.add(myItem) + } + } + } + } + return toXml(myList)?.let { convertToString(it) } + } + } + + // Put an item into an Amazon DynamoDB table. + suspend fun putItemInTable(itemOb: WorkItem): String { + val tableNameVal = "Work" + + // Get all the values to store in the Amazon DynamoDB table. + val myGuid = UUID.randomUUID().toString() + val user = itemOb.name + val desc = itemOb.description + val status = itemOb.status + val guide = itemOb.guide + + val date = Calendar.getInstance().time + val formatter = SimpleDateFormat.getDateTimeInstance() + val formatedDate = formatter.format(date) + + // Add the data to the DynamoDB table. + val itemValues = mutableMapOf() + itemValues["id"] = AttributeValue.S(myGuid) + itemValues["username"] = AttributeValue.S(user.toString()) + itemValues["archive"] = AttributeValue.N("0") + itemValues["date"] = AttributeValue.S(formatedDate) + itemValues["description"] = AttributeValue.S(desc.toString()) + itemValues["guide"] = AttributeValue.S(guide.toString()) + itemValues["status"] = AttributeValue.S(status.toString()) + + val request = PutItemRequest { + tableName = tableNameVal + item = itemValues + } + + DynamoDbClient { region = "us-east-1" }.use { dynamoDBClient -> + dynamoDBClient.putItem(request) + return myGuid + } + } +} + +// Split the item[key] value. +fun splitMyString(str: String): String { + val del1 = "=" + val del2 = ")" + val parts = str.split(del1, del2) + val myVal = parts[1] + return myVal +} + +// Convert Work item data into XML to pass back to the view. +private fun toXml(itemList: MutableList): Document? { + try { + val factory = DocumentBuilderFactory.newInstance() + val builder = factory.newDocumentBuilder() + val doc = builder.newDocument() + + // Start building the XML. + val root = doc.createElement("Items") + doc.appendChild(root) + + // Get the elements from the collection. + val custCount = itemList.size + + // Iterate through the collection. + for (index in 0 until custCount) { + // Get the WorkItem object from the collection. + val myItem = itemList[index] + val item = doc.createElement("Item") + root.appendChild(item) + + // Set Id. + val id = doc.createElement("Id") + id.appendChild(doc.createTextNode(myItem.id)) + item.appendChild(id) + + // Set Name. + val name = doc.createElement("Name") + name.appendChild(doc.createTextNode(myItem.name)) + item.appendChild(name) + + // Set Date. + val date = doc.createElement("Date") + date.appendChild(doc.createTextNode(myItem.date)) + item.appendChild(date) + + // Set Description. + val desc = doc.createElement("Description") + desc.appendChild(doc.createTextNode(myItem.description)) + item.appendChild(desc) + + // Set Guide. + val guide = doc.createElement("Guide") + guide.appendChild(doc.createTextNode(myItem.guide)) + item.appendChild(guide) + + // Set Status. + val status = doc.createElement("Status") + status.appendChild(doc.createTextNode(myItem.status)) + item.appendChild(status) + } + return doc + } catch (e: ParserConfigurationException) { + e.printStackTrace() + } + return null +} + +private fun convertToString(xml: Document): String? { + try { + val transformer = TransformerFactory.newInstance().newTransformer() + val result = StreamResult(StringWriter()) + val source = DOMSource(xml) + transformer.transform(source, result) + return result.writer.toString() + } catch (ex: TransformerException) { + ex.printStackTrace() + } + return null +} diff --git a/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/SendMessage.kt b/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/SendMessage.kt index b5ba73b88ff..0c05ea1f334 100644 --- a/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/SendMessage.kt +++ b/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/SendMessage.kt @@ -1,56 +1,56 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.aws.rest - -import aws.sdk.kotlin.services.ses.SesClient -import aws.sdk.kotlin.services.ses.model.Body -import aws.sdk.kotlin.services.ses.model.Content -import aws.sdk.kotlin.services.ses.model.Destination -import aws.sdk.kotlin.services.ses.model.Message -import aws.sdk.kotlin.services.ses.model.SendEmailRequest -import org.springframework.stereotype.Component - -@Component -class SendMessage { - - suspend fun send(recipient: String, strValue: String?) { - // The HTML body of the email. - val bodyHTML = ( - "" + "" + "" + "

Amazon DynamoDB Items!

" + - "" + "" + "" - ) - - val destinationOb = Destination { - toAddresses = listOf(recipient) - } - - val contentOb = Content { - data = bodyHTML - } - - val subOb = Content { - data = "Item Report" - } - - val bodyOb = Body { - html = contentOb - } - - val msgOb = Message { - subject = subOb - body = bodyOb - } - - val emailRequest = SendEmailRequest { - destination = destinationOb - message = msgOb - source = "scmacdon@amazon.com" - } - - SesClient { region = "us-east-1" }.use { sesClient -> - println("Attempting to send an email through Amazon SES using the AWS SDK for Kotlin...") - sesClient.sendEmail(emailRequest) - } - } -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.aws.rest + +import aws.sdk.kotlin.services.ses.SesClient +import aws.sdk.kotlin.services.ses.model.Body +import aws.sdk.kotlin.services.ses.model.Content +import aws.sdk.kotlin.services.ses.model.Destination +import aws.sdk.kotlin.services.ses.model.Message +import aws.sdk.kotlin.services.ses.model.SendEmailRequest +import org.springframework.stereotype.Component + +@Component +class SendMessage { + + suspend fun send(recipient: String, strValue: String?) { + // The HTML body of the email. + val bodyHTML = ( + "" + "" + "" + "

Amazon DynamoDB Items!

" + + "" + "" + "" + ) + + val destinationOb = Destination { + toAddresses = listOf(recipient) + } + + val contentOb = Content { + data = bodyHTML + } + + val subOb = Content { + data = "Item Report" + } + + val bodyOb = Body { + html = contentOb + } + + val msgOb = Message { + subject = subOb + body = bodyOb + } + + val emailRequest = SendEmailRequest { + destination = destinationOb + message = msgOb + source = "scmacdon@amazon.com" + } + + SesClient { region = "us-east-1" }.use { sesClient -> + println("Attempting to send an email through Amazon SES using the AWS SDK for Kotlin...") + sesClient.sendEmail(emailRequest) + } + } +} diff --git a/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/WorkItem.kt b/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/WorkItem.kt index 17fff35f462..6108f9cef8d 100644 --- a/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/WorkItem.kt +++ b/kotlin/usecases/itemtracker_dynamodb/src/main/kotlin/com/aws/rest/WorkItem.kt @@ -1,14 +1,14 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.aws.rest - -class WorkItem { - var id: String? = null - var arc: String? = null - var name: String? = null - var guide: String? = null - var date: String? = null - var description: String? = null - var status: String? = null -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.aws.rest + +class WorkItem { + var id: String? = null + var arc: String? = null + var name: String? = null + var guide: String? = null + var date: String? = null + var description: String? = null + var status: String? = null +} diff --git a/kotlin/usecases/itemtracker_dynamodb/src/test/kotlin/DynamoDBTest.kt b/kotlin/usecases/itemtracker_dynamodb/src/test/kotlin/DynamoDBTest.kt index a884080720f..50f8fe92086 100644 --- a/kotlin/usecases/itemtracker_dynamodb/src/test/kotlin/DynamoDBTest.kt +++ b/kotlin/usecases/itemtracker_dynamodb/src/test/kotlin/DynamoDBTest.kt @@ -1,89 +1,89 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -import com.aws.rest.DynamoDBService -import com.aws.rest.SendMessage -import com.aws.rest.WorkItem -import kotlinx.coroutines.runBlocking -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.BeforeAll -import org.junit.jupiter.api.MethodOrderer -import org.junit.jupiter.api.Order -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestMethodOrder -import java.io.IOException -import java.io.InputStream -import java.util.Properties - -@TestInstance(TestInstance.Lifecycle.PER_CLASS) -@TestMethodOrder(MethodOrderer.OrderAnnotation::class) -class DynamoDBTest { - - private var email = "" - private var idToFlip = "" - private var nameVal = "" - private var guideVal = "" - private var descriptionVal = "" - private var statusVal = "" - - @BeforeAll - fun setup() { - val input: InputStream = this.javaClass.getClassLoader().getResourceAsStream("config.properties") - val prop = Properties() - - // Load the properties file. - prop.load(input) - email = prop.getProperty("email") - idToFlip = prop.getProperty("idToFlip") - nameVal = prop.getProperty("nameVal") - guideVal = prop.getProperty("guideVal") - descriptionVal = prop.getProperty("descriptionVal") - statusVal = prop.getProperty("statusVal") - } - - @Test - @Order(1) - fun getItems() = runBlocking { - val dbService = DynamoDBService() - val list = dbService.getOpenItems(false) - Assertions.assertTrue(list.isNotEmpty()) - println("Test 1 passed") - } - - @Test - @Order(2) - fun flipItemTest() = runBlocking { - val dbService = DynamoDBService() - dbService.archiveItemEC(idToFlip) - println("Test 2 passed") - } - - @Test - @Order(3) - fun reportTest() = runBlocking { - val sendMessage = SendMessage() - val dbService = DynamoDBService() - val xml = dbService.getOpenReport(false) - try { - sendMessage.send(email, xml) - } catch (e: IOException) { - e.stackTrace - } - println("Test 3 passed") - } - - @Test - @Order(4) - fun addTest() = runBlocking { - val dbService = DynamoDBService() - val myWork = WorkItem() - myWork.guide = guideVal - myWork.description = descriptionVal - myWork.status = statusVal - myWork.name = nameVal - val id = dbService.putItemInTable(myWork) - Assertions.assertTrue(id.isNotEmpty()) - println("Test 4 passed") - } -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import com.aws.rest.DynamoDBService +import com.aws.rest.SendMessage +import com.aws.rest.WorkItem +import kotlinx.coroutines.runBlocking +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.BeforeAll +import org.junit.jupiter.api.MethodOrderer +import org.junit.jupiter.api.Order +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.TestInstance +import org.junit.jupiter.api.TestMethodOrder +import java.io.IOException +import java.io.InputStream +import java.util.Properties + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@TestMethodOrder(MethodOrderer.OrderAnnotation::class) +class DynamoDBTest { + + private var email = "" + private var idToFlip = "" + private var nameVal = "" + private var guideVal = "" + private var descriptionVal = "" + private var statusVal = "" + + @BeforeAll + fun setup() { + val input: InputStream = this.javaClass.getClassLoader().getResourceAsStream("config.properties") + val prop = Properties() + + // Load the properties file. + prop.load(input) + email = prop.getProperty("email") + idToFlip = prop.getProperty("idToFlip") + nameVal = prop.getProperty("nameVal") + guideVal = prop.getProperty("guideVal") + descriptionVal = prop.getProperty("descriptionVal") + statusVal = prop.getProperty("statusVal") + } + + @Test + @Order(1) + fun getItems() = runBlocking { + val dbService = DynamoDBService() + val list = dbService.getOpenItems(false) + Assertions.assertTrue(list.isNotEmpty()) + println("Test 1 passed") + } + + @Test + @Order(2) + fun flipItemTest() = runBlocking { + val dbService = DynamoDBService() + dbService.archiveItemEC(idToFlip) + println("Test 2 passed") + } + + @Test + @Order(3) + fun reportTest() = runBlocking { + val sendMessage = SendMessage() + val dbService = DynamoDBService() + val xml = dbService.getOpenReport(false) + try { + sendMessage.send(email, xml) + } catch (e: IOException) { + e.stackTrace + } + println("Test 3 passed") + } + + @Test + @Order(4) + fun addTest() = runBlocking { + val dbService = DynamoDBService() + val myWork = WorkItem() + myWork.guide = guideVal + myWork.description = descriptionVal + myWork.status = statusVal + myWork.name = nameVal + val id = dbService.putItemInTable(myWork) + Assertions.assertTrue(id.isNotEmpty()) + println("Test 4 passed") + } +} diff --git a/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/DemoApplication.kt b/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/DemoApplication.kt index 7dc23a89650..8d04f16fcad 100644 --- a/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/DemoApplication.kt +++ b/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/DemoApplication.kt @@ -1,92 +1,92 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.example.demo - -import kotlinx.coroutines.runBlocking -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.autoconfigure.SpringBootApplication -import org.springframework.boot.runApplication -import org.springframework.http.HttpStatus -import org.springframework.web.bind.annotation.CrossOrigin -import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.PostMapping -import org.springframework.web.bind.annotation.PutMapping -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.ResponseStatus -import org.springframework.web.bind.annotation.RestController -import java.io.IOException - -@SpringBootApplication -open class DemoApplication - -fun main(args: Array) { - runApplication(*args) -} - -@CrossOrigin(origins = ["*"]) -@RestController -class MessageResource { - - @Autowired - private lateinit var wi: WorkItemRepository - - @Autowired - private lateinit var sendMsg: SendMessage - - // Add a new item. - @PostMapping("api/items") - fun addItems(@RequestBody payLoad: Map): String = runBlocking { - val nameVal = "user" - val guideVal = payLoad.get("guide").toString() - val descriptionVal = payLoad.get("description").toString() - val statusVal = payLoad.get("status").toString() - - // Create a Work Item object. - val myWork = WorkItem() - myWork.guide = guideVal - myWork.description = descriptionVal - myWork.status = statusVal - myWork.name = nameVal - val id = wi.injestNewSubmission(myWork) - return@runBlocking "Item $id added successfully!" - } - - // Retrieve items. - @GetMapping("api/items") - fun getItems(@RequestParam(required = false) archived: String?): MutableList = runBlocking { - val wi = WorkItemRepository() - val list: MutableList - if (archived != null) { - list = wi.getItemsDataSQL(archived) - } else { - list = wi.getItemsDataSQL("") - } - return@runBlocking list - } - - // Flip an item from Active to Archive. - @PutMapping("api/items/{id}:archive") - @ResponseStatus(value = HttpStatus.NO_CONTENT) - fun modUser(@PathVariable id: String) = runBlocking { - wi.flipItemArchive(id) - return@runBlocking - } - - @PostMapping("api/items:report") - @ResponseStatus(value = HttpStatus.NO_CONTENT) - fun sendReport(@RequestBody body: Map) = runBlocking { - val email = body.get("email") - val xml = wi.getItemsDataSQLReport("0") - try { - if (email != null) { - sendMsg.send(email, xml) - } - } catch (e: IOException) { - e.stackTrace - } - return@runBlocking - } -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.example.demo + +import kotlinx.coroutines.runBlocking +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.autoconfigure.SpringBootApplication +import org.springframework.boot.runApplication +import org.springframework.http.HttpStatus +import org.springframework.web.bind.annotation.CrossOrigin +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.PutMapping +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.ResponseStatus +import org.springframework.web.bind.annotation.RestController +import java.io.IOException + +@SpringBootApplication +open class DemoApplication + +fun main(args: Array) { + runApplication(*args) +} + +@CrossOrigin(origins = ["*"]) +@RestController +class MessageResource { + + @Autowired + private lateinit var wi: WorkItemRepository + + @Autowired + private lateinit var sendMsg: SendMessage + + // Add a new item. + @PostMapping("api/items") + fun addItems(@RequestBody payLoad: Map): String = runBlocking { + val nameVal = "user" + val guideVal = payLoad.get("guide").toString() + val descriptionVal = payLoad.get("description").toString() + val statusVal = payLoad.get("status").toString() + + // Create a Work Item object. + val myWork = WorkItem() + myWork.guide = guideVal + myWork.description = descriptionVal + myWork.status = statusVal + myWork.name = nameVal + val id = wi.injestNewSubmission(myWork) + return@runBlocking "Item $id added successfully!" + } + + // Retrieve items. + @GetMapping("api/items") + fun getItems(@RequestParam(required = false) archived: String?): MutableList = runBlocking { + val wi = WorkItemRepository() + val list: MutableList + if (archived != null) { + list = wi.getItemsDataSQL(archived) + } else { + list = wi.getItemsDataSQL("") + } + return@runBlocking list + } + + // Flip an item from Active to Archive. + @PutMapping("api/items/{id}:archive") + @ResponseStatus(value = HttpStatus.NO_CONTENT) + fun modUser(@PathVariable id: String) = runBlocking { + wi.flipItemArchive(id) + return@runBlocking + } + + @PostMapping("api/items:report") + @ResponseStatus(value = HttpStatus.NO_CONTENT) + fun sendReport(@RequestBody body: Map) = runBlocking { + val email = body.get("email") + val xml = wi.getItemsDataSQLReport("0") + try { + if (email != null) { + sendMsg.send(email, xml) + } + } catch (e: IOException) { + e.stackTrace + } + return@runBlocking + } +} diff --git a/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/SendMessage.kt b/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/SendMessage.kt index 21be1383ab3..0b17c8c9364 100644 --- a/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/SendMessage.kt +++ b/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/SendMessage.kt @@ -1,64 +1,64 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.example.demo -import aws.sdk.kotlin.services.ses.SesClient -import aws.sdk.kotlin.services.ses.model.Body -import aws.sdk.kotlin.services.ses.model.Content -import aws.sdk.kotlin.services.ses.model.Destination -import aws.sdk.kotlin.services.ses.model.Message -import aws.sdk.kotlin.services.ses.model.SendEmailRequest -import aws.sdk.kotlin.services.ses.model.SesException -import org.springframework.stereotype.Component -import kotlin.system.exitProcess -@Component -class SendMessage { - - suspend fun send( - recipient: String, - strValue: String? - ) { - val sesClient = SesClient { region = "us-east-1" } - // The HTML body of the email. - val bodyHTML = ( - "" + "" + "" + "

Amazon RDS Items!

" + - "" + "" + "" - ) - - val destinationOb = Destination { - toAddresses = listOf(recipient) - } - - val contentOb = Content { - data = bodyHTML - } - - val subOb = Content { - data = "Item Report" - } - - val bodyOb = Body { - html = contentOb - } - - val msgOb = Message { - subject = subOb - body = bodyOb - } - - val emailRequest = SendEmailRequest { - destination = destinationOb - message = msgOb - source = "scmacdon@amazon.com" - } - - try { - println("Attempting to send an email through Amazon SES using the AWS SDK for Kotlin...") - sesClient.sendEmail(emailRequest) - } catch (e: SesException) { - println(e.message) - sesClient.close() - exitProcess(0) - } - } -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.example.demo +import aws.sdk.kotlin.services.ses.SesClient +import aws.sdk.kotlin.services.ses.model.Body +import aws.sdk.kotlin.services.ses.model.Content +import aws.sdk.kotlin.services.ses.model.Destination +import aws.sdk.kotlin.services.ses.model.Message +import aws.sdk.kotlin.services.ses.model.SendEmailRequest +import aws.sdk.kotlin.services.ses.model.SesException +import org.springframework.stereotype.Component +import kotlin.system.exitProcess +@Component +class SendMessage { + + suspend fun send( + recipient: String, + strValue: String?, + ) { + val sesClient = SesClient { region = "us-east-1" } + // The HTML body of the email. + val bodyHTML = ( + "" + "" + "" + "

Amazon RDS Items!

" + + "" + "" + "" + ) + + val destinationOb = Destination { + toAddresses = listOf(recipient) + } + + val contentOb = Content { + data = bodyHTML + } + + val subOb = Content { + data = "Item Report" + } + + val bodyOb = Body { + html = contentOb + } + + val msgOb = Message { + subject = subOb + body = bodyOb + } + + val emailRequest = SendEmailRequest { + destination = destinationOb + message = msgOb + source = "scmacdon@amazon.com" + } + + try { + println("Attempting to send an email through Amazon SES using the AWS SDK for Kotlin...") + sesClient.sendEmail(emailRequest) + } catch (e: SesException) { + println(e.message) + sesClient.close() + exitProcess(0) + } + } +} diff --git a/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/WorkItem.kt b/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/WorkItem.kt index 4860ba3ea0b..49e70dfee67 100644 --- a/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/WorkItem.kt +++ b/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/WorkItem.kt @@ -1,14 +1,14 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.example.demo - -class WorkItem { - var id: String? = null - var name: String? = null - var guide: String? = null - var date: String? = null - var description: String? = null - var status: String? = null - var archived: Boolean? = null -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.example.demo + +class WorkItem { + var id: String? = null + var name: String? = null + var guide: String? = null + var date: String? = null + var description: String? = null + var status: String? = null + var archived: Boolean? = null +} diff --git a/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/WorkItemRepository.kt b/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/WorkItemRepository.kt index d5ed2cf01dc..60673c49f9f 100644 --- a/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/WorkItemRepository.kt +++ b/kotlin/usecases/serverless_rds/src/main/kotlin/com/example/demo/WorkItemRepository.kt @@ -1,331 +1,331 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.example.demo - -import aws.sdk.kotlin.services.rdsdata.RdsDataClient -import aws.sdk.kotlin.services.rdsdata.model.ExecuteStatementRequest -import aws.sdk.kotlin.services.rdsdata.model.Field -import aws.sdk.kotlin.services.rdsdata.model.SqlParameter -import org.springframework.stereotype.Component -import org.w3c.dom.Document -import java.io.StringWriter -import java.sql.Date -import java.text.SimpleDateFormat -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import javax.xml.parsers.DocumentBuilderFactory -import javax.xml.parsers.ParserConfigurationException -import javax.xml.transform.TransformerException -import javax.xml.transform.TransformerFactory -import javax.xml.transform.dom.DOMSource -import javax.xml.transform.stream.StreamResult - -@Component -class WorkItemRepository { - private val secretArnVal = "" - private val resourceArnVal = "" - - fun param(nameVal: String, valueVal: String): SqlParameter { - val myPar = SqlParameter { - name = nameVal - value = Field.StringValue(valueVal) - } - return myPar - } - - // Archive the specific item. - suspend fun flipItemArchive(id: String): String { - val sqlStatement: String - val arc = "1" - - // Specify the SQL statement to query data. - sqlStatement = "update work set archive = (:arch) where idwork =(:id);" - val parametersVal = listOf( - param("arch", arc), - param("id", id) - ) - val sqlRequest = ExecuteStatementRequest { - secretArn = secretArnVal - sql = sqlStatement - database = "jobs" - resourceArn = resourceArnVal - parameters = parametersVal - } - - RdsDataClient { region = "us-east-1" }.use { rdsDataClient -> - rdsDataClient.executeStatement(sqlRequest) - } - return id - } - - // Get items from the database. - suspend fun getItemsDataSQL(status: String): MutableList { - val records = mutableListOf() - val sqlStatement: String - val sqlRequest: ExecuteStatementRequest - val isArc: String - if (status.compareTo("true") == 0) { - sqlStatement = "SELECT idwork, date, description, guide, status, username, archive " + - "FROM work WHERE archive = :arch ;" - isArc = "1" - val parametersVal = listOf(param("arch", isArc)) - sqlRequest = ExecuteStatementRequest { - secretArn = secretArnVal - sql = sqlStatement - database = "jobs" - resourceArn = resourceArnVal - parameters = parametersVal - } - } else if (status.compareTo("false") == 0) { - sqlStatement = "SELECT idwork, date, description, guide, status, username, archive " + - "FROM work WHERE archive = :arch ;" - isArc = "0" - val parametersVal = listOf(param("arch", isArc)) - - sqlRequest = ExecuteStatementRequest { - secretArn = secretArnVal - sql = sqlStatement - database = "jobs" - resourceArn = resourceArnVal - parameters = parametersVal - } - } else { - sqlStatement = "SELECT idwork, date, description, guide, status, username, archive FROM work ;" - sqlRequest = ExecuteStatementRequest { - secretArn = secretArnVal - sql = sqlStatement - database = "jobs" - resourceArn = resourceArnVal - } - } - - RdsDataClient { region = "us-east-1" }.use { rdsDataClient -> - val response = rdsDataClient.executeStatement(sqlRequest) - val dataList: List>? = response.records - var workItem: WorkItem - var index: Int - - // Get the records. - if (dataList != null) { - for (list in dataList) { - workItem = WorkItem() - index = 0 - for (myField in list) { - val field: Field = myField - val result = field.toString() - val value = result.substringAfter("=").substringBefore(')') - when (index) { - 0 -> { - workItem.id = value - } - 1 -> { - workItem.date = value - } - 2 -> { - workItem.description = value - } - 3 -> { - workItem.guide = value - } - 4 -> { - workItem.status = value - } - 5 -> { - workItem.name = value - } - 6 -> { - workItem.archived = value != "false" - } - } - index++ - } - - // Push the object to the list. - records.add(workItem) - } - } - } - return records - } - - // Inject a new submission. - suspend fun injestNewSubmission(item: WorkItem): String { - val arc = "0" - val name = item.name.toString() - val guide = item.guide.toString() - val description = item.description.toString() - val status = item.status.toString() - - // Generate the work item ID. - val uuid = UUID.randomUUID() - val workId = uuid.toString() - - // Date conversion. - val dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss") - val now = LocalDateTime.now() - val sDate1 = dtf.format(now) - val date1 = SimpleDateFormat("yyyy/MM/dd").parse(sDate1) - val sqlDate = Date(date1.time) - - // Inject an item into the database. - val sqlStatement = - "INSERT INTO work (idwork, username, date, description, guide, status, archive) VALUES" + - "(:idwork, :username, :date, :description, :guide, :status, :arch);" - - val parametersVal = listOf( - param("arch", arc), - param("username", name), - param("status", status), - param("date", sqlDate.toString()), - param("description", description), - param("guide", guide), - param("idwork", workId) - ) - - val sqlRequest = ExecuteStatementRequest { - secretArn = secretArnVal - sql = sqlStatement - database = "jobs" - resourceArn = resourceArnVal - parameters = parametersVal - } - - RdsDataClient { region = "us-east-1" }.use { rdsDataClient -> - rdsDataClient.executeStatement(sqlRequest) - } - - return workId - } - - // Get Items data for the content that is sent using Amazon SES. - suspend fun getItemsDataSQLReport(arch: String): String? { - val records = mutableListOf() - val sqlStatement = "SELECT idwork, date, description, guide, status, username, archive " + - "FROM work WHERE archive = :arch ;" - - val parametersVal = listOf(param("arch", arch)) - val sqlRequest = ExecuteStatementRequest { - secretArn = secretArnVal - sql = sqlStatement - database = "jobs" - resourceArn = resourceArnVal - parameters = parametersVal - } - - RdsDataClient { region = "us-east-1" }.use { rdsDataClient -> - val response = rdsDataClient.executeStatement(sqlRequest) - val dataList: List>? = response.records - var workItem: WorkItem - var index: Int - - // Get the records. - if (dataList != null) { - for (list in dataList) { - workItem = WorkItem() - index = 0 - for (myField in list) { - val field: Field = myField - val result = field.toString() - val value = result.substringAfter("=").substringBefore(')') - when (index) { - 0 -> { - workItem.id = value - } - 1 -> { - workItem.date = value - } - 2 -> { - workItem.description = value - } - 3 -> { - workItem.guide = value - } - 4 -> { - workItem.status = value - } - 5 -> { - workItem.name = value - } - } - index++ - } - - // Push the object to the list. - records.add(workItem) - } - } - } - return convertToString(toXml(records)) - } - - // Convert Work data into XML to use in the report. - fun toXml(itemList: List): Document? { - try { - val factory = DocumentBuilderFactory.newInstance() - val builder = factory.newDocumentBuilder() - val doc = builder.newDocument() - val root = doc.createElement("Items") - doc.appendChild(root) - - // Get the elements from the collection. - val custCount = itemList.size - - // Iterate through the collection. - for (index in 0 until custCount) { - // Get the WorkItem object from the collection. - val myItem = itemList[index] - val item = doc.createElement("Item") - root.appendChild(item) - - // Set Id. - val id = doc.createElement("Id") - id.appendChild(doc.createTextNode(myItem.id)) - item.appendChild(id) - - // Set Name. - val name = doc.createElement("Name") - name.appendChild(doc.createTextNode(myItem.name)) - item.appendChild(name) - - // Set Date. - val date = doc.createElement("Date") - date.appendChild(doc.createTextNode(myItem.date)) - item.appendChild(date) - - // Set Description. - val desc = doc.createElement("Description") - desc.appendChild(doc.createTextNode(myItem.description)) - item.appendChild(desc) - - // Set Guide. - val guide = doc.createElement("Guide") - guide.appendChild(doc.createTextNode(myItem.guide)) - item.appendChild(guide) - - // Set Status. - val status = doc.createElement("Status") - status.appendChild(doc.createTextNode(myItem.status)) - item.appendChild(status) - } - return doc - } catch (e: ParserConfigurationException) { - e.printStackTrace() - } - return null - } - - fun convertToString(xml: Document?): String? { - try { - val transformer = TransformerFactory.newInstance().newTransformer() - val result = StreamResult(StringWriter()) - val source = DOMSource(xml) - transformer.transform(source, result) - return result.writer.toString() - } catch (ex: TransformerException) { - ex.printStackTrace() - } - return null - } -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.example.demo + +import aws.sdk.kotlin.services.rdsdata.RdsDataClient +import aws.sdk.kotlin.services.rdsdata.model.ExecuteStatementRequest +import aws.sdk.kotlin.services.rdsdata.model.Field +import aws.sdk.kotlin.services.rdsdata.model.SqlParameter +import org.springframework.stereotype.Component +import org.w3c.dom.Document +import java.io.StringWriter +import java.sql.Date +import java.text.SimpleDateFormat +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter +import java.util.UUID +import javax.xml.parsers.DocumentBuilderFactory +import javax.xml.parsers.ParserConfigurationException +import javax.xml.transform.TransformerException +import javax.xml.transform.TransformerFactory +import javax.xml.transform.dom.DOMSource +import javax.xml.transform.stream.StreamResult + +@Component +class WorkItemRepository { + private val secretArnVal = "" + private val resourceArnVal = "" + + fun param(nameVal: String, valueVal: String): SqlParameter { + val myPar = SqlParameter { + name = nameVal + value = Field.StringValue(valueVal) + } + return myPar + } + + // Archive the specific item. + suspend fun flipItemArchive(id: String): String { + val sqlStatement: String + val arc = "1" + + // Specify the SQL statement to query data. + sqlStatement = "update work set archive = (:arch) where idwork =(:id);" + val parametersVal = listOf( + param("arch", arc), + param("id", id), + ) + val sqlRequest = ExecuteStatementRequest { + secretArn = secretArnVal + sql = sqlStatement + database = "jobs" + resourceArn = resourceArnVal + parameters = parametersVal + } + + RdsDataClient { region = "us-east-1" }.use { rdsDataClient -> + rdsDataClient.executeStatement(sqlRequest) + } + return id + } + + // Get items from the database. + suspend fun getItemsDataSQL(status: String): MutableList { + val records = mutableListOf() + val sqlStatement: String + val sqlRequest: ExecuteStatementRequest + val isArc: String + if (status.compareTo("true") == 0) { + sqlStatement = "SELECT idwork, date, description, guide, status, username, archive " + + "FROM work WHERE archive = :arch ;" + isArc = "1" + val parametersVal = listOf(param("arch", isArc)) + sqlRequest = ExecuteStatementRequest { + secretArn = secretArnVal + sql = sqlStatement + database = "jobs" + resourceArn = resourceArnVal + parameters = parametersVal + } + } else if (status.compareTo("false") == 0) { + sqlStatement = "SELECT idwork, date, description, guide, status, username, archive " + + "FROM work WHERE archive = :arch ;" + isArc = "0" + val parametersVal = listOf(param("arch", isArc)) + + sqlRequest = ExecuteStatementRequest { + secretArn = secretArnVal + sql = sqlStatement + database = "jobs" + resourceArn = resourceArnVal + parameters = parametersVal + } + } else { + sqlStatement = "SELECT idwork, date, description, guide, status, username, archive FROM work ;" + sqlRequest = ExecuteStatementRequest { + secretArn = secretArnVal + sql = sqlStatement + database = "jobs" + resourceArn = resourceArnVal + } + } + + RdsDataClient { region = "us-east-1" }.use { rdsDataClient -> + val response = rdsDataClient.executeStatement(sqlRequest) + val dataList: List>? = response.records + var workItem: WorkItem + var index: Int + + // Get the records. + if (dataList != null) { + for (list in dataList) { + workItem = WorkItem() + index = 0 + for (myField in list) { + val field: Field = myField + val result = field.toString() + val value = result.substringAfter("=").substringBefore(')') + when (index) { + 0 -> { + workItem.id = value + } + 1 -> { + workItem.date = value + } + 2 -> { + workItem.description = value + } + 3 -> { + workItem.guide = value + } + 4 -> { + workItem.status = value + } + 5 -> { + workItem.name = value + } + 6 -> { + workItem.archived = value != "false" + } + } + index++ + } + + // Push the object to the list. + records.add(workItem) + } + } + } + return records + } + + // Inject a new submission. + suspend fun injestNewSubmission(item: WorkItem): String { + val arc = "0" + val name = item.name.toString() + val guide = item.guide.toString() + val description = item.description.toString() + val status = item.status.toString() + + // Generate the work item ID. + val uuid = UUID.randomUUID() + val workId = uuid.toString() + + // Date conversion. + val dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss") + val now = LocalDateTime.now() + val sDate1 = dtf.format(now) + val date1 = SimpleDateFormat("yyyy/MM/dd").parse(sDate1) + val sqlDate = Date(date1.time) + + // Inject an item into the database. + val sqlStatement = + "INSERT INTO work (idwork, username, date, description, guide, status, archive) VALUES" + + "(:idwork, :username, :date, :description, :guide, :status, :arch);" + + val parametersVal = listOf( + param("arch", arc), + param("username", name), + param("status", status), + param("date", sqlDate.toString()), + param("description", description), + param("guide", guide), + param("idwork", workId), + ) + + val sqlRequest = ExecuteStatementRequest { + secretArn = secretArnVal + sql = sqlStatement + database = "jobs" + resourceArn = resourceArnVal + parameters = parametersVal + } + + RdsDataClient { region = "us-east-1" }.use { rdsDataClient -> + rdsDataClient.executeStatement(sqlRequest) + } + + return workId + } + + // Get Items data for the content that is sent using Amazon SES. + suspend fun getItemsDataSQLReport(arch: String): String? { + val records = mutableListOf() + val sqlStatement = "SELECT idwork, date, description, guide, status, username, archive " + + "FROM work WHERE archive = :arch ;" + + val parametersVal = listOf(param("arch", arch)) + val sqlRequest = ExecuteStatementRequest { + secretArn = secretArnVal + sql = sqlStatement + database = "jobs" + resourceArn = resourceArnVal + parameters = parametersVal + } + + RdsDataClient { region = "us-east-1" }.use { rdsDataClient -> + val response = rdsDataClient.executeStatement(sqlRequest) + val dataList: List>? = response.records + var workItem: WorkItem + var index: Int + + // Get the records. + if (dataList != null) { + for (list in dataList) { + workItem = WorkItem() + index = 0 + for (myField in list) { + val field: Field = myField + val result = field.toString() + val value = result.substringAfter("=").substringBefore(')') + when (index) { + 0 -> { + workItem.id = value + } + 1 -> { + workItem.date = value + } + 2 -> { + workItem.description = value + } + 3 -> { + workItem.guide = value + } + 4 -> { + workItem.status = value + } + 5 -> { + workItem.name = value + } + } + index++ + } + + // Push the object to the list. + records.add(workItem) + } + } + } + return convertToString(toXml(records)) + } + + // Convert Work data into XML to use in the report. + fun toXml(itemList: List): Document? { + try { + val factory = DocumentBuilderFactory.newInstance() + val builder = factory.newDocumentBuilder() + val doc = builder.newDocument() + val root = doc.createElement("Items") + doc.appendChild(root) + + // Get the elements from the collection. + val custCount = itemList.size + + // Iterate through the collection. + for (index in 0 until custCount) { + // Get the WorkItem object from the collection. + val myItem = itemList[index] + val item = doc.createElement("Item") + root.appendChild(item) + + // Set Id. + val id = doc.createElement("Id") + id.appendChild(doc.createTextNode(myItem.id)) + item.appendChild(id) + + // Set Name. + val name = doc.createElement("Name") + name.appendChild(doc.createTextNode(myItem.name)) + item.appendChild(name) + + // Set Date. + val date = doc.createElement("Date") + date.appendChild(doc.createTextNode(myItem.date)) + item.appendChild(date) + + // Set Description. + val desc = doc.createElement("Description") + desc.appendChild(doc.createTextNode(myItem.description)) + item.appendChild(desc) + + // Set Guide. + val guide = doc.createElement("Guide") + guide.appendChild(doc.createTextNode(myItem.guide)) + item.appendChild(guide) + + // Set Status. + val status = doc.createElement("Status") + status.appendChild(doc.createTextNode(myItem.status)) + item.appendChild(status) + } + return doc + } catch (e: ParserConfigurationException) { + e.printStackTrace() + } + return null + } + + fun convertToString(xml: Document?): String? { + try { + val transformer = TransformerFactory.newInstance().newTransformer() + val result = StreamResult(StringWriter()) + val source = DOMSource(xml) + transformer.transform(source, result) + return result.writer.toString() + } catch (ex: TransformerException) { + ex.printStackTrace() + } + return null + } +} diff --git a/kotlin/usecases/subpub_app/src/main/kotlin/com/aws/kotlin/SnsService.kt b/kotlin/usecases/subpub_app/src/main/kotlin/com/aws/kotlin/SnsService.kt index 737945c41be..16babd8515f 100644 --- a/kotlin/usecases/subpub_app/src/main/kotlin/com/aws/kotlin/SnsService.kt +++ b/kotlin/usecases/subpub_app/src/main/kotlin/com/aws/kotlin/SnsService.kt @@ -1,179 +1,179 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.aws.kotlin - -import aws.sdk.kotlin.services.sns.SnsClient -import aws.sdk.kotlin.services.sns.model.ListSubscriptionsByTopicRequest -import aws.sdk.kotlin.services.sns.model.PublishRequest -import aws.sdk.kotlin.services.sns.model.SubscribeRequest -import aws.sdk.kotlin.services.sns.model.UnsubscribeRequest -import aws.sdk.kotlin.services.translate.TranslateClient -import aws.sdk.kotlin.services.translate.model.TranslateTextRequest -import org.springframework.stereotype.Component -import org.w3c.dom.Document -import java.io.StringWriter -import javax.xml.parsers.DocumentBuilderFactory -import javax.xml.parsers.ParserConfigurationException -import javax.xml.transform.TransformerConfigurationException -import javax.xml.transform.TransformerException -import javax.xml.transform.TransformerFactory -import javax.xml.transform.dom.DOMSource -import javax.xml.transform.stream.StreamResult - -@Component -class SnsService { - var topicArnVal = "" - - // Create a Subscription. - suspend fun subEmail(email: String?): String? { - val request = SubscribeRequest { - protocol = "email" - endpoint = email - returnSubscriptionArn = true - topicArn = topicArnVal - } - - SnsClient { region = "us-west-2" }.use { snsClient -> - val result = snsClient.subscribe(request) - return result.subscriptionArn - } - } - - suspend fun pubTopic(messageVal: String, lang: String): String { - val translateClient = TranslateClient { region = "us-east-1" } - val body: String - - if (lang.compareTo("English") == 0) { - body = messageVal - } else if (lang.compareTo("French") == 0) { - val textRequest = TranslateTextRequest { - sourceLanguageCode = "en" - targetLanguageCode = "fr" - text = messageVal - } - - val textResponse = translateClient.translateText(textRequest) - body = textResponse.translatedText.toString() - } else { - val textRequest = TranslateTextRequest { - sourceLanguageCode = "en" - targetLanguageCode = "es" - text = messageVal - } - - val textResponse = translateClient.translateText(textRequest) - body = textResponse.translatedText.toString() - } - - val request = PublishRequest { - message = body - topicArn = topicArnVal - } - - SnsClient { region = "us-west-2" }.use { snsClient -> - val result = snsClient.publish(request) - return "{$result.messageId.toString()} message sent successfully in $lang." - } - } - - suspend fun unSubEmail(emailEndpoint: String) { - val subscriptionArnVal = getTopicArnValue(emailEndpoint) - val request = UnsubscribeRequest { - subscriptionArn = subscriptionArnVal - } - - SnsClient { region = "us-west-2" }.use { snsClient -> - snsClient.unsubscribe(request) - } - } - - // Returns the Sub Amazon Resource Name (ARN) based on the given endpoint used for unSub. - suspend fun getTopicArnValue(endpoint: String): String? { - var subArn: String - val request = ListSubscriptionsByTopicRequest { - topicArn = topicArnVal - } - - SnsClient { region = "us-west-2" }.use { snsClient -> - val response = snsClient.listSubscriptionsByTopic(request) - response.subscriptions?.forEach { sub -> - if (sub.endpoint?.compareTo(endpoint) == 0) { - subArn = sub.subscriptionArn.toString() - return subArn - } - } - return "" - } - } - - suspend fun getAllSubscriptions(): String? { - val subList = mutableListOf() - val request = ListSubscriptionsByTopicRequest { - topicArn = topicArnVal - } - - SnsClient { region = "us-west-2" }.use { snsClient -> - val response = snsClient.listSubscriptionsByTopic(request) - response.subscriptions?.forEach { sub -> - subList.add(sub.endpoint.toString()) - } - return convertToString(toXml(subList)) - } - } - - // Convert the list to XML to pass back to the view. - private fun toXml(subsList: List): Document? { - try { - val factory = DocumentBuilderFactory.newInstance() - factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true) - val builder = factory.newDocumentBuilder() - val doc = builder.newDocument() - - // Start building the XML. - val root = doc.createElement("Subs") - doc.appendChild(root) - - // Iterate through the collection. - for (sub in subsList) { - val item = doc.createElement("Sub") - root.appendChild(item) - - // Set email. - val email = doc.createElement("email") - email.appendChild(doc.createTextNode(sub)) - item.appendChild(email) - } - return doc - } catch (e: ParserConfigurationException) { - e.printStackTrace() - } - return null - } - - private fun convertToString(xml: Document?): String? { - try { - val transformerFactory = getSecureTransformerFactory() - val transformer = transformerFactory?.newTransformer() - val result = StreamResult(StringWriter()) - val source = DOMSource(xml) - if (transformer != null) { - transformer.transform(source, result) - } - return result.writer.toString() - } catch (ex: TransformerException) { - ex.printStackTrace() - } - return null - } - - private fun getSecureTransformerFactory(): TransformerFactory? { - val transformerFactory: TransformerFactory = TransformerFactory.newInstance() - try { - transformerFactory.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true) - } catch (e: TransformerConfigurationException) { - e.printStackTrace() - } - return transformerFactory - } -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.aws.kotlin + +import aws.sdk.kotlin.services.sns.SnsClient +import aws.sdk.kotlin.services.sns.model.ListSubscriptionsByTopicRequest +import aws.sdk.kotlin.services.sns.model.PublishRequest +import aws.sdk.kotlin.services.sns.model.SubscribeRequest +import aws.sdk.kotlin.services.sns.model.UnsubscribeRequest +import aws.sdk.kotlin.services.translate.TranslateClient +import aws.sdk.kotlin.services.translate.model.TranslateTextRequest +import org.springframework.stereotype.Component +import org.w3c.dom.Document +import java.io.StringWriter +import javax.xml.parsers.DocumentBuilderFactory +import javax.xml.parsers.ParserConfigurationException +import javax.xml.transform.TransformerConfigurationException +import javax.xml.transform.TransformerException +import javax.xml.transform.TransformerFactory +import javax.xml.transform.dom.DOMSource +import javax.xml.transform.stream.StreamResult + +@Component +class SnsService { + var topicArnVal = "" + + // Create a Subscription. + suspend fun subEmail(email: String?): String? { + val request = SubscribeRequest { + protocol = "email" + endpoint = email + returnSubscriptionArn = true + topicArn = topicArnVal + } + + SnsClient { region = "us-west-2" }.use { snsClient -> + val result = snsClient.subscribe(request) + return result.subscriptionArn + } + } + + suspend fun pubTopic(messageVal: String, lang: String): String { + val translateClient = TranslateClient { region = "us-east-1" } + val body: String + + if (lang.compareTo("English") == 0) { + body = messageVal + } else if (lang.compareTo("French") == 0) { + val textRequest = TranslateTextRequest { + sourceLanguageCode = "en" + targetLanguageCode = "fr" + text = messageVal + } + + val textResponse = translateClient.translateText(textRequest) + body = textResponse.translatedText.toString() + } else { + val textRequest = TranslateTextRequest { + sourceLanguageCode = "en" + targetLanguageCode = "es" + text = messageVal + } + + val textResponse = translateClient.translateText(textRequest) + body = textResponse.translatedText.toString() + } + + val request = PublishRequest { + message = body + topicArn = topicArnVal + } + + SnsClient { region = "us-west-2" }.use { snsClient -> + val result = snsClient.publish(request) + return "{$result.messageId.toString()} message sent successfully in $lang." + } + } + + suspend fun unSubEmail(emailEndpoint: String) { + val subscriptionArnVal = getTopicArnValue(emailEndpoint) + val request = UnsubscribeRequest { + subscriptionArn = subscriptionArnVal + } + + SnsClient { region = "us-west-2" }.use { snsClient -> + snsClient.unsubscribe(request) + } + } + + // Returns the Sub Amazon Resource Name (ARN) based on the given endpoint used for unSub. + suspend fun getTopicArnValue(endpoint: String): String? { + var subArn: String + val request = ListSubscriptionsByTopicRequest { + topicArn = topicArnVal + } + + SnsClient { region = "us-west-2" }.use { snsClient -> + val response = snsClient.listSubscriptionsByTopic(request) + response.subscriptions?.forEach { sub -> + if (sub.endpoint?.compareTo(endpoint) == 0) { + subArn = sub.subscriptionArn.toString() + return subArn + } + } + return "" + } + } + + suspend fun getAllSubscriptions(): String? { + val subList = mutableListOf() + val request = ListSubscriptionsByTopicRequest { + topicArn = topicArnVal + } + + SnsClient { region = "us-west-2" }.use { snsClient -> + val response = snsClient.listSubscriptionsByTopic(request) + response.subscriptions?.forEach { sub -> + subList.add(sub.endpoint.toString()) + } + return convertToString(toXml(subList)) + } + } + + // Convert the list to XML to pass back to the view. + private fun toXml(subsList: List): Document? { + try { + val factory = DocumentBuilderFactory.newInstance() + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true) + val builder = factory.newDocumentBuilder() + val doc = builder.newDocument() + + // Start building the XML. + val root = doc.createElement("Subs") + doc.appendChild(root) + + // Iterate through the collection. + for (sub in subsList) { + val item = doc.createElement("Sub") + root.appendChild(item) + + // Set email. + val email = doc.createElement("email") + email.appendChild(doc.createTextNode(sub)) + item.appendChild(email) + } + return doc + } catch (e: ParserConfigurationException) { + e.printStackTrace() + } + return null + } + + private fun convertToString(xml: Document?): String? { + try { + val transformerFactory = getSecureTransformerFactory() + val transformer = transformerFactory?.newTransformer() + val result = StreamResult(StringWriter()) + val source = DOMSource(xml) + if (transformer != null) { + transformer.transform(source, result) + } + return result.writer.toString() + } catch (ex: TransformerException) { + ex.printStackTrace() + } + return null + } + + private fun getSecureTransformerFactory(): TransformerFactory? { + val transformerFactory: TransformerFactory = TransformerFactory.newInstance() + try { + transformerFactory.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true) + } catch (e: TransformerConfigurationException) { + e.printStackTrace() + } + return transformerFactory + } +} diff --git a/kotlin/usecases/subpub_app/src/main/kotlin/com/aws/kotlin/SubApplication.kt b/kotlin/usecases/subpub_app/src/main/kotlin/com/aws/kotlin/SubApplication.kt index 3bdf2ef6810..5a4ffe34433 100644 --- a/kotlin/usecases/subpub_app/src/main/kotlin/com/aws/kotlin/SubApplication.kt +++ b/kotlin/usecases/subpub_app/src/main/kotlin/com/aws/kotlin/SubApplication.kt @@ -1,69 +1,65 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.aws.kotlin - -import kotlinx.coroutines.runBlocking -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.autoconfigure.SpringBootApplication -import org.springframework.boot.runApplication -import org.springframework.stereotype.Controller -import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RequestMethod -import org.springframework.web.bind.annotation.ResponseBody -import javax.servlet.http.HttpServletRequest -import javax.servlet.http.HttpServletResponse - -@SpringBootApplication -open class SubApplication - -fun main(args: Array) { - runApplication(*args) -} - -@Controller -class MessageResource { - - @Autowired - var sns: SnsService? = null - - @GetMapping("/") - fun root(): String { - return "index" - } - - @GetMapping("/subscribe") - fun add(): String { - return "sub" - } - - @RequestMapping(value = ["/delSub"], method = [RequestMethod.POST]) - @ResponseBody - fun delSub(request: HttpServletRequest, response: HttpServletResponse?): String? = runBlocking { - val email = request.getParameter("email") - sns?.unSubEmail(email) - return@runBlocking "$email was successfully deleted!" - } - - @RequestMapping(value = ["/addEmail"], method = [RequestMethod.POST]) - @ResponseBody - fun addItems(request: HttpServletRequest, response: HttpServletResponse?): String? = runBlocking { - val email = request.getParameter("email") - return@runBlocking sns?.subEmail(email) - } - - @RequestMapping(value = ["/addMessage"], method = [RequestMethod.POST]) - @ResponseBody - fun addMessage(request: HttpServletRequest, response: HttpServletResponse?): String? = runBlocking { - val body = request.getParameter("body") - val lang = request.getParameter("lang") - return@runBlocking sns?.pubTopic(body, lang) - } - - @RequestMapping(value = ["/getSubs"], method = [RequestMethod.GET]) - @ResponseBody - fun getSubs(request: HttpServletRequest?, response: HttpServletResponse?): String? = runBlocking { - return@runBlocking sns?.getAllSubscriptions() - } -} +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.aws.kotlin + +import kotlinx.coroutines.runBlocking +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.autoconfigure.SpringBootApplication +import org.springframework.boot.runApplication +import org.springframework.stereotype.Controller +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RequestMethod +import org.springframework.web.bind.annotation.ResponseBody +import javax.servlet.http.HttpServletRequest +import javax.servlet.http.HttpServletResponse + +@SpringBootApplication +open class SubApplication + +fun main(args: Array) { + runApplication(*args) +} + +@Controller +class MessageResource { + + @Autowired + var sns: SnsService? = null + + @GetMapping("/") + fun root(): String = "index" + + @GetMapping("/subscribe") + fun add(): String = "sub" + + @RequestMapping(value = ["/delSub"], method = [RequestMethod.POST]) + @ResponseBody + fun delSub(request: HttpServletRequest, response: HttpServletResponse?): String? = runBlocking { + val email = request.getParameter("email") + sns?.unSubEmail(email) + return@runBlocking "$email was successfully deleted!" + } + + @RequestMapping(value = ["/addEmail"], method = [RequestMethod.POST]) + @ResponseBody + fun addItems(request: HttpServletRequest, response: HttpServletResponse?): String? = runBlocking { + val email = request.getParameter("email") + return@runBlocking sns?.subEmail(email) + } + + @RequestMapping(value = ["/addMessage"], method = [RequestMethod.POST]) + @ResponseBody + fun addMessage(request: HttpServletRequest, response: HttpServletResponse?): String? = runBlocking { + val body = request.getParameter("body") + val lang = request.getParameter("lang") + return@runBlocking sns?.pubTopic(body, lang) + } + + @RequestMapping(value = ["/getSubs"], method = [RequestMethod.GET]) + @ResponseBody + fun getSubs(request: HttpServletRequest?, response: HttpServletResponse?): String? = runBlocking { + return@runBlocking sns?.getAllSubscriptions() + } +} diff --git a/kotlin/usecases/subpub_app_android/src/main/kotlin/com/example/androidsubpub/MainActivity.kt b/kotlin/usecases/subpub_app_android/src/main/kotlin/com/example/androidsubpub/MainActivity.kt index 08af536dd97..6ffcd634e11 100644 --- a/kotlin/usecases/subpub_app_android/src/main/kotlin/com/example/androidsubpub/MainActivity.kt +++ b/kotlin/usecases/subpub_app_android/src/main/kotlin/com/example/androidsubpub/MainActivity.kt @@ -1,54 +1,56 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 - package com.example.androidsubpub - - import androidx.appcompat.app.AppCompatActivity - import android.os.Bundle - import android.view.View - import android.widget.* - import kotlinx.coroutines.runBlocking - import aws.sdk.kotlin.runtime.auth.credentials.StaticCredentialsProvider - import aws.sdk.kotlin.services.sns.SnsClient - import aws.sdk.kotlin.services.sns.model.* - import java.util.regex.Pattern - import kotlin.system.exitProcess - import aws.sdk.kotlin.services.sns.model.SnsException - import aws.sdk.kotlin.services.sns.model.ListSubscriptionsByTopicRequest - import aws.sdk.kotlin.services.translate.TranslateClient - import aws.sdk.kotlin.services.translate.model.TranslateTextRequest - - class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener { - - var topicArnVal = "" - val items = arrayOf("En", "Fr", "Sp") - var chosenLan: String ="" - - override fun onCreate(savedInstanceState: Bundle?) { +package com.example.androidsubpub + +import android.os.Bundle +import android.view.View +import android.widget.* +import androidx.appcompat.app.AppCompatActivity +import aws.sdk.kotlin.runtime.auth.credentials.StaticCredentialsProvider +import aws.sdk.kotlin.services.sns.SnsClient +import aws.sdk.kotlin.services.sns.model.* +import aws.sdk.kotlin.services.sns.model.ListSubscriptionsByTopicRequest +import aws.sdk.kotlin.services.sns.model.SnsException +import aws.sdk.kotlin.services.translate.TranslateClient +import aws.sdk.kotlin.services.translate.model.TranslateTextRequest +import kotlinx.coroutines.runBlocking +import java.util.regex.Pattern +import kotlin.system.exitProcess + +class MainActivity : + AppCompatActivity(), + AdapterView.OnItemSelectedListener { + + var topicArnVal = "" + val items = arrayOf("En", "Fr", "Sp") + var chosenLan: String = "" + + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) - val dropdown = findViewById(R.id.spinner) + val dropdown = findViewById(R.id.spinner) dropdown.onItemSelectedListener = this val adapter = ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, items) dropdown.adapter = adapter - } - - override fun onItemSelected(parent: AdapterView<*>?, - view: View, position: Int, - id: Long) { + } + override fun onItemSelected( + parent: AdapterView<*>?, + view: View, + position: Int, + id: Long, + ) { chosenLan = parent?.getItemAtPosition(position).toString() val toast = Toast.makeText(applicationContext, chosenLan, Toast.LENGTH_SHORT) toast.setMargin(50f, 50f) toast.show() - } + } - override fun onNothingSelected(parent: AdapterView<*>?) { - - } + override fun onNothingSelected(parent: AdapterView<*>?) { + } // Publish a message. fun pubTopic(view: View) = runBlocking { - val snsClient = getClient() val translateClient = getTranslateClient() val bodyMessage: EditText = findViewById(R.id.txtMessage) @@ -56,8 +58,7 @@ var translateBody: String // Need to translate the message if user selected another language. - if (chosenLan == "Fr" ) { - + if (chosenLan == "Fr") { val textRequest = TranslateTextRequest { sourceLanguageCode = "en" targetLanguageCode = "fr" @@ -66,23 +67,20 @@ val textResponse = translateClient.translateText(textRequest) translateBody = textResponse.translatedText.toString() - - } else if (chosenLan == "Sp" ) { - + } else if (chosenLan == "Sp") { val textRequest = TranslateTextRequest { - sourceLanguageCode = "en" - targetLanguageCode = "es" - text = body - } + sourceLanguageCode = "en" + targetLanguageCode = "es" + text = body + } val textResponse = translateClient.translateText(textRequest) translateBody = textResponse.translatedText.toString() - - } else + } else { translateBody = body + } try { - val request = PublishRequest { message = translateBody topicArn = topicArnVal @@ -90,20 +88,17 @@ val result = snsClient.publish(request) showToast("{$result.messageId.toString()} published!") - } catch (e: SnsException) { println(e.message) snsClient.close() } - } - - // Get all subscriptions. - fun getSubs(view: View) = runBlocking { + } + // Get all subscriptions. + fun getSubs(view: View) = runBlocking { val subList = mutableListOf() val snsClient: SnsClient = getClient() try { - val request = ListSubscriptionsByTopicRequest { topicArn = topicArnVal } @@ -114,16 +109,14 @@ val listString = java.lang.String.join(", ", subList) showToast(listString) - - } catch (e: SnsException) { + } catch (e: SnsException) { println(e.message) snsClient.close() } - } - - // Remove a subscription based on an email. - fun unSubUser(view: View) = runBlocking { + } + // Remove a subscription based on an email. + fun unSubUser(view: View) = runBlocking { val snsClient = getClient() val emailVal: EditText = findViewById(R.id.txtEmail) val emailStr = emailVal.text.toString() @@ -133,48 +126,45 @@ if (!isValidEmail) { showToast("Email not valid") } else { - try { - var subArn = "" - val listRequest = ListSubscriptionsByTopicRequest { - topicArn = topicArnVal - } - val response = snsClient.listSubscriptionsByTopic(listRequest) - response.subscriptions?.forEach { sub -> - - if (sub.endpoint?.compareTo(emailStr) == 0) { - subArn = sub.subscriptionArn.toString() - } - } - - val request = UnsubscribeRequest { - subscriptionArn = subArn - } + try { + var subArn = "" + val listRequest = ListSubscriptionsByTopicRequest { + topicArn = topicArnVal + } + val response = snsClient.listSubscriptionsByTopic(listRequest) + response.subscriptions?.forEach { sub -> - snsClient.unsubscribe(request) - showToast("$emailStr was unsubscribed") + if (sub.endpoint?.compareTo(emailStr) == 0) { + subArn = sub.subscriptionArn.toString() + } + } - } catch (e: SnsException) { - println(e.message) - snsClient.close() - exitProcess(0) + val request = UnsubscribeRequest { + subscriptionArn = subArn } - } - } - // Create a new subscription. - fun subUser(view: View) = runBlocking{ + snsClient.unsubscribe(request) + showToast("$emailStr was unsubscribed") + } catch (e: SnsException) { + println(e.message) + snsClient.close() + exitProcess(0) + } + } + } + // Create a new subscription. + fun subUser(view: View) = runBlocking { val snsClient = getClient() - val emailVal: EditText = findViewById(R.id.txtEmail) + val emailVal: EditText = findViewById(R.id.txtEmail) val emailStr = emailVal.text.toString() val isValidEmail = checkEmail(emailStr) // Make sure that the email is valid. if (!isValidEmail) { showToast("Email not valid") - } - else { + } else { try { val request = SubscribeRequest { protocol = "email" @@ -183,68 +173,63 @@ topicArn = topicArnVal } - val result = snsClient.subscribe(request) - showToast(result.subscriptionArn.toString()) - + val result = snsClient.subscribe(request) + showToast(result.subscriptionArn.toString()) } catch (e: SnsException) { println(e.message) snsClient.close() exitProcess(0) } } - } - - // Returns the Sub Amazon Resource Name (ARN) based on the given endpoint used for unSub. - suspend fun getTopicArnValue(snsClient: SnsClient, endpoint: String): String? { - - try { - var subArn: String + } - val request = ListSubscriptionsByTopicRequest { - topicArn = topicArnVal - } + // Returns the Sub Amazon Resource Name (ARN) based on the given endpoint used for unSub. + suspend fun getTopicArnValue(snsClient: SnsClient, endpoint: String): String? { + try { + var subArn: String - val response = snsClient.listSubscriptionsByTopic(request) - response.subscriptions?.forEach { sub -> + val request = ListSubscriptionsByTopicRequest { + topicArn = topicArnVal + } - if (sub.endpoint?.compareTo(endpoint) ==0 ) { - subArn = sub.subscriptionArn.toString() - return subArn - } - } + val response = snsClient.listSubscriptionsByTopic(request) + response.subscriptions?.forEach { sub -> - return "" - } catch (e: SnsException) { - println(e.message) - snsClient.close() - exitProcess(0) + if (sub.endpoint?.compareTo(endpoint) == 0) { + subArn = sub.subscriptionArn.toString() + return subArn } } + return "" + } catch (e: SnsException) { + println(e.message) + snsClient.close() + exitProcess(0) + } + } - fun getTranslateClient() : TranslateClient{ - + fun getTranslateClient(): TranslateClient { val staticCredentials = StaticCredentialsProvider { accessKeyId = "" secretAccessKey = "" } - val translateClient = TranslateClient{ + val translateClient = TranslateClient { region = "us-west-2" credentialsProvider = staticCredentials } return translateClient - } - - fun getClient() : SnsClient{ + } + fun getClient(): SnsClient { val staticCredentials = StaticCredentialsProvider { accessKeyId = "" secretAccessKey = "" } - val snsClient = SnsClient{ + val snsClient = SnsClient { region = "us-west-2" credentialsProvider = staticCredentials } @@ -252,23 +237,21 @@ return snsClient } - fun showToast(value:String){ + fun showToast(value: String) { val toast = Toast.makeText(applicationContext, value, Toast.LENGTH_SHORT) toast.setMargin(50f, 50f) toast.show() } - fun checkEmail(email: String?): Boolean { - return EMAIL_ADDRESS_PATTERN.matcher(email).matches() - } + fun checkEmail(email: String?): Boolean = EMAIL_ADDRESS_PATTERN.matcher(email).matches() val EMAIL_ADDRESS_PATTERN: Pattern = Pattern.compile( "[a-zA-Z0-9\\+\\.\\_\\%\\-\\+]{1,256}" + - "\\@" + - "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" + - "(" + - "\\." + - "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" + - ")+" - ) - } + "\\@" + + "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" + + "(" + + "\\." + + "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" + + ")+", + ) +} diff --git a/kotlin/usecases/topics_and_queues/build.gradle.kts b/kotlin/usecases/topics_and_queues/build.gradle.kts index 407cd8f1a22..e35c586dd61 100644 --- a/kotlin/usecases/topics_and_queues/build.gradle.kts +++ b/kotlin/usecases/topics_and_queues/build.gradle.kts @@ -39,7 +39,7 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1") testImplementation(kotlin("test")) } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/usecases/topics_and_queues/src/main/kotlin/com/example/sns/SNSWorkflow.kt b/kotlin/usecases/topics_and_queues/src/main/kotlin/com/example/sns/SNSWorkflow.kt index fdf39a90420..20063972bb9 100644 --- a/kotlin/usecases/topics_and_queues/src/main/kotlin/com/example/sns/SNSWorkflow.kt +++ b/kotlin/usecases/topics_and_queues/src/main/kotlin/com/example/sns/SNSWorkflow.kt @@ -75,7 +75,7 @@ suspend fun main() { In this workflow, you will create an SNS topic and subscribe an SQS queue to the topic. You can select from several options for configuring the topic and the subscriptions for the queue. You can then post to the topic and see the results in the queue. - """.trimIndent() + """.trimIndent(), ) println(DASHES) @@ -85,7 +85,7 @@ suspend fun main() { SNS topics can be configured as FIFO (First-In-First-Out). FIFO topics deliver messages in order and support deduplication and message filtering. Would you like to work with FIFO topics? (y/n) - """.trimIndent() + """.trimIndent(), ) useFIFO = input.nextLine() if (useFIFO.compareTo("y") == 0) { @@ -96,7 +96,7 @@ suspend fun main() { Deduplication IDs are either set in the message or automatically generated from content using a hash function. If a message is successfully published to an SNS FIFO topic, any message published and determined to have the same deduplication ID, within the five-minute deduplication interval, is accepted but not delivered. - For more information about deduplication, see https://docs.aws.amazon.com/sns/latest/dg/fifo-message-dedup.html.""" + For more information about deduplication, see https://docs.aws.amazon.com/sns/latest/dg/fifo-message-dedup.html.""", ) println("Would you like to use content-based deduplication instead of entering a deduplication ID? (y/n)") @@ -176,7 +176,7 @@ suspend fun main() { println( """If you add a filter to this subscription, then only the filtered messages will be received in the queue. For information about message filtering, see https://docs.aws.amazon.com/sns/latest/dg/sns-message-filtering.html -For this example, you can filter messages by a "tone" attribute.""" +For this example, you can filter messages by a "tone" attribute.""", ) println("Would you like to filter messages for $sqsQueueName's subscription to the topic $topicName? (y/n)") val filterAns: String = input.nextLine() @@ -368,7 +368,7 @@ suspend fun pubMessageFIFO( msgAttValue: String, duplication: String, groupIdVal: String?, - deduplicationID: String? + deduplicationID: String?, ) { // Means the user did not choose to use a message attribute. if (msgAttValue.isEmpty()) { @@ -449,7 +449,7 @@ suspend fun subQueue(topicArnVal: String?, queueArnVal: String, filterList: List val result = snsClient.subscribe(request) println( "The queue " + queueArnVal + " has been subscribed to the topic " + topicArnVal + "\n" + - "with the subscription ARN " + result.subscriptionArn + "with the subscription ARN " + result.subscriptionArn, ) return result.subscriptionArn } 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 7de420eb170..a686d088c94 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 @@ -21,36 +21,28 @@ class QueuePayload { fun QueuePayload() {} // Getter and Setter methods for token - fun getToken(): String? { - return token - } + fun getToken(): String? = token fun setToken(token: String?) { this.token = token } // Getter and Setter methods for pipelineExecutionArn - fun getPipelineExecutionArn(): String? { - return pipelineExecutionArn - } + fun getPipelineExecutionArn(): String? = pipelineExecutionArn fun setPipelineExecutionArn(pipelineExecutionArn: String?) { this.pipelineExecutionArn = pipelineExecutionArn } // Getter and Setter methods for status - fun getStatus(): String? { - return status - } + fun getStatus(): String? = status fun setStatus(status: String?) { this.status = status } // Getter and Setter methods for arguments - fun getArguments(): HashMap? { - return arguments - } + fun getArguments(): HashMap? = arguments fun setArguments(arguments: HashMap?) { this.arguments = arguments diff --git a/kotlin/usecases/workflow_sagemaker_pipes/build.gradle.kts b/kotlin/usecases/workflow_sagemaker_pipes/build.gradle.kts index 8bce90b4e46..7eedc741536 100644 --- a/kotlin/usecases/workflow_sagemaker_pipes/build.gradle.kts +++ b/kotlin/usecases/workflow_sagemaker_pipes/build.gradle.kts @@ -43,6 +43,6 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } -tasks.withType() { +tasks.withType { kotlinOptions.jvmTarget = "17" } diff --git a/kotlin/usecases/workflow_sagemaker_pipes/src/main/kotlin/com/example/sage/SagemakerWorkflow.kt b/kotlin/usecases/workflow_sagemaker_pipes/src/main/kotlin/com/example/sage/SagemakerWorkflow.kt index 378eff9d59c..47b713bff24 100644 --- a/kotlin/usecases/workflow_sagemaker_pipes/src/main/kotlin/com/example/sage/SagemakerWorkflow.kt +++ b/kotlin/usecases/workflow_sagemaker_pipes/src/main/kotlin/com/example/sage/SagemakerWorkflow.kt @@ -129,7 +129,7 @@ suspend fun main(args: Array) { Amazon SageMaker pipeline. The pipeline uses an AWS Lambda function and an Amazon SQS Queue. It runs a vector enrichment reverse geocode job to reverse geocode addresses in an input file and store the results in an export file. - """.trimIndent() + """.trimIndent(), ) println(DASHES) @@ -167,7 +167,7 @@ suspend fun main(args: Array) { """ The pipeline has completed. To view the pipeline and runs in SageMaker Studio, follow these instructions: https://docs.aws.amazon.com/sagemaker/latest/dg/pipelines-studio.html - """.trimIndent() + """.trimIndent(), ) println(DASHES) diff --git a/kotlin/usecases/workflow_sagemaker_pipes/src/test/kotlin/KotlinTest.kt b/kotlin/usecases/workflow_sagemaker_pipes/src/test/kotlin/KotlinTest.kt index df88cb92078..d05f825db67 100644 --- a/kotlin/usecases/workflow_sagemaker_pipes/src/test/kotlin/KotlinTest.kt +++ b/kotlin/usecases/workflow_sagemaker_pipes/src/test/kotlin/KotlinTest.kt @@ -78,7 +78,7 @@ class KotlinTest { Amazon SageMaker pipeline. The pipeline uses an AWS Lambda function and an Amazon SQS Queue. It runs a vector enrichment reverse geocode job to reverse geocode addresses in an input file and store the results in an export file. - """.trimIndent() + """.trimIndent(), ) println(DASHES) From e5713651b002ac94162b560e6b980a6d5d464f35 Mon Sep 17 00:00:00 2001 From: scmacdon Date: Tue, 18 Jun 2024 13:49:13 -0400 Subject: [PATCH 2/3] cleaned up kotlin files --- .../bedrock/src/test/kotlin/BedrockTest.kt | 3 +- kotlin/services/sts/build.gradle.kts | 2 +- .../gradle/wrapper/gradle-wrapper.jar | Bin 59536 -> 0 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 - kotlin/usecases/creating_pam/gradlew | 185 --------- kotlin/usecases/creating_pam/gradlew.bat | 89 ---- .../com/example/photo/handlers/GetHandler.kt | 4 +- .../example/photo/handlers/UploadHandler.kt | 6 +- kotlin/usecases/first_android_app/README.md | 388 ------------------ .../usecases/first_android_app/images/app.png | Bin 63791 -> 0 bytes .../first_android_app/images/app0.png | Bin 31555 -> 0 bytes .../first_android_app/images/app2.png | Bin 51052 -> 0 bytes .../first_android_app/images/app3.png | Bin 32363 -> 0 bytes .../first_android_app/images/app4.png | Bin 49239 -> 0 bytes .../first_android_app/images/app5.png | Bin 27842 -> 0 bytes .../first_android_app/images/project.png | Bin 46950 -> 0 bytes .../first_android_app/images/project1.png | Bin 49908 -> 0 bytes .../first_android_app/images/project2.png | Bin 68640 -> 0 bytes .../first_android_app/images/project3.png | Bin 21088 -> 0 bytes .../first_android_app/images/project4.png | Bin 20310 -> 0 bytes .../first_android_app/images/project5.png | Bin 57606 -> 0 bytes .../first_android_app/images/project5a.png | Bin 42000 -> 0 bytes .../first_android_app/images/project6.png | Bin 18727 -> 0 bytes .../first_android_app/images/projectBuild.png | Bin 28137 -> 0 bytes .../images/projectClasses.png | Bin 41765 -> 0 bytes .../first_android_app/images/projectNew.png | Bin 23641 -> 0 bytes .../first_android_app/images/projectUI.png | Bin 74594 -> 0 bytes .../usecases/first_android_app/images/t.txt | 1 - .../first_android_app/images/table.png | Bin 23068 -> 0 bytes .../first_android_app/images/table1.png | Bin 68295 -> 0 bytes .../first_android_app/images/table2.png | Bin 26051 -> 0 bytes .../first_android_app/images/text.png | Bin 89765 -> 0 bytes .../first_android_app/images/text1.png | Bin 137605 -> 0 bytes .../kotlin/com/example/awsapp/Database.kt | 51 --- .../kotlin/com/example/awsapp/MainActivity.kt | 74 ---- .../kotlin/com/example/awsapp/SendMessage.kt | 28 -- .../com/example/androidsubpub/MainActivity.kt | 4 +- .../build.gradle.kts | 2 +- .../main/kotlin/org/example/QueuePayload.kt | 30 -- .../org/example/SageMakerLambdaFunction.kt | 12 +- 40 files changed, 15 insertions(+), 869 deletions(-) delete mode 100644 kotlin/usecases/creating_pam/gradle/wrapper/gradle-wrapper.jar delete mode 100644 kotlin/usecases/creating_pam/gradle/wrapper/gradle-wrapper.properties delete mode 100644 kotlin/usecases/creating_pam/gradlew delete mode 100644 kotlin/usecases/creating_pam/gradlew.bat delete mode 100644 kotlin/usecases/first_android_app/README.md delete mode 100644 kotlin/usecases/first_android_app/images/app.png delete mode 100644 kotlin/usecases/first_android_app/images/app0.png delete mode 100644 kotlin/usecases/first_android_app/images/app2.png delete mode 100644 kotlin/usecases/first_android_app/images/app3.png delete mode 100644 kotlin/usecases/first_android_app/images/app4.png delete mode 100644 kotlin/usecases/first_android_app/images/app5.png delete mode 100644 kotlin/usecases/first_android_app/images/project.png delete mode 100644 kotlin/usecases/first_android_app/images/project1.png delete mode 100644 kotlin/usecases/first_android_app/images/project2.png delete mode 100644 kotlin/usecases/first_android_app/images/project3.png delete mode 100644 kotlin/usecases/first_android_app/images/project4.png delete mode 100644 kotlin/usecases/first_android_app/images/project5.png delete mode 100644 kotlin/usecases/first_android_app/images/project5a.png delete mode 100644 kotlin/usecases/first_android_app/images/project6.png delete mode 100644 kotlin/usecases/first_android_app/images/projectBuild.png delete mode 100644 kotlin/usecases/first_android_app/images/projectClasses.png delete mode 100644 kotlin/usecases/first_android_app/images/projectNew.png delete mode 100644 kotlin/usecases/first_android_app/images/projectUI.png delete mode 100644 kotlin/usecases/first_android_app/images/t.txt delete mode 100644 kotlin/usecases/first_android_app/images/table.png delete mode 100644 kotlin/usecases/first_android_app/images/table1.png delete mode 100644 kotlin/usecases/first_android_app/images/table2.png delete mode 100644 kotlin/usecases/first_android_app/images/text.png delete mode 100644 kotlin/usecases/first_android_app/images/text1.png delete mode 100644 kotlin/usecases/first_android_app/src/main/kotlin/com/example/awsapp/Database.kt delete mode 100644 kotlin/usecases/first_android_app/src/main/kotlin/com/example/awsapp/MainActivity.kt delete mode 100644 kotlin/usecases/first_android_app/src/main/kotlin/com/example/awsapp/SendMessage.kt diff --git a/kotlin/services/bedrock/src/test/kotlin/BedrockTest.kt b/kotlin/services/bedrock/src/test/kotlin/BedrockTest.kt index 2ef271e04b5..3c3bc1557ed 100644 --- a/kotlin/services/bedrock/src/test/kotlin/BedrockTest.kt +++ b/kotlin/services/bedrock/src/test/kotlin/BedrockTest.kt @@ -13,10 +13,9 @@ import org.junit.jupiter.api.TestMethodOrder @TestInstance(TestInstance.Lifecycle.PER_CLASS) @TestMethodOrder(OrderAnnotation::class) class BedrockTest { - @Test @Order(1) - fun ListFoundationModels() = runBlocking { + fun listFoundationModels() = runBlocking { val modelSummaries = listFoundationModels() assertFalse(modelSummaries!!.isEmpty()) } diff --git a/kotlin/services/sts/build.gradle.kts b/kotlin/services/sts/build.gradle.kts index 348cb9da5e8..91183182cc1 100644 --- a/kotlin/services/sts/build.gradle.kts +++ b/kotlin/services/sts/build.gradle.kts @@ -18,7 +18,7 @@ buildscript { maven("https://plugins.gradle.org/m2/") } dependencies { - classpath("org.jlleitschuh.gradle:ktlint-gradle:11.5.1") + classpath("org.jlleitschuh.gradle:ktlint-gradle:12.1.1") } } diff --git a/kotlin/usecases/creating_pam/gradle/wrapper/gradle-wrapper.jar b/kotlin/usecases/creating_pam/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7454180f2ae8848c63b8b4dea2cb829da983f2fa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 59536 zcma&NbC71ylI~qywr$(CZQJHswz}-9F59+k+g;UV+cs{`J?GrGXYR~=-ydruB3JCa zB64N^cILAcWk5iofq)<(fq;O7{th4@;QxID0)qN`mJ?GIqLY#rX8-|G{5M0pdVW5^ zzXk$-2kQTAC?_N@B`&6-N-rmVFE=$QD?>*=4<|!MJu@}isLc4AW#{m2if&A5T5g&~ ziuMQeS*U5sL6J698wOd)K@oK@1{peP5&Esut<#VH^u)gp`9H4)`uE!2$>RTctN+^u z=ASkePDZA-X8)rp%D;p*~P?*a_=*Kwc<^>QSH|^<0>o37lt^+Mj1;4YvJ(JR-Y+?%Nu}JAYj5 z_Qc5%Ao#F?q32i?ZaN2OSNhWL;2oDEw_({7ZbgUjna!Fqn3NzLM@-EWFPZVmc>(fZ z0&bF-Ch#p9C{YJT9Rcr3+Y_uR^At1^BxZ#eo>$PLJF3=;t_$2|t+_6gg5(j{TmjYU zK12c&lE?Eh+2u2&6Gf*IdKS&6?rYbSEKBN!rv{YCm|Rt=UlPcW9j`0o6{66#y5t9C zruFA2iKd=H%jHf%ypOkxLnO8#H}#Zt{8p!oi6)7#NqoF({t6|J^?1e*oxqng9Q2Cc zg%5Vu!em)}Yuj?kaP!D?b?(C*w!1;>R=j90+RTkyEXz+9CufZ$C^umX^+4|JYaO<5 zmIM3#dv`DGM;@F6;(t!WngZSYzHx?9&$xEF70D1BvfVj<%+b#)vz)2iLCrTeYzUcL z(OBnNoG6Le%M+@2oo)&jdOg=iCszzv59e zDRCeaX8l1hC=8LbBt|k5?CXgep=3r9BXx1uR8!p%Z|0+4Xro=xi0G!e{c4U~1j6!) zH6adq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O^lN%5)4p*D^H+B){n8%VPUzi! zDihoGcP71a6!ab`l^hK&*dYrVYzJ0)#}xVrp!e;lI!+x+bfCN0KXwUAPU9@#l7@0& QuEJmfE|#`Dqx|px0L@K;Y5)KL diff --git a/kotlin/usecases/creating_pam/gradle/wrapper/gradle-wrapper.properties b/kotlin/usecases/creating_pam/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 69a9715077f..00000000000 --- a/kotlin/usecases/creating_pam/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/kotlin/usecases/creating_pam/gradlew b/kotlin/usecases/creating_pam/gradlew deleted file mode 100644 index 744e882ed57..00000000000 --- a/kotlin/usecases/creating_pam/gradlew +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MSYS* | MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -exec "$JAVACMD" "$@" diff --git a/kotlin/usecases/creating_pam/gradlew.bat b/kotlin/usecases/creating_pam/gradlew.bat deleted file mode 100644 index 107acd32c4e..00000000000 --- a/kotlin/usecases/creating_pam/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/handlers/GetHandler.kt b/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/handlers/GetHandler.kt index 2db794340b1..84bdd5f2f66 100644 --- a/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/handlers/GetHandler.kt +++ b/kotlin/usecases/creating_pam/src/main/kotlin/com/example/photo/handlers/GetHandler.kt @@ -14,7 +14,7 @@ import kotlinx.coroutines.runBlocking import java.util.TreeMap class GetHandler : RequestHandler { - val CORS_HEADER_MAP: Map = java.util.Map.of("Access-Control-Allow-Origin", "*") + val corsHeaderMap: Map = java.util.Map.of("Access-Control-Allow-Origin", "*") fun toJson(src: Any?): String? { val gson = Gson() @@ -33,7 +33,7 @@ class GetHandler : RequestHandler { - val CORS_HEADER_MAP: Map = java.util.Map.of("Access-Control-Allow-Origin", "*") + val corsHeaderMap: Map = java.util.Map.of("Access-Control-Allow-Origin", "*") fun toJson(src: Any?): String? { val gson = Gson() @@ -30,7 +30,7 @@ class UploadHandler : RequestHandler - - - - -