|
| 1 | +/* |
| 2 | + * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with |
| 5 | + * the License. A copy of the License is located at |
| 6 | + * |
| 7 | + * http://aws.amazon.com/apache2.0 |
| 8 | + * |
| 9 | + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| 10 | + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions |
| 11 | + * and limitations under the License. |
| 12 | + */ |
| 13 | + |
| 14 | +package com.amazonaws.services.lambda.runtime.events; |
| 15 | + |
| 16 | +import org.joda.time.DateTime; |
| 17 | + |
| 18 | +import java.io.Serializable; |
| 19 | +import java.util.List; |
| 20 | + |
| 21 | +/** |
| 22 | + * represents a scheduled V2 event |
| 23 | + */ |
| 24 | +public class ScheduledV2Event implements Serializable, Cloneable { |
| 25 | + |
| 26 | + private static final long serialVersionUID = -463442139623175611L; |
| 27 | + |
| 28 | + private String version; |
| 29 | + |
| 30 | + private String account; |
| 31 | + |
| 32 | + private String region; |
| 33 | + |
| 34 | + private String detail; |
| 35 | + |
| 36 | + private String detailType; |
| 37 | + |
| 38 | + private String source; |
| 39 | + |
| 40 | + private String id; |
| 41 | + |
| 42 | + private DateTime time; |
| 43 | + |
| 44 | + private List<String> resources; |
| 45 | + |
| 46 | + /** |
| 47 | + * default constructor |
| 48 | + */ |
| 49 | + public ScheduledV2Event() { |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * @return the version number |
| 54 | + */ |
| 55 | + public String getVersion() { |
| 56 | + return version; |
| 57 | + } |
| 58 | + |
| 59 | + /** |
| 60 | + * @param version the version number |
| 61 | + */ |
| 62 | + public void setVersion(String version) { |
| 63 | + this.version = version; |
| 64 | + } |
| 65 | + |
| 66 | + /** |
| 67 | + * @param version version number |
| 68 | + * @return ScheduledV2Event |
| 69 | + */ |
| 70 | + public ScheduledV2Event withVersion(String version) { |
| 71 | + setVersion(version); |
| 72 | + return this; |
| 73 | + } |
| 74 | + |
| 75 | + /** |
| 76 | + * @return the account id |
| 77 | + */ |
| 78 | + public String getAccount() { |
| 79 | + return account; |
| 80 | + } |
| 81 | + |
| 82 | + /** |
| 83 | + * @param account the account id |
| 84 | + */ |
| 85 | + public void setAccount(String account) { |
| 86 | + this.account = account; |
| 87 | + } |
| 88 | + |
| 89 | + /** |
| 90 | + * @param account account id |
| 91 | + * @return ScheduledV2Event |
| 92 | + */ |
| 93 | + public ScheduledV2Event withAccount(String account) { |
| 94 | + setAccount(account); |
| 95 | + return this; |
| 96 | + } |
| 97 | + |
| 98 | + /** |
| 99 | + * @return the aws region |
| 100 | + */ |
| 101 | + public String getRegion() { |
| 102 | + return region; |
| 103 | + } |
| 104 | + |
| 105 | + /** |
| 106 | + * @param region the aws region |
| 107 | + */ |
| 108 | + public void setRegion(String region) { |
| 109 | + this.region = region; |
| 110 | + } |
| 111 | + |
| 112 | + /** |
| 113 | + * @param region aws region |
| 114 | + * @return ScheduledV2Event |
| 115 | + */ |
| 116 | + public ScheduledV2Event withRegion(String region) { |
| 117 | + setRegion(region); |
| 118 | + return this; |
| 119 | + } |
| 120 | + |
| 121 | + /** |
| 122 | + * @return The details of the events (usually left blank) |
| 123 | + */ |
| 124 | + public String getDetail() { |
| 125 | + return detail; |
| 126 | + } |
| 127 | + |
| 128 | + /** |
| 129 | + * @param detail The details of the events (usually left blank) |
| 130 | + */ |
| 131 | + public void setDetail(String detail) { |
| 132 | + this.detail = detail; |
| 133 | + } |
| 134 | + |
| 135 | + /** |
| 136 | + * @param detail details of the events (usually left blank) |
| 137 | + * @return ScheduledV2Event |
| 138 | + */ |
| 139 | + public ScheduledV2Event withDetail(String detail) { |
| 140 | + setDetail(detail); |
| 141 | + return this; |
| 142 | + } |
| 143 | + |
| 144 | + /** |
| 145 | + * @return The details type - see cloud watch events for more info |
| 146 | + */ |
| 147 | + public String getDetailType() { |
| 148 | + return detailType; |
| 149 | + } |
| 150 | + |
| 151 | + /** |
| 152 | + * @param detailType The details type - see cloud watch events for more info |
| 153 | + */ |
| 154 | + public void setDetailType(String detailType) { |
| 155 | + this.detailType = detailType; |
| 156 | + } |
| 157 | + |
| 158 | + /** |
| 159 | + * @param detailType The details type - see cloud watch events for more info |
| 160 | + * @return ScheduledV2Event |
| 161 | + */ |
| 162 | + public ScheduledV2Event withDetailType(String detailType) { |
| 163 | + setDetailType(detailType); |
| 164 | + return this; |
| 165 | + } |
| 166 | + |
| 167 | + /** |
| 168 | + * @return the source of the event |
| 169 | + */ |
| 170 | + public String getSource() { |
| 171 | + return source; |
| 172 | + } |
| 173 | + |
| 174 | + /** |
| 175 | + * @param source the source of the event |
| 176 | + */ |
| 177 | + public void setSource(String source) { |
| 178 | + this.source = source; |
| 179 | + } |
| 180 | + |
| 181 | + /** |
| 182 | + * @param source source of the event |
| 183 | + * @return ScheduledV2Event |
| 184 | + */ |
| 185 | + public ScheduledV2Event withSource(String source) { |
| 186 | + setSource(source); |
| 187 | + return this; |
| 188 | + } |
| 189 | + |
| 190 | + /** |
| 191 | + * @return the timestamp for when the event is scheduled |
| 192 | + */ |
| 193 | + public DateTime getTime() { |
| 194 | + return this.time; |
| 195 | + } |
| 196 | + |
| 197 | + /** |
| 198 | + * @param time the timestamp for when the event is scheduled |
| 199 | + */ |
| 200 | + public void setTime(DateTime time) { |
| 201 | + this.time = time; |
| 202 | + } |
| 203 | + |
| 204 | + /** |
| 205 | + * @param time the timestamp for when the event is scheduled |
| 206 | + * @return ScheduledV2Event |
| 207 | + */ |
| 208 | + public ScheduledV2Event withTime(DateTime time) { |
| 209 | + setTime(time); |
| 210 | + return this; |
| 211 | + } |
| 212 | + |
| 213 | + /** |
| 214 | + * @return the id of the event |
| 215 | + */ |
| 216 | + public String getId() { |
| 217 | + return id; |
| 218 | + } |
| 219 | + |
| 220 | + /** |
| 221 | + * @param id the id of the event |
| 222 | + */ |
| 223 | + public void setId(String id) { |
| 224 | + this.id = id; |
| 225 | + } |
| 226 | + |
| 227 | + /** |
| 228 | + * @param id id of event |
| 229 | + * @return ScheduledV2Event |
| 230 | + */ |
| 231 | + public ScheduledV2Event withId(String id) { |
| 232 | + setId(id); |
| 233 | + return this; |
| 234 | + } |
| 235 | + |
| 236 | + /** |
| 237 | + * @return the resources used by event |
| 238 | + */ |
| 239 | + public List<String> getResources() { |
| 240 | + return this.resources; |
| 241 | + } |
| 242 | + |
| 243 | + /** |
| 244 | + * @param resources the resources used by event |
| 245 | + */ |
| 246 | + public void setResources(List<String> resources) { |
| 247 | + this.resources = resources; |
| 248 | + } |
| 249 | + |
| 250 | + /** |
| 251 | + * @param resources list of resource names |
| 252 | + * @return Scheduled V2 event object |
| 253 | + */ |
| 254 | + public ScheduledV2Event withResources(List<String> resources) { |
| 255 | + setResources(resources); |
| 256 | + return this; |
| 257 | + } |
| 258 | + |
| 259 | + /** |
| 260 | + * Returns a string representation of this object; useful for testing and debugging. |
| 261 | + * |
| 262 | + * @return A string representation of this object. |
| 263 | + * @see Object#toString() |
| 264 | + */ |
| 265 | + @Override |
| 266 | + public String toString() { |
| 267 | + StringBuilder sb = new StringBuilder(); |
| 268 | + sb.append("{"); |
| 269 | + if (getVersion() != null) |
| 270 | + sb.append("version: ").append(getVersion()).append(","); |
| 271 | + if (getAccount() != null) |
| 272 | + sb.append("account: ").append(getAccount()).append(","); |
| 273 | + if (getRegion() != null) |
| 274 | + sb.append("region: ").append(getRegion()).append(","); |
| 275 | + if (getDetail() != null) |
| 276 | + sb.append("detail: ").append(getDetail()).append(","); |
| 277 | + if (getDetailType() != null) |
| 278 | + sb.append("detailType: ").append(getDetailType()).append(","); |
| 279 | + if (getSource() != null) |
| 280 | + sb.append("source: ").append(getSource()).append(","); |
| 281 | + if (getId() != null) |
| 282 | + sb.append("id: ").append(getId()).append(","); |
| 283 | + if (getTime() != null) |
| 284 | + sb.append("time: ").append(getTime().toString()).append(","); |
| 285 | + if (getResources() != null) |
| 286 | + sb.append("resources: ").append(getResources()); |
| 287 | + sb.append("}"); |
| 288 | + return sb.toString(); |
| 289 | + } |
| 290 | + |
| 291 | + @Override |
| 292 | + public boolean equals(Object obj) { |
| 293 | + if (this == obj) |
| 294 | + return true; |
| 295 | + if (obj == null) |
| 296 | + return false; |
| 297 | + |
| 298 | + if (obj instanceof ScheduledV2Event == false) |
| 299 | + return false; |
| 300 | + ScheduledV2Event other = (ScheduledV2Event) obj; |
| 301 | + if (other.getVersion() == null ^ this.getVersion() == null) |
| 302 | + return false; |
| 303 | + if (other.getVersion() != null && other.getVersion().equals(this.getVersion()) == false) |
| 304 | + return false; |
| 305 | + if (other.getAccount() == null ^ this.getAccount() == null) |
| 306 | + return false; |
| 307 | + if (other.getAccount() != null && other.getAccount().equals(this.getAccount()) == false) |
| 308 | + return false; |
| 309 | + if (other.getRegion() == null ^ this.getRegion() == null) |
| 310 | + return false; |
| 311 | + if (other.getRegion() != null && other.getRegion().equals(this.getRegion()) == false) |
| 312 | + return false; |
| 313 | + if (other.getDetail() == null ^ this.getDetail() == null) |
| 314 | + return false; |
| 315 | + if (other.getDetail() != null && other.getDetail().equals(this.getDetail()) == false) |
| 316 | + return false; |
| 317 | + if (other.getDetailType() == null ^ this.getDetailType() == null) |
| 318 | + return false; |
| 319 | + if (other.getDetailType() != null && other.getDetailType().equals(this.getDetailType()) == false) |
| 320 | + return false; |
| 321 | + if (other.getSource() == null ^ this.getSource() == null) |
| 322 | + return false; |
| 323 | + if (other.getSource() != null && other.getSource().equals(this.getSource()) == false) |
| 324 | + return false; |
| 325 | + if (other.getId() == null ^ this.getId() == null) |
| 326 | + return false; |
| 327 | + if (other.getId() != null && other.getId().equals(this.getId()) == false) |
| 328 | + return false; |
| 329 | + if (other.getTime() == null ^ this.getTime() == null) |
| 330 | + return false; |
| 331 | + if (other.getTime() != null && other.getTime().equals(this.getTime()) == false) |
| 332 | + return false; |
| 333 | + if (other.getResources() == null ^ this.getResources() == null) |
| 334 | + return false; |
| 335 | + if (other.getResources() != null && other.getResources().equals(this.getResources()) == false) |
| 336 | + return false; |
| 337 | + return true; |
| 338 | + } |
| 339 | + |
| 340 | + @Override |
| 341 | + public int hashCode() { |
| 342 | + final int prime = 31; |
| 343 | + int hashCode = 1; |
| 344 | + |
| 345 | + hashCode = prime * hashCode + ((getVersion() == null) ? 0 : getVersion().hashCode()); |
| 346 | + hashCode = prime * hashCode + ((getAccount() == null) ? 0 : getAccount().hashCode()); |
| 347 | + hashCode = prime * hashCode + ((getRegion() == null) ? 0 : getRegion().hashCode()); |
| 348 | + hashCode = prime * hashCode + ((getDetail() == null) ? 0 : getDetail().hashCode()); |
| 349 | + hashCode = prime * hashCode + ((getDetailType() == null) ? 0 : getDetailType().hashCode()); |
| 350 | + hashCode = prime * hashCode + ((getSource() == null) ? 0 : getSource().hashCode()); |
| 351 | + hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode()); |
| 352 | + hashCode = prime * hashCode + ((getTime() == null) ? 0 : getTime().hashCode()); |
| 353 | + hashCode = prime * hashCode + ((getResources() == null) ? 0 : getResources().hashCode()); |
| 354 | + return hashCode; |
| 355 | + } |
| 356 | + |
| 357 | + @Override |
| 358 | + public ScheduledV2Event clone() { |
| 359 | + try { |
| 360 | + return (ScheduledV2Event) super.clone(); |
| 361 | + } catch (CloneNotSupportedException e) { |
| 362 | + throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); |
| 363 | + } |
| 364 | + } |
| 365 | + |
| 366 | +} |
0 commit comments