Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
861835c
updated the Kotlin SDK build
scmacdon Jul 7, 2025
615e22d
updated the Kotlin SDK build
scmacdon Jul 7, 2025
184f4d3
updated a Readme
scmacdon Jul 7, 2025
9002e4e
updated build number
scmacdon Jul 7, 2025
be1d8ce
updated build number
scmacdon Jul 7, 2025
c079bf5
updated build number
scmacdon Jul 7, 2025
fd0807e
updated build number
scmacdon Jul 7, 2025
37aa095
updated build number
scmacdon Jul 7, 2025
65cd21d
updated build number
scmacdon Jul 7, 2025
37a7d4a
updated build number
scmacdon Jul 7, 2025
295b597
updated build number
scmacdon Jul 7, 2025
fedfbe0
updated build number
scmacdon Jul 7, 2025
da91c79
updated build number
scmacdon Jul 7, 2025
ebb762f
updated build number
scmacdon Jul 7, 2025
6e8dfbb
updated build number
scmacdon Jul 7, 2025
f9cb587
updated build number
scmacdon Jul 7, 2025
51e891e
updated build number
scmacdon Jul 7, 2025
79ef989
updated build number
scmacdon Jul 7, 2025
08a9301
updated build number
scmacdon Jul 8, 2025
e4db46e
updated build number
scmacdon Jul 8, 2025
fb08bab
updated build number
scmacdon Jul 8, 2025
e83b04c
updated build number
scmacdon Jul 8, 2025
4342e0d
updated build number
scmacdon Jul 8, 2025
985a090
updated build number
scmacdon Jul 8, 2025
38eb9af
update build number
scmacdon Jul 8, 2025
b9e394f
update build number
scmacdon Jul 8, 2025
eb79d5b
update build number
scmacdon Jul 8, 2025
b9d8cfd
updated build number
scmacdon Jul 9, 2025
2e28113
updated build number
scmacdon Jul 9, 2025
a6750e0
fixed linter issue
scmacdon Jul 9, 2025
fac82ba
fixed linter issue
scmacdon Jul 9, 2025
d331cfb
fixed linter issue
scmacdon Jul 9, 2025
cf014ca
fixed linter issue
scmacdon Jul 9, 2025
c94bc13
Updated build number
scmacdon Jul 9, 2025
da64d76
Updated build number
scmacdon Jul 9, 2025
57197a3
Updated build number
scmacdon Jul 9, 2025
c3c4d59
Updated build number
scmacdon Jul 9, 2025
e58e220
Updated build number
scmacdon Jul 9, 2025
c717b4a
Updated build number
scmacdon Jul 9, 2025
994afb3
Updated build number
scmacdon Jul 9, 2025
b9410d2
Updated build number
scmacdon Jul 9, 2025
d17b237
Updated build number
scmacdon Jul 9, 2025
35cc6ae
Updated build number
scmacdon Jul 9, 2025
7e3efd1
Updated build number and API
scmacdon Jul 9, 2025
9744bb7
Updated build number and API
scmacdon Jul 9, 2025
7912fc6
Updated build number and API
scmacdon Jul 9, 2025
019d9f0
Updated build number and API
scmacdon Jul 9, 2025
ca42849
Updated build number and API
scmacdon Jul 9, 2025
0f1a9e4
Updated build number and API
scmacdon Jul 9, 2025
b5d5caf
Updated build number and API
scmacdon Jul 9, 2025
1f8da26
Remove java from tracking
scmacdon Jul 10, 2025
3e1582f
updated Kotlin MediaConvert code
scmacdon Jul 10, 2025
7a67d90
fixed linter issues
scmacdon Jul 15, 2025
4a7eea4
fixed linter issues
scmacdon Jul 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
252 changes: 126 additions & 126 deletions javav2/example_code/comprehend/src/test/java/AmazonComprehendTest.java
Original file line number Diff line number Diff line change
@@ -1,126 +1,126 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import com.example.comprehend.*;
import com.google.gson.Gson;
import org.junit.jupiter.api.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.auth.credentials.EnvironmentVariableCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.comprehend.ComprehendClient;
import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient;
import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueRequest;
import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueResponse;
import java.io.*;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
/**
* To run these integration tests, you must set the required values
* in the config.properties file or AWS Secrets Manager.
*/
@TestInstance(TestInstance.Lifecycle.PER_METHOD)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class AmazonComprehendTest {
private static final Logger logger = LoggerFactory.getLogger(AmazonComprehendTest.class);
private static ComprehendClient comClient;
private static String text = "Amazon.com, Inc. is located in Seattle, WA and was founded July 5th, 1994 by Jeff Bezos, allowing customers to buy everything from books to blenders. Seattle is north of Portland and south of Vancouver, BC. Other notable Seattle - based companies are Starbucks and Boeing";
private static String frText = "Il pleut aujourd'hui à Seattle";
private static String dataAccessRoleArn;
private static String s3Uri;
private static String documentClassifierName;
@BeforeAll
public static void setUp() throws IOException {
comClient = ComprehendClient.builder()
.region(Region.US_EAST_1)
.build();
// Get the values to run these tests from AWS Secrets Manager.
Gson gson = new Gson();
String json = getSecretValues();
SecretValues values = gson.fromJson(json, SecretValues.class);
dataAccessRoleArn = values.getDataAccessRoleArn();
s3Uri = values.getS3Uri();
documentClassifierName = values.getDocumentClassifier();
}
@Test
@Tag("weathertop")
@Tag("IntegrationTest")
@Order(1)
public void testDetectEntities() {
assertDoesNotThrow(() -> DetectEntities.detectAllEntities(comClient, text));
logger.info("Test 1 passed");
}
@Test
@Tag("weathertop")
@Tag("IntegrationTest")
@Order(2)
public void testDetectKeyPhrases() {
assertDoesNotThrow(() -> DetectKeyPhrases.detectAllKeyPhrases(comClient, text));
logger.info("Test 2 passed");
}
@Test
@Tag("weathertop")
@Tag("IntegrationTest")
@Order(3)
public void testDetectLanguage() {
assertDoesNotThrow(() -> DetectLanguage.detectTheDominantLanguage(comClient, frText));
logger.info("Test 3 passed");
}
@Test
@Tag("weathertop")
@Tag("IntegrationTest")
@Order(4)
public void testDetectSentiment() {
assertDoesNotThrow(() -> DetectSentiment.detectSentiments(comClient, text));
logger.info("Test 4 passed");
}
@Test
@Tag("weathertop")
@Tag("IntegrationTest")
@Order(5)
public void testDetectSyntax() {
assertDoesNotThrow(() -> DetectSyntax.detectAllSyntax(comClient, text));
logger.info("Test 5 passed");
}
private static String getSecretValues() {
SecretsManagerClient secretClient = SecretsManagerClient.builder()
.region(Region.US_EAST_1)
.build();
String secretName = "test/comprehend";
GetSecretValueRequest valueRequest = GetSecretValueRequest.builder()
.secretId(secretName)
.build();
GetSecretValueResponse valueResponse = secretClient.getSecretValue(valueRequest);
return valueResponse.secretString();
}
@Nested
@DisplayName("A class used to get test values from test/comprehend (an AWS Secrets Manager secret)")
class SecretValues {
private String dataAccessRoleArn;
private String s3Uri;
private String documentClassifier;
public String getDataAccessRoleArn() {
return dataAccessRoleArn;
}
public String getS3Uri() {
return s3Uri;
}
public String getDocumentClassifier() {
return documentClassifier;
}
}
}
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import com.example.comprehend.*;
import com.google.gson.Gson;
import org.junit.jupiter.api.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.auth.credentials.EnvironmentVariableCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.comprehend.ComprehendClient;
import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient;
import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueRequest;
import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueResponse;
import java.io.*;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

