software.amazon.awssdk.services.cloudwatch.model.MetricStreamEntry Maven / Gradle / Ivy
Show all versions of cloudwatch 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.cloudwatch.model;
import java.io.Serializable;
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.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;
/**
*
* This structure contains the configuration information about one metric stream.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class MetricStreamEntry implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
.getter(getter(MetricStreamEntry::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();
private static final SdkField CREATION_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationDate").getter(getter(MetricStreamEntry::creationDate)).setter(setter(Builder::creationDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationDate").build()).build();
private static final SdkField LAST_UPDATE_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastUpdateDate").getter(getter(MetricStreamEntry::lastUpdateDate))
.setter(setter(Builder::lastUpdateDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdateDate").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(MetricStreamEntry::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField FIREHOSE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FirehoseArn").getter(getter(MetricStreamEntry::firehoseArn)).setter(setter(Builder::firehoseArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FirehoseArn").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(MetricStreamEntry::state)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField OUTPUT_FORMAT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OutputFormat").getter(getter(MetricStreamEntry::outputFormatAsString))
.setter(setter(Builder::outputFormat))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutputFormat").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD,
CREATION_DATE_FIELD, LAST_UPDATE_DATE_FIELD, NAME_FIELD, FIREHOSE_ARN_FIELD, STATE_FIELD, OUTPUT_FORMAT_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final Instant creationDate;
private final Instant lastUpdateDate;
private final String name;
private final String firehoseArn;
private final String state;
private final String outputFormat;
private MetricStreamEntry(BuilderImpl builder) {
this.arn = builder.arn;
this.creationDate = builder.creationDate;
this.lastUpdateDate = builder.lastUpdateDate;
this.name = builder.name;
this.firehoseArn = builder.firehoseArn;
this.state = builder.state;
this.outputFormat = builder.outputFormat;
}
/**
*
* The ARN of the metric stream.
*
*
* @return The ARN of the metric stream.
*/
public final String arn() {
return arn;
}
/**
*
* The date that the metric stream was originally created.
*
*
* @return The date that the metric stream was originally created.
*/
public final Instant creationDate() {
return creationDate;
}
/**
*
* The date that the configuration of this metric stream was most recently updated.
*
*
* @return The date that the configuration of this metric stream was most recently updated.
*/
public final Instant lastUpdateDate() {
return lastUpdateDate;
}
/**
*
* The name of the metric stream.
*
*
* @return The name of the metric stream.
*/
public final String name() {
return name;
}
/**
*
* The ARN of the Kinesis Firehose devlivery stream that is used for this metric stream.
*
*
* @return The ARN of the Kinesis Firehose devlivery stream that is used for this metric stream.
*/
public final String firehoseArn() {
return firehoseArn;
}
/**
*
* The current state of this stream. Valid values are running
and stopped
.
*
*
* @return The current state of this stream. Valid values are running
and stopped
.
*/
public final String state() {
return state;
}
/**
*
* The output format of this metric stream. Valid values are json
, opentelemetry1.0
, and
* opentelemetry0.7
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #outputFormat} will
* return {@link MetricStreamOutputFormat#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #outputFormatAsString}.
*
*
* @return The output format of this metric stream. Valid values are json
,
* opentelemetry1.0
, and opentelemetry0.7
.
* @see MetricStreamOutputFormat
*/
public final MetricStreamOutputFormat outputFormat() {
return MetricStreamOutputFormat.fromValue(outputFormat);
}
/**
*
* The output format of this metric stream. Valid values are json
, opentelemetry1.0
, and
* opentelemetry0.7
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #outputFormat} will
* return {@link MetricStreamOutputFormat#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #outputFormatAsString}.
*
*
* @return The output format of this metric stream. Valid values are json
,
* opentelemetry1.0
, and opentelemetry0.7
.
* @see MetricStreamOutputFormat
*/
public final String outputFormatAsString() {
return outputFormat;
}
@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(arn());
hashCode = 31 * hashCode + Objects.hashCode(creationDate());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdateDate());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(firehoseArn());
hashCode = 31 * hashCode + Objects.hashCode(state());
hashCode = 31 * hashCode + Objects.hashCode(outputFormatAsString());
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 MetricStreamEntry)) {
return false;
}
MetricStreamEntry other = (MetricStreamEntry) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(creationDate(), other.creationDate())
&& Objects.equals(lastUpdateDate(), other.lastUpdateDate()) && Objects.equals(name(), other.name())
&& Objects.equals(firehoseArn(), other.firehoseArn()) && Objects.equals(state(), other.state())
&& Objects.equals(outputFormatAsString(), other.outputFormatAsString());
}
/**
* 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("MetricStreamEntry").add("Arn", arn()).add("CreationDate", creationDate())
.add("LastUpdateDate", lastUpdateDate()).add("Name", name()).add("FirehoseArn", firehoseArn())
.add("State", state()).add("OutputFormat", outputFormatAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "CreationDate":
return Optional.ofNullable(clazz.cast(creationDate()));
case "LastUpdateDate":
return Optional.ofNullable(clazz.cast(lastUpdateDate()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "FirehoseArn":
return Optional.ofNullable(clazz.cast(firehoseArn()));
case "State":
return Optional.ofNullable(clazz.cast(state()));
case "OutputFormat":
return Optional.ofNullable(clazz.cast(outputFormatAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function