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

software.amazon.awssdk.services.devopsguru.model.ServiceResourceCost Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Dev Ops Guru module holds the client classes that are used for communicating with Dev Ops Guru.

There is a newer version: 2.29.39
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.devopsguru.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;

/**
 * 

* An object that contains information about the estimated monthly cost to analyze an Amazon Web Services resource. For * more information, see Estimate * your Amazon DevOps Guru costs and Amazon DevOps Guru * pricing. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ServiceResourceCost implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type") .getter(getter(ServiceResourceCost::type)).setter(setter(Builder::type)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build(); private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State") .getter(getter(ServiceResourceCost::stateAsString)).setter(setter(Builder::state)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build(); private static final SdkField COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("Count") .getter(getter(ServiceResourceCost::count)).setter(setter(Builder::count)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Count").build()).build(); private static final SdkField UNIT_COST_FIELD = SdkField. builder(MarshallingType.DOUBLE) .memberName("UnitCost").getter(getter(ServiceResourceCost::unitCost)).setter(setter(Builder::unitCost)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UnitCost").build()).build(); private static final SdkField COST_FIELD = SdkField. builder(MarshallingType.DOUBLE).memberName("Cost") .getter(getter(ServiceResourceCost::cost)).setter(setter(Builder::cost)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Cost").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TYPE_FIELD, STATE_FIELD, COUNT_FIELD, UNIT_COST_FIELD, COST_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final String type; private final String state; private final Integer count; private final Double unitCost; private final Double cost; private ServiceResourceCost(BuilderImpl builder) { this.type = builder.type; this.state = builder.state; this.count = builder.count; this.unitCost = builder.unitCost; this.cost = builder.cost; } /** *

* The type of the Amazon Web Services resource. *

* * @return The type of the Amazon Web Services resource. */ public final String type() { return type; } /** *

* The state of the resource. The resource is ACTIVE if it produces metrics, events, or logs within an * hour, otherwise it is INACTIVE. You pay for the number of active Amazon Web Services resource hours * analyzed for each resource. Inactive resources are not charged. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link CostEstimationServiceResourceState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is * available from {@link #stateAsString}. *

* * @return The state of the resource. The resource is ACTIVE if it produces metrics, events, or logs * within an hour, otherwise it is INACTIVE. You pay for the number of active Amazon Web * Services resource hours analyzed for each resource. Inactive resources are not charged. * @see CostEstimationServiceResourceState */ public final CostEstimationServiceResourceState state() { return CostEstimationServiceResourceState.fromValue(state); } /** *

* The state of the resource. The resource is ACTIVE if it produces metrics, events, or logs within an * hour, otherwise it is INACTIVE. You pay for the number of active Amazon Web Services resource hours * analyzed for each resource. Inactive resources are not charged. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link CostEstimationServiceResourceState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is * available from {@link #stateAsString}. *

* * @return The state of the resource. The resource is ACTIVE if it produces metrics, events, or logs * within an hour, otherwise it is INACTIVE. You pay for the number of active Amazon Web * Services resource hours analyzed for each resource. Inactive resources are not charged. * @see CostEstimationServiceResourceState */ public final String stateAsString() { return state; } /** *

* The number of active resources analyzed for this service to create a monthly cost estimate. *

* * @return The number of active resources analyzed for this service to create a monthly cost estimate. */ public final Integer count() { return count; } /** *

* The price per hour to analyze the resources in the service. For more information, see Estimate your Amazon DevOps * Guru costs and Amazon DevOps Guru pricing. *

* * @return The price per hour to analyze the resources in the service. For more information, see Estimate your Amazon * DevOps Guru costs and Amazon DevOps Guru * pricing. */ public final Double unitCost() { return unitCost; } /** *

* The total estimated monthly cost to analyze the active resources for this resource. *

* * @return The total estimated monthly cost to analyze the active resources for this resource. */ public final Double cost() { return cost; } @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(type()); hashCode = 31 * hashCode + Objects.hashCode(stateAsString()); hashCode = 31 * hashCode + Objects.hashCode(count()); hashCode = 31 * hashCode + Objects.hashCode(unitCost()); hashCode = 31 * hashCode + Objects.hashCode(cost()); 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 ServiceResourceCost)) { return false; } ServiceResourceCost other = (ServiceResourceCost) obj; return Objects.equals(type(), other.type()) && Objects.equals(stateAsString(), other.stateAsString()) && Objects.equals(count(), other.count()) && Objects.equals(unitCost(), other.unitCost()) && Objects.equals(cost(), other.cost()); } /** * 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("ServiceResourceCost").add("Type", type()).add("State", stateAsString()).add("Count", count()) .add("UnitCost", unitCost()).add("Cost", cost()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Type": return Optional.ofNullable(clazz.cast(type())); case "State": return Optional.ofNullable(clazz.cast(stateAsString())); case "Count": return Optional.ofNullable(clazz.cast(count())); case "UnitCost": return Optional.ofNullable(clazz.cast(unitCost())); case "Cost": return Optional.ofNullable(clazz.cast(cost())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("Type", TYPE_FIELD); map.put("State", STATE_FIELD); map.put("Count", COUNT_FIELD); map.put("UnitCost", UNIT_COST_FIELD); map.put("Cost", COST_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((ServiceResourceCost) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The type of the Amazon Web Services resource. *

* * @param type * The type of the Amazon Web Services resource. * @return Returns a reference to this object so that method calls can be chained together. */ Builder type(String type); /** *

* The state of the resource. The resource is ACTIVE if it produces metrics, events, or logs within * an hour, otherwise it is INACTIVE. You pay for the number of active Amazon Web Services resource * hours analyzed for each resource. Inactive resources are not charged. *

* * @param state * The state of the resource. The resource is ACTIVE if it produces metrics, events, or logs * within an hour, otherwise it is INACTIVE. You pay for the number of active Amazon Web * Services resource hours analyzed for each resource. Inactive resources are not charged. * @see CostEstimationServiceResourceState * @return Returns a reference to this object so that method calls can be chained together. * @see CostEstimationServiceResourceState */ Builder state(String state); /** *

* The state of the resource. The resource is ACTIVE if it produces metrics, events, or logs within * an hour, otherwise it is INACTIVE. You pay for the number of active Amazon Web Services resource * hours analyzed for each resource. Inactive resources are not charged. *

* * @param state * The state of the resource. The resource is ACTIVE if it produces metrics, events, or logs * within an hour, otherwise it is INACTIVE. You pay for the number of active Amazon Web * Services resource hours analyzed for each resource. Inactive resources are not charged. * @see CostEstimationServiceResourceState * @return Returns a reference to this object so that method calls can be chained together. * @see CostEstimationServiceResourceState */ Builder state(CostEstimationServiceResourceState state); /** *

* The number of active resources analyzed for this service to create a monthly cost estimate. *

* * @param count * The number of active resources analyzed for this service to create a monthly cost estimate. * @return Returns a reference to this object so that method calls can be chained together. */ Builder count(Integer count); /** *

* The price per hour to analyze the resources in the service. For more information, see Estimate your Amazon * DevOps Guru costs and Amazon DevOps Guru * pricing. *

* * @param unitCost * The price per hour to analyze the resources in the service. For more information, see Estimate your * Amazon DevOps Guru costs and Amazon DevOps * Guru pricing. * @return Returns a reference to this object so that method calls can be chained together. */ Builder unitCost(Double unitCost); /** *

* The total estimated monthly cost to analyze the active resources for this resource. *

* * @param cost * The total estimated monthly cost to analyze the active resources for this resource. * @return Returns a reference to this object so that method calls can be chained together. */ Builder cost(Double cost); } static final class BuilderImpl implements Builder { private String type; private String state; private Integer count; private Double unitCost; private Double cost; private BuilderImpl() { } private BuilderImpl(ServiceResourceCost model) { type(model.type); state(model.state); count(model.count); unitCost(model.unitCost); cost(model.cost); } public final String getType() { return type; } public final void setType(String type) { this.type = type; } @Override public final Builder type(String type) { this.type = type; return this; } public final String getState() { return state; } public final void setState(String state) { this.state = state; } @Override public final Builder state(String state) { this.state = state; return this; } @Override public final Builder state(CostEstimationServiceResourceState state) { this.state(state == null ? null : state.toString()); return this; } public final Integer getCount() { return count; } public final void setCount(Integer count) { this.count = count; } @Override public final Builder count(Integer count) { this.count = count; return this; } public final Double getUnitCost() { return unitCost; } public final void setUnitCost(Double unitCost) { this.unitCost = unitCost; } @Override public final Builder unitCost(Double unitCost) { this.unitCost = unitCost; return this; } public final Double getCost() { return cost; } public final void setCost(Double cost) { this.cost = cost; } @Override public final Builder cost(Double cost) { this.cost = cost; return this; } @Override public ServiceResourceCost build() { return new ServiceResourceCost(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy