software.amazon.awssdk.services.computeoptimizer.model.GetRdsDatabaseRecommendationProjectedMetricsRequest Maven / Gradle / Ivy
Show all versions of computeoptimizer Show documentation
/*
* 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.computeoptimizer.model;
import java.time.Instant;
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.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetRdsDatabaseRecommendationProjectedMetricsRequest extends ComputeOptimizerRequest
implements
ToCopyableBuilder {
private static final SdkField RESOURCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("resourceArn").getter(getter(GetRdsDatabaseRecommendationProjectedMetricsRequest::resourceArn))
.setter(setter(Builder::resourceArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceArn").build()).build();
private static final SdkField STAT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("stat")
.getter(getter(GetRdsDatabaseRecommendationProjectedMetricsRequest::statAsString)).setter(setter(Builder::stat))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("stat").build()).build();
private static final SdkField PERIOD_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("period").getter(getter(GetRdsDatabaseRecommendationProjectedMetricsRequest::period))
.setter(setter(Builder::period))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("period").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("startTime").getter(getter(GetRdsDatabaseRecommendationProjectedMetricsRequest::startTime))
.setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startTime").build()).build();
private static final SdkField END_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("endTime").getter(getter(GetRdsDatabaseRecommendationProjectedMetricsRequest::endTime))
.setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("endTime").build()).build();
private static final SdkField RECOMMENDATION_PREFERENCES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("recommendationPreferences")
.getter(getter(GetRdsDatabaseRecommendationProjectedMetricsRequest::recommendationPreferences))
.setter(setter(Builder::recommendationPreferences)).constructor(RecommendationPreferences::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("recommendationPreferences").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RESOURCE_ARN_FIELD,
STAT_FIELD, PERIOD_FIELD, START_TIME_FIELD, END_TIME_FIELD, RECOMMENDATION_PREFERENCES_FIELD));
private final String resourceArn;
private final String stat;
private final Integer period;
private final Instant startTime;
private final Instant endTime;
private final RecommendationPreferences recommendationPreferences;
private GetRdsDatabaseRecommendationProjectedMetricsRequest(BuilderImpl builder) {
super(builder);
this.resourceArn = builder.resourceArn;
this.stat = builder.stat;
this.period = builder.period;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
this.recommendationPreferences = builder.recommendationPreferences;
}
/**
*
* The ARN that identifies the Amazon RDS.
*
*
* The following is the format of the ARN:
*
*
* arn:aws:rds:{region}:{accountId}:db:{resourceName}
*
*
* @return The ARN that identifies the Amazon RDS.
*
* The following is the format of the ARN:
*
*
* arn:aws:rds:{region}:{accountId}:db:{resourceName}
*/
public final String resourceArn() {
return resourceArn;
}
/**
*
* The statistic of the projected metrics.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #stat} will return
* {@link MetricStatistic#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statAsString}.
*
*
* @return The statistic of the projected metrics.
* @see MetricStatistic
*/
public final MetricStatistic stat() {
return MetricStatistic.fromValue(stat);
}
/**
*
* The statistic of the projected metrics.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #stat} will return
* {@link MetricStatistic#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statAsString}.
*
*
* @return The statistic of the projected metrics.
* @see MetricStatistic
*/
public final String statAsString() {
return stat;
}
/**
*
* The granularity, in seconds, of the projected metrics data points.
*
*
* @return The granularity, in seconds, of the projected metrics data points.
*/
public final Integer period() {
return period;
}
/**
*
* The timestamp of the first projected metrics data point to return.
*
*
* @return The timestamp of the first projected metrics data point to return.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The timestamp of the last projected metrics data point to return.
*
*
* @return The timestamp of the last projected metrics data point to return.
*/
public final Instant endTime() {
return endTime;
}
/**
* Returns the value of the RecommendationPreferences property for this object.
*
* @return The value of the RecommendationPreferences property for this object.
*/
public final RecommendationPreferences recommendationPreferences() {
return recommendationPreferences;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(resourceArn());
hashCode = 31 * hashCode + Objects.hashCode(statAsString());
hashCode = 31 * hashCode + Objects.hashCode(period());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(recommendationPreferences());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GetRdsDatabaseRecommendationProjectedMetricsRequest)) {
return false;
}
GetRdsDatabaseRecommendationProjectedMetricsRequest other = (GetRdsDatabaseRecommendationProjectedMetricsRequest) obj;
return Objects.equals(resourceArn(), other.resourceArn()) && Objects.equals(statAsString(), other.statAsString())
&& Objects.equals(period(), other.period()) && Objects.equals(startTime(), other.startTime())
&& Objects.equals(endTime(), other.endTime())
&& Objects.equals(recommendationPreferences(), other.recommendationPreferences());
}
/**
* 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("GetRdsDatabaseRecommendationProjectedMetricsRequest").add("ResourceArn", resourceArn())
.add("Stat", statAsString()).add("Period", period()).add("StartTime", startTime()).add("EndTime", endTime())
.add("RecommendationPreferences", recommendationPreferences()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "resourceArn":
return Optional.ofNullable(clazz.cast(resourceArn()));
case "stat":
return Optional.ofNullable(clazz.cast(statAsString()));
case "period":
return Optional.ofNullable(clazz.cast(period()));
case "startTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "endTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "recommendationPreferences":
return Optional.ofNullable(clazz.cast(recommendationPreferences()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function