View Javadoc
1   package org.kuali.common.devops.jenkins.upgrade;
2   
3   import javax.validation.constraints.Min;
4   
5   import org.kuali.common.aws.model.ImmutableAWSCredentials;
6   import org.kuali.common.core.build.ValidatingBuilder;
7   import org.kuali.common.core.validate.annotation.IdiotProofImmutable;
8   
9   import com.amazonaws.auth.AWSCredentials;
10  import com.fasterxml.jackson.annotation.JsonIgnore;
11  
12  @IdiotProofImmutable
13  public final class JenkinsArchiveContext {
14  
15  	private final String hostname;
16  	private final String bucket;
17  	private final String home;
18  	@JsonIgnore
19  	private final ImmutableAWSCredentials credentials;
20  	private final String timezone;
21  	private final String age;
22  	private final String stack;
23  	private final JenkinsCommand command;
24  	@Min(1)
25  	private final int threads;
26  
27  	private JenkinsArchiveContext(Builder builder) {
28  		this.hostname = builder.hostname;
29  		this.bucket = builder.bucket;
30  		this.home = builder.home;
31  		this.timezone = builder.timezone;
32  		this.age = builder.age;
33  		this.threads = builder.threads;
34  		this.stack = builder.stack;
35  		this.command = builder.command;
36  		this.credentials = ImmutableAWSCredentials.copyOf(builder.credentials);
37  	}
38  
39  	public static final Builder builder() {
40  		return new Builder();
41  	}
42  
43  	public static class Builder extends ValidatingBuilder<JenkinsArchiveContext> {
44  
45  		private String hostname;
46  		private String bucket;
47  		private String home;
48  		private JenkinsCommand command;
49  		private String timezone;
50  		private AWSCredentials credentials;
51  		private String age;
52  		private int threads;
53  		private String stack;
54  
55  		public Builder withCommand(JenkinsCommand command) {
56  			this.command = command;
57  			return this;
58  		}
59  
60  		public Builder withThreads(int threads) {
61  			this.threads = threads;
62  			return this;
63  		}
64  
65  		public Builder withAge(String age) {
66  			this.age = age;
67  			return this;
68  		}
69  
70  		public Builder withStack(String stack) {
71  			this.stack = stack;
72  			return this;
73  		}
74  
75  		public Builder withTimezone(String timezone) {
76  			this.timezone = timezone;
77  			return this;
78  		}
79  
80  		public Builder withHostname(String hostname) {
81  			this.hostname = hostname;
82  			return this;
83  		}
84  
85  		public Builder withBucket(String bucket) {
86  			this.bucket = bucket;
87  			return this;
88  		}
89  
90  		public Builder withHome(String home) {
91  			this.home = home;
92  			return this;
93  		}
94  
95  		public Builder withCredentials(AWSCredentials credentials) {
96  			this.credentials = credentials;
97  			return this;
98  		}
99  
100 		@Override
101 		public JenkinsArchiveContext build() {
102 			return validate(new JenkinsArchiveContext(this));
103 		}
104 	}
105 
106 	public String getHostname() {
107 		return hostname;
108 	}
109 
110 	public String getBucket() {
111 		return bucket;
112 	}
113 
114 	public String getHome() {
115 		return home;
116 	}
117 
118 	public AWSCredentials getCredentials() {
119 		return credentials;
120 	}
121 
122 	public String getTimezone() {
123 		return timezone;
124 	}
125 
126 	public String getAge() {
127 		return age;
128 	}
129 
130 	public int getThreads() {
131 		return threads;
132 	}
133 
134 	public JenkinsCommand getCommand() {
135 		return command;
136 	}
137 
138 	public String getStack() {
139 		return stack;
140 	}
141 
142 }