Skip to content

Commit d570190

Browse files
committed
Adding in CodeDeploy
1 parent d51033c commit d570190

File tree

14 files changed

+4268
-0
lines changed

14 files changed

+4268
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"category": "AWS CodeDeploy",
3+
"type": "feature",
4+
"description": "Supporting AWS CodeDeploy"
5+
}

aws-sdk-java/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,11 @@
602602
<artifactId>kafka</artifactId>
603603
<version>${awsjavasdk.version}</version>
604604
</dependency>
605+
<dependency>
606+
<groupId>software.amazon.awssdk</groupId>
607+
<artifactId>codedeploy</artifactId>
608+
<version>${awsjavasdk.version}</version>
609+
</dependency>
605610
</dependencies>
606611
<build>
607612
<finalName>${project.artifactId}-${project.version}</finalName>

bom/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,11 @@
518518
<groupId>software.amazon.awssdk</groupId>
519519
<version>${awsjavasdk.version}</version>
520520
</dependency>
521+
<dependency>
522+
<groupId>software.amazon.awssdk</groupId>
523+
<artifactId>codedeploy</artifactId>
524+
<version>${awsjavasdk.version}</version>
525+
</dependency>
521526
<dependency>
522527
<artifactId>runtime</artifactId>
523528
<groupId>software.amazon.awssdk</groupId>

pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,10 @@
11291129
<title>WorkDocs</title>
11301130
<packages>software.amazon.awssdk.services.workdocs*</packages>
11311131
</group>
1132+
<group>
1133+
<title>CodeDeploy</title>
1134+
<packages>software.amazon.awssdk.services.codedeploy*</packages>
1135+
</group>
11321136
<group>
11331137
<title>Common</title>
11341138
<packages>software.amazon.awssdk*</packages>

services/codedeploy/build.properties

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License").
5+
# You may not use this file except in compliance with the License.
6+
# A copy of the License is located at
7+
#
8+
# http://aws.amazon.com/apache2.0
9+
#
10+
# or in the "license" file accompanying this file. This file is distributed
11+
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
# express or implied. See the License for the specific language governing
13+
# permissions and limitations under the License.
14+
#
15+
16+
source.. = src/main/java,\
17+
src/main/resources
18+
output.. = bin/
19+
20+
bin.includes = LICENSE.txt,\
21+
NOTICE.txt,\
22+
META-INF/,\
23+
.
24+
25+
jre.compilation.profile = JavaSE-1.6

