1 package org.kuali.common.devops.model;
2
3 import org.kuali.common.util.Assert;
4
5 public final class User {
6
7 private final String login;
8 private final String home;
9 private final String group;
10 private final String authorizedKeys;
11
12 public static class Builder {
13
14
15 private final String login;
16
17
18 private String home;
19 private String group;
20 private String authorizedKeys;
21
22 public Builder(String login) {
23 this.login = login;
24 group(login);
25 home("/home/" + login);
26 }
27
28
29
30
31 public Builder home(String home) {
32 this.home = home;
33 this.authorizedKeys = home + "/.ssh/authorized_keys";
34 return this;
35 }
36
37 public Builder authorizedKeys(String authorizedKeys) {
38 this.authorizedKeys = authorizedKeys;
39 return this;
40 }
41
42 public Builder group(String group) {
43 this.group = group;
44 return this;
45 }
46
47 public User build() {
48 Assert.noBlanks(login, group, home, authorizedKeys);
49 return new User(this);
50 }
51 }
52
53 private User(Builder builder) {
54 this.login = builder.login;
55 this.group = builder.group;
56 this.authorizedKeys = builder.authorizedKeys;
57 this.home = builder.home;
58 }
59
60 public String getLogin() {
61 return login;
62 }
63
64 public String getHome() {
65 return home;
66 }
67
68 public String getAuthorizedKeys() {
69 return authorizedKeys;
70 }
71
72 public String getGroup() {
73 return group;
74 }
75
76 }