com.amazonaws.services.cloudfront.model.TestResult Maven / Gradle / Ivy
Show all versions of aws-java-sdk-cloudfront 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.cloudfront.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* Contains the result of testing a CloudFront function with TestFunction
.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class TestResult implements Serializable, Cloneable {
/**
*
* Contains configuration information and metadata about the CloudFront function that was tested.
*
*/
private FunctionSummary functionSummary;
/**
*
* The amount of time that the function took to run as a percentage of the maximum allowed time. For example, a
* compute utilization of 35 means that the function completed in 35% of the maximum allowed time.
*
*/
private String computeUtilization;
/**
*
* Contains the log lines that the function wrote (if any) when running the test.
*
*/
private com.amazonaws.internal.SdkInternalList functionExecutionLogs;
/**
*
* If the result of testing the function was an error, this field contains the error message.
*
*/
private String functionErrorMessage;
/**
*
* The event object returned by the function. For more information about the structure of the event object, see Event
* object structure in the Amazon CloudFront Developer Guide.
*
*/
private String functionOutput;
/**
*
* Contains configuration information and metadata about the CloudFront function that was tested.
*
*
* @param functionSummary
* Contains configuration information and metadata about the CloudFront function that was tested.
*/
public void setFunctionSummary(FunctionSummary functionSummary) {
this.functionSummary = functionSummary;
}
/**
*
* Contains configuration information and metadata about the CloudFront function that was tested.
*
*
* @return Contains configuration information and metadata about the CloudFront function that was tested.
*/
public FunctionSummary getFunctionSummary() {
return this.functionSummary;
}
/**
*
* Contains configuration information and metadata about the CloudFront function that was tested.
*
*
* @param functionSummary
* Contains configuration information and metadata about the CloudFront function that was tested.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TestResult withFunctionSummary(FunctionSummary functionSummary) {
setFunctionSummary(functionSummary);
return this;
}
/**
*
* The amount of time that the function took to run as a percentage of the maximum allowed time. For example, a
* compute utilization of 35 means that the function completed in 35% of the maximum allowed time.
*
*
* @param computeUtilization
* The amount of time that the function took to run as a percentage of the maximum allowed time. For example,
* a compute utilization of 35 means that the function completed in 35% of the maximum allowed time.
*/
public void setComputeUtilization(String computeUtilization) {
this.computeUtilization = computeUtilization;
}
/**
*
* The amount of time that the function took to run as a percentage of the maximum allowed time. For example, a
* compute utilization of 35 means that the function completed in 35% of the maximum allowed time.
*
*
* @return The amount of time that the function took to run as a percentage of the maximum allowed time. For
* example, a compute utilization of 35 means that the function completed in 35% of the maximum allowed
* time.
*/
public String getComputeUtilization() {
return this.computeUtilization;
}
/**
*
* The amount of time that the function took to run as a percentage of the maximum allowed time. For example, a
* compute utilization of 35 means that the function completed in 35% of the maximum allowed time.
*
*
* @param computeUtilization
* The amount of time that the function took to run as a percentage of the maximum allowed time. For example,
* a compute utilization of 35 means that the function completed in 35% of the maximum allowed time.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TestResult withComputeUtilization(String computeUtilization) {
setComputeUtilization(computeUtilization);
return this;
}
/**
*
* Contains the log lines that the function wrote (if any) when running the test.
*
*
* @return Contains the log lines that the function wrote (if any) when running the test.
*/
public java.util.List getFunctionExecutionLogs() {
if (functionExecutionLogs == null) {
functionExecutionLogs = new com.amazonaws.internal.SdkInternalList();
}
return functionExecutionLogs;
}
/**
*
* Contains the log lines that the function wrote (if any) when running the test.
*
*
* @param functionExecutionLogs
* Contains the log lines that the function wrote (if any) when running the test.
*/
public void setFunctionExecutionLogs(java.util.Collection functionExecutionLogs) {
if (functionExecutionLogs == null) {
this.functionExecutionLogs = null;
return;
}
this.functionExecutionLogs = new com.amazonaws.internal.SdkInternalList(functionExecutionLogs);
}
/**
*
* Contains the log lines that the function wrote (if any) when running the test.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setFunctionExecutionLogs(java.util.Collection)} or
* {@link #withFunctionExecutionLogs(java.util.Collection)} if you want to override the existing values.
*
*
* @param functionExecutionLogs
* Contains the log lines that the function wrote (if any) when running the test.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TestResult withFunctionExecutionLogs(String... functionExecutionLogs) {
if (this.functionExecutionLogs == null) {
setFunctionExecutionLogs(new com.amazonaws.internal.SdkInternalList(functionExecutionLogs.length));
}
for (String ele : functionExecutionLogs) {
this.functionExecutionLogs.add(ele);
}
return this;
}
/**
*
* Contains the log lines that the function wrote (if any) when running the test.
*
*
* @param functionExecutionLogs
* Contains the log lines that the function wrote (if any) when running the test.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TestResult withFunctionExecutionLogs(java.util.Collection functionExecutionLogs) {
setFunctionExecutionLogs(functionExecutionLogs);
return this;
}
/**
*
* If the result of testing the function was an error, this field contains the error message.
*
*
* @param functionErrorMessage
* If the result of testing the function was an error, this field contains the error message.
*/
public void setFunctionErrorMessage(String functionErrorMessage) {
this.functionErrorMessage = functionErrorMessage;
}
/**
*
* If the result of testing the function was an error, this field contains the error message.
*
*
* @return If the result of testing the function was an error, this field contains the error message.
*/
public String getFunctionErrorMessage() {
return this.functionErrorMessage;
}
/**
*
* If the result of testing the function was an error, this field contains the error message.
*
*
* @param functionErrorMessage
* If the result of testing the function was an error, this field contains the error message.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TestResult withFunctionErrorMessage(String functionErrorMessage) {
setFunctionErrorMessage(functionErrorMessage);
return this;
}
/**
*
* The event object returned by the function. For more information about the structure of the event object, see Event
* object structure in the Amazon CloudFront Developer Guide.
*
*
* @param functionOutput
* The event object returned by the function. For more information about the structure of the event object,
* see Event object structure in the Amazon CloudFront Developer Guide.
*/
public void setFunctionOutput(String functionOutput) {
this.functionOutput = functionOutput;
}
/**
*
* The event object returned by the function. For more information about the structure of the event object, see Event
* object structure in the Amazon CloudFront Developer Guide.
*
*
* @return The event object returned by the function. For more information about the structure of the event object,
* see Event
* object structure in the Amazon CloudFront Developer Guide.
*/
public String getFunctionOutput() {
return this.functionOutput;
}
/**
*
* The event object returned by the function. For more information about the structure of the event object, see Event
* object structure in the Amazon CloudFront Developer Guide.
*
*
* @param functionOutput
* The event object returned by the function. For more information about the structure of the event object,
* see Event object structure in the Amazon CloudFront Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TestResult withFunctionOutput(String functionOutput) {
setFunctionOutput(functionOutput);
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 (getFunctionSummary() != null)
sb.append("FunctionSummary: ").append(getFunctionSummary()).append(",");
if (getComputeUtilization() != null)
sb.append("ComputeUtilization: ").append(getComputeUtilization()).append(",");
if (getFunctionExecutionLogs() != null)
sb.append("FunctionExecutionLogs: ").append("***Sensitive Data Redacted***").append(",");
if (getFunctionErrorMessage() != null)
sb.append("FunctionErrorMessage: ").append("***Sensitive Data Redacted***").append(",");
if (getFunctionOutput() != null)
sb.append("FunctionOutput: ").append("***Sensitive Data Redacted***");
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof TestResult == false)
return false;
TestResult other = (TestResult) obj;
if (other.getFunctionSummary() == null ^ this.getFunctionSummary() == null)
return false;
if (other.getFunctionSummary() != null && other.getFunctionSummary().equals(this.getFunctionSummary()) == false)
return false;
if (other.getComputeUtilization() == null ^ this.getComputeUtilization() == null)
return false;
if (other.getComputeUtilization() != null && other.getComputeUtilization().equals(this.getComputeUtilization()) == false)
return false;
if (other.getFunctionExecutionLogs() == null ^ this.getFunctionExecutionLogs() == null)
return false;
if (other.getFunctionExecutionLogs() != null && other.getFunctionExecutionLogs().equals(this.getFunctionExecutionLogs()) == false)
return false;
if (other.getFunctionErrorMessage() == null ^ this.getFunctionErrorMessage() == null)
return false;
if (other.getFunctionErrorMessage() != null && other.getFunctionErrorMessage().equals(this.getFunctionErrorMessage()) == false)
return false;
if (other.getFunctionOutput() == null ^ this.getFunctionOutput() == null)
return false;
if (other.getFunctionOutput() != null && other.getFunctionOutput().equals(this.getFunctionOutput()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getFunctionSummary() == null) ? 0 : getFunctionSummary().hashCode());
hashCode = prime * hashCode + ((getComputeUtilization() == null) ? 0 : getComputeUtilization().hashCode());
hashCode = prime * hashCode + ((getFunctionExecutionLogs() == null) ? 0 : getFunctionExecutionLogs().hashCode());
hashCode = prime * hashCode + ((getFunctionErrorMessage() == null) ? 0 : getFunctionErrorMessage().hashCode());
hashCode = prime * hashCode + ((getFunctionOutput() == null) ? 0 : getFunctionOutput().hashCode());
return hashCode;
}
@Override
public TestResult clone() {
try {
return (TestResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}