Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.wisdom.model.StartImportJobRequest Maven / Gradle / Ivy
Go to download
The AWS Java SDK for Wisdom module holds the client classes that are used for
communicating with Wisdom.
/*
* 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.wisdom.model;
import java.util.Arrays;
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 software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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.DefaultValueTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
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 StartImportJobRequest extends WisdomRequest implements
ToCopyableBuilder {
private static final SdkField CLIENT_TOKEN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("clientToken")
.getter(getter(StartImportJobRequest::clientToken))
.setter(setter(Builder::clientToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clientToken").build(),
DefaultValueTrait.idempotencyToken()).build();
private static final SdkField EXTERNAL_SOURCE_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("externalSourceConfiguration")
.getter(getter(StartImportJobRequest::externalSourceConfiguration))
.setter(setter(Builder::externalSourceConfiguration))
.constructor(ExternalSourceConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("externalSourceConfiguration")
.build()).build();
private static final SdkField IMPORT_JOB_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("importJobType").getter(getter(StartImportJobRequest::importJobTypeAsString))
.setter(setter(Builder::importJobType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("importJobType").build()).build();
private static final SdkField KNOWLEDGE_BASE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("knowledgeBaseId").getter(getter(StartImportJobRequest::knowledgeBaseId))
.setter(setter(Builder::knowledgeBaseId))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("knowledgeBaseId").build()).build();
private static final SdkField> METADATA_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("metadata")
.getter(getter(StartImportJobRequest::metadata))
.setter(setter(Builder::metadata))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("metadata").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 UPLOAD_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("uploadId").getter(getter(StartImportJobRequest::uploadId)).setter(setter(Builder::uploadId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("uploadId").build()).build();
private static final List> SDK_FIELDS = Collections
.unmodifiableList(Arrays.asList(CLIENT_TOKEN_FIELD, EXTERNAL_SOURCE_CONFIGURATION_FIELD, IMPORT_JOB_TYPE_FIELD,
KNOWLEDGE_BASE_ID_FIELD, METADATA_FIELD, UPLOAD_ID_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private final String clientToken;
private final ExternalSourceConfiguration externalSourceConfiguration;
private final String importJobType;
private final String knowledgeBaseId;
private final Map metadata;
private final String uploadId;
private StartImportJobRequest(BuilderImpl builder) {
super(builder);
this.clientToken = builder.clientToken;
this.externalSourceConfiguration = builder.externalSourceConfiguration;
this.importJobType = builder.importJobType;
this.knowledgeBaseId = builder.knowledgeBaseId;
this.metadata = builder.metadata;
this.uploadId = builder.uploadId;
}
/**
*
* The tags used to organize, track, or control access for this resource.
*
*
* @return The tags used to organize, track, or control access for this resource.
*/
public final String clientToken() {
return clientToken;
}
/**
*
* The configuration information of the external source that the resource data are imported from.
*
*
* @return The configuration information of the external source that the resource data are imported from.
*/
public final ExternalSourceConfiguration externalSourceConfiguration() {
return externalSourceConfiguration;
}
/**
*
* The type of the import job.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #importJobType}
* will return {@link ImportJobType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #importJobTypeAsString}.
*
*
* @return The type of the import job.
*
*
*
* For importing quick response resource, set the value to QUICK_RESPONSES
.
*
*
* @see ImportJobType
*/
public final ImportJobType importJobType() {
return ImportJobType.fromValue(importJobType);
}
/**
*
* The type of the import job.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #importJobType}
* will return {@link ImportJobType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #importJobTypeAsString}.
*
*
* @return The type of the import job.
*
*
*
* For importing quick response resource, set the value to QUICK_RESPONSES
.
*
*
* @see ImportJobType
*/
public final String importJobTypeAsString() {
return importJobType;
}
/**
*
* The identifier of the knowledge base. This should not be a QUICK_RESPONSES type knowledge base if you're storing
* Wisdom Content resource to it. Can be either the ID or the ARN. URLs cannot contain the ARN.
*
*
*
* @return The identifier of the knowledge base. This should not be a QUICK_RESPONSES type knowledge base if you're
* storing Wisdom Content resource to it. Can be either the ID or the ARN. URLs cannot contain the ARN.
*
*
*
* For importing Wisdom quick responses, this should be a QUICK_RESPONSES
type knowledge base.
*
*
*/
public final String knowledgeBaseId() {
return knowledgeBaseId;
}
/**
* For responses, this returns true if the service returned a value for the Metadata 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 hasMetadata() {
return metadata != null && !(metadata instanceof SdkAutoConstructMap);
}
/**
*
* The metadata fields of the imported Wisdom resources.
*
*
* 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 #hasMetadata} method.
*
*
* @return The metadata fields of the imported Wisdom resources.
*/
public final Map metadata() {
return metadata;
}
/**
*
* A pointer to the uploaded asset. This value is returned by StartContentUpload .
*
*
* @return A pointer to the uploaded asset. This value is returned by StartContentUpload .
*/
public final String uploadId() {
return uploadId;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(clientToken());
hashCode = 31 * hashCode + Objects.hashCode(externalSourceConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(importJobTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(knowledgeBaseId());
hashCode = 31 * hashCode + Objects.hashCode(hasMetadata() ? metadata() : null);
hashCode = 31 * hashCode + Objects.hashCode(uploadId());
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 StartImportJobRequest)) {
return false;
}
StartImportJobRequest other = (StartImportJobRequest) obj;
return Objects.equals(clientToken(), other.clientToken())
&& Objects.equals(externalSourceConfiguration(), other.externalSourceConfiguration())
&& Objects.equals(importJobTypeAsString(), other.importJobTypeAsString())
&& Objects.equals(knowledgeBaseId(), other.knowledgeBaseId()) && hasMetadata() == other.hasMetadata()
&& Objects.equals(metadata(), other.metadata()) && Objects.equals(uploadId(), other.uploadId());
}
/**
* 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("StartImportJobRequest").add("ClientToken", clientToken())
.add("ExternalSourceConfiguration", externalSourceConfiguration()).add("ImportJobType", importJobTypeAsString())
.add("KnowledgeBaseId", knowledgeBaseId()).add("Metadata", hasMetadata() ? metadata() : null)
.add("UploadId", uploadId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "clientToken":
return Optional.ofNullable(clazz.cast(clientToken()));
case "externalSourceConfiguration":
return Optional.ofNullable(clazz.cast(externalSourceConfiguration()));
case "importJobType":
return Optional.ofNullable(clazz.cast(importJobTypeAsString()));
case "knowledgeBaseId":
return Optional.ofNullable(clazz.cast(knowledgeBaseId()));
case "metadata":
return Optional.ofNullable(clazz.cast(metadata()));
case "uploadId":
return Optional.ofNullable(clazz.cast(uploadId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("clientToken", CLIENT_TOKEN_FIELD);
map.put("externalSourceConfiguration", EXTERNAL_SOURCE_CONFIGURATION_FIELD);
map.put("importJobType", IMPORT_JOB_TYPE_FIELD);
map.put("knowledgeBaseId", KNOWLEDGE_BASE_ID_FIELD);
map.put("metadata", METADATA_FIELD);
map.put("uploadId", UPLOAD_ID_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function getter(Function g) {
return obj -> g.apply((StartImportJobRequest) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends WisdomRequest.Builder, SdkPojo, CopyableBuilder {
/**
*
* The tags used to organize, track, or control access for this resource.
*
*
* @param clientToken
* The tags used to organize, track, or control access for this resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder clientToken(String clientToken);
/**
*
* The configuration information of the external source that the resource data are imported from.
*
*
* @param externalSourceConfiguration
* The configuration information of the external source that the resource data are imported from.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder externalSourceConfiguration(ExternalSourceConfiguration externalSourceConfiguration);
/**
*
* The configuration information of the external source that the resource data are imported from.
*
* This is a convenience method that creates an instance of the {@link ExternalSourceConfiguration.Builder}
* avoiding the need to create one manually via {@link ExternalSourceConfiguration#builder()}.
*
*
* When the {@link Consumer} completes, {@link ExternalSourceConfiguration.Builder#build()} is called
* immediately and its result is passed to {@link #externalSourceConfiguration(ExternalSourceConfiguration)}.
*
* @param externalSourceConfiguration
* a consumer that will call methods on {@link ExternalSourceConfiguration.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #externalSourceConfiguration(ExternalSourceConfiguration)
*/
default Builder externalSourceConfiguration(Consumer externalSourceConfiguration) {
return externalSourceConfiguration(ExternalSourceConfiguration.builder().applyMutation(externalSourceConfiguration)
.build());
}
/**
*
* The type of the import job.
*
*
*
* @param importJobType
* The type of the import job.
*
*
*
* For importing quick response resource, set the value to QUICK_RESPONSES
.
*
*
* @see ImportJobType
* @return Returns a reference to this object so that method calls can be chained together.
* @see ImportJobType
*/
Builder importJobType(String importJobType);
/**
*
* The type of the import job.
*
*
*
* @param importJobType
* The type of the import job.
*
*
*
* For importing quick response resource, set the value to QUICK_RESPONSES
.
*
*
* @see ImportJobType
* @return Returns a reference to this object so that method calls can be chained together.
* @see ImportJobType
*/
Builder importJobType(ImportJobType importJobType);
/**
*
* The identifier of the knowledge base. This should not be a QUICK_RESPONSES type knowledge base if you're
* storing Wisdom Content resource to it. Can be either the ID or the ARN. URLs cannot contain the ARN.
*
*
*
* @param knowledgeBaseId
* The identifier of the knowledge base. This should not be a QUICK_RESPONSES type knowledge base if
* you're storing Wisdom Content resource to it. Can be either the ID or the ARN. URLs cannot contain the
* ARN.
*
*
*
* For importing Wisdom quick responses, this should be a QUICK_RESPONSES
type knowledge
* base.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder knowledgeBaseId(String knowledgeBaseId);
/**
*
* The metadata fields of the imported Wisdom resources.
*
*
* @param metadata
* The metadata fields of the imported Wisdom resources.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder metadata(Map metadata);
/**
*
* A pointer to the uploaded asset. This value is returned by StartContentUpload .
*
*
* @param uploadId
* A pointer to the uploaded asset. This value is returned by StartContentUpload .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder uploadId(String uploadId);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends WisdomRequest.BuilderImpl implements Builder {
private String clientToken;
private ExternalSourceConfiguration externalSourceConfiguration;
private String importJobType;
private String knowledgeBaseId;
private Map metadata = DefaultSdkAutoConstructMap.getInstance();
private String uploadId;
private BuilderImpl() {
}
private BuilderImpl(StartImportJobRequest model) {
super(model);
clientToken(model.clientToken);
externalSourceConfiguration(model.externalSourceConfiguration);
importJobType(model.importJobType);
knowledgeBaseId(model.knowledgeBaseId);
metadata(model.metadata);
uploadId(model.uploadId);
}
public final String getClientToken() {
return clientToken;
}
public final void setClientToken(String clientToken) {
this.clientToken = clientToken;
}
@Override
public final Builder clientToken(String clientToken) {
this.clientToken = clientToken;
return this;
}
public final ExternalSourceConfiguration.Builder getExternalSourceConfiguration() {
return externalSourceConfiguration != null ? externalSourceConfiguration.toBuilder() : null;
}
public final void setExternalSourceConfiguration(ExternalSourceConfiguration.BuilderImpl externalSourceConfiguration) {
this.externalSourceConfiguration = externalSourceConfiguration != null ? externalSourceConfiguration.build() : null;
}
@Override
public final Builder externalSourceConfiguration(ExternalSourceConfiguration externalSourceConfiguration) {
this.externalSourceConfiguration = externalSourceConfiguration;
return this;
}
public final String getImportJobType() {
return importJobType;
}
public final void setImportJobType(String importJobType) {
this.importJobType = importJobType;
}
@Override
public final Builder importJobType(String importJobType) {
this.importJobType = importJobType;
return this;
}
@Override
public final Builder importJobType(ImportJobType importJobType) {
this.importJobType(importJobType == null ? null : importJobType.toString());
return this;
}
public final String getKnowledgeBaseId() {
return knowledgeBaseId;
}
public final void setKnowledgeBaseId(String knowledgeBaseId) {
this.knowledgeBaseId = knowledgeBaseId;
}
@Override
public final Builder knowledgeBaseId(String knowledgeBaseId) {
this.knowledgeBaseId = knowledgeBaseId;
return this;
}
public final Map getMetadata() {
if (metadata instanceof SdkAutoConstructMap) {
return null;
}
return metadata;
}
public final void setMetadata(Map metadata) {
this.metadata = ContentMetadataCopier.copy(metadata);
}
@Override
public final Builder metadata(Map metadata) {
this.metadata = ContentMetadataCopier.copy(metadata);
return this;
}
public final String getUploadId() {
return uploadId;
}
public final void setUploadId(String uploadId) {
this.uploadId = uploadId;
}
@Override
public final Builder uploadId(String uploadId) {
this.uploadId = uploadId;
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 StartImportJobRequest build() {
return new StartImportJobRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}