Skip to content

Kotlin updated the Kotlin SDK build #7514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions kotlin/services/appsync/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.0"
kotlin("jvm") version "2.0.0"
application
}

Expand All @@ -27,7 +27,7 @@ repositories {
}
apply(plugin = "org.jlleitschuh.gradle.ktlint")
dependencies {
implementation(platform("aws.sdk.kotlin:bom:1.3.112"))
implementation(platform("aws.sdk.kotlin:bom:1.4.119"))
implementation("aws.sdk.kotlin:appsync")
implementation("aws.sdk.kotlin:sts")
implementation("aws.sdk.kotlin:s3")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ suspend fun createKey(apiIdVal: String): String? {
description = "Created using the AWS SDK for Kotlin"
}

AppSyncClient { region = "us-east-1" }.use { appClient ->
AppSyncClient.fromEnvironment { region = "us-east-1" }.use { appClient ->
val response = appClient.createApiKey(apiKeyRequest)
return response.apiKey?.id
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ suspend fun createDS(
type = DataSourceType.AmazonDynamodb
}

AppSyncClient { region = "us-east-1" }.use { appClient ->
AppSyncClient.fromEnvironment { region = "us-east-1" }.use { appClient ->
val response = appClient.createDataSource(request)
return response.dataSource?.dataSourceArn
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ suspend fun deleteKey(
id = keyIdVal
}

AppSyncClient { region = "us-east-1" }.use { appClient ->
AppSyncClient.fromEnvironment { region = "us-east-1" }.use { appClient ->
appClient.deleteApiKey(apiKeyRequest)
println("$keyIdVal key was deleted.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ suspend fun deleteDS(
name = dsName
}

AppSyncClient { region = "us-east-1" }.use { appClient ->
AppSyncClient.fromEnvironment { region = "us-east-1" }.use { appClient ->
appClient.deleteDataSource(request)
println("The data source was deleted.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ suspend fun getDS(apiIdVal: String?, dsName: String?) {
name = dsName
}

AppSyncClient { region = "us-east-1" }.use { appClient ->
AppSyncClient.fromEnvironment { region = "us-east-1" }.use { appClient ->
val response = appClient.getDataSource(request)
println("The DataSource ARN is ${response.dataSource?.dataSourceArn}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ suspend fun getKeys(apiIdVal: String?) {
apiId = apiIdVal
}

AppSyncClient { region = "us-east-1" }.use { appClient ->
AppSyncClient.fromEnvironment { region = "us-east-1" }.use { appClient ->
val response = appClient.listApiKeys(request)
response.apiKeys?.forEach { key ->
println("The key Id is ${key.id}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ suspend fun main() {

// snippet-start:[appsync.kotlin.get_apis.main]
suspend fun getApis() {
AppSyncClient { region = "us-east-1" }.use { appClient ->
AppSyncClient.fromEnvironment { region = "us-east-1" }.use { appClient ->
val response = appClient.listGraphqlApis(ListGraphqlApisRequest {})
response.graphqlApis?.forEach { graph ->
println("The name of the graph api is ${graph.name}")
Expand Down
4 changes: 2 additions & 2 deletions kotlin/services/athena/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.0"
kotlin("jvm") version "2.0.0"
application
}

Expand All @@ -27,7 +27,7 @@ repositories {
}
apply(plugin = "org.jlleitschuh.gradle.ktlint")
dependencies {
implementation(platform("aws.sdk.kotlin:bom:1.3.112"))
implementation(platform("aws.sdk.kotlin:bom:1.4.119"))
implementation("aws.sdk.kotlin:athena")
implementation("aws.sdk.kotlin:secretsmanager")
implementation("aws.smithy.kotlin:http-client-engine-okhttp")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ suspend fun main(args: Array<String>) {

// snippet-start:[athena.kotlin.CreateNamedQueryExample.main]
suspend fun createNamedQuery(queryStringVal: String, namedQuery: String, databaseVal: String): String? {
AthenaClient { region = "us-west-2" }.use { athenaClient ->
AthenaClient.fromEnvironment { region = "us-west-2" }.use { athenaClient ->
val resp = athenaClient.createNamedQuery(
CreateNamedQueryRequest {
database = databaseVal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ suspend fun deleteQueryName(sampleNamedQueryId: String?) {
namedQueryId = sampleNamedQueryId
}

AthenaClient { region = "us-west-2" }.use { athenaClient ->
AthenaClient.fromEnvironment { region = "us-west-2" }.use { athenaClient ->
athenaClient.deleteNamedQuery(request)
println("$sampleNamedQueryId was deleted!")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ suspend fun listNamedQueries() {
this.maxResults = 10
}

AthenaClient { region = "us-west-2" }.use { athenaClient ->
AthenaClient.fromEnvironment { region = "us-west-2" }.use { athenaClient ->
val responses = athenaClient.listNamedQueries(request)
responses.namedQueryIds?.forEach { queries ->
println("Retrieved account alias $queries")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ suspend fun listQueryIds() {
maxResults = 10
}

AthenaClient { region = "us-west-2" }.use { athenaClient ->
AthenaClient.fromEnvironment { region = "us-west-2" }.use { athenaClient ->
val response = athenaClient.listQueryExecutions(request)
response.queryExecutionIds?.forEach { queries ->
println("The value is $queries")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ suspend fun submitAthenaQuery(queryStringVal: String, databaseVal: String, outpu
resultConfiguration = resultConfigurationOb
}

AthenaClient { region = "us-west-2" }.use { athenaClient ->
AthenaClient.fromEnvironment { region = "us-west-2" }.use { athenaClient ->
val response = athenaClient.startQueryExecution(request)
return response.queryExecutionId
}
Expand Down
4 changes: 2 additions & 2 deletions kotlin/services/autoscale/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.0"
kotlin("jvm") version "2.0.0"
application
}

Expand All @@ -27,7 +27,7 @@ repositories {
}
apply(plugin = "org.jlleitschuh.gradle.ktlint")
dependencies {
implementation(platform("aws.sdk.kotlin:bom:1.3.112"))
implementation(platform("aws.sdk.kotlin:bom:1.4.119"))
implementation("aws.sdk.kotlin:autoscaling")
implementation("aws.sdk.kotlin:secretsmanager")
implementation("aws.smithy.kotlin:http-client-engine-okhttp")
Expand Down
4 changes: 2 additions & 2 deletions kotlin/services/cloudformation/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.0"
kotlin("jvm") version "2.0.0"
application
}

Expand All @@ -27,7 +27,7 @@ repositories {
}
apply(plugin = "org.jlleitschuh.gradle.ktlint")
dependencies {
implementation(platform("aws.sdk.kotlin:bom:1.3.112"))
implementation(platform("aws.sdk.kotlin:bom:1.4.119"))
implementation("aws.sdk.kotlin:cloudformation")
implementation("aws.sdk.kotlin:secretsmanager")
implementation("aws.smithy.kotlin:http-client-engine-okhttp")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ suspend fun createCFStack(stackNameVal: String, roleARNVal: String?, location: S
onFailure = OnFailure.Rollback
}

CloudFormationClient { region = "us-east-1" }.use { cfClient ->
CloudFormationClient.fromEnvironment { region = "us-east-1" }.use { cfClient ->
cfClient.createStack(request)
println("$stackNameVal was created")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ suspend fun deleteSpecificTemplate(stackNameVal: String?) {
stackName = stackNameVal
}

CloudFormationClient { region = "us-east-1" }.use { cfClient ->
CloudFormationClient.fromEnvironment { region = "us-east-1" }.use { cfClient ->
cfClient.deleteStack(request)
println("The AWS CloudFormation stack was successfully deleted!")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ suspend fun main() {

// snippet-start:[cf.kotlin.get_stacks.main]
suspend fun describeAllStacks() {
CloudFormationClient { region = "us-east-1" }.use { cfClient ->
CloudFormationClient.fromEnvironment { region = "us-east-1" }.use { cfClient ->
val stacksResponse: DescribeStacksResponse = cfClient.describeStacks(DescribeStacksRequest {})
stacksResponse.stacks?.forEach { stack ->
println("The stack description is ${stack.description}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ suspend fun getSpecificTemplate(stackNameVal: String) {
stackName = stackNameVal
}

CloudFormationClient { region = "us-east-1" }.use { cfClient ->
CloudFormationClient.fromEnvironment { region = "us-east-1" }.use { cfClient ->
val response = cfClient.getTemplate(request)
val body = response.templateBody
println(body)
Expand Down
4 changes: 2 additions & 2 deletions kotlin/services/cloudtrail/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.0"
kotlin("jvm") version "2.0.0"
application
}

Expand All @@ -27,7 +27,7 @@ repositories {
}
apply(plugin = "org.jlleitschuh.gradle.ktlint")
dependencies {
implementation(platform("aws.sdk.kotlin:bom:1.3.112"))
implementation(platform("aws.sdk.kotlin:bom:1.4.119"))
implementation("aws.sdk.kotlin:cloudtrail")
implementation("aws.sdk.kotlin:secretsmanager")
implementation("aws.smithy.kotlin:http-client-engine-okhttp")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ suspend fun createNewTrail(
isMultiRegionTrail = true
}

CloudTrailClient { region = "us-east-1" }.use { cloudTrail ->
CloudTrailClient.fromEnvironment { region = "us-east-1" }.use { cloudTrail ->
val trailResponse = cloudTrail.createTrail(request)
println("The trail ARN is ${trailResponse.trailArn}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ suspend fun deleteSpecificTrail(trailName: String) {
name = trailName
}

CloudTrailClient { region = "us-east-1" }.use { cloudTrail ->
CloudTrailClient.fromEnvironment { region = "us-east-1" }.use { cloudTrail ->
cloudTrail.deleteTrail(request)
println("$trailName was successfully deleted")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ suspend fun describeSpecificTrails(trailName: String) {
trailNameList = listOf(trailName)
}

CloudTrailClient { region = "us-east-1" }.use { cloudTrail ->
CloudTrailClient.fromEnvironment { region = "us-east-1" }.use { cloudTrail ->
val response = cloudTrail.describeTrails(request)
response.trailList?.forEach { trail ->
println("The ARN of the trail is ${trail.trailArn}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ suspend fun getSelectors(trailNameVal: String) {
trailName = trailNameVal
}

CloudTrailClient { region = "us-east-1" }.use { cloudTrail ->
CloudTrailClient.fromEnvironment { region = "us-east-1" }.use { cloudTrail ->

val response = cloudTrail.getEventSelectors(request)
response.eventSelectors?.forEach { selector ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ suspend fun lookupAllEvents() {
maxResults = 20
}

CloudTrailClient { region = "us-east-1" }.use { cloudTrail ->
CloudTrailClient.fromEnvironment { region = "us-east-1" }.use { cloudTrail ->
val response = cloudTrail.lookupEvents(request)
response.events?.forEach { event ->
println("Event name is ${event.eventName}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ suspend fun setSelector(trailNameVal: String?) {
readWriteType = ReadWriteType.fromValue("All")
}

CloudTrailClient { region = "us-east-1" }.use { cloudTrail ->
CloudTrailClient.fromEnvironment { region = "us-east-1" }.use { cloudTrail ->
cloudTrail.putEventSelectors(
PutEventSelectorsRequest {
trailName = trailNameVal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ suspend fun stopLog(trailName: String) {
StopLoggingRequest {
name = trailName
}
CloudTrailClient { region = "us-east-1" }.use { cloudTrail ->
CloudTrailClient.fromEnvironment { region = "us-east-1" }.use { cloudTrail ->
cloudTrail.stopLogging(request)
println("$trailName has stopped logging")
}
Expand All @@ -48,7 +48,7 @@ suspend fun startLog(trailName: String) {
StartLoggingRequest {
name = trailName
}
CloudTrailClient { region = "us-east-1" }.use { cloudTrail ->
CloudTrailClient.fromEnvironment { region = "us-east-1" }.use { cloudTrail ->
cloudTrail.startLogging(request)
println("$trailName has started logging")
}
Expand Down
32 changes: 16 additions & 16 deletions kotlin/services/cloudwatch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,24 @@ Code examples that show you how to perform the essential operations within a ser

Code excerpts that show you how to call individual service functions.

- [DeleteAlarms](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L299)
- [DeleteAnomalyDetector](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L272)
- [DeleteDashboards](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L313)
- [DescribeAlarmHistory](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L413)
- [DescribeAlarms](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L602)
- [DescribeAlarmsForMetric](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L457)
- [DescribeAnomalyDetectors](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L362)
- [DeleteAlarms](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L298)
- [DeleteAnomalyDetector](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L271)
- [DeleteDashboards](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L312)
- [DescribeAlarmHistory](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L412)
- [DescribeAlarms](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L598)
- [DescribeAlarmsForMetric](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L453)
- [DescribeAnomalyDetectors](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L361)
- [DisableAlarmActions](src/main/kotlin/com/kotlin/cloudwatch/DisableAlarmActions.kt#L39)
- [EnableAlarmActions](src/main/kotlin/com/kotlin/cloudwatch/EnableAlarmActions.kt#L38)
- [GetMetricData](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L539)
- [GetMetricStatistics](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L801)
- [GetMetricWidgetImage](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L326)
- [ListDashboards](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L714)
- [ListMetrics](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L842)
- [PutAnomalyDetector](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L386)
- [PutDashboard](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L728)
- [GetMetricData](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L535)
- [GetMetricStatistics](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L797)
- [GetMetricWidgetImage](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L325)
- [ListDashboards](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L710)
- [ListMetrics](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L838)
- [PutAnomalyDetector](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L385)
- [PutDashboard](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L724)
- [PutMetricAlarm](src/main/kotlin/com/kotlin/cloudwatch/PutMetricAlarm.kt#L44)
- [PutMetricData](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L491)
- [PutMetricData](src/main/kotlin/com/kotlin/cloudwatch/CloudWatchScenario.kt#L487)


<!--custom.examples.start-->
Expand Down Expand Up @@ -160,4 +160,4 @@ You can run the JUnit tests from an IDE, such as IntelliJ, or from the command l

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
4 changes: 2 additions & 2 deletions kotlin/services/cloudwatch/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.0"
kotlin("jvm") version "2.0.0"
application
}

Expand All @@ -28,7 +28,7 @@ repositories {

apply(plugin = "org.jlleitschuh.gradle.ktlint")
dependencies {
implementation(platform("aws.sdk.kotlin:bom:1.3.112"))
implementation(platform("aws.sdk.kotlin:bom:1.4.119"))
implementation("aws.sdk.kotlin:cloudwatch")
implementation("aws.sdk.kotlin:cloudwatchevents")
implementation("aws.sdk.kotlin:cloudwatchlogs")
Expand Down
Loading
Loading