/**
* To run these integration tests, you must set the required values
* in the config.properties file or AWS Secrets Manager.
*/
@TestInstance(TestInstance.Lifecycle.PER_METHOD)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class AmazonComprehendTest {
private static final Logger logger = LoggerFactory.getLogger(AmazonComprehendTest.class);
private static ComprehendClient comClient;
private static String text = "Amazon.com, Inc. is located in Seattle, WA and was founded July 5th, 1994 by Jeff Bezos, allowing customers to buy everything from books to blenders. Seattle is north of Portland and south of Vancouver, BC. Other notable Seattle - based companies are Starbucks and Boeing";
private static String frText = "Il pleut aujourd'hui à Seattle";
private static String dataAccessRoleArn;
private static String s3Uri;
private static String documentClassifierName;

@BeforeAll
public static void setUp() throws IOException {
comClient = ComprehendClient.builder()
.region(Region.US_EAST_1)
.build();

// Get the values to run these tests from AWS Secrets Manager.
Gson gson = new Gson();
String json = getSecretValues();
SecretValues values = gson.fromJson(json, SecretValues.class);
dataAccessRoleArn = values.getDataAccessRoleArn();
s3Uri = values.getS3Uri();
documentClassifierName = values.getDocumentClassifier();
}

@Test
@Tag("weathertop2")
@Tag("IntegrationTest")
@Order(1)
public void testDetectEntities() {
assertDoesNotThrow(() -> DetectEntities.detectAllEntities(comClient, text));
logger.info("Test 1 passed");
}

@Test
@Tag("weathertop")
@Tag("IntegrationTest")
@Order(2)
public void testDetectKeyPhrases() {
assertDoesNotThrow(() -> DetectKeyPhrases.detectAllKeyPhrases(comClient, text));
logger.info("Test 2 passed");
}

@Test
@Tag("weathertop")
@Tag("IntegrationTest")
@Order(3)
public void testDetectLanguage() {
assertDoesNotThrow(() -> DetectLanguage.detectTheDominantLanguage(comClient, frText));
logger.info("Test 3 passed");
}

@Test
@Tag("weathertop")
@Tag("IntegrationTest")
@Order(4)
public void testDetectSentiment() {
assertDoesNotThrow(() -> DetectSentiment.detectSentiments(comClient, text));
logger.info("Test 4 passed");
}

@Test
@Tag("weathertop")
@Tag("IntegrationTest")
@Order(5)
public void testDetectSyntax() {
assertDoesNotThrow(() -> DetectSyntax.detectAllSyntax(comClient, text));
logger.info("Test 5 passed");
}

private static String getSecretValues() {
SecretsManagerClient secretClient = SecretsManagerClient.builder()
.region(Region.US_EAST_1)
.build();
String secretName = "test/comprehend";

GetSecretValueRequest valueRequest = GetSecretValueRequest.builder()
.secretId(secretName)
.build();

GetSecretValueResponse valueResponse = secretClient.getSecretValue(valueRequest);
return valueResponse.secretString();
}

@Nested
@DisplayName("A class used to get test values from test/comprehend (an AWS Secrets Manager secret)")
class SecretValues {
private String dataAccessRoleArn;
private String s3Uri;
private String documentClassifier;

public String getDataAccessRoleArn() {
return dataAccessRoleArn;
}

public String getS3Uri() {
return s3Uri;
}

public String getDocumentClassifier() {
return documentClassifier;
}
}
}
4 changes: 2 additions & 2 deletions kotlin/services/apigateway/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.1.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:apigateway")
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 @@ -37,7 +37,7 @@ suspend fun createNewDeployment(restApiIdVal: String?, stageNameVal: String?): S
stageName = stageNameVal
}

