software.amazon.awssdk.services.iotsitewise.model.DescribeGatewayResponse Maven / Gradle / Ivy
Show all versions of iotsitewise 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.iotsitewise.model;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
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 DescribeGatewayResponse extends IoTSiteWiseResponse implements
ToCopyableBuilder {
private static final SdkField GATEWAY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeGatewayResponse::gatewayId)).setter(setter(Builder::gatewayId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("gatewayId").build()).build();
private static final SdkField GATEWAY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeGatewayResponse::gatewayName)).setter(setter(Builder::gatewayName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("gatewayName").build()).build();
private static final SdkField GATEWAY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeGatewayResponse::gatewayArn)).setter(setter(Builder::gatewayArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("gatewayArn").build()).build();
private static final SdkField GATEWAY_PLATFORM_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(DescribeGatewayResponse::gatewayPlatform))
.setter(setter(Builder::gatewayPlatform)).constructor(GatewayPlatform::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("gatewayPlatform").build()).build();
private static final SdkField> GATEWAY_CAPABILITY_SUMMARIES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(DescribeGatewayResponse::gatewayCapabilitySummaries))
.setter(setter(Builder::gatewayCapabilitySummaries))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("gatewayCapabilitySummaries").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(GatewayCapabilitySummary::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField CREATION_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(DescribeGatewayResponse::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)
.getter(getter(DescribeGatewayResponse::lastUpdateDate)).setter(setter(Builder::lastUpdateDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastUpdateDate").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(GATEWAY_ID_FIELD,
GATEWAY_NAME_FIELD, GATEWAY_ARN_FIELD, GATEWAY_PLATFORM_FIELD, GATEWAY_CAPABILITY_SUMMARIES_FIELD,
CREATION_DATE_FIELD, LAST_UPDATE_DATE_FIELD));
private final String gatewayId;
private final String gatewayName;
private final String gatewayArn;
private final GatewayPlatform gatewayPlatform;
private final List gatewayCapabilitySummaries;
private final Instant creationDate;
private final Instant lastUpdateDate;
private DescribeGatewayResponse(BuilderImpl builder) {
super(builder);
this.gatewayId = builder.gatewayId;
this.gatewayName = builder.gatewayName;
this.gatewayArn = builder.gatewayArn;
this.gatewayPlatform = builder.gatewayPlatform;
this.gatewayCapabilitySummaries = builder.gatewayCapabilitySummaries;
this.creationDate = builder.creationDate;
this.lastUpdateDate = builder.lastUpdateDate;
}
/**
*
* The ID of the gateway device.
*
*
* @return The ID of the gateway device.
*/
public String gatewayId() {
return gatewayId;
}
/**
*
* The name of the gateway.
*
*
* @return The name of the gateway.
*/
public String gatewayName() {
return gatewayName;
}
/**
*
* The ARN of the gateway,
* which has the following format.
*
*
* arn:${Partition}:iotsitewise:${Region}:${Account}:gateway/${GatewayId}
*
*
* @return The ARN of the
* gateway, which has the following format.
*
* arn:${Partition}:iotsitewise:${Region}:${Account}:gateway/${GatewayId}
*/
public String gatewayArn() {
return gatewayArn;
}
/**
*
* The gateway's platform.
*
*
* @return The gateway's platform.
*/
public GatewayPlatform gatewayPlatform() {
return gatewayPlatform;
}
/**
* Returns true if the GatewayCapabilitySummaries property was specified by the sender (it may be empty), or false
* if the sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the
* AWS service.
*/
public boolean hasGatewayCapabilitySummaries() {
return gatewayCapabilitySummaries != null && !(gatewayCapabilitySummaries instanceof SdkAutoConstructList);
}
/**
*
* A list of gateway capability summaries that each contain a namespace and status. Each gateway capability defines
* data sources for the gateway. To retrieve a capability configuration's definition, use DescribeGatewayCapabilityConfiguration.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasGatewayCapabilitySummaries()} to see if a value was sent in this field.
*
*
* @return A list of gateway capability summaries that each contain a namespace and status. Each gateway capability
* defines data sources for the gateway. To retrieve a capability configuration's definition, use DescribeGatewayCapabilityConfiguration.
*/
public List gatewayCapabilitySummaries() {
return gatewayCapabilitySummaries;
}
/**
*
* The date the gateway was created, in Unix epoch time.
*
*
* @return The date the gateway was created, in Unix epoch time.
*/
public Instant creationDate() {
return creationDate;
}
/**
*
* The date the gateway was last updated, in Unix epoch time.
*
*
* @return The date the gateway was last updated, in Unix epoch time.
*/
public Instant lastUpdateDate() {
return lastUpdateDate;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(gatewayId());
hashCode = 31 * hashCode + Objects.hashCode(gatewayName());
hashCode = 31 * hashCode + Objects.hashCode(gatewayArn());
hashCode = 31 * hashCode + Objects.hashCode(gatewayPlatform());
hashCode = 31 * hashCode + Objects.hashCode(gatewayCapabilitySummaries());
hashCode = 31 * hashCode + Objects.hashCode(creationDate());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdateDate());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DescribeGatewayResponse)) {
return false;
}
DescribeGatewayResponse other = (DescribeGatewayResponse) obj;
return Objects.equals(gatewayId(), other.gatewayId()) && Objects.equals(gatewayName(), other.gatewayName())
&& Objects.equals(gatewayArn(), other.gatewayArn()) && Objects.equals(gatewayPlatform(), other.gatewayPlatform())
&& Objects.equals(gatewayCapabilitySummaries(), other.gatewayCapabilitySummaries())
&& Objects.equals(creationDate(), other.creationDate())
&& Objects.equals(lastUpdateDate(), other.lastUpdateDate());
}
/**
* 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 String toString() {
return ToString.builder("DescribeGatewayResponse").add("GatewayId", gatewayId()).add("GatewayName", gatewayName())
.add("GatewayArn", gatewayArn()).add("GatewayPlatform", gatewayPlatform())
.add("GatewayCapabilitySummaries", gatewayCapabilitySummaries()).add("CreationDate", creationDate())
.add("LastUpdateDate", lastUpdateDate()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "gatewayId":
return Optional.ofNullable(clazz.cast(gatewayId()));
case "gatewayName":
return Optional.ofNullable(clazz.cast(gatewayName()));
case "gatewayArn":
return Optional.ofNullable(clazz.cast(gatewayArn()));
case "gatewayPlatform":
return Optional.ofNullable(clazz.cast(gatewayPlatform()));
case "gatewayCapabilitySummaries":
return Optional.ofNullable(clazz.cast(gatewayCapabilitySummaries()));
case "creationDate":
return Optional.ofNullable(clazz.cast(creationDate()));
case "lastUpdateDate":
return Optional.ofNullable(clazz.cast(lastUpdateDate()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function