Skip to content

Commit

Permalink
removed additional sample files
Browse files Browse the repository at this point in the history
  • Loading branch information
scmacdon committed Feb 7, 2024
1 parent ce3e644 commit eb784cc
Show file tree
Hide file tree
Showing 17 changed files with 572 additions and 4 deletions.
4 changes: 2 additions & 2 deletions kotlin/services/cloudtrail/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ repositories {
}
apply(plugin = "org.jlleitschuh.gradle.ktlint")
dependencies {
implementation("aws.sdk.kotlin:cloudtrail:1.0.0")
implementation("aws.sdk.kotlin:secretsmanager:1.0.0")
implementation("aws.sdk.kotlin:cloudtrail:1.0.30")
implementation("aws.sdk.kotlin:secretsmanager:1.0.30")
implementation("aws.smithy.kotlin:http-client-engine-okhttp:0.30.0")
implementation("aws.smithy.kotlin:http-client-engine-crt:0.30.0")
implementation("com.google.code.gson:gson:2.10")
Expand Down
119 changes: 119 additions & 0 deletions kotlin/services/cloudtrail/src/test/kotlin/CloudtrailKotlinTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import aws.sdk.kotlin.runtime.auth.credentials.EnvironmentCredentialsProvider
import aws.sdk.kotlin.services.secretsmanager.SecretsManagerClient
import aws.sdk.kotlin.services.secretsmanager.model.GetSecretValueRequest
import com.google.gson.Gson
import com.kotlin.cloudtrail.createNewTrail
import com.kotlin.cloudtrail.deleteSpecificTrail
import com.kotlin.cloudtrail.describeSpecificTrails
import com.kotlin.cloudtrail.getSelectors
import com.kotlin.cloudtrail.lookupAllEvents
import com.kotlin.cloudtrail.setSelector
import com.kotlin.cloudtrail.startLog
import com.kotlin.cloudtrail.stopLog
import kotlinx.coroutines.runBlocking
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation
import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Order
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.TestMethodOrder

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@TestMethodOrder(OrderAnnotation::class)
class CloudtrailKotlinTest {
private var trailName = ""
private var s3BucketName = ""

@BeforeAll
fun setup() = runBlocking {
val gson = Gson()
val json: String = getSecretValues()
val values: SecretValues = gson.fromJson<SecretValues>(json, SecretValues::class.java)
trailName = values.trailName.toString()
s3BucketName = values.s3BucketName.toString()

// Uncomment this code block if you prefer using a config.properties file to retrieve AWS values required for these tests.
/*
val input: InputStream = this.javaClass.getClassLoader().getResourceAsStream("config.properties")
val prop = Properties()
// load the properties file.
prop.load(input)
trailName = prop.getProperty("trailName")
s3BucketName = prop.getProperty("s3BucketName")
*/
}

@Test
@Order(1)
fun createTrail() = runBlocking {
createNewTrail(trailName, s3BucketName)
println("Test 1 passed")
}

@Test
@Order(2)
fun putEventSelectors() = runBlocking {
setSelector(trailName)
println("Test 2 passed")
}

@Test
@Order(3)
fun getEventSelectors() = runBlocking {
getSelectors(trailName)
println("Test 3 passed")
}

@Test
@Order(4)
fun lookupEvents() = runBlocking {
lookupAllEvents()
println("Test 4 passed")
}

@Test
@Order(5)
fun describeTrails() = runBlocking {
describeSpecificTrails(trailName)
println("Test 5 passed")
}

@Test
@Order(6)
fun startLogging() = runBlocking {
startLog(trailName)
stopLog(trailName)
println("Test 6 passed")
}

@Test
@Order(7)
fun deleteTrail() = runBlocking {
deleteSpecificTrail(trailName)
println("Test 7 passed")
}

private suspend fun getSecretValues(): String {
val secretName = "test/cloudtrail"
val valueRequest = GetSecretValueRequest {
secretId = secretName
}
SecretsManagerClient { region = "us-east-1"; credentialsProvider = EnvironmentCredentialsProvider() }.use { secretClient ->
val valueResponse = secretClient.getSecretValue(valueRequest)
return valueResponse.secretString.toString()
}
}

@Nested
@DisplayName("A class used to get test values from test/cloudtrail (an AWS Secrets Manager secret)")
internal class SecretValues {
val trailName: String? = null
val s3BucketName: String? = null
}
}
162 changes: 162 additions & 0 deletions resources/sample_files/GeoSpatialPipeline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{
"Version": "2020-12-01",
"Metadata": {},
"Parameters": [
{
"Name": "parameter_execution_role",
"Type": "String",
"DefaultValue": ""
},
{
"Name": "parameter_region",
"Type": "String",
"DefaultValue": "us-west-2"
},
{
"Name": "parameter_queue_url",
"Type": "String",
"DefaultValue": ""
},
{
"Name": "parameter_vej_input_config",
"Type": "String",
"DefaultValue": ""
},
{
"Name": "parameter_vej_export_config",
"Type": "String",
"DefaultValue": ""
},
{
"Name": "parameter_step_1_vej_config",
"Type": "String",
"DefaultValue": ""
}
],
"PipelineExperimentConfig": {
"ExperimentName": {
"Get": "Execution.PipelineName"
},
"TrialName": {
"Get": "Execution.PipelineExecutionId"
}
},
"Steps": [
{
"Name": "vej-processing-step",
"Type": "Lambda",
"Arguments": {
"role": {
"Get": "Parameters.parameter_execution_role"
},
"region": {
"Get": "Parameters.parameter_region"
},
"vej_input_config": {
"Get": "Parameters.parameter_vej_input_config"
},
"vej_config": {
"Get": "Parameters.parameter_step_1_vej_config"
},
"vej_name": "vej-pipeline-step-1"
},
"FunctionArn": "*FUNCTION_ARN*",
"OutputParameters": [
{
"OutputName": "statusCode",
"OutputType": "String"
},
{
"OutputName": "vej_arn",
"OutputType": "String"
}
]
},
{
"Name": "vej-callback-step",
"Type": "Callback",
"Arguments": {
"role": {
"Get": "Parameters.parameter_execution_role"
},
"region": {
"Get": "Parameters.parameter_region"
},
"vej_arn": {
"Get": "Steps.vej-processing-step.OutputParameters['vej_arn']"
}
},
"DependsOn": [
"vej-processing-step"
],
"SqsQueueUrl": {
"Get": "Parameters.parameter_queue_url"
},
"OutputParameters": [
{
"OutputName": "vej_status",
"OutputType": "String"
}
]
},
{
"Name": "export-vej-step",
"Type": "Lambda",
"Arguments": {
"vej_arn": {
"Get": "Steps.vej-processing-step.OutputParameters['vej_arn']"
},
"role": {
"Get": "Parameters.parameter_execution_role"
},
"region": {
"Get": "Parameters.parameter_region"
},
"vej_export_config": {
"Get": "Parameters.parameter_vej_export_config"
}
},
"DependsOn": [
"vej-callback-step"
],
"FunctionArn": "*FUNCTION_ARN*",
"OutputParameters": [
{
"OutputName": "statusCode",
"OutputType": "String"
},
{
"OutputName": "vej_arn",
"OutputType": "String"
}
]
},
{
"Name": "export-vej-callback",
"Type": "Callback",
"Arguments": {
"role": {
"Get": "Parameters.parameter_execution_role"
},
"region": {
"Get": "Parameters.parameter_region"
},
"vej_arn": {
"Get": "Steps.export-vej-step.OutputParameters['vej_arn']"
}
},
"DependsOn": [
"export-vej-step"
],
"SqsQueueUrl": {
"Get": "Parameters.parameter_queue_url"
},
"OutputParameters": [
{
"OutputName": "statusJob",
"OutputType": "String"
}
]
}
]
}
Binary file removed resources/sample_files/Jack.png
Binary file not shown.
Binary file removed resources/sample_files/Lam1.png
Binary file not shown.
Binary file removed resources/sample_files/Lam4.png
Binary file not shown.
2 changes: 2 additions & 0 deletions resources/sample_files/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ These files are included as shared sample data files for use in examples in this
* [speech_sample.mp3](.sample_media/speech_sample.mp3) `A sample audio file of speech used for Amazon Transcribe examples.`
* [spheres_2.jpg](.sample_media/spheres_2.jpg) `A sample image of the Amazon Spheres in Seattle.`
* [market_2.jpg](.sample_media/market_2.jpg) `A sample image of the public market in Seattle.`
* [sample_cert.pem](./sample_cert.pem) `A sample certificate PEM file.`
* [sample_private_key.pem](./sample_private_key.pem) `A sample private key PEM file.`
* [sample_saml_metadata.xml](./sample_saml_metadata.xml) `A sample SAML metadata file for creating a SAML provider.`

Binary file removed resources/sample_files/WorkReport.xls
Binary file not shown.
2 changes: 1 addition & 1 deletion resources/sample_files/chat_sfn_state_machine.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@
}
}
}
}
}
Loading

0 comments on commit eb784cc

Please sign in to comment.