services/codedeploy/pom.xml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
~ Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License").
6+
~ You may not use this file except in compliance with the License.
7+
~ A copy of the License is located at
8+
~
9+
~ http://aws.amazon.com/apache2.0
10+
~
11+
~ or in the "license" file accompanying this file. This file is distributed
12+
~ on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13+
~ express or implied. See the License for the specific language governing
14+
~ permissions and limitations under the License.
15+
-->
16+
17+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
18+
xmlns="http://maven.apache.org/POM/4.0.0"
19+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
20+
<modelVersion>4.0.0</modelVersion>
21+
<parent>
22+
<groupId>software.amazon.awssdk</groupId>
23+
<artifactId>services</artifactId>
24+
<version>2.1.4-SNAPSHOT</version>
25+
</parent>
26+
<artifactId>codedeploy</artifactId>
27+
<name>AWS Java SDK :: Services :: AWS CodeDeploy</name>
28+
<description>The AWS Java SDK for AWS CodeDeploy module holds the client classes that are used for communicating
29+
with AWS CodeDeploy
30+
Service
31+
</description>
32+
<url>https://aws.amazon.com/sdkforjava</url>
33+
<build>
34+
<plugins>
35+
<plugin>
36+
<groupId>org.apache.maven.plugins</groupId>
37+
<artifactId>maven-jar-plugin</artifactId>
38+
<configuration>
39+
<archive>
40+
<manifestEntries>
41+
<Automatic-Module-Name>software.amazon.awssdk.services.codedeploy</Automatic-Module-Name>
42+
</manifestEntries>
43+
</archive>
44+
</configuration>
45+
</plugin>
46+
</plugins>
47+
</build>
48+
49+
<dependencies>
50+
<dependency>
51+
<groupId>software.amazon.awssdk</groupId>
52+
<artifactId>aws-json-protocol</artifactId>
53+
<version>${awsjavasdk.version}</version>
54+
</dependency>
55+
<dependency>
56+
<groupId>software.amazon.awssdk</groupId>
57+
<artifactId>protocol-core</artifactId>
58+
<version>${awsjavasdk.version}</version>
59+
</dependency>
60+
</dependencies>
61+
</project>
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/*
2+
* Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package software.amazon.awssdk.services.codedeploy;
17+
18+
import static org.junit.Assert.assertEquals;
19+
import static org.junit.Assert.assertNotNull;
20+
import static org.junit.Assert.assertTrue;
21+
import static org.junit.Assert.fail;
22+
23+
import java.io.FileNotFoundException;
24+
import java.io.IOException;
25+
import java.util.List;
26+
import org.junit.AfterClass;
27+
import org.junit.BeforeClass;
28+
import org.junit.Test;
29+
import software.amazon.awssdk.core.exception.SdkServiceException;
30+
import software.amazon.awssdk.services.codedeploy.model.ApplicationInfo;
31+
import software.amazon.awssdk.services.codedeploy.model.CreateApplicationRequest;
32+
import software.amazon.awssdk.services.codedeploy.model.CreateApplicationResponse;
33+
import software.amazon.awssdk.services.codedeploy.model.CreateDeploymentGroupRequest;
34+
import software.amazon.awssdk.services.codedeploy.model.DeleteApplicationRequest;
35+
import software.amazon.awssdk.services.codedeploy.model.GetApplicationRequest;
36+
import software.amazon.awssdk.services.codedeploy.model.GetApplicationResponse;
37+
import software.amazon.awssdk.services.codedeploy.model.ListApplicationsRequest;
38+
import software.amazon.awssdk.services.codedeploy.model.ListApplicationsResponse;
39+
40+
/**
41+
* Performs basic integration tests for AWS Code Deploy service.
42+
*
43+
*/
44+
public class CodeDeployIntegrationTest extends IntegrationTestBase {
45+
46+
/**
47+
* The name of the application being created.
48+
*/
49+
private static final String APP_NAME = "java-sdk-appln-"
50+
+ System.currentTimeMillis();
51+
/** The name of the deployment group being created, */
52+
private static final String DEPLOYMENT_GROUP_NAME = "java-sdk-deploy-"
53+
+ System.currentTimeMillis();
54+
55+
/**
56+
* The id of the application created in AWS Code Deploy service.
57+
*/
58+
private static String applicationId = null;
59+
60+
/**
61+
* Creates an application and asserts the result for the application id
62+
* returned from code deploy service.
63+
*/
64+
@BeforeClass
65+
public static void setUp() throws FileNotFoundException, IOException {
66+
IntegrationTestBase.setUp();
67+
CreateApplicationRequest createRequest = CreateApplicationRequest.builder()
68+
.applicationName(APP_NAME)
69+
.build();
70+
CreateApplicationResponse createResult = codeDeploy
71+
.createApplication(createRequest);
72+
applicationId = createResult.applicationId();
73+
assertNotNull(applicationId);
74+
}
75+
76+
/**
77+
* Delete the application from code deploy service created for this testing.
78+
*/
79+
@AfterClass
80+
public static void tearDown() {
81+
if (applicationId != null) {
82+
codeDeploy.deleteApplication(DeleteApplicationRequest.builder()
83+
.applicationName(APP_NAME)
84+
.build());
85+
}
86+
}
87+
88+
/**
89+
* Performs a list application operation. Asserts that the result should
90+
* have atleast one application
91+
*/
92+
@Test
93+
public void testListApplication() {
94+
ListApplicationsResponse listResult = codeDeploy.listApplications(ListApplicationsRequest.builder().build());
95+
List<String> applicationList = listResult.applications();
96+
assertTrue(applicationList.size() >= 1);
97+
assertTrue(applicationList.contains(APP_NAME));
98+
}
99+
100+
/**
101+
* Performs a get application operation. Asserts that the application name
102+
* and id retrieved matches the one created for the testing.
103+
*/
104+
@Test
105+
public void testGetApplication() {
106+
GetApplicationResponse getResult = codeDeploy
107+
.getApplication(GetApplicationRequest.builder()
108+
.applicationName(APP_NAME)
109+
.build());
110+
ApplicationInfo applicationInfo = getResult.application();
111+
assertEquals(applicationId, applicationInfo.applicationId());
112+
assertEquals(APP_NAME, applicationInfo.applicationName());
113+
}
114+
115+
/**
116+
* Tries to create a deployment group. The operation should fail as the
117+
* service role arn is not mentioned as part of the request.
118+
* TODO: Re work on this test case to use the IAM role ARN when the code supports it.
119+
*/
120+
@Test
121+
public void testCreateDeploymentGroup() {
122+
try {
123+
codeDeploy.createDeploymentGroup(CreateDeploymentGroupRequest.builder()
124+
.applicationName(APP_NAME)
125+
.deploymentGroupName(DEPLOYMENT_GROUP_NAME).build());
126+
fail("Create Deployment group should fail as it requires a service role ARN to be specified");
127+
} catch (Exception ace) {
128+
assertTrue(ace instanceof SdkServiceException);
129+
}
130+
}
131+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package software.amazon.awssdk.services.codedeploy;
17+
18+
import java.io.FileNotFoundException;
19+
import java.io.IOException;
20+
import org.junit.BeforeClass;
21+
import software.amazon.awssdk.testutils.service.AwsTestBase;
22+
23+
public class IntegrationTestBase extends AwsTestBase {
24+
25+
/**
26+
* The code deploy client reference used for testing.
27+
*/
28+
protected static CodeDeployClient codeDeploy;
29+
30+
/**
31+
* Reads the credentials and sets up the code deploy the client.
32+
*/
33+
@BeforeClass
34+
public static void setUp() throws FileNotFoundException, IOException {
35+
setUpCredentials();
36+
codeDeploy = CodeDeployClient.builder().credentialsProvider(CREDENTIALS_PROVIDER_CHAIN).build();
37+
}
38+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"blacklistedSimpleMethods" : [
3+
"continueDeployment",
4+
"skipWaitTimeForInstanceTermination",
5+
"updateApplication",
6+
"batchGetApplications",
7+
"batchGetDeployments",
8+
"batchGetOnPremisesInstances",
9+
"deleteGitHubAccountToken",
10+
"putLifecycleEventHookExecutionStatus"
11+
],
12+
"deprecatedOperations": [
13+
"BatchGetDeploymentInstances",
14+
"GetDeploymentInstance",
15+
"ListDeploymentInstances",
16+
"SkipWaitTimeForInstanceTermination"
17+
],
18+
"deprecatedShapes" : [
19+
"InstanceDoesNotExistException",
20+
"InstanceIdRequiredException",
21+
"InstanceStatus",
22+
"InstanceSummary"
23+
]
24+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"version": "1.0",
3+
"examples": {
4+
}
5+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"pagination": {
3+
"ListApplicationRevisions": {
4+
"input_token": "nextToken",
5+
"output_token": "nextToken",
6+
"result_key": "revisions"
7+
},
8+
"ListApplications": {
9+
"input_token": "nextToken",
10+
"output_token": "nextToken",
11+
"result_key": "applications"
12+
},
13+
"ListDeploymentConfigs": {
14+
"input_token": "nextToken",
15+
"output_token": "nextToken",
16+
"result_key": "deploymentConfigsList"
17+
},
18+
"ListDeploymentGroups": {
19+
"input_token": "nextToken",
20+
"output_token": "nextToken",
21+
"result_key": "deploymentGroups"
22+
},
23+
"ListDeployments": {
24+
"input_token": "nextToken",
25+
"output_token": "nextToken",
26+
"result_key": "deployments"
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)