Skip to content

Kotlin Updated the SDK build number in Gradle Build file and include fromEnvironment() #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 52 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
52df0f0
updated the Kotlin SDK build
scmacdon Jul 7, 2025
5557e4d
updated the Kotlin SDK build
scmacdon Jul 7, 2025
a36460c
updated a Readme
scmacdon Jul 7, 2025
a88afcd
updated build number
scmacdon Jul 7, 2025
b6d829b
updated build number
scmacdon Jul 7, 2025
c5182f8
updated build number
scmacdon Jul 7, 2025
cfd703f
updated build number
scmacdon Jul 7, 2025
90fda0c
updated build number
scmacdon Jul 7, 2025
78d5cd4
updated build number
scmacdon Jul 7, 2025
a972f9a
updated build number
scmacdon Jul 7, 2025
f9ed47a
updated build number
scmacdon Jul 7, 2025
0c202ad
updated build number
scmacdon Jul 7, 2025
acbf5db
updated build number
scmacdon Jul 7, 2025
82ea449
updated build number
scmacdon Jul 7, 2025
2995f13
updated build number
scmacdon Jul 7, 2025
614cbb6
updated build number
scmacdon Jul 7, 2025
a757a6d
updated build number
scmacdon Jul 7, 2025
632431d
updated build number
scmacdon Jul 7, 2025
cd0db99
updated build number
scmacdon Jul 8, 2025
a56129b
updated build number
scmacdon Jul 8, 2025
bce567d
updated build number
scmacdon Jul 8, 2025
cbd1eb3
updated build number
scmacdon Jul 8, 2025
115fd4b
updated build number
scmacdon Jul 8, 2025
af67057
updated build number
scmacdon Jul 8, 2025
6f79b1f
update build number
scmacdon Jul 8, 2025
e745689
update build number
scmacdon Jul 8, 2025
9134ceb
update build number
scmacdon Jul 8, 2025
8afd9a4
updated build number
scmacdon Jul 9, 2025
d6351ef
updated build number
scmacdon Jul 9, 2025
a4e00c1
fixed linter issue
scmacdon Jul 9, 2025
07834f9
fixed linter issue
scmacdon Jul 9, 2025
e668b16
fixed linter issue
scmacdon Jul 9, 2025
d0cc52f
fixed linter issue
scmacdon Jul 9, 2025
3d2581b
Updated build number
scmacdon Jul 9, 2025
e059e1d
Updated build number
scmacdon Jul 9, 2025
7fa79ab
Updated build number
scmacdon Jul 9, 2025
9fc798b
Updated build number
scmacdon Jul 9, 2025
200e79b
Updated build number
scmacdon Jul 9, 2025
64591fd
Updated build number
scmacdon Jul 9, 2025
002fc30
Updated build number
scmacdon Jul 9, 2025
a5099f6
Updated build number
scmacdon Jul 9, 2025
509b19c
Updated build number
scmacdon Jul 9, 2025
5cd1bcd
Updated build number
scmacdon Jul 9, 2025
8b43bc8
Updated build number and API
scmacdon Jul 9, 2025
5d210d8
Updated build number and API
scmacdon Jul 9, 2025
e33ec26
Updated build number and API
scmacdon Jul 9, 2025
a5f7af7
Updated build number and API
scmacdon Jul 9, 2025
9168dfc
Updated build number and API
scmacdon Jul 9, 2025
09eb415
Updated build number and API
scmacdon Jul 9, 2025
3b2a5af
Updated build number and API
scmacdon Jul 9, 2025
3f6feba
Remove java from tracking
scmacdon Jul 10, 2025
5adb323
updated Kotlin MediaConvert code
scmacdon Jul 10, 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