/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.proton.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Detail data for a resource sync attempt activated by a push to a repository. *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ResourceSyncAttempt implements Serializable, Cloneable, StructuredPojo { /** *

* An array of events with detail data. *

*/ private java.util.List events; /** *

* Detail data for the initial repository commit, path and push. *

*/ private Revision initialRevision; /** *

* The time when the sync attempt started. *

*/ private java.util.Date startedAt; /** *

* The status of the sync attempt. *

*/ private String status; /** *

* The resource that is synced to. *

*/ private String target; /** *

* Detail data for the target revision. *

*/ private Revision targetRevision; /** *

* An array of events with detail data. *

* * @return An array of events with detail data. */ public java.util.List getEvents() { return events; } /** *

* An array of events with detail data. *

* * @param events * An array of events with detail data. */ public void setEvents(java.util.Collection events) { if (events == null) { this.events = null; return; } this.events = new java.util.ArrayList(events); } /** *

* An array of events with detail data. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setEvents(java.util.Collection)} or {@link #withEvents(java.util.Collection)} if you want to override the * existing values. *

* * @param events * An array of events with detail data. * @return Returns a reference to this object so that method calls can be chained together. */ public ResourceSyncAttempt withEvents(ResourceSyncEvent... events) { if (this.events == null) { setEvents(new java.util.ArrayList(events.length)); } for (ResourceSyncEvent ele : events) { this.events.add(ele); } return this; } /** *

* An array of events with detail data. *

* * @param events * An array of events with detail data. * @return Returns a reference to this object so that method calls can be chained together. */ public ResourceSyncAttempt withEvents(java.util.Collection events) { setEvents(events); return this; } /** *

* Detail data for the initial repository commit, path and push. *

* * @param initialRevision * Detail data for the initial repository commit, path and push. */ public void setInitialRevision(Revision initialRevision) { this.initialRevision = initialRevision; } /** *

* Detail data for the initial repository commit, path and push. *

* * @return Detail data for the initial repository commit, path and push. */ public Revision getInitialRevision() { return this.initialRevision; } /** *

* Detail data for the initial repository commit, path and push. *

* * @param initialRevision * Detail data for the initial repository commit, path and push. * @return Returns a reference to this object so that method calls can be chained together. */ public ResourceSyncAttempt withInitialRevision(Revision initialRevision) { setInitialRevision(initialRevision); return this; } /** *

* The time when the sync attempt started. *

* * @param startedAt * The time when the sync attempt started. */ public void setStartedAt(java.util.Date startedAt) { this.startedAt = startedAt; } /** *

* The time when the sync attempt started. *

* * @return The time when the sync attempt started. */ public java.util.Date getStartedAt() { return this.startedAt; } /** *

* The time when the sync attempt started. *

* * @param startedAt * The time when the sync attempt started. * @return Returns a reference to this object so that method calls can be chained together. */ public ResourceSyncAttempt withStartedAt(java.util.Date startedAt) { setStartedAt(startedAt); return this; } /** *

* The status of the sync attempt. *

* * @param status * The status of the sync attempt. * @see ResourceSyncStatus */ public void setStatus(String status) { this.status = status; } /** *

* The status of the sync attempt. *

* * @return The status of the sync attempt. * @see ResourceSyncStatus */ public String getStatus() { return this.status; } /** *

* The status of the sync attempt. *

* * @param status * The status of the sync attempt. * @return Returns a reference to this object so that method calls can be chained together. * @see ResourceSyncStatus */ public ResourceSyncAttempt withStatus(String status) { setStatus(status); return this; } /** *

* The status of the sync attempt. *

* * @param status * The status of the sync attempt. * @return Returns a reference to this object so that method calls can be chained together. * @see ResourceSyncStatus */ public ResourceSyncAttempt withStatus(ResourceSyncStatus status) { this.status = status.toString(); return this; } /** *

* The resource that is synced to. *

* * @param target * The resource that is synced to. */ public void setTarget(String target) { this.target = target; } /** *

* The resource that is synced to. *

* * @return The resource that is synced to. */ public String getTarget() { return this.target; } /** *

* The resource that is synced to. *

* * @param target * The resource that is synced to. * @return Returns a reference to this object so that method calls can be chained together. */ public ResourceSyncAttempt withTarget(String target) { setTarget(target); return this; } /** *

* Detail data for the target revision. *

* * @param targetRevision * Detail data for the target revision. */ public void setTargetRevision(Revision targetRevision) { this.targetRevision = targetRevision; } /** *

* Detail data for the target revision. *

* * @return Detail data for the target revision. */ public Revision getTargetRevision() { return this.targetRevision; } /** *

* Detail data for the target revision. *

* * @param targetRevision * Detail data for the target revision. * @return Returns a reference to this object so that method calls can be chained together. */ public ResourceSyncAttempt withTargetRevision(Revision targetRevision) { setTargetRevision(targetRevision); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getEvents() != null) sb.append("Events: ").append(getEvents()).append(","); if (getInitialRevision() != null) sb.append("InitialRevision: ").append(getInitialRevision()).append(","); if (getStartedAt() != null) sb.append("StartedAt: ").append(getStartedAt()).append(","); if (getStatus() != null) sb.append("Status: ").append(getStatus()).append(","); if (getTarget() != null) sb.append("Target: ").append(getTarget()).append(","); if (getTargetRevision() != null) sb.append("TargetRevision: ").append(getTargetRevision()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ResourceSyncAttempt == false) return false; ResourceSyncAttempt other = (ResourceSyncAttempt) obj; if (other.getEvents() == null ^ this.getEvents() == null) return false; if (other.getEvents() != null && other.getEvents().equals(this.getEvents()) == false) return false; if (other.getInitialRevision() == null ^ this.getInitialRevision() == null) return false; if (other.getInitialRevision() != null && other.getInitialRevision().equals(this.getInitialRevision()) == false) return false; if (other.getStartedAt() == null ^ this.getStartedAt() == null) return false; if (other.getStartedAt() != null && other.getStartedAt().equals(this.getStartedAt()) == false) return false; if (other.getStatus() == null ^ this.getStatus() == null) return false; if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false) return false; if (other.getTarget() == null ^ this.getTarget() == null) return false; if (other.getTarget() != null && other.getTarget().equals(this.getTarget()) == false) return false; if (other.getTargetRevision() == null ^ this.getTargetRevision() == null) return false; if (other.getTargetRevision() != null && other.getTargetRevision().equals(this.getTargetRevision()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getEvents() == null) ? 0 : getEvents().hashCode()); hashCode = prime * hashCode + ((getInitialRevision() == null) ? 0 : getInitialRevision().hashCode()); hashCode = prime * hashCode + ((getStartedAt() == null) ? 0 : getStartedAt().hashCode()); hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); hashCode = prime * hashCode + ((getTarget() == null) ? 0 : getTarget().hashCode()); hashCode = prime * hashCode + ((getTargetRevision() == null) ? 0 : getTargetRevision().hashCode()); return hashCode; } @Override public ResourceSyncAttempt clone() { try { return (ResourceSyncAttempt) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.proton.model.transform.ResourceSyncAttemptMarshaller.getInstance().marshall(this, protocolMarshaller); } }