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

software.amazon.awssdk.services.iotsitewise.model.DescribeGatewayResponse Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Io T Site Wise module holds the client classes that are used for communicating with Io T Site Wise.

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

* The ID of the gateway device. *

* * @param gatewayId * The ID of the gateway device. * @return Returns a reference to this object so that method calls can be chained together. */ Builder gatewayId(String gatewayId); /** *

* The name of the gateway. *

* * @param gatewayName * The name of the gateway. * @return Returns a reference to this object so that method calls can be chained together. */ Builder gatewayName(String gatewayName); /** *

* The ARN of the * gateway, which has the following format. *

*

* arn:${Partition}:iotsitewise:${Region}:${Account}:gateway/${GatewayId} *

* * @param gatewayArn * The ARN of * the gateway, which has the following format.

*

* arn:${Partition}:iotsitewise:${Region}:${Account}:gateway/${GatewayId} * @return Returns a reference to this object so that method calls can be chained together. */ Builder gatewayArn(String gatewayArn); /** *

* The gateway's platform. *

* * @param gatewayPlatform * The gateway's platform. * @return Returns a reference to this object so that method calls can be chained together. */ Builder gatewayPlatform(GatewayPlatform gatewayPlatform); /** *

* The gateway's platform. *

* This is a convenience that creates an instance of the {@link GatewayPlatform.Builder} avoiding the need to * create one manually via {@link GatewayPlatform#builder()}. * * When the {@link Consumer} completes, {@link GatewayPlatform.Builder#build()} is called immediately and its * result is passed to {@link #gatewayPlatform(GatewayPlatform)}. * * @param gatewayPlatform * a consumer that will call methods on {@link GatewayPlatform.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #gatewayPlatform(GatewayPlatform) */ default Builder gatewayPlatform(Consumer gatewayPlatform) { return gatewayPlatform(GatewayPlatform.builder().applyMutation(gatewayPlatform).build()); } /** *

* 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. *

* * @param gatewayCapabilitySummaries * 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. * @return Returns a reference to this object so that method calls can be chained together. */ Builder gatewayCapabilitySummaries(Collection gatewayCapabilitySummaries); /** *

* 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. *

* * @param gatewayCapabilitySummaries * 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. * @return Returns a reference to this object so that method calls can be chained together. */ Builder gatewayCapabilitySummaries(GatewayCapabilitySummary... gatewayCapabilitySummaries); /** *

* 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. *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding * the need to create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called * immediately and its result is passed to {@link #gatewayCapabilitySummaries(List)}. * * @param gatewayCapabilitySummaries * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #gatewayCapabilitySummaries(List) */ Builder gatewayCapabilitySummaries(Consumer... gatewayCapabilitySummaries); /** *

* The date the gateway was created, in Unix epoch time. *

* * @param creationDate * The date the gateway was created, in Unix epoch time. * @return Returns a reference to this object so that method calls can be chained together. */ Builder creationDate(Instant creationDate); /** *

* The date the gateway was last updated, in Unix epoch time. *

* * @param lastUpdateDate * The date the gateway was last updated, in Unix epoch time. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastUpdateDate(Instant lastUpdateDate); } static final class BuilderImpl extends IoTSiteWiseResponse.BuilderImpl implements Builder { private String gatewayId; private String gatewayName; private String gatewayArn; private GatewayPlatform gatewayPlatform; private List gatewayCapabilitySummaries = DefaultSdkAutoConstructList.getInstance(); private Instant creationDate; private Instant lastUpdateDate; private BuilderImpl() { } private BuilderImpl(DescribeGatewayResponse model) { super(model); gatewayId(model.gatewayId); gatewayName(model.gatewayName); gatewayArn(model.gatewayArn); gatewayPlatform(model.gatewayPlatform); gatewayCapabilitySummaries(model.gatewayCapabilitySummaries); creationDate(model.creationDate); lastUpdateDate(model.lastUpdateDate); } public final String getGatewayId() { return gatewayId; } @Override public final Builder gatewayId(String gatewayId) { this.gatewayId = gatewayId; return this; } public final void setGatewayId(String gatewayId) { this.gatewayId = gatewayId; } public final String getGatewayName() { return gatewayName; } @Override public final Builder gatewayName(String gatewayName) { this.gatewayName = gatewayName; return this; } public final void setGatewayName(String gatewayName) { this.gatewayName = gatewayName; } public final String getGatewayArn() { return gatewayArn; } @Override public final Builder gatewayArn(String gatewayArn) { this.gatewayArn = gatewayArn; return this; } public final void setGatewayArn(String gatewayArn) { this.gatewayArn = gatewayArn; } public final GatewayPlatform.Builder getGatewayPlatform() { return gatewayPlatform != null ? gatewayPlatform.toBuilder() : null; } @Override public final Builder gatewayPlatform(GatewayPlatform gatewayPlatform) { this.gatewayPlatform = gatewayPlatform; return this; } public final void setGatewayPlatform(GatewayPlatform.BuilderImpl gatewayPlatform) { this.gatewayPlatform = gatewayPlatform != null ? gatewayPlatform.build() : null; } public final Collection getGatewayCapabilitySummaries() { return gatewayCapabilitySummaries != null ? gatewayCapabilitySummaries.stream() .map(GatewayCapabilitySummary::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder gatewayCapabilitySummaries(Collection gatewayCapabilitySummaries) { this.gatewayCapabilitySummaries = GatewayCapabilitySummariesCopier.copy(gatewayCapabilitySummaries); return this; } @Override @SafeVarargs public final Builder gatewayCapabilitySummaries(GatewayCapabilitySummary... gatewayCapabilitySummaries) { gatewayCapabilitySummaries(Arrays.asList(gatewayCapabilitySummaries)); return this; } @Override @SafeVarargs public final Builder gatewayCapabilitySummaries(Consumer... gatewayCapabilitySummaries) { gatewayCapabilitySummaries(Stream.of(gatewayCapabilitySummaries) .map(c -> GatewayCapabilitySummary.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setGatewayCapabilitySummaries( Collection gatewayCapabilitySummaries) { this.gatewayCapabilitySummaries = GatewayCapabilitySummariesCopier.copyFromBuilder(gatewayCapabilitySummaries); } public final Instant getCreationDate() { return creationDate; } @Override public final Builder creationDate(Instant creationDate) { this.creationDate = creationDate; return this; } public final void setCreationDate(Instant creationDate) { this.creationDate = creationDate; } public final Instant getLastUpdateDate() { return lastUpdateDate; } @Override public final Builder lastUpdateDate(Instant lastUpdateDate) { this.lastUpdateDate = lastUpdateDate; return this; } public final void setLastUpdateDate(Instant lastUpdateDate) { this.lastUpdateDate = lastUpdateDate; } @Override public DescribeGatewayResponse build() { return new DescribeGatewayResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy