1   package org.kuali.common.devops.ubuntu;
2   
3   import static com.google.common.base.Optional.absent;
4   
5   import java.util.List;
6   
7   import org.kuali.common.aws.ec2.model.ImmutableTag;
8   import org.kuali.common.core.build.ValidatingBuilder;
9   import org.kuali.common.core.validate.annotation.IdiotProofImmutable;
10  
11  import com.amazonaws.services.ec2.model.Tag;
12  import com.google.common.base.Optional;
13  import com.google.common.collect.ImmutableList;
14  
15  @IdiotProofImmutable
16  public final class MountVolumeRequest {
17  
18  	
19  
20  
21  	private final ImmutableList<Tag> volumeTags;
22  
23  	
24  
25  
26  	private final String instanceId;
27  
28  	
29  
30  
31  	private final String device;
32  
33  	
34  
35  
36  	private final String path;
37  
38  	
39  
40  
41  	private final Optional<String> ownership;
42  
43  	private MountVolumeRequest(Builder builder) {
44  		this.volumeTags = ImmutableList.copyOf(ImmutableTag.copyOf(builder.volumeTags));
45  		this.instanceId = builder.instanceId;
46  		this.device = builder.device;
47  		this.path = builder.path;
48  		this.ownership = builder.ownership;
49  	}
50  
51  	public static Builder builder() {
52  		return new Builder();
53  	}
54  
55  	public static class Builder extends ValidatingBuilder<MountVolumeRequest> {
56  
57  		private List<Tag> volumeTags;
58  		private String instanceId;
59  		private String device;
60  		private String path;
61  		private Optional<String> ownership = absent();
62  
63  		public Builder withVolumeTags(List<Tag> volumeTags) {
64  			this.volumeTags = volumeTags;
65  			return this;
66  		}
67  
68  		public Builder withOwnership(Optional<String> ownership) {
69  			this.ownership = ownership;
70  			return this;
71  		}
72  
73  		public Builder withOwnership(String ownership) {
74  			return withOwnership(Optional.of(ownership));
75  		}
76  
77  		public Builder withInstanceId(String instanceId) {
78  			this.instanceId = instanceId;
79  			return this;
80  		}
81  
82  		public Builder withPath(String path) {
83  			this.path = path;
84  			return this;
85  		}
86  
87  		public Builder withDevice(String device) {
88  			this.device = device;
89  			return this;
90  		}
91  
92  		@Override
93  		public MountVolumeRequest build() {
94  			return validate(new MountVolumeRequest(this));
95  		}
96  	}
97  
98  	public List<Tag> getVolumeTags() {
99  		return volumeTags;
100 	}
101 
102 	public String getInstanceId() {
103 		return instanceId;
104 	}
105 
106 	public String getDevice() {
107 		return device;
108 	}
109 
110 	public String getPath() {
111 		return path;
112 	}
113 
114 	public Optional<String> getOwnership() {
115 		return ownership;
116 	}
117 
118 }