software.amazon.awssdk.services.costexplorer.model.RootCause Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of costexplorer Show documentation
Show all versions of costexplorer Show documentation
The AWS Java SDK for AWS Cost Explorer module holds the client classes that are used for communicating
with AWS Cost Explorer Service
/*
* 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;
/**
*
* The combination of AWS service, linked account, Region, and usage type where a cost anomaly is observed.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class RootCause implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField SERVICE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Service")
.getter(getter(RootCause::service)).setter(setter(Builder::service))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Service").build()).build();
private static final SdkField REGION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Region")
.getter(getter(RootCause::region)).setter(setter(Builder::region))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Region").build()).build();
private static final SdkField LINKED_ACCOUNT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LinkedAccount").getter(getter(RootCause::linkedAccount)).setter(setter(Builder::linkedAccount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LinkedAccount").build()).build();
private static final SdkField USAGE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("UsageType").getter(getter(RootCause::usageType)).setter(setter(Builder::usageType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UsageType").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SERVICE_FIELD, REGION_FIELD,
LINKED_ACCOUNT_FIELD, USAGE_TYPE_FIELD));
private static final long serialVersionUID = 1L;
private final String service;
private final String region;
private final String linkedAccount;
private final String usageType;
private RootCause(BuilderImpl builder) {
this.service = builder.service;
this.region = builder.region;
this.linkedAccount = builder.linkedAccount;
this.usageType = builder.usageType;
}
/**
*
* The AWS service name associated with the cost anomaly.
*
*
* @return The AWS service name associated with the cost anomaly.
*/
public final String service() {
return service;
}
/**
*
* The AWS Region associated with the cost anomaly.
*
*
* @return The AWS Region associated with the cost anomaly.
*/
public final String region() {
return region;
}
/**
*
* The linked account value associated with the cost anomaly.
*
*
* @return The linked account value associated with the cost anomaly.
*/
public final String linkedAccount() {
return linkedAccount;
}
/**
*
* The UsageType
value associated with the cost anomaly.
*
*
* @return The UsageType
value associated with the cost anomaly.
*/
public final String usageType() {
return usageType;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(service());
hashCode = 31 * hashCode + Objects.hashCode(region());
hashCode = 31 * hashCode + Objects.hashCode(linkedAccount());
hashCode = 31 * hashCode + Objects.hashCode(usageType());
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 RootCause)) {
return false;
}
RootCause other = (RootCause) obj;
return Objects.equals(service(), other.service()) && Objects.equals(region(), other.region())
&& Objects.equals(linkedAccount(), other.linkedAccount()) && Objects.equals(usageType(), other.usageType());
}
/**
* 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("RootCause").add("Service", service()).add("Region", region())
.add("LinkedAccount", linkedAccount()).add("UsageType", usageType()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Service":
return Optional.ofNullable(clazz.cast(service()));
case "Region":
return Optional.ofNullable(clazz.cast(region()));
case "LinkedAccount":
return Optional.ofNullable(clazz.cast(linkedAccount()));
case "UsageType":
return Optional.ofNullable(clazz.cast(usageType()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy