
com.amazonaws.services.lightsail.model.EstimateByTime Maven / Gradle / Ivy
/*
* 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.lightsail.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* An estimate that's associated with a time period.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class EstimateByTime implements Serializable, Cloneable, StructuredPojo {
/**
*
* The amount of cost or usage that's measured for the cost estimate.
*
*/
private Double usageCost;
/**
*
* The unit of measurement that's used for the cost estimate.
*
*/
private String pricingUnit;
/**
*
* The number of pricing units used to calculate the total number of hours. For example, 1 unit equals 1 hour.
*
*/
private Double unit;
/**
*
* The currency of the estimate in USD.
*
*/
private String currency;
/**
*
* The period of time, in days, that an estimate covers. The period has a start date and an end date. The start date
* must come before the end date.
*
*/
private TimePeriod timePeriod;
/**
*
* The amount of cost or usage that's measured for the cost estimate.
*
*
* @param usageCost
* The amount of cost or usage that's measured for the cost estimate.
*/
public void setUsageCost(Double usageCost) {
this.usageCost = usageCost;
}
/**
*
* The amount of cost or usage that's measured for the cost estimate.
*
*
* @return The amount of cost or usage that's measured for the cost estimate.
*/
public Double getUsageCost() {
return this.usageCost;
}
/**
*
* The amount of cost or usage that's measured for the cost estimate.
*
*
* @param usageCost
* The amount of cost or usage that's measured for the cost estimate.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EstimateByTime withUsageCost(Double usageCost) {
setUsageCost(usageCost);
return this;
}
/**
*
* The unit of measurement that's used for the cost estimate.
*
*
* @param pricingUnit
* The unit of measurement that's used for the cost estimate.
* @see PricingUnit
*/
public void setPricingUnit(String pricingUnit) {
this.pricingUnit = pricingUnit;
}
/**
*
* The unit of measurement that's used for the cost estimate.
*
*
* @return The unit of measurement that's used for the cost estimate.
* @see PricingUnit
*/
public String getPricingUnit() {
return this.pricingUnit;
}
/**
*
* The unit of measurement that's used for the cost estimate.
*
*
* @param pricingUnit
* The unit of measurement that's used for the cost estimate.
* @return Returns a reference to this object so that method calls can be chained together.
* @see PricingUnit
*/
public EstimateByTime withPricingUnit(String pricingUnit) {
setPricingUnit(pricingUnit);
return this;
}
/**
*
* The unit of measurement that's used for the cost estimate.
*
*
* @param pricingUnit
* The unit of measurement that's used for the cost estimate.
* @return Returns a reference to this object so that method calls can be chained together.
* @see PricingUnit
*/
public EstimateByTime withPricingUnit(PricingUnit pricingUnit) {
this.pricingUnit = pricingUnit.toString();
return this;
}
/**
*
* The number of pricing units used to calculate the total number of hours. For example, 1 unit equals 1 hour.
*
*
* @param unit
* The number of pricing units used to calculate the total number of hours. For example, 1 unit equals 1
* hour.
*/
public void setUnit(Double unit) {
this.unit = unit;
}
/**
*
* The number of pricing units used to calculate the total number of hours. For example, 1 unit equals 1 hour.
*
*
* @return The number of pricing units used to calculate the total number of hours. For example, 1 unit equals 1
* hour.
*/
public Double getUnit() {
return this.unit;
}
/**
*
* The number of pricing units used to calculate the total number of hours. For example, 1 unit equals 1 hour.
*
*
* @param unit
* The number of pricing units used to calculate the total number of hours. For example, 1 unit equals 1
* hour.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EstimateByTime withUnit(Double unit) {
setUnit(unit);
return this;
}
/**
*
* The currency of the estimate in USD.
*
*
* @param currency
* The currency of the estimate in USD.
* @see Currency
*/
public void setCurrency(String currency) {
this.currency = currency;
}
/**
*
* The currency of the estimate in USD.
*
*
* @return The currency of the estimate in USD.
* @see Currency
*/
public String getCurrency() {
return this.currency;
}
/**
*
* The currency of the estimate in USD.
*
*
* @param currency
* The currency of the estimate in USD.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Currency
*/
public EstimateByTime withCurrency(String currency) {
setCurrency(currency);
return this;
}
/**
*
* The currency of the estimate in USD.
*
*
* @param currency
* The currency of the estimate in USD.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Currency
*/
public EstimateByTime withCurrency(Currency currency) {
this.currency = currency.toString();
return this;
}
/**
*
* The period of time, in days, that an estimate covers. The period has a start date and an end date. The start date
* must come before the end date.
*
*
* @param timePeriod
* The period of time, in days, that an estimate covers. The period has a start date and an end date. The
* start date must come before the end date.
*/
public void setTimePeriod(TimePeriod timePeriod) {
this.timePeriod = timePeriod;
}
/**
*
* The period of time, in days, that an estimate covers. The period has a start date and an end date. The start date
* must come before the end date.
*
*
* @return The period of time, in days, that an estimate covers. The period has a start date and an end date. The
* start date must come before the end date.
*/
public TimePeriod getTimePeriod() {
return this.timePeriod;
}
/**
*
* The period of time, in days, that an estimate covers. The period has a start date and an end date. The start date
* must come before the end date.
*
*
* @param timePeriod
* The period of time, in days, that an estimate covers. The period has a start date and an end date. The
* start date must come before the end date.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EstimateByTime withTimePeriod(TimePeriod timePeriod) {
setTimePeriod(timePeriod);
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 (getUsageCost() != null)
sb.append("UsageCost: ").append(getUsageCost()).append(",");
if (getPricingUnit() != null)
sb.append("PricingUnit: ").append(getPricingUnit()).append(",");
if (getUnit() != null)
sb.append("Unit: ").append(getUnit()).append(",");
if (getCurrency() != null)
sb.append("Currency: ").append(getCurrency()).append(",");
if (getTimePeriod() != null)
sb.append("TimePeriod: ").append(getTimePeriod());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof EstimateByTime == false)
return false;
EstimateByTime other = (EstimateByTime) obj;
if (other.getUsageCost() == null ^ this.getUsageCost() == null)
return false;
if (other.getUsageCost() != null && other.getUsageCost().equals(this.getUsageCost()) == false)
return false;
if (other.getPricingUnit() == null ^ this.getPricingUnit() == null)
return false;
if (other.getPricingUnit() != null && other.getPricingUnit().equals(this.getPricingUnit()) == false)
return false;
if (other.getUnit() == null ^ this.getUnit() == null)
return false;
if (other.getUnit() != null && other.getUnit().equals(this.getUnit()) == false)
return false;
if (other.getCurrency() == null ^ this.getCurrency() == null)
return false;
if (other.getCurrency() != null && other.getCurrency().equals(this.getCurrency()) == false)
return false;
if (other.getTimePeriod() == null ^ this.getTimePeriod() == null)
return false;
if (other.getTimePeriod() != null && other.getTimePeriod().equals(this.getTimePeriod()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getUsageCost() == null) ? 0 : getUsageCost().hashCode());
hashCode = prime * hashCode + ((getPricingUnit() == null) ? 0 : getPricingUnit().hashCode());
hashCode = prime * hashCode + ((getUnit() == null) ? 0 : getUnit().hashCode());
hashCode = prime * hashCode + ((getCurrency() == null) ? 0 : getCurrency().hashCode());
hashCode = prime * hashCode + ((getTimePeriod() == null) ? 0 : getTimePeriod().hashCode());
return hashCode;
}
@Override
public EstimateByTime clone() {
try {
return (EstimateByTime) 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.lightsail.model.transform.EstimateByTimeMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}