ApiGatewayClient { region = "us-east-1" }.use { apiGateway ->
ApiGatewayClient.fromEnvironment { region = "us-east-1" }.use { apiGateway ->
val response = apiGateway.createDeployment(request)
println("The id of the deployment is " + response.id)
return response.id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ suspend fun createAPI(restApiName: String?): String? {
name = restApiName
}

ApiGatewayClient { region = "us-east-1" }.use { apiGateway ->
ApiGatewayClient.fromEnvironment { region = "us-east-1" }.use { apiGateway ->
val response = apiGateway.createRestApi(request)
println("The id of the new api is ${response.id}")
return response.id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ suspend fun deleteAPI(restApiIdVal: String?) {
restApiId = restApiIdVal
}

ApiGatewayClient { region = "us-east-1" }.use { apiGateway ->
ApiGatewayClient.fromEnvironment { region = "us-east-1" }.use { apiGateway ->
apiGateway.deleteRestApi(request)
println("The API was successfully deleted")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ suspend fun main() {

// snippet-start:[apigateway.kotlin.get_apikeys.main]
suspend fun getKeys() {
ApiGatewayClient { region = "us-east-1" }.use { apiGateway ->
ApiGatewayClient.fromEnvironment { region = "us-east-1" }.use { apiGateway ->
val response = apiGateway.getApiKeys(GetApiKeysRequest { })
response.items?.forEach { key ->
println("Key is $key")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ suspend fun getAllDeployments(restApiIdVal: String?) {
restApiId = restApiIdVal
}

ApiGatewayClient { region = "us-east-1" }.use { apiGateway ->
ApiGatewayClient.fromEnvironment { region = "us-east-1" }.use { apiGateway ->
val response = apiGateway.getDeployments(request)
response.items?.forEach { deployment ->
println("The deployment id is ${deployment.id}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suspend fun getSpecificMethod(restApiIdVal: String?, resourceIdVal: String?, htt
resourceId = resourceIdVal
}

ApiGatewayClient { region = "us-east-1" }.use { apiGateway ->
ApiGatewayClient.fromEnvironment { region = "us-east-1" }.use { apiGateway ->
val response = apiGateway.getMethod(methodRequest)

// Retrieve a method response associated with a given HTTP status code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ suspend fun getAllStages(restApiIdVal: String?) {
restApiId = restApiIdVal
}

ApiGatewayClient { region = "us-east-1" }.use { apiGateway ->
ApiGatewayClient.fromEnvironment { region = "us-east-1" }.use { apiGateway ->
val response = apiGateway.getStages(stagesRequest)
response.item?.forEach { stage ->
println("Stage name is ${stage.stageName}")
Expand Down
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.1.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
Loading
Loading