software.amazon.awssdk.services.translate.model.ImportTerminologyRequest Maven / Gradle / Ivy
Show all versions of translate Show documentation
/*
* 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.translate.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.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.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 ImportTerminologyRequest extends TranslateRequest implements
ToCopyableBuilder {
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ImportTerminologyRequest::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField MERGE_STRATEGY_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ImportTerminologyRequest::mergeStrategyAsString)).setter(setter(Builder::mergeStrategy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MergeStrategy").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ImportTerminologyRequest::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField TERMINOLOGY_DATA_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(ImportTerminologyRequest::terminologyData))
.setter(setter(Builder::terminologyData)).constructor(TerminologyData::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TerminologyData").build()).build();
private static final SdkField ENCRYPTION_KEY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(ImportTerminologyRequest::encryptionKey))
.setter(setter(Builder::encryptionKey)).constructor(EncryptionKey::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EncryptionKey").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD,
MERGE_STRATEGY_FIELD, DESCRIPTION_FIELD, TERMINOLOGY_DATA_FIELD, ENCRYPTION_KEY_FIELD));
private final String name;
private final String mergeStrategy;
private final String description;
private final TerminologyData terminologyData;
private final EncryptionKey encryptionKey;
private ImportTerminologyRequest(BuilderImpl builder) {
super(builder);
this.name = builder.name;
this.mergeStrategy = builder.mergeStrategy;
this.description = builder.description;
this.terminologyData = builder.terminologyData;
this.encryptionKey = builder.encryptionKey;
}
/**
*
* The name of the custom terminology being imported.
*
*
* @return The name of the custom terminology being imported.
*/
public String name() {
return name;
}
/**
*
* The merge strategy of the custom terminology being imported. Currently, only the OVERWRITE merge strategy is
* supported. In this case, the imported terminology will overwrite an existing terminology of the same name.
*
*
* 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 merge strategy of the custom terminology being imported. Currently, only the OVERWRITE merge strategy
* is supported. In this case, the imported terminology will overwrite an existing terminology of the same
* name.
* @see MergeStrategy
*/
public MergeStrategy mergeStrategy() {
return MergeStrategy.fromValue(mergeStrategy);
}
/**
*
* The merge strategy of the custom terminology being imported. Currently, only the OVERWRITE merge strategy is
* supported. In this case, the imported terminology will overwrite an existing terminology of the same name.
*
*
* 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 merge strategy of the custom terminology being imported. Currently, only the OVERWRITE merge strategy
* is supported. In this case, the imported terminology will overwrite an existing terminology of the same
* name.
* @see MergeStrategy
*/
public String mergeStrategyAsString() {
return mergeStrategy;
}
/**
*
* The description of the custom terminology being imported.
*
*
* @return The description of the custom terminology being imported.
*/
public String description() {
return description;
}
/**
*
* The terminology data for the custom terminology being imported.
*
*
* @return The terminology data for the custom terminology being imported.
*/
public TerminologyData terminologyData() {
return terminologyData;
}
/**
*
* The encryption key for the custom terminology being imported.
*
*
* @return The encryption key for the custom terminology being imported.
*/
public EncryptionKey encryptionKey() {
return encryptionKey;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(mergeStrategyAsString());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(terminologyData());
hashCode = 31 * hashCode + Objects.hashCode(encryptionKey());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ImportTerminologyRequest)) {
return false;
}
ImportTerminologyRequest other = (ImportTerminologyRequest) obj;
return Objects.equals(name(), other.name()) && Objects.equals(mergeStrategyAsString(), other.mergeStrategyAsString())
&& Objects.equals(description(), other.description())
&& Objects.equals(terminologyData(), other.terminologyData())
&& Objects.equals(encryptionKey(), other.encryptionKey());
}
/**
* 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("ImportTerminologyRequest").add("Name", name()).add("MergeStrategy", mergeStrategyAsString())
.add("Description", description()).add("TerminologyData", terminologyData())
.add("EncryptionKey", encryptionKey()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "MergeStrategy":
return Optional.ofNullable(clazz.cast(mergeStrategyAsString()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "TerminologyData":
return Optional.ofNullable(clazz.cast(terminologyData()));
case "EncryptionKey":
return Optional.ofNullable(clazz.cast(encryptionKey()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function