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

software.amazon.awssdk.services.lexmodelbuilding.model.GetImportResponse 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.lexmodelbuilding.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.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.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 GetImportResponse extends LexModelBuildingResponse implements
        ToCopyableBuilder {
    private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
            .getter(getter(GetImportResponse::name)).setter(setter(Builder::name))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();

    private static final SdkField RESOURCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("resourceType").getter(getter(GetImportResponse::resourceTypeAsString))
            .setter(setter(Builder::resourceType))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceType").build()).build();

    private static final SdkField MERGE_STRATEGY_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("mergeStrategy").getter(getter(GetImportResponse::mergeStrategyAsString))
            .setter(setter(Builder::mergeStrategy))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("mergeStrategy").build()).build();

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

    private static final SdkField IMPORT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("importStatus").getter(getter(GetImportResponse::importStatusAsString))
            .setter(setter(Builder::importStatus))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("importStatus").build()).build();

    private static final SdkField> FAILURE_REASON_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("failureReason")
            .getter(getter(GetImportResponse::failureReason))
            .setter(setter(Builder::failureReason))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("failureReason").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField CREATED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
            .memberName("createdDate").getter(getter(GetImportResponse::createdDate)).setter(setter(Builder::createdDate))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdDate").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD,
            RESOURCE_TYPE_FIELD, MERGE_STRATEGY_FIELD, IMPORT_ID_FIELD, IMPORT_STATUS_FIELD, FAILURE_REASON_FIELD,
            CREATED_DATE_FIELD));

    private final String name;

    private final String resourceType;

    private final String mergeStrategy;

    private final String importId;

    private final String importStatus;

    private final List failureReason;

    private final Instant createdDate;

    private GetImportResponse(BuilderImpl builder) {
        super(builder);
        this.name = builder.name;
        this.resourceType = builder.resourceType;
        this.mergeStrategy = builder.mergeStrategy;
        this.importId = builder.importId;
        this.importStatus = builder.importStatus;
        this.failureReason = builder.failureReason;
        this.createdDate = builder.createdDate;
    }

    /**
     * 

* The name given to the import job. *

* * @return The name given to the import job. */ public final String name() { return name; } /** *

* The type of resource imported. *

*

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

* * @return The type of resource imported. * @see ResourceType */ public final ResourceType resourceType() { return ResourceType.fromValue(resourceType); } /** *

* The type of resource imported. *

*

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

* * @return The type of resource imported. * @see ResourceType */ public final String resourceTypeAsString() { return resourceType; } /** *

* The action taken when there was a conflict between an existing resource and a resource in the import file. *

*

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

* * @return The action taken when there was a conflict between an existing resource and a resource in the import * file. * @see MergeStrategy */ public final MergeStrategy mergeStrategy() { return MergeStrategy.fromValue(mergeStrategy); } /** *

* The action taken when there was a conflict between an existing resource and a resource in the import file. *

*

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

* * @return The action taken when there was a conflict between an existing resource and a resource in the import * file. * @see MergeStrategy */ public final String mergeStrategyAsString() { return mergeStrategy; } /** *

* The identifier for the specific import job. *

* * @return The identifier for the specific import job. */ public final String importId() { return importId; } /** *

* The status of the import job. If the status is FAILED, you can get the reason for the failure from * the failureReason field. *

*

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

* * @return The status of the import job. If the status is FAILED, you can get the reason for the * failure from the failureReason field. * @see ImportStatus */ public final ImportStatus importStatus() { return ImportStatus.fromValue(importStatus); } /** *

* The status of the import job. If the status is FAILED, you can get the reason for the failure from * the failureReason field. *

*

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

* * @return The status of the import job. If the status is FAILED, you can get the reason for the * failure from the failureReason field. * @see ImportStatus */ public final String importStatusAsString() { return importStatus; } /** * For responses, this returns true if the service returned a value for the FailureReason 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 hasFailureReason() { return failureReason != null && !(failureReason instanceof SdkAutoConstructList); } /** *

* A string that describes why an import job failed to complete. *

*

* 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 #hasFailureReason} method. *

* * @return A string that describes why an import job failed to complete. */ public final List failureReason() { return failureReason; } /** *

* A timestamp for the date and time that the import job was created. *

* * @return A timestamp for the date and time that the import job was created. */ public final Instant createdDate() { return createdDate; } @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(name()); hashCode = 31 * hashCode + Objects.hashCode(resourceTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(mergeStrategyAsString()); hashCode = 31 * hashCode + Objects.hashCode(importId()); hashCode = 31 * hashCode + Objects.hashCode(importStatusAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasFailureReason() ? failureReason() : null); hashCode = 31 * hashCode + Objects.hashCode(createdDate()); 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 GetImportResponse)) { return false; } GetImportResponse other = (GetImportResponse) obj; return Objects.equals(name(), other.name()) && Objects.equals(resourceTypeAsString(), other.resourceTypeAsString()) && Objects.equals(mergeStrategyAsString(), other.mergeStrategyAsString()) && Objects.equals(importId(), other.importId()) && Objects.equals(importStatusAsString(), other.importStatusAsString()) && hasFailureReason() == other.hasFailureReason() && Objects.equals(failureReason(), other.failureReason()) && Objects.equals(createdDate(), other.createdDate()); } /** * 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("GetImportResponse").add("Name", name()).add("ResourceType", resourceTypeAsString()) .add("MergeStrategy", mergeStrategyAsString()).add("ImportId", importId()) .add("ImportStatus", importStatusAsString()).add("FailureReason", hasFailureReason() ? failureReason() : null) .add("CreatedDate", createdDate()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "name": return Optional.ofNullable(clazz.cast(name())); case "resourceType": return Optional.ofNullable(clazz.cast(resourceTypeAsString())); case "mergeStrategy": return Optional.ofNullable(clazz.cast(mergeStrategyAsString())); case "importId": return Optional.ofNullable(clazz.cast(importId())); case "importStatus": return Optional.ofNullable(clazz.cast(importStatusAsString())); case "failureReason": return Optional.ofNullable(clazz.cast(failureReason())); case "createdDate": return Optional.ofNullable(clazz.cast(createdDate())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((GetImportResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends LexModelBuildingResponse.Builder, SdkPojo, CopyableBuilder { /** *

* The name given to the import job. *

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

* The type of resource imported. *

* * @param resourceType * The type of resource imported. * @see ResourceType * @return Returns a reference to this object so that method calls can be chained together. * @see ResourceType */ Builder resourceType(String resourceType); /** *

* The type of resource imported. *

* * @param resourceType * The type of resource imported. * @see ResourceType * @return Returns a reference to this object so that method calls can be chained together. * @see ResourceType */ Builder resourceType(ResourceType resourceType); /** *

* The action taken when there was a conflict between an existing resource and a resource in the import file. *

* * @param mergeStrategy * The action taken when there was a conflict between an existing resource and a resource in the import * file. * @see MergeStrategy * @return Returns a reference to this object so that method calls can be chained together. * @see MergeStrategy */ Builder mergeStrategy(String mergeStrategy); /** *

* The action taken when there was a conflict between an existing resource and a resource in the import file. *

* * @param mergeStrategy * The action taken when there was a conflict between an existing resource and a resource in the import * file. * @see MergeStrategy * @return Returns a reference to this object so that method calls can be chained together. * @see MergeStrategy */ Builder mergeStrategy(MergeStrategy mergeStrategy); /** *

* The identifier for the specific import job. *

* * @param importId * The identifier for the specific import job. * @return Returns a reference to this object so that method calls can be chained together. */ Builder importId(String importId); /** *

* The status of the import job. If the status is FAILED, you can get the reason for the failure * from the failureReason field. *

* * @param importStatus * The status of the import job. If the status is FAILED, you can get the reason for the * failure from the failureReason field. * @see ImportStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ImportStatus */ Builder importStatus(String importStatus); /** *

* The status of the import job. If the status is FAILED, you can get the reason for the failure * from the failureReason field. *

* * @param importStatus * The status of the import job. If the status is FAILED, you can get the reason for the * failure from the failureReason field. * @see ImportStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ImportStatus */ Builder importStatus(ImportStatus importStatus); /** *

* A string that describes why an import job failed to complete. *

* * @param failureReason * A string that describes why an import job failed to complete. * @return Returns a reference to this object so that method calls can be chained together. */ Builder failureReason(Collection failureReason); /** *

* A string that describes why an import job failed to complete. *

* * @param failureReason * A string that describes why an import job failed to complete. * @return Returns a reference to this object so that method calls can be chained together. */ Builder failureReason(String... failureReason); /** *

* A timestamp for the date and time that the import job was created. *

* * @param createdDate * A timestamp for the date and time that the import job was created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder createdDate(Instant createdDate); } static final class BuilderImpl extends LexModelBuildingResponse.BuilderImpl implements Builder { private String name; private String resourceType; private String mergeStrategy; private String importId; private String importStatus; private List failureReason = DefaultSdkAutoConstructList.getInstance(); private Instant createdDate; private BuilderImpl() { } private BuilderImpl(GetImportResponse model) { super(model); name(model.name); resourceType(model.resourceType); mergeStrategy(model.mergeStrategy); importId(model.importId); importStatus(model.importStatus); failureReason(model.failureReason); createdDate(model.createdDate); } 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 String getResourceType() { return resourceType; } public final void setResourceType(String resourceType) { this.resourceType = resourceType; } @Override public final Builder resourceType(String resourceType) { this.resourceType = resourceType; return this; } @Override public final Builder resourceType(ResourceType resourceType) { this.resourceType(resourceType == null ? null : resourceType.toString()); return this; } public final String getMergeStrategy() { return mergeStrategy; } public final void setMergeStrategy(String mergeStrategy) { this.mergeStrategy = mergeStrategy; } @Override public final Builder mergeStrategy(String mergeStrategy) { this.mergeStrategy = mergeStrategy; return this; } @Override public final Builder mergeStrategy(MergeStrategy mergeStrategy) { this.mergeStrategy(mergeStrategy == null ? null : mergeStrategy.toString()); return this; } public final String getImportId() { return importId; } public final void setImportId(String importId) { this.importId = importId; } @Override public final Builder importId(String importId) { this.importId = importId; return this; } public final String getImportStatus() { return importStatus; } public final void setImportStatus(String importStatus) { this.importStatus = importStatus; } @Override public final Builder importStatus(String importStatus) { this.importStatus = importStatus; return this; } @Override public final Builder importStatus(ImportStatus importStatus) { this.importStatus(importStatus == null ? null : importStatus.toString()); return this; } public final Collection getFailureReason() { if (failureReason instanceof SdkAutoConstructList) { return null; } return failureReason; } public final void setFailureReason(Collection failureReason) { this.failureReason = StringListCopier.copy(failureReason); } @Override public final Builder failureReason(Collection failureReason) { this.failureReason = StringListCopier.copy(failureReason); return this; } @Override @SafeVarargs public final Builder failureReason(String... failureReason) { failureReason(Arrays.asList(failureReason)); return this; } public final Instant getCreatedDate() { return createdDate; } public final void setCreatedDate(Instant createdDate) { this.createdDate = createdDate; } @Override public final Builder createdDate(Instant createdDate) { this.createdDate = createdDate; return this; } @Override public GetImportResponse build() { return new GetImportResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy