
com.amazonaws.services.costexplorer.model.ResultByTime Maven / Gradle / Ivy
Show all versions of aws-java-sdk-costexplorer Show documentation
/*
* Copyright 2020-2025 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.costexplorer.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* The result that's associated with a time period.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ResultByTime implements Serializable, Cloneable, StructuredPojo {
/**
*
* The time period that the result covers.
*
*/
private DateInterval timePeriod;
/**
*
* The total amount of cost or usage accrued during the time period.
*
*/
private java.util.Map total;
/**
*
* The groups that this time period includes.
*
*/
private java.util.List groups;
/**
*
* Determines whether the result is estimated.
*
*/
private Boolean estimated;
/**
*
* The time period that the result covers.
*
*
* @param timePeriod
* The time period that the result covers.
*/
public void setTimePeriod(DateInterval timePeriod) {
this.timePeriod = timePeriod;
}
/**
*
* The time period that the result covers.
*
*
* @return The time period that the result covers.
*/
public DateInterval getTimePeriod() {
return this.timePeriod;
}
/**
*
* The time period that the result covers.
*
*
* @param timePeriod
* The time period that the result covers.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResultByTime withTimePeriod(DateInterval timePeriod) {
setTimePeriod(timePeriod);
return this;
}
/**
*
* The total amount of cost or usage accrued during the time period.
*
*
* @return The total amount of cost or usage accrued during the time period.
*/
public java.util.Map getTotal() {
return total;
}
/**
*
* The total amount of cost or usage accrued during the time period.
*
*
* @param total
* The total amount of cost or usage accrued during the time period.
*/
public void setTotal(java.util.Map total) {
this.total = total;
}
/**
*
* The total amount of cost or usage accrued during the time period.
*
*
* @param total
* The total amount of cost or usage accrued during the time period.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResultByTime withTotal(java.util.Map total) {
setTotal(total);
return this;
}
/**
* Add a single Total entry
*
* @see ResultByTime#withTotal
* @returns a reference to this object so that method calls can be chained together.
*/
public ResultByTime addTotalEntry(String key, MetricValue value) {
if (null == this.total) {
this.total = new java.util.HashMap();
}
if (this.total.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.total.put(key, value);
return this;
}
/**
* Removes all the entries added into Total.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResultByTime clearTotalEntries() {
this.total = null;
return this;
}
/**
*
* The groups that this time period includes.
*
*
* @return The groups that this time period includes.
*/
public java.util.List getGroups() {
return groups;
}
/**
*
* The groups that this time period includes.
*
*
* @param groups
* The groups that this time period includes.
*/
public void setGroups(java.util.Collection groups) {
if (groups == null) {
this.groups = null;
return;
}
this.groups = new java.util.ArrayList(groups);
}
/**
*
* The groups that this time period includes.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setGroups(java.util.Collection)} or {@link #withGroups(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param groups
* The groups that this time period includes.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResultByTime withGroups(Group... groups) {
if (this.groups == null) {
setGroups(new java.util.ArrayList(groups.length));
}
for (Group ele : groups) {
this.groups.add(ele);
}
return this;
}
/**
*
* The groups that this time period includes.
*
*
* @param groups
* The groups that this time period includes.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResultByTime withGroups(java.util.Collection groups) {
setGroups(groups);
return this;
}
/**
*
* Determines whether the result is estimated.
*
*
* @param estimated
* Determines whether the result is estimated.
*/
public void setEstimated(Boolean estimated) {
this.estimated = estimated;
}
/**
*
* Determines whether the result is estimated.
*
*
* @return Determines whether the result is estimated.
*/
public Boolean getEstimated() {
return this.estimated;
}
/**
*
* Determines whether the result is estimated.
*
*
* @param estimated
* Determines whether the result is estimated.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResultByTime withEstimated(Boolean estimated) {
setEstimated(estimated);
return this;
}
/**
*
* Determines whether the result is estimated.
*
*
* @return Determines whether the result is estimated.
*/
public Boolean isEstimated() {
return this.estimated;
}
/**
* 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 (getTimePeriod() != null)
sb.append("TimePeriod: ").append(getTimePeriod()).append(",");
if (getTotal() != null)
sb.append("Total: ").append(getTotal()).append(",");
if (getGroups() != null)
sb.append("Groups: ").append(getGroups()).append(",");
if (getEstimated() != null)
sb.append("Estimated: ").append(getEstimated());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ResultByTime == false)
return false;
ResultByTime other = (ResultByTime) obj;
if (other.getTimePeriod() == null ^ this.getTimePeriod() == null)
return false;
if (other.getTimePeriod() != null && other.getTimePeriod().equals(this.getTimePeriod()) == false)
return false;
if (other.getTotal() == null ^ this.getTotal() == null)
return false;
if (other.getTotal() != null && other.getTotal().equals(this.getTotal()) == false)
return false;
if (other.getGroups() == null ^ this.getGroups() == null)
return false;
if (other.getGroups() != null && other.getGroups().equals(this.getGroups()) == false)
return false;
if (other.getEstimated() == null ^ this.getEstimated() == null)
return false;
if (other.getEstimated() != null && other.getEstimated().equals(this.getEstimated()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getTimePeriod() == null) ? 0 : getTimePeriod().hashCode());
hashCode = prime * hashCode + ((getTotal() == null) ? 0 : getTotal().hashCode());
hashCode = prime * hashCode + ((getGroups() == null) ? 0 : getGroups().hashCode());
hashCode = prime * hashCode + ((getEstimated() == null) ? 0 : getEstimated().hashCode());
return hashCode;
}
@Override
public ResultByTime clone() {
try {
return (ResultByTime) 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.costexplorer.model.transform.ResultByTimeMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}