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

software.amazon.awssdk.services.greengrass.model.GetResourceDefinitionResponse Maven / Gradle / Ivy

Go to download

>The AWS Java SDK for AWS Greengrass module holds the client classes that are used for communicating with AWS Greengrass Service

There is a newer version: 2.29.39
Show newest version
/*
 * Copyright 2014-2019 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.greengrass.model;

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 GetResourceDefinitionResponse extends GreengrassResponse implements
        ToCopyableBuilder {
    private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(GetResourceDefinitionResponse::arn)).setter(setter(Builder::arn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();

    private static final SdkField CREATION_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(GetResourceDefinitionResponse::creationTimestamp)).setter(setter(Builder::creationTimestamp))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTimestamp").build()).build();

    private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(GetResourceDefinitionResponse::id)).setter(setter(Builder::id))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();

    private static final SdkField LAST_UPDATED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(GetResourceDefinitionResponse::lastUpdatedTimestamp)).setter(setter(Builder::lastUpdatedTimestamp))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTimestamp").build())
            .build();

    private static final SdkField LATEST_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(GetResourceDefinitionResponse::latestVersion)).setter(setter(Builder::latestVersion))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LatestVersion").build()).build();

    private static final SdkField LATEST_VERSION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(GetResourceDefinitionResponse::latestVersionArn)).setter(setter(Builder::latestVersionArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LatestVersionArn").build()).build();

    private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(GetResourceDefinitionResponse::name)).setter(setter(Builder::name))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD,
            CREATION_TIMESTAMP_FIELD, ID_FIELD, LAST_UPDATED_TIMESTAMP_FIELD, LATEST_VERSION_FIELD, LATEST_VERSION_ARN_FIELD,
            NAME_FIELD));

    private final String arn;

    private final String creationTimestamp;

    private final String id;

    private final String lastUpdatedTimestamp;

    private final String latestVersion;

    private final String latestVersionArn;

    private final String name;

    private GetResourceDefinitionResponse(BuilderImpl builder) {
        super(builder);
        this.arn = builder.arn;
        this.creationTimestamp = builder.creationTimestamp;
        this.id = builder.id;
        this.lastUpdatedTimestamp = builder.lastUpdatedTimestamp;
        this.latestVersion = builder.latestVersion;
        this.latestVersionArn = builder.latestVersionArn;
        this.name = builder.name;
    }

    /**
     * The ARN of the definition.
     * 
     * @return The ARN of the definition.
     */
    public String arn() {
        return arn;
    }

    /**
     * The time, in milliseconds since the epoch, when the definition was created.
     * 
     * @return The time, in milliseconds since the epoch, when the definition was created.
     */
    public String creationTimestamp() {
        return creationTimestamp;
    }

    /**
     * The ID of the definition.
     * 
     * @return The ID of the definition.
     */
    public String id() {
        return id;
    }

    /**
     * The time, in milliseconds since the epoch, when the definition was last updated.
     * 
     * @return The time, in milliseconds since the epoch, when the definition was last updated.
     */
    public String lastUpdatedTimestamp() {
        return lastUpdatedTimestamp;
    }

    /**
     * The latest version of the definition.
     * 
     * @return The latest version of the definition.
     */
    public String latestVersion() {
        return latestVersion;
    }

    /**
     * The ARN of the latest version of the definition.
     * 
     * @return The ARN of the latest version of the definition.
     */
    public String latestVersionArn() {
        return latestVersionArn;
    }

    /**
     * The name of the definition.
     * 
     * @return The name of the definition.
     */
    public String name() {
        return name;
    }

    @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 + Objects.hashCode(arn());
        hashCode = 31 * hashCode + Objects.hashCode(creationTimestamp());
        hashCode = 31 * hashCode + Objects.hashCode(id());
        hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTimestamp());
        hashCode = 31 * hashCode + Objects.hashCode(latestVersion());
        hashCode = 31 * hashCode + Objects.hashCode(latestVersionArn());
        hashCode = 31 * hashCode + Objects.hashCode(name());
        return hashCode;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof GetResourceDefinitionResponse)) {
            return false;
        }
        GetResourceDefinitionResponse other = (GetResourceDefinitionResponse) obj;
        return Objects.equals(arn(), other.arn()) && Objects.equals(creationTimestamp(), other.creationTimestamp())
                && Objects.equals(id(), other.id()) && Objects.equals(lastUpdatedTimestamp(), other.lastUpdatedTimestamp())
                && Objects.equals(latestVersion(), other.latestVersion())
                && Objects.equals(latestVersionArn(), other.latestVersionArn()) && Objects.equals(name(), other.name());
    }

    /**
     * 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("GetResourceDefinitionResponse").add("Arn", arn()).add("CreationTimestamp", creationTimestamp())
                .add("Id", id()).add("LastUpdatedTimestamp", lastUpdatedTimestamp()).add("LatestVersion", latestVersion())
                .add("LatestVersionArn", latestVersionArn()).add("Name", name()).build();
    }

    public  Optional getValueForField(String fieldName, Class clazz) {
        switch (fieldName) {
        case "Arn":
            return Optional.ofNullable(clazz.cast(arn()));
        case "CreationTimestamp":
            return Optional.ofNullable(clazz.cast(creationTimestamp()));
        case "Id":
            return Optional.ofNullable(clazz.cast(id()));
        case "LastUpdatedTimestamp":
            return Optional.ofNullable(clazz.cast(lastUpdatedTimestamp()));
        case "LatestVersion":
            return Optional.ofNullable(clazz.cast(latestVersion()));
        case "LatestVersionArn":
            return Optional.ofNullable(clazz.cast(latestVersionArn()));
        case "Name":
            return Optional.ofNullable(clazz.cast(name()));
        default:
            return Optional.empty();
        }
    }

    @Override
    public List> sdkFields() {
        return SDK_FIELDS;
    }

    private static  Function getter(Function g) {
        return obj -> g.apply((GetResourceDefinitionResponse) obj);
    }

    private static  BiConsumer setter(BiConsumer s) {
        return (obj, val) -> s.accept((Builder) obj, val);
    }

    public interface Builder extends GreengrassResponse.Builder, SdkPojo, CopyableBuilder {
        /**
         * The ARN of the definition.
         * 
         * @param arn
         *        The ARN of the definition.
         * @return Returns a reference to this object so that method calls can be chained together.
         */
        Builder arn(String arn);

        /**
         * The time, in milliseconds since the epoch, when the definition was created.
         * 
         * @param creationTimestamp
         *        The time, in milliseconds since the epoch, when the definition was created.
         * @return Returns a reference to this object so that method calls can be chained together.
         */
        Builder creationTimestamp(String creationTimestamp);

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

        /**
         * The time, in milliseconds since the epoch, when the definition was last updated.
         * 
         * @param lastUpdatedTimestamp
         *        The time, in milliseconds since the epoch, when the definition was last updated.
         * @return Returns a reference to this object so that method calls can be chained together.
         */
        Builder lastUpdatedTimestamp(String lastUpdatedTimestamp);

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

        /**
         * The ARN of the latest version of the definition.
         * 
         * @param latestVersionArn
         *        The ARN of the latest version of the definition.
         * @return Returns a reference to this object so that method calls can be chained together.
         */
        Builder latestVersionArn(String latestVersionArn);

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

    static final class BuilderImpl extends GreengrassResponse.BuilderImpl implements Builder {
        private String arn;

        private String creationTimestamp;

        private String id;

        private String lastUpdatedTimestamp;

        private String latestVersion;

        private String latestVersionArn;

        private String name;

        private BuilderImpl() {
        }

        private BuilderImpl(GetResourceDefinitionResponse model) {
            super(model);
            arn(model.arn);
            creationTimestamp(model.creationTimestamp);
            id(model.id);
            lastUpdatedTimestamp(model.lastUpdatedTimestamp);
            latestVersion(model.latestVersion);
            latestVersionArn(model.latestVersionArn);
            name(model.name);
        }

        public final String getArn() {
            return arn;
        }

        @Override
        public final Builder arn(String arn) {
            this.arn = arn;
            return this;
        }

        public final void setArn(String arn) {
            this.arn = arn;
        }

        public final String getCreationTimestamp() {
            return creationTimestamp;
        }

        @Override
        public final Builder creationTimestamp(String creationTimestamp) {
            this.creationTimestamp = creationTimestamp;
            return this;
        }

        public final void setCreationTimestamp(String creationTimestamp) {
            this.creationTimestamp = creationTimestamp;
        }

        public final String getId() {
            return id;
        }

        @Override
        public final Builder id(String id) {
            this.id = id;
            return this;
        }

        public final void setId(String id) {
            this.id = id;
        }

        public final String getLastUpdatedTimestamp() {
            return lastUpdatedTimestamp;
        }

        @Override
        public final Builder lastUpdatedTimestamp(String lastUpdatedTimestamp) {
            this.lastUpdatedTimestamp = lastUpdatedTimestamp;
            return this;
        }

        public final void setLastUpdatedTimestamp(String lastUpdatedTimestamp) {
            this.lastUpdatedTimestamp = lastUpdatedTimestamp;
        }

        public final String getLatestVersion() {
            return latestVersion;
        }

        @Override
        public final Builder latestVersion(String latestVersion) {
            this.latestVersion = latestVersion;
            return this;
        }

        public final void setLatestVersion(String latestVersion) {
            this.latestVersion = latestVersion;
        }

        public final String getLatestVersionArn() {
            return latestVersionArn;
        }

        @Override
        public final Builder latestVersionArn(String latestVersionArn) {
            this.latestVersionArn = latestVersionArn;
            return this;
        }

        public final void setLatestVersionArn(String latestVersionArn) {
            this.latestVersionArn = latestVersionArn;
        }

        public final String getName() {
            return name;
        }

        @Override
        public final Builder name(String name) {
            this.name = name;
            return this;
        }

        public final void setName(String name) {
            this.name = name;
        }

        @Override
        public GetResourceDefinitionResponse build() {
            return new GetResourceDefinitionResponse(this);
        }

        @Override
        public List> sdkFields() {
            return SDK_FIELDS;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy