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

software.amazon.awssdk.services.cleanroomsml.model.GetTrainingDatasetResponse Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Clean Rooms ML module holds the client classes that are used for communicating with Clean Rooms ML.

There is a newer version: 2.29.19
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.cleanroomsml.model;

import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.traits.MapTrait;
import software.amazon.awssdk.core.traits.TimestampFormatTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
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 GetTrainingDatasetResponse extends CleanRoomsMlResponse implements
        ToCopyableBuilder {
    private static final SdkField CREATE_TIME_FIELD = SdkField
            . builder(MarshallingType.INSTANT)
            .memberName("createTime")
            .getter(getter(GetTrainingDatasetResponse::createTime))
            .setter(setter(Builder::createTime))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createTime").build(),
                    TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();

    private static final SdkField UPDATE_TIME_FIELD = SdkField
            . builder(MarshallingType.INSTANT)
            .memberName("updateTime")
            .getter(getter(GetTrainingDatasetResponse::updateTime))
            .setter(setter(Builder::updateTime))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("updateTime").build(),
                    TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();

    private static final SdkField TRAINING_DATASET_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("trainingDatasetArn").getter(getter(GetTrainingDatasetResponse::trainingDatasetArn))
            .setter(setter(Builder::trainingDatasetArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("trainingDatasetArn").build())
            .build();

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

    private static final SdkField> TRAINING_DATA_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("trainingData")
            .getter(getter(GetTrainingDatasetResponse::trainingData))
            .setter(setter(Builder::trainingData))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("trainingData").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(Dataset::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
            .getter(getter(GetTrainingDatasetResponse::statusAsString)).setter(setter(Builder::status))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();

    private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("roleArn").getter(getter(GetTrainingDatasetResponse::roleArn)).setter(setter(Builder::roleArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("roleArn").build()).build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("tags")
            .getter(getter(GetTrainingDatasetResponse::tags))
            .setter(setter(Builder::tags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build()).build()).build()).build();

    private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("description").getter(getter(GetTrainingDatasetResponse::description))
            .setter(setter(Builder::description))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CREATE_TIME_FIELD,
            UPDATE_TIME_FIELD, TRAINING_DATASET_ARN_FIELD, NAME_FIELD, TRAINING_DATA_FIELD, STATUS_FIELD, ROLE_ARN_FIELD,
            TAGS_FIELD, DESCRIPTION_FIELD));

    private static final Map> SDK_NAME_TO_FIELD = Collections
            .unmodifiableMap(new HashMap>() {
                {
                    put("createTime", CREATE_TIME_FIELD);
                    put("updateTime", UPDATE_TIME_FIELD);
                    put("trainingDatasetArn", TRAINING_DATASET_ARN_FIELD);
                    put("name", NAME_FIELD);
                    put("trainingData", TRAINING_DATA_FIELD);
                    put("status", STATUS_FIELD);
                    put("roleArn", ROLE_ARN_FIELD);
                    put("tags", TAGS_FIELD);
                    put("description", DESCRIPTION_FIELD);
                }
            });

    private final Instant createTime;

    private final Instant updateTime;

    private final String trainingDatasetArn;

    private final String name;

    private final List trainingData;

    private final String status;

    private final String roleArn;

    private final Map tags;

    private final String description;

    private GetTrainingDatasetResponse(BuilderImpl builder) {
        super(builder);
        this.createTime = builder.createTime;
        this.updateTime = builder.updateTime;
        this.trainingDatasetArn = builder.trainingDatasetArn;
        this.name = builder.name;
        this.trainingData = builder.trainingData;
        this.status = builder.status;
        this.roleArn = builder.roleArn;
        this.tags = builder.tags;
        this.description = builder.description;
    }

    /**
     * 

* The time at which the training dataset was created. *

* * @return The time at which the training dataset was created. */ public final Instant createTime() { return createTime; } /** *

* The most recent time at which the training dataset was updated. *

* * @return The most recent time at which the training dataset was updated. */ public final Instant updateTime() { return updateTime; } /** *

* The Amazon Resource Name (ARN) of the training dataset. *

* * @return The Amazon Resource Name (ARN) of the training dataset. */ public final String trainingDatasetArn() { return trainingDatasetArn; } /** *

* The name of the training dataset. *

* * @return The name of the training dataset. */ public final String name() { return name; } /** * For responses, this returns true if the service returned a value for the TrainingData property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasTrainingData() { return trainingData != null && !(trainingData instanceof SdkAutoConstructList); } /** *

* Metadata about the requested training data. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasTrainingData} method. *

* * @return Metadata about the requested training data. */ public final List trainingData() { return trainingData; } /** *

* The status of the training dataset. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #status} will * return {@link TrainingDatasetStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #statusAsString}. *

* * @return The status of the training dataset. * @see TrainingDatasetStatus */ public final TrainingDatasetStatus status() { return TrainingDatasetStatus.fromValue(status); } /** *

* The status of the training dataset. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #status} will * return {@link TrainingDatasetStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #statusAsString}. *

* * @return The status of the training dataset. * @see TrainingDatasetStatus */ public final String statusAsString() { return status; } /** *

* The IAM role used to read the training data. *

* * @return The IAM role used to read the training data. */ public final String roleArn() { return roleArn; } /** * For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that * the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful * because the SDK will never return a null collection or map, but you may need to differentiate between the service * returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true * if a value for the property was specified in the request builder, and false if a value was not specified. */ public final boolean hasTags() { return tags != null && !(tags instanceof SdkAutoConstructMap); } /** *

* The tags that are assigned to this training dataset. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasTags} method. *

* * @return The tags that are assigned to this training dataset. */ public final Map tags() { return tags; } /** *

* The description of the training dataset. *

* * @return The description of the training dataset. */ public final String description() { return description; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(createTime()); hashCode = 31 * hashCode + Objects.hashCode(updateTime()); hashCode = 31 * hashCode + Objects.hashCode(trainingDatasetArn()); hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(hasTrainingData() ? trainingData() : null); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); hashCode = 31 * hashCode + Objects.hashCode(roleArn()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); hashCode = 31 * hashCode + Objects.hashCode(description()); 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 GetTrainingDatasetResponse)) { return false; } GetTrainingDatasetResponse other = (GetTrainingDatasetResponse) obj; return Objects.equals(createTime(), other.createTime()) && Objects.equals(updateTime(), other.updateTime()) && Objects.equals(trainingDatasetArn(), other.trainingDatasetArn()) && Objects.equals(name(), other.name()) && hasTrainingData() == other.hasTrainingData() && Objects.equals(trainingData(), other.trainingData()) && Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(roleArn(), other.roleArn()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()) && Objects.equals(description(), other.description()); } /** * 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("GetTrainingDatasetResponse").add("CreateTime", createTime()).add("UpdateTime", updateTime()) .add("TrainingDatasetArn", trainingDatasetArn()).add("Name", name()) .add("TrainingData", hasTrainingData() ? trainingData() : null).add("Status", statusAsString()) .add("RoleArn", roleArn()).add("Tags", hasTags() ? tags() : null).add("Description", description()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "createTime": return Optional.ofNullable(clazz.cast(createTime())); case "updateTime": return Optional.ofNullable(clazz.cast(updateTime())); case "trainingDatasetArn": return Optional.ofNullable(clazz.cast(trainingDatasetArn())); case "name": return Optional.ofNullable(clazz.cast(name())); case "trainingData": return Optional.ofNullable(clazz.cast(trainingData())); case "status": return Optional.ofNullable(clazz.cast(statusAsString())); case "roleArn": return Optional.ofNullable(clazz.cast(roleArn())); case "tags": return Optional.ofNullable(clazz.cast(tags())); case "description": return Optional.ofNullable(clazz.cast(description())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Function getter(Function g) { return obj -> g.apply((GetTrainingDatasetResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends CleanRoomsMlResponse.Builder, SdkPojo, CopyableBuilder { /** *

* The time at which the training dataset was created. *

* * @param createTime * The time at which the training dataset was created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder createTime(Instant createTime); /** *

* The most recent time at which the training dataset was updated. *

* * @param updateTime * The most recent time at which the training dataset was updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder updateTime(Instant updateTime); /** *

* The Amazon Resource Name (ARN) of the training dataset. *

* * @param trainingDatasetArn * The Amazon Resource Name (ARN) of the training dataset. * @return Returns a reference to this object so that method calls can be chained together. */ Builder trainingDatasetArn(String trainingDatasetArn); /** *

* The name of the training dataset. *

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

* Metadata about the requested training data. *

* * @param trainingData * Metadata about the requested training data. * @return Returns a reference to this object so that method calls can be chained together. */ Builder trainingData(Collection trainingData); /** *

* Metadata about the requested training data. *

* * @param trainingData * Metadata about the requested training data. * @return Returns a reference to this object so that method calls can be chained together. */ Builder trainingData(Dataset... trainingData); /** *

* Metadata about the requested training data. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.cleanroomsml.model.Dataset.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.cleanroomsml.model.Dataset#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.cleanroomsml.model.Dataset.Builder#build()} is called immediately and * its result is passed to {@link #trainingData(List)}. * * @param trainingData * a consumer that will call methods on * {@link software.amazon.awssdk.services.cleanroomsml.model.Dataset.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #trainingData(java.util.Collection) */ Builder trainingData(Consumer... trainingData); /** *

* The status of the training dataset. *

* * @param status * The status of the training dataset. * @see TrainingDatasetStatus * @return Returns a reference to this object so that method calls can be chained together. * @see TrainingDatasetStatus */ Builder status(String status); /** *

* The status of the training dataset. *

* * @param status * The status of the training dataset. * @see TrainingDatasetStatus * @return Returns a reference to this object so that method calls can be chained together. * @see TrainingDatasetStatus */ Builder status(TrainingDatasetStatus status); /** *

* The IAM role used to read the training data. *

* * @param roleArn * The IAM role used to read the training data. * @return Returns a reference to this object so that method calls can be chained together. */ Builder roleArn(String roleArn); /** *

* The tags that are assigned to this training dataset. *

* * @param tags * The tags that are assigned to this training dataset. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Map tags); /** *

* The description of the training dataset. *

* * @param description * The description of the training dataset. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); } static final class BuilderImpl extends CleanRoomsMlResponse.BuilderImpl implements Builder { private Instant createTime; private Instant updateTime; private String trainingDatasetArn; private String name; private List trainingData = DefaultSdkAutoConstructList.getInstance(); private String status; private String roleArn; private Map tags = DefaultSdkAutoConstructMap.getInstance(); private String description; private BuilderImpl() { } private BuilderImpl(GetTrainingDatasetResponse model) { super(model); createTime(model.createTime); updateTime(model.updateTime); trainingDatasetArn(model.trainingDatasetArn); name(model.name); trainingData(model.trainingData); status(model.status); roleArn(model.roleArn); tags(model.tags); description(model.description); } public final Instant getCreateTime() { return createTime; } public final void setCreateTime(Instant createTime) { this.createTime = createTime; } @Override public final Builder createTime(Instant createTime) { this.createTime = createTime; return this; } public final Instant getUpdateTime() { return updateTime; } public final void setUpdateTime(Instant updateTime) { this.updateTime = updateTime; } @Override public final Builder updateTime(Instant updateTime) { this.updateTime = updateTime; return this; } public final String getTrainingDatasetArn() { return trainingDatasetArn; } public final void setTrainingDatasetArn(String trainingDatasetArn) { this.trainingDatasetArn = trainingDatasetArn; } @Override public final Builder trainingDatasetArn(String trainingDatasetArn) { this.trainingDatasetArn = trainingDatasetArn; return this; } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final List getTrainingData() { List result = DatasetListCopier.copyToBuilder(this.trainingData); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setTrainingData(Collection trainingData) { this.trainingData = DatasetListCopier.copyFromBuilder(trainingData); } @Override public final Builder trainingData(Collection trainingData) { this.trainingData = DatasetListCopier.copy(trainingData); return this; } @Override @SafeVarargs public final Builder trainingData(Dataset... trainingData) { trainingData(Arrays.asList(trainingData)); return this; } @Override @SafeVarargs public final Builder trainingData(Consumer... trainingData) { trainingData(Stream.of(trainingData).map(c -> Dataset.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final String getStatus() { return status; } public final void setStatus(String status) { this.status = status; } @Override public final Builder status(String status) { this.status = status; return this; } @Override public final Builder status(TrainingDatasetStatus status) { this.status(status == null ? null : status.toString()); return this; } public final String getRoleArn() { return roleArn; } public final void setRoleArn(String roleArn) { this.roleArn = roleArn; } @Override public final Builder roleArn(String roleArn) { this.roleArn = roleArn; return this; } public final Map getTags() { if (tags instanceof SdkAutoConstructMap) { return null; } return tags; } public final void setTags(Map tags) { this.tags = TagMapCopier.copy(tags); } @Override public final Builder tags(Map tags) { this.tags = TagMapCopier.copy(tags); return this; } public final String getDescription() { return description; } public final void setDescription(String description) { this.description = description; } @Override public final Builder description(String description) { this.description = description; return this; } @Override public GetTrainingDatasetResponse build() { return new GetTrainingDatasetResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy