Skip to content
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

Update Java V2 POM files #6504

Closed
wants to merge 13 commits into from
Closed
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
10 changes: 9 additions & 1 deletion javav2/example_code/appautoscale/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,21 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.23.13</version>
<version>2.25.56</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sso</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>ssooidc</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
10 changes: 9 additions & 1 deletion javav2/example_code/appsync/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,21 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.21.20</version>
<version>2.25.56</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sso</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>ssooidc</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
10 changes: 9 additions & 1 deletion javav2/example_code/athena/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,21 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.21.20</version>
<version>2.25.56</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sso</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>ssooidc</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
10 changes: 9 additions & 1 deletion javav2/example_code/autoscale/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,21 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.21.20</version>
<version>2.25.56</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sso</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>ssooidc</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
14 changes: 11 additions & 3 deletions javav2/example_code/cloudformation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>CloudFormationV2</groupId>
<artifactId>CloudFormationV2</artifactId>
<groupId>CloudFormation</groupId>
<artifactId>CloudFormation</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -38,13 +38,21 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.21.20</version>
<version>2.25.56</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sso</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>ssooidc</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>cloudformation</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
import software.amazon.awssdk.services.cloudformation.model.DescribeStacksRequest;
import software.amazon.awssdk.services.cloudformation.model.DescribeStacksResponse;
import software.amazon.awssdk.services.cloudformation.waiters.CloudFormationWaiter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
// snippet-end:[cf.java2.create_stack.import]

/**
Expand Down Expand Up @@ -69,39 +74,28 @@ public static void main(String[] args) {
.region(region)
.build();

createCFStack(cfClient, stackName, roleARN, location, key, value);
createCFStack(cfClient, stackName, roleARN, location);
cfClient.close();
}

public static void createCFStack(CloudFormationClient cfClient,
String stackName,
String roleARN,
String location,
String key,
String value) {
String stackName,
String roleARN,
String location) {
try {
CloudFormationWaiter waiter = cfClient.waiter();
Parameter myParameter = Parameter.builder()
.parameterKey(key)
.parameterValue(value)
.build();

// Create the request to create the stack
CreateStackRequest stackRequest = CreateStackRequest.builder()
.stackName(stackName)
.templateURL(location)
.roleARN(roleARN)
.onFailure(OnFailure.ROLLBACK)
.parameters(myParameter)
.build();
.stackName(stackName)
.templateURL(location)
.roleARN(roleARN)
.onFailure(OnFailure.ROLLBACK)
.build();

// Create the stack
cfClient.createStack(stackRequest);
DescribeStacksRequest stacksRequest = DescribeStacksRequest.builder()
.stackName(stackName)
.build();

WaiterResponse<DescribeStacksResponse> waiterResponse = waiter.waitUntilStackCreateComplete(stacksRequest);
waiterResponse.matched().response().ifPresent(System.out::println);
System.out.println(stackName + " is ready");
// Print a confirmation message
System.out.println(stackName + " creation initiated");

} catch (CloudFormationException e) {
System.err.println(e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public static void describeAllStacks(CloudFormationClient cfClient) {
DescribeStacksResponse stacksResponse = cfClient.describeStacks();
List<Stack> stacks = stacksResponse.stacks();
for (Stack stack : stacks) {
System.out.println("The stack description is " + stack.description());
System.out.println("The stack Id is " + stack.stackId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
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.util.Random;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

/**
Expand All @@ -23,8 +26,6 @@ public class CloudFormationTest {
private static String stackName = "";
private static String roleARN = "";
private static String location = "";
private static String key = "";
private static String value = "";

@BeforeAll
public static void setUp() {
Expand All @@ -34,14 +35,14 @@ public static void setUp() {
.build();

// Get the values to run these tests from AWS Secrets Manager.
Random random = new Random();
int randomNum = random.nextInt((10000 - 1) + 1) + 1;
Gson gson = new Gson();
String json = getSecretValues();
SecretValues values = gson.fromJson(json, SecretValues.class);
stackName = values.getStackName();
stackName = values.getStackName()+randomNum ;
roleARN = values.getRoleARN();
location = values.getLocation();
key = values.getKey();
value = values.getValue();

// Uncomment this code block if you prefer using a config.properties file to
// retrieve AWS values required for these tests.
Expand Down Expand Up @@ -73,7 +74,7 @@ public static void setUp() {
@Tag("IntegrationTest")
@Order(1)
public void CreateStack() {
assertDoesNotThrow(() -> CreateStack.createCFStack(cfClient, stackName, roleARN, location, key, value));
assertDoesNotThrow(() -> CreateStack.createCFStack(cfClient, stackName, roleARN, location));
System.out.println("Test 1 passed");
}

Expand Down Expand Up @@ -123,10 +124,6 @@ class SecretValues {
private String roleARN;
private String location;

private String key;

private String value;

public String getStackName() {
return stackName;
}
Expand All @@ -139,13 +136,6 @@ public String getLocation() {
return location;
}

public String getKey() {
return key;
}

public String getValue() {
return value;
}
}

}
10 changes: 9 additions & 1 deletion javav2/example_code/cloudfront/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.21.20</version>
<version>2.25.56</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -49,6 +49,14 @@
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sso</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>ssooidc</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,8 @@ public void GetDistribution() {
System.out.println("Test 5 passed");
}


@Test
@Order(6)
public void ModifyDistribution() {

ModifyDistribution.modDistribution(cloudFrontClient, distributionId);
System.out.println("Test 6 passed");
}

@Test
@Order(7)
public void DeleteFunction(){

DeleteFunction.deleteSpecificFunction(cloudFrontClient, functionName, eTagVal);
Expand Down
10 changes: 9 additions & 1 deletion javav2/example_code/cloudtrail/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,21 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.21.20</version>
<version>2.25.56</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sso</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>ssooidc</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>cloudtrail</artifactId>
Expand Down
10 changes: 9 additions & 1 deletion javav2/example_code/cloudwatch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,21 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.21.20</version>
<version>2.25.56</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sso</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>ssooidc</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
10 changes: 9 additions & 1 deletion javav2/example_code/codecommit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.21.20</version>
<version>2.25.56</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sso</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>ssooidc</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>codecommit</artifactId>
Expand Down
Loading
Loading