| 1 | /** |
| 2 | * Licensed to jclouds, Inc. (jclouds) under one or more |
| 3 | * contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. jclouds licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | package org.jclouds.ec2.domain; |
| 20 | |
| 21 | import java.util.Date; |
| 22 | |
| 23 | /** |
| 24 | * Holds the encrypted Windows Administrator password for an instance. |
| 25 | * |
| 26 | * @author Richard Downer |
| 27 | */ |
| 28 | public class PasswordData { |
| 29 | |
| 30 | public static Builder builder() { |
| 31 | return new Builder(); |
| 32 | } |
| 33 | |
| 34 | public static class Builder { |
| 35 | |
| 36 | private String requestId; |
| 37 | private String instanceId; |
| 38 | private Date timestamp; |
| 39 | private String passwordData; |
| 40 | |
| 41 | private Builder() {} |
| 42 | |
| 43 | public Builder requestId(String requestId) { |
| 44 | this.requestId = requestId; |
| 45 | return this; |
| 46 | } |
| 47 | |
| 48 | public Builder instanceId(String instanceId) { |
| 49 | this.instanceId = instanceId; |
| 50 | return this; |
| 51 | } |
| 52 | |
| 53 | public Builder timestamp(Date timestamp) { |
| 54 | this.timestamp = timestamp; |
| 55 | return this; |
| 56 | } |
| 57 | |
| 58 | public Builder passwordData(String passwordData) { |
| 59 | this.passwordData = passwordData; |
| 60 | return this; |
| 61 | } |
| 62 | |
| 63 | public PasswordData build() { |
| 64 | return new PasswordData(requestId, instanceId, timestamp, passwordData); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | private String requestId; |
| 69 | private String instanceId; |
| 70 | private Date timestamp; |
| 71 | private String passwordData; |
| 72 | |
| 73 | public PasswordData(String requestId, String instanceId, Date timestamp, String passwordData) { |
| 74 | this.requestId = requestId; |
| 75 | this.instanceId = instanceId; |
| 76 | this.timestamp = timestamp; |
| 77 | this.passwordData = passwordData; |
| 78 | } |
| 79 | |
| 80 | public String getRequestId() { |
| 81 | return requestId; |
| 82 | } |
| 83 | |
| 84 | public String getInstanceId() { |
| 85 | return instanceId; |
| 86 | } |
| 87 | |
| 88 | public Date getTimestamp() { |
| 89 | return timestamp; |
| 90 | } |
| 91 | |
| 92 | public String getPasswordData() { |
| 93 | return passwordData; |
| 94 | } |
| 95 | |
| 96 | @Override |
| 97 | public boolean equals(Object o) { |
| 98 | if (this == o) return true; |
| 99 | if (o == null || getClass() != o.getClass()) return false; |
| 100 | |
| 101 | PasswordData that = (PasswordData) o; |
| 102 | |
| 103 | if (instanceId != null ? !instanceId.equals(that.instanceId) : that.instanceId != null) return false; |
| 104 | if (passwordData != null ? !passwordData.equals(that.passwordData) : that.passwordData != null) return false; |
| 105 | if (requestId != null ? !requestId.equals(that.requestId) : that.requestId != null) return false; |
| 106 | if (timestamp != null ? !timestamp.equals(that.timestamp) : that.timestamp != null) return false; |
| 107 | |
| 108 | return true; |
| 109 | } |
| 110 | |
| 111 | @Override |
| 112 | public int hashCode() { |
| 113 | int result = requestId != null ? requestId.hashCode() : 0; |
| 114 | result = 31 * result + (instanceId != null ? instanceId.hashCode() : 0); |
| 115 | result = 31 * result + (timestamp != null ? timestamp.hashCode() : 0); |
| 116 | result = 31 * result + (passwordData != null ? passwordData.hashCode() : 0); |
| 117 | return result; |
| 118 | } |
| 119 | |
| 120 | @Override |
| 121 | public String toString() { |
| 122 | return "PasswordData{" + |
| 123 | "requestId='" + requestId + '\'' + |
| 124 | ", instanceId='" + instanceId + '\'' + |
| 125 | ", timestamp=" + timestamp + |
| 126 | ", passwordData='" + passwordData + '\'' + |
| 127 | '}'; |
| 128 | } |
| 129 | } |