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

software.amazon.awssdk.services.computeoptimizer.model.GetRdsDatabaseRecommendationProjectedMetricsRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Compute Optimizer module holds the client classes that are used for communicating with Compute Optimizer.

There is a newer version: 2.29.15
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.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 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 getter(Function g) { return obj -> g.apply((GetRdsDatabaseRecommendationProjectedMetricsRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends ComputeOptimizerRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The ARN that identifies the Amazon RDS. *

*

* The following is the format of the ARN: *

*

* arn:aws:rds:{region}:{accountId}:db:{resourceName} *

* * @param resourceArn * The ARN that identifies the Amazon RDS.

*

* The following is the format of the ARN: *

*

* arn:aws:rds:{region}:{accountId}:db:{resourceName} * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceArn(String resourceArn); /** *

* The statistic of the projected metrics. *

* * @param stat * The statistic of the projected metrics. * @see MetricStatistic * @return Returns a reference to this object so that method calls can be chained together. * @see MetricStatistic */ Builder stat(String stat); /** *

* The statistic of the projected metrics. *

* * @param stat * The statistic of the projected metrics. * @see MetricStatistic * @return Returns a reference to this object so that method calls can be chained together. * @see MetricStatistic */ Builder stat(MetricStatistic stat); /** *

* The granularity, in seconds, of the projected metrics data points. *

* * @param period * The granularity, in seconds, of the projected metrics data points. * @return Returns a reference to this object so that method calls can be chained together. */ Builder period(Integer period); /** *

* The timestamp of the first projected metrics data point to return. *

* * @param startTime * The timestamp of the first projected metrics data point to return. * @return Returns a reference to this object so that method calls can be chained together. */ Builder startTime(Instant startTime); /** *

* The timestamp of the last projected metrics data point to return. *

* * @param endTime * The timestamp of the last projected metrics data point to return. * @return Returns a reference to this object so that method calls can be chained together. */ Builder endTime(Instant endTime); /** * Sets the value of the RecommendationPreferences property for this object. * * @param recommendationPreferences * The new value for the RecommendationPreferences property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder recommendationPreferences(RecommendationPreferences recommendationPreferences); /** * Sets the value of the RecommendationPreferences property for this object. * * This is a convenience method that creates an instance of the {@link RecommendationPreferences.Builder} * avoiding the need to create one manually via {@link RecommendationPreferences#builder()}. * *

* When the {@link Consumer} completes, {@link RecommendationPreferences.Builder#build()} is called immediately * and its result is passed to {@link #recommendationPreferences(RecommendationPreferences)}. * * @param recommendationPreferences * a consumer that will call methods on {@link RecommendationPreferences.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #recommendationPreferences(RecommendationPreferences) */ default Builder recommendationPreferences(Consumer recommendationPreferences) { return recommendationPreferences(RecommendationPreferences.builder().applyMutation(recommendationPreferences).build()); } @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends ComputeOptimizerRequest.BuilderImpl implements Builder { private String resourceArn; private String stat; private Integer period; private Instant startTime; private Instant endTime; private RecommendationPreferences recommendationPreferences; private BuilderImpl() { } private BuilderImpl(GetRdsDatabaseRecommendationProjectedMetricsRequest model) { super(model); resourceArn(model.resourceArn); stat(model.stat); period(model.period); startTime(model.startTime); endTime(model.endTime); recommendationPreferences(model.recommendationPreferences); } public final String getResourceArn() { return resourceArn; } public final void setResourceArn(String resourceArn) { this.resourceArn = resourceArn; } @Override public final Builder resourceArn(String resourceArn) { this.resourceArn = resourceArn; return this; } public final String getStat() { return stat; } public final void setStat(String stat) { this.stat = stat; } @Override public final Builder stat(String stat) { this.stat = stat; return this; } @Override public final Builder stat(MetricStatistic stat) { this.stat(stat == null ? null : stat.toString()); return this; } public final Integer getPeriod() { return period; } public final void setPeriod(Integer period) { this.period = period; } @Override public final Builder period(Integer period) { this.period = period; return this; } public final Instant getStartTime() { return startTime; } public final void setStartTime(Instant startTime) { this.startTime = startTime; } @Override public final Builder startTime(Instant startTime) { this.startTime = startTime; return this; } public final Instant getEndTime() { return endTime; } public final void setEndTime(Instant endTime) { this.endTime = endTime; } @Override public final Builder endTime(Instant endTime) { this.endTime = endTime; return this; } public final RecommendationPreferences.Builder getRecommendationPreferences() { return recommendationPreferences != null ? recommendationPreferences.toBuilder() : null; } public final void setRecommendationPreferences(RecommendationPreferences.BuilderImpl recommendationPreferences) { this.recommendationPreferences = recommendationPreferences != null ? recommendationPreferences.build() : null; } @Override public final Builder recommendationPreferences(RecommendationPreferences recommendationPreferences) { this.recommendationPreferences = recommendationPreferences; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public GetRdsDatabaseRecommendationProjectedMetricsRequest build() { return new GetRdsDatabaseRecommendationProjectedMetricsRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy