All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.costexplorer.model.CoverageHours Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Cost Explorer module holds the client classes that are used for communicating with AWS Cost Explorer Service

There is a newer version: 2.28.4
Show newest version
/*
 * Copyright 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 software.amazon.awssdk.services.costexplorer.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* How long a running instance either used a reservation or was On-Demand. *

*/ @Generated("software.amazon.awssdk:codegen") public final class CoverageHours implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ON_DEMAND_HOURS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("OnDemandHours").getter(getter(CoverageHours::onDemandHours)).setter(setter(Builder::onDemandHours)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OnDemandHours").build()).build(); private static final SdkField RESERVED_HOURS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ReservedHours").getter(getter(CoverageHours::reservedHours)).setter(setter(Builder::reservedHours)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReservedHours").build()).build(); private static final SdkField TOTAL_RUNNING_HOURS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("TotalRunningHours").getter(getter(CoverageHours::totalRunningHours)) .setter(setter(Builder::totalRunningHours)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TotalRunningHours").build()).build(); private static final SdkField COVERAGE_HOURS_PERCENTAGE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("CoverageHoursPercentage").getter(getter(CoverageHours::coverageHoursPercentage)) .setter(setter(Builder::coverageHoursPercentage)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CoverageHoursPercentage").build()) .build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ON_DEMAND_HOURS_FIELD, RESERVED_HOURS_FIELD, TOTAL_RUNNING_HOURS_FIELD, COVERAGE_HOURS_PERCENTAGE_FIELD)); private static final long serialVersionUID = 1L; private final String onDemandHours; private final String reservedHours; private final String totalRunningHours; private final String coverageHoursPercentage; private CoverageHours(BuilderImpl builder) { this.onDemandHours = builder.onDemandHours; this.reservedHours = builder.reservedHours; this.totalRunningHours = builder.totalRunningHours; this.coverageHoursPercentage = builder.coverageHoursPercentage; } /** *

* The number of instance running hours that On-Demand Instances covered. *

* * @return The number of instance running hours that On-Demand Instances covered. */ public final String onDemandHours() { return onDemandHours; } /** *

* The number of instance running hours that reservations covered. *

* * @return The number of instance running hours that reservations covered. */ public final String reservedHours() { return reservedHours; } /** *

* The total instance usage, in hours. *

* * @return The total instance usage, in hours. */ public final String totalRunningHours() { return totalRunningHours; } /** *

* The percentage of instance hours that a reservation covered. *

* * @return The percentage of instance hours that a reservation covered. */ public final String coverageHoursPercentage() { return coverageHoursPercentage; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(onDemandHours()); hashCode = 31 * hashCode + Objects.hashCode(reservedHours()); hashCode = 31 * hashCode + Objects.hashCode(totalRunningHours()); hashCode = 31 * hashCode + Objects.hashCode(coverageHoursPercentage()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof CoverageHours)) { return false; } CoverageHours other = (CoverageHours) obj; return Objects.equals(onDemandHours(), other.onDemandHours()) && Objects.equals(reservedHours(), other.reservedHours()) && Objects.equals(totalRunningHours(), other.totalRunningHours()) && Objects.equals(coverageHoursPercentage(), other.coverageHoursPercentage()); } /** * 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. */ @Override public final String toString() { return ToString.builder("CoverageHours").add("OnDemandHours", onDemandHours()).add("ReservedHours", reservedHours()) .add("TotalRunningHours", totalRunningHours()).add("CoverageHoursPercentage", coverageHoursPercentage()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "OnDemandHours": return Optional.ofNullable(clazz.cast(onDemandHours())); case "ReservedHours": return Optional.ofNullable(clazz.cast(reservedHours())); case "TotalRunningHours": return Optional.ofNullable(clazz.cast(totalRunningHours())); case "CoverageHoursPercentage": return Optional.ofNullable(clazz.cast(coverageHoursPercentage())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CoverageHours) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The number of instance running hours that On-Demand Instances covered. *

* * @param onDemandHours * The number of instance running hours that On-Demand Instances covered. * @return Returns a reference to this object so that method calls can be chained together. */ Builder onDemandHours(String onDemandHours); /** *

* The number of instance running hours that reservations covered. *

* * @param reservedHours * The number of instance running hours that reservations covered. * @return Returns a reference to this object so that method calls can be chained together. */ Builder reservedHours(String reservedHours); /** *

* The total instance usage, in hours. *

* * @param totalRunningHours * The total instance usage, in hours. * @return Returns a reference to this object so that method calls can be chained together. */ Builder totalRunningHours(String totalRunningHours); /** *

* The percentage of instance hours that a reservation covered. *

* * @param coverageHoursPercentage * The percentage of instance hours that a reservation covered. * @return Returns a reference to this object so that method calls can be chained together. */ Builder coverageHoursPercentage(String coverageHoursPercentage); } static final class BuilderImpl implements Builder { private String onDemandHours; private String reservedHours; private String totalRunningHours; private String coverageHoursPercentage; private BuilderImpl() { } private BuilderImpl(CoverageHours model) { onDemandHours(model.onDemandHours); reservedHours(model.reservedHours); totalRunningHours(model.totalRunningHours); coverageHoursPercentage(model.coverageHoursPercentage); } public final String getOnDemandHours() { return onDemandHours; } public final void setOnDemandHours(String onDemandHours) { this.onDemandHours = onDemandHours; } @Override public final Builder onDemandHours(String onDemandHours) { this.onDemandHours = onDemandHours; return this; } public final String getReservedHours() { return reservedHours; } public final void setReservedHours(String reservedHours) { this.reservedHours = reservedHours; } @Override public final Builder reservedHours(String reservedHours) { this.reservedHours = reservedHours; return this; } public final String getTotalRunningHours() { return totalRunningHours; } public final void setTotalRunningHours(String totalRunningHours) { this.totalRunningHours = totalRunningHours; } @Override public final Builder totalRunningHours(String totalRunningHours) { this.totalRunningHours = totalRunningHours; return this; } public final String getCoverageHoursPercentage() { return coverageHoursPercentage; } public final void setCoverageHoursPercentage(String coverageHoursPercentage) { this.coverageHoursPercentage = coverageHoursPercentage; } @Override public final Builder coverageHoursPercentage(String coverageHoursPercentage) { this.coverageHoursPercentage = coverageHoursPercentage; return this; } @Override public CoverageHours build() { return new CoverageHours(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy