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

software.amazon.awssdk.services.lexmodelbuilding.model.StartImportRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Lex Model Building module holds the client classes that are used for communicating with Amazon Lex Model Building Service

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

import java.nio.ByteBuffer;
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.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkBytes;
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 StartImportRequest extends LexModelBuildingRequest implements
        ToCopyableBuilder {
    private static final SdkField PAYLOAD_FIELD = SdkField. builder(MarshallingType.SDK_BYTES)
            .memberName("payload").getter(getter(StartImportRequest::payload)).setter(setter(Builder::payload))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("payload").build()).build();

    private static final SdkField RESOURCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("resourceType").getter(getter(StartImportRequest::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(StartImportRequest::mergeStrategyAsString))
            .setter(setter(Builder::mergeStrategy))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("mergeStrategy").build()).build();

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

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PAYLOAD_FIELD,
            RESOURCE_TYPE_FIELD, MERGE_STRATEGY_FIELD, TAGS_FIELD));

    private final SdkBytes payload;

    private final String resourceType;

    private final String mergeStrategy;

    private final List tags;

    private StartImportRequest(BuilderImpl builder) {
        super(builder);
        this.payload = builder.payload;
        this.resourceType = builder.resourceType;
        this.mergeStrategy = builder.mergeStrategy;
        this.tags = builder.tags;
    }

    /**
     * 

* A zip archive in binary format. The archive should contain one file, a JSON file containing the resource to * import. The resource should match the type specified in the resourceType field. *

* * @return A zip archive in binary format. The archive should contain one file, a JSON file containing the resource * to import. The resource should match the type specified in the resourceType field. */ public final SdkBytes payload() { return payload; } /** *

* Specifies the type of resource to export. Each resource also exports any resources that it depends on. *

*
    *
  • *

    * A bot exports dependent intents. *

    *
  • *
  • *

    * An intent exports dependent slot types. *

    *
  • *
*

* 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 Specifies the type of resource to export. Each resource also exports any resources that it depends on. *

*
    *
  • *

    * A bot exports dependent intents. *

    *
  • *
  • *

    * An intent exports dependent slot types. *

    *
  • * @see ResourceType */ public final ResourceType resourceType() { return ResourceType.fromValue(resourceType); } /** *

    * Specifies the type of resource to export. Each resource also exports any resources that it depends on. *

    *
      *
    • *

      * A bot exports dependent intents. *

      *
    • *
    • *

      * An intent exports dependent slot types. *

      *
    • *
    *

    * 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 Specifies the type of resource to export. Each resource also exports any resources that it depends on. *

    *
      *
    • *

      * A bot exports dependent intents. *

      *
    • *
    • *

      * An intent exports dependent slot types. *

      *
    • * @see ResourceType */ public final String resourceTypeAsString() { return resourceType; } /** *

      * Specifies the action that the StartImport operation should take when there is an existing resource * with the same name. *

      *
        *
      • *

        * FAIL_ON_CONFLICT - The import operation is stopped on the first conflict between a resource in the import file * and an existing resource. The name of the resource causing the conflict is in the failureReason * field of the response to the GetImport operation. *

        *

        * OVERWRITE_LATEST - The import operation proceeds even if there is a conflict with an existing resource. The * $LASTEST version of the existing resource is overwritten with the data from 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 Specifies the action that the StartImport operation should take when there is an existing * resource with the same name.

      *
        *
      • *

        * FAIL_ON_CONFLICT - The import operation is stopped on the first conflict between a resource in the import * file and an existing resource. The name of the resource causing the conflict is in the * failureReason field of the response to the GetImport operation. *

        *

        * OVERWRITE_LATEST - The import operation proceeds even if there is a conflict with an existing resource. * The $LASTEST version of the existing resource is overwritten with the data from the import file. *

        *
      • * @see MergeStrategy */ public final MergeStrategy mergeStrategy() { return MergeStrategy.fromValue(mergeStrategy); } /** *

        * Specifies the action that the StartImport operation should take when there is an existing resource * with the same name. *

        *
          *
        • *

          * FAIL_ON_CONFLICT - The import operation is stopped on the first conflict between a resource in the import file * and an existing resource. The name of the resource causing the conflict is in the failureReason * field of the response to the GetImport operation. *

          *

          * OVERWRITE_LATEST - The import operation proceeds even if there is a conflict with an existing resource. The * $LASTEST version of the existing resource is overwritten with the data from 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 Specifies the action that the StartImport operation should take when there is an existing * resource with the same name.

        *
          *
        • *

          * FAIL_ON_CONFLICT - The import operation is stopped on the first conflict between a resource in the import * file and an existing resource. The name of the resource causing the conflict is in the * failureReason field of the response to the GetImport operation. *

          *

          * OVERWRITE_LATEST - The import operation proceeds even if there is a conflict with an existing resource. * The $LASTEST version of the existing resource is overwritten with the data from the import file. *

          *
        • * @see MergeStrategy */ public final String mergeStrategyAsString() { return mergeStrategy; } /** * 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 SdkAutoConstructList); } /** *

          * A list of tags to add to the imported bot. You can only add tags when you import a bot, you can't add tags to an * intent or slot type. *

          *

          * 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 A list of tags to add to the imported bot. You can only add tags when you import a bot, you can't add * tags to an intent or slot type. */ public final List tags() { return tags; } @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(payload()); hashCode = 31 * hashCode + Objects.hashCode(resourceTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(mergeStrategyAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); 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 StartImportRequest)) { return false; } StartImportRequest other = (StartImportRequest) obj; return Objects.equals(payload(), other.payload()) && Objects.equals(resourceTypeAsString(), other.resourceTypeAsString()) && Objects.equals(mergeStrategyAsString(), other.mergeStrategyAsString()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()); } /** * 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("StartImportRequest").add("Payload", payload()).add("ResourceType", resourceTypeAsString()) .add("MergeStrategy", mergeStrategyAsString()).add("Tags", hasTags() ? tags() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "payload": return Optional.ofNullable(clazz.cast(payload())); case "resourceType": return Optional.ofNullable(clazz.cast(resourceTypeAsString())); case "mergeStrategy": return Optional.ofNullable(clazz.cast(mergeStrategyAsString())); case "tags": return Optional.ofNullable(clazz.cast(tags())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((StartImportRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends LexModelBuildingRequest.Builder, SdkPojo, CopyableBuilder { /** *

          * A zip archive in binary format. The archive should contain one file, a JSON file containing the resource to * import. The resource should match the type specified in the resourceType field. *

          * * @param payload * A zip archive in binary format. The archive should contain one file, a JSON file containing the * resource to import. The resource should match the type specified in the resourceType * field. * @return Returns a reference to this object so that method calls can be chained together. */ Builder payload(SdkBytes payload); /** *

          * Specifies the type of resource to export. Each resource also exports any resources that it depends on. *

          *
            *
          • *

            * A bot exports dependent intents. *

            *
          • *
          • *

            * An intent exports dependent slot types. *

            *
          • *
          * * @param resourceType * Specifies the type of resource to export. Each resource also exports any resources that it depends on. *

          *
            *
          • *

            * A bot exports dependent intents. *

            *
          • *
          • *

            * An intent exports dependent slot types. *

            *
          • * @see ResourceType * @return Returns a reference to this object so that method calls can be chained together. * @see ResourceType */ Builder resourceType(String resourceType); /** *

            * Specifies the type of resource to export. Each resource also exports any resources that it depends on. *

            *
              *
            • *

              * A bot exports dependent intents. *

              *
            • *
            • *

              * An intent exports dependent slot types. *

              *
            • *
            * * @param resourceType * Specifies the type of resource to export. Each resource also exports any resources that it depends on. *

            *
              *
            • *

              * A bot exports dependent intents. *

              *
            • *
            • *

              * An intent exports dependent slot types. *

              *
            • * @see ResourceType * @return Returns a reference to this object so that method calls can be chained together. * @see ResourceType */ Builder resourceType(ResourceType resourceType); /** *

              * Specifies the action that the StartImport operation should take when there is an existing * resource with the same name. *

              *
                *
              • *

                * FAIL_ON_CONFLICT - The import operation is stopped on the first conflict between a resource in the import * file and an existing resource. The name of the resource causing the conflict is in the * failureReason field of the response to the GetImport operation. *

                *

                * OVERWRITE_LATEST - The import operation proceeds even if there is a conflict with an existing resource. The * $LASTEST version of the existing resource is overwritten with the data from the import file. *

                *
              • *
              * * @param mergeStrategy * Specifies the action that the StartImport operation should take when there is an existing * resource with the same name.

              *
                *
              • *

                * FAIL_ON_CONFLICT - The import operation is stopped on the first conflict between a resource in the * import file and an existing resource. The name of the resource causing the conflict is in the * failureReason field of the response to the GetImport operation. *

                *

                * OVERWRITE_LATEST - The import operation proceeds even if there is a conflict with an existing * resource. The $LASTEST version of the existing resource is overwritten with the data from 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); /** *

                * Specifies the action that the StartImport operation should take when there is an existing * resource with the same name. *

                *
                  *
                • *

                  * FAIL_ON_CONFLICT - The import operation is stopped on the first conflict between a resource in the import * file and an existing resource. The name of the resource causing the conflict is in the * failureReason field of the response to the GetImport operation. *

                  *

                  * OVERWRITE_LATEST - The import operation proceeds even if there is a conflict with an existing resource. The * $LASTEST version of the existing resource is overwritten with the data from the import file. *

                  *
                • *
                * * @param mergeStrategy * Specifies the action that the StartImport operation should take when there is an existing * resource with the same name.

                *
                  *
                • *

                  * FAIL_ON_CONFLICT - The import operation is stopped on the first conflict between a resource in the * import file and an existing resource. The name of the resource causing the conflict is in the * failureReason field of the response to the GetImport operation. *

                  *

                  * OVERWRITE_LATEST - The import operation proceeds even if there is a conflict with an existing * resource. The $LASTEST version of the existing resource is overwritten with the data from 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); /** *

                  * A list of tags to add to the imported bot. You can only add tags when you import a bot, you can't add tags to * an intent or slot type. *

                  * * @param tags * A list of tags to add to the imported bot. You can only add tags when you import a bot, you can't add * tags to an intent or slot type. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Collection tags); /** *

                  * A list of tags to add to the imported bot. You can only add tags when you import a bot, you can't add tags to * an intent or slot type. *

                  * * @param tags * A list of tags to add to the imported bot. You can only add tags when you import a bot, you can't add * tags to an intent or slot type. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Tag... tags); /** *

                  * A list of tags to add to the imported bot. You can only add tags when you import a bot, you can't add tags to * an intent or slot type. *

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

                  * When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.lexmodelbuilding.model.Tag.Builder#build()} is called immediately and * its result is passed to {@link #tags(List)}. * * @param tags * a consumer that will call methods on * {@link software.amazon.awssdk.services.lexmodelbuilding.model.Tag.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tags(java.util.Collection) */ Builder tags(Consumer... tags); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends LexModelBuildingRequest.BuilderImpl implements Builder { private SdkBytes payload; private String resourceType; private String mergeStrategy; private List tags = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(StartImportRequest model) { super(model); payload(model.payload); resourceType(model.resourceType); mergeStrategy(model.mergeStrategy); tags(model.tags); } public final ByteBuffer getPayload() { return payload == null ? null : payload.asByteBuffer(); } public final void setPayload(ByteBuffer payload) { payload(payload == null ? null : SdkBytes.fromByteBuffer(payload)); } @Override public final Builder payload(SdkBytes payload) { this.payload = payload; 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 List getTags() { List result = TagListCopier.copyToBuilder(this.tags); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setTags(Collection tags) { this.tags = TagListCopier.copyFromBuilder(tags); } @Override public final Builder tags(Collection tags) { this.tags = TagListCopier.copy(tags); return this; } @Override @SafeVarargs public final Builder tags(Tag... tags) { tags(Arrays.asList(tags)); return this; } @Override @SafeVarargs public final Builder tags(Consumer... tags) { tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public StartImportRequest build() { return new StartImportRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy