1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package br.com.ingenieux.mojo.beanstalk.env;
18
19 import org.apache.maven.plugins.annotations.Mojo;
20 import org.apache.maven.plugins.annotations.Parameter;
21
22 import br.com.ingenieux.mojo.beanstalk.AbstractBeanstalkMojo;
23 import br.com.ingenieux.mojo.beanstalk.cmd.env.waitfor.WaitForEnvironmentCommand;
24 import br.com.ingenieux.mojo.beanstalk.cmd.env.waitfor.WaitForEnvironmentContext;
25 import br.com.ingenieux.mojo.beanstalk.cmd.env.waitfor.WaitForEnvironmentContextBuilder;
26
27
28
29
30
31
32 @Mojo(name = "wait-for-environment")
33 public class WaitForEnvironmentMojo extends AbstractBeanstalkMojo {
34
35
36
37
38 @Parameter(property = "beanstalk.applicationName", defaultValue = "${project.artifactId}", required = true)
39 String applicationName;
40
41
42
43
44 @Parameter(property = "beanstalk.timeoutMins", defaultValue = "20")
45 Integer timeoutMins;
46
47
48
49
50 @Parameter(property = "beanstalk.statusToWaitFor", defaultValue = "Ready")
51 String statusToWaitFor;
52
53
54
55
56 @Parameter(property = "beanstalk.healthToWaitFor", defaultValue = "Green")
57 String healthToWaitFor;
58
59
60
61
62 @Parameter(property = "beanstalk.environmentRef", defaultValue = "${project.artifactId}.elasticbeanstalk.com")
63 String environmentRef;
64
65 @Override
66 protected Object executeInternal() throws Exception {
67 WaitForEnvironmentContext context =
68 new WaitForEnvironmentContextBuilder()
69 .withApplicationName(applicationName)
70 .withStatusToWaitFor(statusToWaitFor)
71 .withTimeoutMins(timeoutMins)
72 .withHealth(healthToWaitFor)
73 .withEnvironmentRef(environmentRef)
74 .build();
75
76 WaitForEnvironmentCommanditfor/WaitForEnvironmentCommand.html#WaitForEnvironmentCommand">WaitForEnvironmentCommand command = new WaitForEnvironmentCommand(this);
77
78 return command.execute(context);
79 }
80 }