Skip to content

Commit e0afa88

Browse files
committed
add Hello Kotlin
1 parent 5ef2a81 commit e0afa88

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

.doc_gen/metadata/neptune_metadata.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ neptune_Hello:
55
synopsis: get started using &neptune;.
66
category: Hello
77
languages:
8+
Kotlin:
9+
versions:
10+
- sdk_version: 1
11+
github: kotlin/services/neptune
12+
sdkguide:
13+
excerpts:
14+
- description:
15+
snippet_tags:
16+
- neptune.kotlin.hello.main
817
Python:
918
versions:
1019
- sdk_version: 3
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package com.example.neptune.scenerio
5+
6+
import aws.sdk.kotlin.services.neptune.NeptuneClient
7+
import aws.sdk.kotlin.services.neptune.model.DescribeDbClustersRequest
8+
9+
// snippet-start:[neptune.kotlin.hello.main]
10+
/**
11+
* Before running this Kotlin code example, set up your development environment, including your credentials.
12+
*
13+
* For more information, see the following documentation topic:
14+
*
15+
* https://docs.aws.amazon.com/sdk-for-kotlin/latest/developer-guide/setup.html
16+
*/
17+
suspend fun main(args: Array<String>) {
18+
print("Hello Amazon Neptune")
19+
listDBClusters()
20+
}
21+
22+
/**
23+
* Suspends the current coroutine to list details of DB clusters in Amazon Neptune.
24+
*/
25+
public suspend fun listDBClusters() {
26+
val request = DescribeDbClustersRequest {
27+
maxRecords = 20
28+
}
29+
30+
NeptuneClient { region = "us-east-1" }.use { neptuneClient ->
31+
neptuneClient.describeDbClusters(request)
32+
val response = neptuneClient.describeDbClusters(request)
33+
response.dbClusters?.forEach { cluster ->
34+
println("Cluster Identifier: ${cluster.dbClusterIdentifier}")
35+
println("Status: ${cluster.status}")
36+
println("Endpoint: ${cluster.endpoint}")
37+
println("Engine: ${cluster.engine}")
38+
println("Engine Version: ${cluster.engineVersion}")
39+
println("---")
40+
}
41+
}
42+
}
43+
// snippet-end:[neptune.kotlin.hello.main]

kotlin/services/neptune/src/main/java/com/example/neptune/scenerio/NeptuneScenario.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ val DASHES = String(CharArray(80)).replace("\u0000", "-")
2828
var scanner = Scanner(System.`in`)
2929
private val pollInterval: Duration = Duration.ofSeconds(20)
3030
private val timeout: Duration = Duration.ofMinutes(30)
31+
32+
/**
33+
* Before running this Kotlin code example, set up your development environment, including your credentials.
34+
*
35+
* For more information, see the following documentation topic:
36+
*
37+
* https://docs.aws.amazon.com/sdk-for-kotlin/latest/developer-guide/setup.html
38+
*/
3139
suspend fun main(args: Array<String>) {
3240
val subnetGroupName = "neptuneSubnetGroup200"
3341
val clusterName = "neptuneCluster200"

0 commit comments

Comments
 (0)