com.amazonaws.services.xray.model.Trace Maven / Gradle / Ivy
Show all versions of aws-java-sdk-xray Show documentation
/*
* Copyright 2017-2022 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.xray.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* A collection of segment documents with matching trace IDs.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Trace implements Serializable, Cloneable, StructuredPojo {
/**
*
* The unique identifier for the request that generated the trace's segments and subsegments.
*
*/
private String id;
/**
*
* The length of time in seconds between the start time of the root segment and the end time of the last segment
* that completed.
*
*/
private Double duration;
/**
*
* LimitExceeded is set to true when the trace has exceeded one of the defined quotas. For more information about
* quotas, see Amazon Web Services X-Ray endpoints
* and quotas.
*
*/
private Boolean limitExceeded;
/**
*
* Segment documents for the segments and subsegments that comprise the trace.
*
*/
private java.util.List segments;
/**
*
* The unique identifier for the request that generated the trace's segments and subsegments.
*
*
* @param id
* The unique identifier for the request that generated the trace's segments and subsegments.
*/
public void setId(String id) {
this.id = id;
}
/**
*
* The unique identifier for the request that generated the trace's segments and subsegments.
*
*
* @return The unique identifier for the request that generated the trace's segments and subsegments.
*/
public String getId() {
return this.id;
}
/**
*
* The unique identifier for the request that generated the trace's segments and subsegments.
*
*
* @param id
* The unique identifier for the request that generated the trace's segments and subsegments.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Trace withId(String id) {
setId(id);
return this;
}
/**
*
* The length of time in seconds between the start time of the root segment and the end time of the last segment
* that completed.
*
*
* @param duration
* The length of time in seconds between the start time of the root segment and the end time of the last
* segment that completed.
*/
public void setDuration(Double duration) {
this.duration = duration;
}
/**
*
* The length of time in seconds between the start time of the root segment and the end time of the last segment
* that completed.
*
*
* @return The length of time in seconds between the start time of the root segment and the end time of the last
* segment that completed.
*/
public Double getDuration() {
return this.duration;
}
/**
*
* The length of time in seconds between the start time of the root segment and the end time of the last segment
* that completed.
*
*
* @param duration
* The length of time in seconds between the start time of the root segment and the end time of the last
* segment that completed.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Trace withDuration(Double duration) {
setDuration(duration);
return this;
}
/**
*
* LimitExceeded is set to true when the trace has exceeded one of the defined quotas. For more information about
* quotas, see Amazon Web Services X-Ray endpoints
* and quotas.
*
*
* @param limitExceeded
* LimitExceeded is set to true when the trace has exceeded one of the defined quotas. For more information
* about quotas, see Amazon Web Services
* X-Ray endpoints and quotas.
*/
public void setLimitExceeded(Boolean limitExceeded) {
this.limitExceeded = limitExceeded;
}
/**
*
* LimitExceeded is set to true when the trace has exceeded one of the defined quotas. For more information about
* quotas, see Amazon Web Services X-Ray endpoints
* and quotas.
*
*
* @return LimitExceeded is set to true when the trace has exceeded one of the defined quotas. For more information
* about quotas, see Amazon Web Services
* X-Ray endpoints and quotas.
*/
public Boolean getLimitExceeded() {
return this.limitExceeded;
}
/**
*
* LimitExceeded is set to true when the trace has exceeded one of the defined quotas. For more information about
* quotas, see Amazon Web Services X-Ray endpoints
* and quotas.
*
*
* @param limitExceeded
* LimitExceeded is set to true when the trace has exceeded one of the defined quotas. For more information
* about quotas, see Amazon Web Services
* X-Ray endpoints and quotas.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Trace withLimitExceeded(Boolean limitExceeded) {
setLimitExceeded(limitExceeded);
return this;
}
/**
*
* LimitExceeded is set to true when the trace has exceeded one of the defined quotas. For more information about
* quotas, see Amazon Web Services X-Ray endpoints
* and quotas.
*
*
* @return LimitExceeded is set to true when the trace has exceeded one of the defined quotas. For more information
* about quotas, see Amazon Web Services
* X-Ray endpoints and quotas.
*/
public Boolean isLimitExceeded() {
return this.limitExceeded;
}
/**
*
* Segment documents for the segments and subsegments that comprise the trace.
*
*
* @return Segment documents for the segments and subsegments that comprise the trace.
*/
public java.util.List getSegments() {
return segments;
}
/**
*
* Segment documents for the segments and subsegments that comprise the trace.
*
*
* @param segments
* Segment documents for the segments and subsegments that comprise the trace.
*/
public void setSegments(java.util.Collection segments) {
if (segments == null) {
this.segments = null;
return;
}
this.segments = new java.util.ArrayList(segments);
}
/**
*
* Segment documents for the segments and subsegments that comprise the trace.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSegments(java.util.Collection)} or {@link #withSegments(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param segments
* Segment documents for the segments and subsegments that comprise the trace.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Trace withSegments(Segment... segments) {
if (this.segments == null) {
setSegments(new java.util.ArrayList(segments.length));
}
for (Segment ele : segments) {
this.segments.add(ele);
}
return this;
}
/**
*
* Segment documents for the segments and subsegments that comprise the trace.
*
*
* @param segments
* Segment documents for the segments and subsegments that comprise the trace.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Trace withSegments(java.util.Collection segments) {
setSegments(segments);
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 (getId() != null)
sb.append("Id: ").append(getId()).append(",");
if (getDuration() != null)
sb.append("Duration: ").append(getDuration()).append(",");
if (getLimitExceeded() != null)
sb.append("LimitExceeded: ").append(getLimitExceeded()).append(",");
if (getSegments() != null)
sb.append("Segments: ").append(getSegments());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Trace == false)
return false;
Trace other = (Trace) obj;
if (other.getId() == null ^ this.getId() == null)
return false;
if (other.getId() != null && other.getId().equals(this.getId()) == false)
return false;
if (other.getDuration() == null ^ this.getDuration() == null)
return false;
if (other.getDuration() != null && other.getDuration().equals(this.getDuration()) == false)
return false;
if (other.getLimitExceeded() == null ^ this.getLimitExceeded() == null)
return false;
if (other.getLimitExceeded() != null && other.getLimitExceeded().equals(this.getLimitExceeded()) == false)
return false;
if (other.getSegments() == null ^ this.getSegments() == null)
return false;
if (other.getSegments() != null && other.getSegments().equals(this.getSegments()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode());
hashCode = prime * hashCode + ((getDuration() == null) ? 0 : getDuration().hashCode());
hashCode = prime * hashCode + ((getLimitExceeded() == null) ? 0 : getLimitExceeded().hashCode());
hashCode = prime * hashCode + ((getSegments() == null) ? 0 : getSegments().hashCode());
return hashCode;
}
@Override
public Trace clone() {
try {
return (Trace) 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.xray.model.transform.TraceMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}