
software.amazon.awssdk.services.iot.model.UpdateCustomMetricResponse Maven / Gradle / Ivy
/*
* 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.iot.model;
import java.beans.Transient;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateCustomMetricResponse extends IotResponse implements
ToCopyableBuilder {
private static final SdkField METRIC_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("metricName").getter(getter(UpdateCustomMetricResponse::metricName)).setter(setter(Builder::metricName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("metricName").build()).build();
private static final SdkField METRIC_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("metricArn").getter(getter(UpdateCustomMetricResponse::metricArn)).setter(setter(Builder::metricArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("metricArn").build()).build();
private static final SdkField METRIC_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("metricType").getter(getter(UpdateCustomMetricResponse::metricTypeAsString))
.setter(setter(Builder::metricType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("metricType").build()).build();
private static final SdkField DISPLAY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("displayName").getter(getter(UpdateCustomMetricResponse::displayName))
.setter(setter(Builder::displayName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("displayName").build()).build();
private static final SdkField CREATION_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("creationDate").getter(getter(UpdateCustomMetricResponse::creationDate))
.setter(setter(Builder::creationDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationDate").build()).build();
private static final SdkField LAST_MODIFIED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("lastModifiedDate").getter(getter(UpdateCustomMetricResponse::lastModifiedDate))
.setter(setter(Builder::lastModifiedDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastModifiedDate").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(METRIC_NAME_FIELD,
METRIC_ARN_FIELD, METRIC_TYPE_FIELD, DISPLAY_NAME_FIELD, CREATION_DATE_FIELD, LAST_MODIFIED_DATE_FIELD));
private final String metricName;
private final String metricArn;
private final String metricType;
private final String displayName;
private final Instant creationDate;
private final Instant lastModifiedDate;
private UpdateCustomMetricResponse(BuilderImpl builder) {
super(builder);
this.metricName = builder.metricName;
this.metricArn = builder.metricArn;
this.metricType = builder.metricType;
this.displayName = builder.displayName;
this.creationDate = builder.creationDate;
this.lastModifiedDate = builder.lastModifiedDate;
}
/**
*
* The name of the custom metric.
*
*
* @return The name of the custom metric.
*/
public final String metricName() {
return metricName;
}
/**
*
* The Amazon Resource Number (ARN) of the custom metric.
*
*
* @return The Amazon Resource Number (ARN) of the custom metric.
*/
public final String metricArn() {
return metricArn;
}
/**
*
* The type of the custom metric. Types include string-list
, ip-address-list
,
* number-list
, and number
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #metricType} will
* return {@link CustomMetricType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #metricTypeAsString}.
*
*
* @return The type of the custom metric. Types include string-list
, ip-address-list
,
* number-list
, and number
.
* @see CustomMetricType
*/
public final CustomMetricType metricType() {
return CustomMetricType.fromValue(metricType);
}
/**
*
* The type of the custom metric. Types include string-list
, ip-address-list
,
* number-list
, and number
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #metricType} will
* return {@link CustomMetricType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #metricTypeAsString}.
*
*
* @return The type of the custom metric. Types include string-list
, ip-address-list
,
* number-list
, and number
.
* @see CustomMetricType
*/
public final String metricTypeAsString() {
return metricType;
}
/**
*
* A friendly name in the console for the custom metric
*
*
* @return A friendly name in the console for the custom metric
*/
public final String displayName() {
return displayName;
}
/**
*
* The creation date of the custom metric in milliseconds since epoch.
*
*
* @return The creation date of the custom metric in milliseconds since epoch.
*/
public final Instant creationDate() {
return creationDate;
}
/**
*
* The time the custom metric was last modified in milliseconds since epoch.
*
*
* @return The time the custom metric was last modified in milliseconds since epoch.
*/
public final Instant lastModifiedDate() {
return lastModifiedDate;
}
@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(metricName());
hashCode = 31 * hashCode + Objects.hashCode(metricArn());
hashCode = 31 * hashCode + Objects.hashCode(metricTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(displayName());
hashCode = 31 * hashCode + Objects.hashCode(creationDate());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedDate());
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 UpdateCustomMetricResponse)) {
return false;
}
UpdateCustomMetricResponse other = (UpdateCustomMetricResponse) obj;
return Objects.equals(metricName(), other.metricName()) && Objects.equals(metricArn(), other.metricArn())
&& Objects.equals(metricTypeAsString(), other.metricTypeAsString())
&& Objects.equals(displayName(), other.displayName()) && Objects.equals(creationDate(), other.creationDate())
&& Objects.equals(lastModifiedDate(), other.lastModifiedDate());
}
/**
* 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("UpdateCustomMetricResponse").add("MetricName", metricName()).add("MetricArn", metricArn())
.add("MetricType", metricTypeAsString()).add("DisplayName", displayName()).add("CreationDate", creationDate())
.add("LastModifiedDate", lastModifiedDate()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "metricName":
return Optional.ofNullable(clazz.cast(metricName()));
case "metricArn":
return Optional.ofNullable(clazz.cast(metricArn()));
case "metricType":
return Optional.ofNullable(clazz.cast(metricTypeAsString()));
case "displayName":
return Optional.ofNullable(clazz.cast(displayName()));
case "creationDate":
return Optional.ofNullable(clazz.cast(creationDate()));
case "lastModifiedDate":
return Optional.ofNullable(clazz.cast(lastModifiedDate()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function