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

software.amazon.awssdk.services.transcribe.model.LanguageModel Maven / Gradle / Ivy

Go to download

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

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.transcribe.model;

import java.io.Serializable;
import java.time.Instant;
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.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;

/**
 * 

* The structure used to describe a custom language model. *

*/ @Generated("software.amazon.awssdk:codegen") public final class LanguageModel implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField MODEL_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ModelName").getter(getter(LanguageModel::modelName)).setter(setter(Builder::modelName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModelName").build()).build(); private static final SdkField CREATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("CreateTime").getter(getter(LanguageModel::createTime)).setter(setter(Builder::createTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreateTime").build()).build(); private static final SdkField LAST_MODIFIED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("LastModifiedTime").getter(getter(LanguageModel::lastModifiedTime)) .setter(setter(Builder::lastModifiedTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedTime").build()).build(); private static final SdkField LANGUAGE_CODE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("LanguageCode").getter(getter(LanguageModel::languageCodeAsString)).setter(setter(Builder::languageCode)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LanguageCode").build()).build(); private static final SdkField BASE_MODEL_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("BaseModelName").getter(getter(LanguageModel::baseModelNameAsString)) .setter(setter(Builder::baseModelName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BaseModelName").build()).build(); private static final SdkField MODEL_STATUS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ModelStatus").getter(getter(LanguageModel::modelStatusAsString)).setter(setter(Builder::modelStatus)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModelStatus").build()).build(); private static final SdkField UPGRADE_AVAILABILITY_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("UpgradeAvailability").getter(getter(LanguageModel::upgradeAvailability)) .setter(setter(Builder::upgradeAvailability)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpgradeAvailability").build()) .build(); private static final SdkField FAILURE_REASON_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("FailureReason").getter(getter(LanguageModel::failureReason)).setter(setter(Builder::failureReason)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureReason").build()).build(); private static final SdkField INPUT_DATA_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("InputDataConfig") .getter(getter(LanguageModel::inputDataConfig)).setter(setter(Builder::inputDataConfig)) .constructor(InputDataConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InputDataConfig").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MODEL_NAME_FIELD, CREATE_TIME_FIELD, LAST_MODIFIED_TIME_FIELD, LANGUAGE_CODE_FIELD, BASE_MODEL_NAME_FIELD, MODEL_STATUS_FIELD, UPGRADE_AVAILABILITY_FIELD, FAILURE_REASON_FIELD, INPUT_DATA_CONFIG_FIELD)); private static final long serialVersionUID = 1L; private final String modelName; private final Instant createTime; private final Instant lastModifiedTime; private final String languageCode; private final String baseModelName; private final String modelStatus; private final Boolean upgradeAvailability; private final String failureReason; private final InputDataConfig inputDataConfig; private LanguageModel(BuilderImpl builder) { this.modelName = builder.modelName; this.createTime = builder.createTime; this.lastModifiedTime = builder.lastModifiedTime; this.languageCode = builder.languageCode; this.baseModelName = builder.baseModelName; this.modelStatus = builder.modelStatus; this.upgradeAvailability = builder.upgradeAvailability; this.failureReason = builder.failureReason; this.inputDataConfig = builder.inputDataConfig; } /** *

* The name of the custom language model. *

* * @return The name of the custom language model. */ public String modelName() { return modelName; } /** *

* The time the custom language model was created. *

* * @return The time the custom language model was created. */ public Instant createTime() { return createTime; } /** *

* The most recent time the custom language model was modified. *

* * @return The most recent time the custom language model was modified. */ public Instant lastModifiedTime() { return lastModifiedTime; } /** *

* The language code you used to create your custom language model. *

*

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

* * @return The language code you used to create your custom language model. * @see CLMLanguageCode */ public CLMLanguageCode languageCode() { return CLMLanguageCode.fromValue(languageCode); } /** *

* The language code you used to create your custom language model. *

*

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

* * @return The language code you used to create your custom language model. * @see CLMLanguageCode */ public String languageCodeAsString() { return languageCode; } /** *

* The Amazon Transcribe standard language model, or base model used to create the custom language model. *

*

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

* * @return The Amazon Transcribe standard language model, or base model used to create the custom language model. * @see BaseModelName */ public BaseModelName baseModelName() { return BaseModelName.fromValue(baseModelName); } /** *

* The Amazon Transcribe standard language model, or base model used to create the custom language model. *

*

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

* * @return The Amazon Transcribe standard language model, or base model used to create the custom language model. * @see BaseModelName */ public String baseModelNameAsString() { return baseModelName; } /** *

* The creation status of a custom language model. When the status is COMPLETED the model is ready for * use. *

*

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

* * @return The creation status of a custom language model. When the status is COMPLETED the model is * ready for use. * @see ModelStatus */ public ModelStatus modelStatus() { return ModelStatus.fromValue(modelStatus); } /** *

* The creation status of a custom language model. When the status is COMPLETED the model is ready for * use. *

*

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

* * @return The creation status of a custom language model. When the status is COMPLETED the model is * ready for use. * @see ModelStatus */ public String modelStatusAsString() { return modelStatus; } /** *

* Whether the base model used for the custom language model is up to date. If this field is true then * you are running the most up-to-date version of the base model in your custom language model. *

* * @return Whether the base model used for the custom language model is up to date. If this field is * true then you are running the most up-to-date version of the base model in your custom * language model. */ public Boolean upgradeAvailability() { return upgradeAvailability; } /** *

* The reason why the custom language model couldn't be created. *

* * @return The reason why the custom language model couldn't be created. */ public String failureReason() { return failureReason; } /** *

* The data access role and Amazon S3 prefixes for the input files used to train the custom language model. *

* * @return The data access role and Amazon S3 prefixes for the input files used to train the custom language model. */ public InputDataConfig inputDataConfig() { return inputDataConfig; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(modelName()); hashCode = 31 * hashCode + Objects.hashCode(createTime()); hashCode = 31 * hashCode + Objects.hashCode(lastModifiedTime()); hashCode = 31 * hashCode + Objects.hashCode(languageCodeAsString()); hashCode = 31 * hashCode + Objects.hashCode(baseModelNameAsString()); hashCode = 31 * hashCode + Objects.hashCode(modelStatusAsString()); hashCode = 31 * hashCode + Objects.hashCode(upgradeAvailability()); hashCode = 31 * hashCode + Objects.hashCode(failureReason()); hashCode = 31 * hashCode + Objects.hashCode(inputDataConfig()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof LanguageModel)) { return false; } LanguageModel other = (LanguageModel) obj; return Objects.equals(modelName(), other.modelName()) && Objects.equals(createTime(), other.createTime()) && Objects.equals(lastModifiedTime(), other.lastModifiedTime()) && Objects.equals(languageCodeAsString(), other.languageCodeAsString()) && Objects.equals(baseModelNameAsString(), other.baseModelNameAsString()) && Objects.equals(modelStatusAsString(), other.modelStatusAsString()) && Objects.equals(upgradeAvailability(), other.upgradeAvailability()) && Objects.equals(failureReason(), other.failureReason()) && Objects.equals(inputDataConfig(), other.inputDataConfig()); } /** * 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("LanguageModel").add("ModelName", modelName()).add("CreateTime", createTime()) .add("LastModifiedTime", lastModifiedTime()).add("LanguageCode", languageCodeAsString()) .add("BaseModelName", baseModelNameAsString()).add("ModelStatus", modelStatusAsString()) .add("UpgradeAvailability", upgradeAvailability()).add("FailureReason", failureReason()) .add("InputDataConfig", inputDataConfig()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ModelName": return Optional.ofNullable(clazz.cast(modelName())); case "CreateTime": return Optional.ofNullable(clazz.cast(createTime())); case "LastModifiedTime": return Optional.ofNullable(clazz.cast(lastModifiedTime())); case "LanguageCode": return Optional.ofNullable(clazz.cast(languageCodeAsString())); case "BaseModelName": return Optional.ofNullable(clazz.cast(baseModelNameAsString())); case "ModelStatus": return Optional.ofNullable(clazz.cast(modelStatusAsString())); case "UpgradeAvailability": return Optional.ofNullable(clazz.cast(upgradeAvailability())); case "FailureReason": return Optional.ofNullable(clazz.cast(failureReason())); case "InputDataConfig": return Optional.ofNullable(clazz.cast(inputDataConfig())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((LanguageModel) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the custom language model. *

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

* The time the custom language model was created. *

* * @param createTime * The time the custom language model 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 the custom language model was modified. *

* * @param lastModifiedTime * The most recent time the custom language model was modified. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastModifiedTime(Instant lastModifiedTime); /** *

* The language code you used to create your custom language model. *

* * @param languageCode * The language code you used to create your custom language model. * @see CLMLanguageCode * @return Returns a reference to this object so that method calls can be chained together. * @see CLMLanguageCode */ Builder languageCode(String languageCode); /** *

* The language code you used to create your custom language model. *

* * @param languageCode * The language code you used to create your custom language model. * @see CLMLanguageCode * @return Returns a reference to this object so that method calls can be chained together. * @see CLMLanguageCode */ Builder languageCode(CLMLanguageCode languageCode); /** *

* The Amazon Transcribe standard language model, or base model used to create the custom language model. *

* * @param baseModelName * The Amazon Transcribe standard language model, or base model used to create the custom language model. * @see BaseModelName * @return Returns a reference to this object so that method calls can be chained together. * @see BaseModelName */ Builder baseModelName(String baseModelName); /** *

* The Amazon Transcribe standard language model, or base model used to create the custom language model. *

* * @param baseModelName * The Amazon Transcribe standard language model, or base model used to create the custom language model. * @see BaseModelName * @return Returns a reference to this object so that method calls can be chained together. * @see BaseModelName */ Builder baseModelName(BaseModelName baseModelName); /** *

* The creation status of a custom language model. When the status is COMPLETED the model is ready * for use. *

* * @param modelStatus * The creation status of a custom language model. When the status is COMPLETED the model is * ready for use. * @see ModelStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ModelStatus */ Builder modelStatus(String modelStatus); /** *

* The creation status of a custom language model. When the status is COMPLETED the model is ready * for use. *

* * @param modelStatus * The creation status of a custom language model. When the status is COMPLETED the model is * ready for use. * @see ModelStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ModelStatus */ Builder modelStatus(ModelStatus modelStatus); /** *

* Whether the base model used for the custom language model is up to date. If this field is true * then you are running the most up-to-date version of the base model in your custom language model. *

* * @param upgradeAvailability * Whether the base model used for the custom language model is up to date. If this field is * true then you are running the most up-to-date version of the base model in your custom * language model. * @return Returns a reference to this object so that method calls can be chained together. */ Builder upgradeAvailability(Boolean upgradeAvailability); /** *

* The reason why the custom language model couldn't be created. *

* * @param failureReason * The reason why the custom language model couldn't be created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder failureReason(String failureReason); /** *

* The data access role and Amazon S3 prefixes for the input files used to train the custom language model. *

* * @param inputDataConfig * The data access role and Amazon S3 prefixes for the input files used to train the custom language * model. * @return Returns a reference to this object so that method calls can be chained together. */ Builder inputDataConfig(InputDataConfig inputDataConfig); /** *

* The data access role and Amazon S3 prefixes for the input files used to train the custom language model. *

* This is a convenience that creates an instance of the {@link InputDataConfig.Builder} avoiding the need to * create one manually via {@link InputDataConfig#builder()}. * * When the {@link Consumer} completes, {@link InputDataConfig.Builder#build()} is called immediately and its * result is passed to {@link #inputDataConfig(InputDataConfig)}. * * @param inputDataConfig * a consumer that will call methods on {@link InputDataConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #inputDataConfig(InputDataConfig) */ default Builder inputDataConfig(Consumer inputDataConfig) { return inputDataConfig(InputDataConfig.builder().applyMutation(inputDataConfig).build()); } } static final class BuilderImpl implements Builder { private String modelName; private Instant createTime; private Instant lastModifiedTime; private String languageCode; private String baseModelName; private String modelStatus; private Boolean upgradeAvailability; private String failureReason; private InputDataConfig inputDataConfig; private BuilderImpl() { } private BuilderImpl(LanguageModel model) { modelName(model.modelName); createTime(model.createTime); lastModifiedTime(model.lastModifiedTime); languageCode(model.languageCode); baseModelName(model.baseModelName); modelStatus(model.modelStatus); upgradeAvailability(model.upgradeAvailability); failureReason(model.failureReason); inputDataConfig(model.inputDataConfig); } public final String getModelName() { return modelName; } @Override public final Builder modelName(String modelName) { this.modelName = modelName; return this; } public final void setModelName(String modelName) { this.modelName = modelName; } public final Instant getCreateTime() { return createTime; } @Override public final Builder createTime(Instant createTime) { this.createTime = createTime; return this; } public final void setCreateTime(Instant createTime) { this.createTime = createTime; } public final Instant getLastModifiedTime() { return lastModifiedTime; } @Override public final Builder lastModifiedTime(Instant lastModifiedTime) { this.lastModifiedTime = lastModifiedTime; return this; } public final void setLastModifiedTime(Instant lastModifiedTime) { this.lastModifiedTime = lastModifiedTime; } public final String getLanguageCode() { return languageCode; } @Override public final Builder languageCode(String languageCode) { this.languageCode = languageCode; return this; } @Override public final Builder languageCode(CLMLanguageCode languageCode) { this.languageCode(languageCode == null ? null : languageCode.toString()); return this; } public final void setLanguageCode(String languageCode) { this.languageCode = languageCode; } public final String getBaseModelName() { return baseModelName; } @Override public final Builder baseModelName(String baseModelName) { this.baseModelName = baseModelName; return this; } @Override public final Builder baseModelName(BaseModelName baseModelName) { this.baseModelName(baseModelName == null ? null : baseModelName.toString()); return this; } public final void setBaseModelName(String baseModelName) { this.baseModelName = baseModelName; } public final String getModelStatus() { return modelStatus; } @Override public final Builder modelStatus(String modelStatus) { this.modelStatus = modelStatus; return this; } @Override public final Builder modelStatus(ModelStatus modelStatus) { this.modelStatus(modelStatus == null ? null : modelStatus.toString()); return this; } public final void setModelStatus(String modelStatus) { this.modelStatus = modelStatus; } public final Boolean getUpgradeAvailability() { return upgradeAvailability; } @Override public final Builder upgradeAvailability(Boolean upgradeAvailability) { this.upgradeAvailability = upgradeAvailability; return this; } public final void setUpgradeAvailability(Boolean upgradeAvailability) { this.upgradeAvailability = upgradeAvailability; } public final String getFailureReason() { return failureReason; } @Override public final Builder failureReason(String failureReason) { this.failureReason = failureReason; return this; } public final void setFailureReason(String failureReason) { this.failureReason = failureReason; } public final InputDataConfig.Builder getInputDataConfig() { return inputDataConfig != null ? inputDataConfig.toBuilder() : null; } @Override public final Builder inputDataConfig(InputDataConfig inputDataConfig) { this.inputDataConfig = inputDataConfig; return this; } public final void setInputDataConfig(InputDataConfig.BuilderImpl inputDataConfig) { this.inputDataConfig = inputDataConfig != null ? inputDataConfig.build() : null; } @Override public LanguageModel build() { return new LanguageModel(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy