
software.amazon.awssdk.services.cloudwatch.model.DescribeAlarmHistoryRequest Maven / Gradle / Ivy
/*
* Copyright 2013-2018 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.cloudwatch.model;
import java.time.Instant;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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 DescribeAlarmHistoryRequest extends CloudWatchRequest implements
ToCopyableBuilder {
private final String alarmName;
private final String historyItemType;
private final Instant startDate;
private final Instant endDate;
private final Integer maxRecords;
private final String nextToken;
private DescribeAlarmHistoryRequest(BuilderImpl builder) {
super(builder);
this.alarmName = builder.alarmName;
this.historyItemType = builder.historyItemType;
this.startDate = builder.startDate;
this.endDate = builder.endDate;
this.maxRecords = builder.maxRecords;
this.nextToken = builder.nextToken;
}
/**
*
* The name of the alarm.
*
*
* @return The name of the alarm.
*/
public String alarmName() {
return alarmName;
}
/**
*
* The type of alarm histories to retrieve.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #historyItemType}
* will return {@link HistoryItemType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #historyItemTypeAsString}.
*
*
* @return The type of alarm histories to retrieve.
* @see HistoryItemType
*/
public HistoryItemType historyItemType() {
return HistoryItemType.fromValue(historyItemType);
}
/**
*
* The type of alarm histories to retrieve.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #historyItemType}
* will return {@link HistoryItemType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #historyItemTypeAsString}.
*
*
* @return The type of alarm histories to retrieve.
* @see HistoryItemType
*/
public String historyItemTypeAsString() {
return historyItemType;
}
/**
*
* The starting date to retrieve alarm history.
*
*
* @return The starting date to retrieve alarm history.
*/
public Instant startDate() {
return startDate;
}
/**
*
* The ending date to retrieve alarm history.
*
*
* @return The ending date to retrieve alarm history.
*/
public Instant endDate() {
return endDate;
}
/**
*
* The maximum number of alarm history records to retrieve.
*
*
* @return The maximum number of alarm history records to retrieve.
*/
public Integer maxRecords() {
return maxRecords;
}
/**
*
* The token returned by a previous call to indicate that there is more data available.
*
*
* @return The token returned by a previous call to indicate that there is more data available.
*/
public String nextToken() {
return nextToken;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(alarmName());
hashCode = 31 * hashCode + Objects.hashCode(historyItemTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(startDate());
hashCode = 31 * hashCode + Objects.hashCode(endDate());
hashCode = 31 * hashCode + Objects.hashCode(maxRecords());
hashCode = 31 * hashCode + Objects.hashCode(nextToken());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DescribeAlarmHistoryRequest)) {
return false;
}
DescribeAlarmHistoryRequest other = (DescribeAlarmHistoryRequest) obj;
return Objects.equals(alarmName(), other.alarmName())
&& Objects.equals(historyItemTypeAsString(), other.historyItemTypeAsString())
&& Objects.equals(startDate(), other.startDate()) && Objects.equals(endDate(), other.endDate())
&& Objects.equals(maxRecords(), other.maxRecords()) && Objects.equals(nextToken(), other.nextToken());
}
@Override
public String toString() {
return ToString.builder("DescribeAlarmHistoryRequest").add("AlarmName", alarmName())
.add("HistoryItemType", historyItemTypeAsString()).add("StartDate", startDate()).add("EndDate", endDate())
.add("MaxRecords", maxRecords()).add("NextToken", nextToken()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AlarmName":
return Optional.ofNullable(clazz.cast(alarmName()));
case "HistoryItemType":
return Optional.ofNullable(clazz.cast(historyItemTypeAsString()));
case "StartDate":
return Optional.ofNullable(clazz.cast(startDate()));
case "EndDate":
return Optional.ofNullable(clazz.cast(endDate()));
case "MaxRecords":
return Optional.ofNullable(clazz.cast(maxRecords()));
case "NextToken":
return Optional.ofNullable(clazz.cast(nextToken()));
default:
return Optional.empty();
}
}
public interface Builder extends CloudWatchRequest.Builder, CopyableBuilder {
/**
*
* The name of the alarm.
*
*
* @param alarmName
* The name of the alarm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder alarmName(String alarmName);
/**
*
* The type of alarm histories to retrieve.
*
*
* @param historyItemType
* The type of alarm histories to retrieve.
* @see HistoryItemType
* @return Returns a reference to this object so that method calls can be chained together.
* @see HistoryItemType
*/
Builder historyItemType(String historyItemType);
/**
*
* The type of alarm histories to retrieve.
*
*
* @param historyItemType
* The type of alarm histories to retrieve.
* @see HistoryItemType
* @return Returns a reference to this object so that method calls can be chained together.
* @see HistoryItemType
*/
Builder historyItemType(HistoryItemType historyItemType);
/**
*
* The starting date to retrieve alarm history.
*
*
* @param startDate
* The starting date to retrieve alarm history.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder startDate(Instant startDate);
/**
*
* The ending date to retrieve alarm history.
*
*
* @param endDate
* The ending date to retrieve alarm history.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder endDate(Instant endDate);
/**
*
* The maximum number of alarm history records to retrieve.
*
*
* @param maxRecords
* The maximum number of alarm history records to retrieve.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder maxRecords(Integer maxRecords);
/**
*
* The token returned by a previous call to indicate that there is more data available.
*
*
* @param nextToken
* The token returned by a previous call to indicate that there is more data available.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder nextToken(String nextToken);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends CloudWatchRequest.BuilderImpl implements Builder {
private String alarmName;
private String historyItemType;
private Instant startDate;
private Instant endDate;
private Integer maxRecords;
private String nextToken;
private BuilderImpl() {
}
private BuilderImpl(DescribeAlarmHistoryRequest model) {
super(model);
alarmName(model.alarmName);
historyItemType(model.historyItemType);
startDate(model.startDate);
endDate(model.endDate);
maxRecords(model.maxRecords);
nextToken(model.nextToken);
}
public final String getAlarmName() {
return alarmName;
}
@Override
public final Builder alarmName(String alarmName) {
this.alarmName = alarmName;
return this;
}
public final void setAlarmName(String alarmName) {
this.alarmName = alarmName;
}
public final String getHistoryItemType() {
return historyItemType;
}
@Override
public final Builder historyItemType(String historyItemType) {
this.historyItemType = historyItemType;
return this;
}
@Override
public final Builder historyItemType(HistoryItemType historyItemType) {
this.historyItemType(historyItemType.toString());
return this;
}
public final void setHistoryItemType(String historyItemType) {
this.historyItemType = historyItemType;
}
public final Instant getStartDate() {
return startDate;
}
@Override
public final Builder startDate(Instant startDate) {
this.startDate = startDate;
return this;
}
public final void setStartDate(Instant startDate) {
this.startDate = startDate;
}
public final Instant getEndDate() {
return endDate;
}
@Override
public final Builder endDate(Instant endDate) {
this.endDate = endDate;
return this;
}
public final void setEndDate(Instant endDate) {
this.endDate = endDate;
}
public final Integer getMaxRecords() {
return maxRecords;
}
@Override
public final Builder maxRecords(Integer maxRecords) {
this.maxRecords = maxRecords;
return this;
}
public final void setMaxRecords(Integer maxRecords) {
this.maxRecords = maxRecords;
}
public final String getNextToken() {
return nextToken;
}
@Override
public final Builder nextToken(String nextToken) {
this.nextToken = nextToken;
return this;
}
public final void setNextToken(String nextToken) {
this.nextToken = nextToken;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public DescribeAlarmHistoryRequest build() {
return new DescribeAlarmHistoryRequest(this);
}
}
}