software.amazon.awssdk.services.transcribe.model.TranscriptionJob Maven / Gradle / Ivy
Show all versions of transcribe 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.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;
/**
*
* Describes an asynchronous transcription job that was created with the StartTranscriptionJob
operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TranscriptionJob implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField TRANSCRIPTION_JOB_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(TranscriptionJob::transcriptionJobName)).setter(setter(Builder::transcriptionJobName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TranscriptionJobName").build())
.build();
private static final SdkField TRANSCRIPTION_JOB_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(TranscriptionJob::transcriptionJobStatusAsString)).setter(setter(Builder::transcriptionJobStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TranscriptionJobStatus").build())
.build();
private static final SdkField LANGUAGE_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(TranscriptionJob::languageCodeAsString)).setter(setter(Builder::languageCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LanguageCode").build()).build();
private static final SdkField MEDIA_SAMPLE_RATE_HERTZ_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(TranscriptionJob::mediaSampleRateHertz)).setter(setter(Builder::mediaSampleRateHertz))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MediaSampleRateHertz").build())
.build();
private static final SdkField MEDIA_FORMAT_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(TranscriptionJob::mediaFormatAsString)).setter(setter(Builder::mediaFormat))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MediaFormat").build()).build();
private static final SdkField MEDIA_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(TranscriptionJob::media)).setter(setter(Builder::media)).constructor(Media::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Media").build()).build();
private static final SdkField TRANSCRIPT_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(TranscriptionJob::transcript)).setter(setter(Builder::transcript)).constructor(Transcript::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Transcript").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(TranscriptionJob::creationTime)).setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField COMPLETION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(TranscriptionJob::completionTime)).setter(setter(Builder::completionTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompletionTime").build()).build();
private static final SdkField FAILURE_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(TranscriptionJob::failureReason)).setter(setter(Builder::failureReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureReason").build()).build();
private static final SdkField SETTINGS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(TranscriptionJob::settings)).setter(setter(Builder::settings)).constructor(Settings::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Settings").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TRANSCRIPTION_JOB_NAME_FIELD,
TRANSCRIPTION_JOB_STATUS_FIELD, LANGUAGE_CODE_FIELD, MEDIA_SAMPLE_RATE_HERTZ_FIELD, MEDIA_FORMAT_FIELD, MEDIA_FIELD,
TRANSCRIPT_FIELD, CREATION_TIME_FIELD, COMPLETION_TIME_FIELD, FAILURE_REASON_FIELD, SETTINGS_FIELD));
private static final long serialVersionUID = 1L;
private final String transcriptionJobName;
private final String transcriptionJobStatus;
private final String languageCode;
private final Integer mediaSampleRateHertz;
private final String mediaFormat;
private final Media media;
private final Transcript transcript;
private final Instant creationTime;
private final Instant completionTime;
private final String failureReason;
private final Settings settings;
private TranscriptionJob(BuilderImpl builder) {
this.transcriptionJobName = builder.transcriptionJobName;
this.transcriptionJobStatus = builder.transcriptionJobStatus;
this.languageCode = builder.languageCode;
this.mediaSampleRateHertz = builder.mediaSampleRateHertz;
this.mediaFormat = builder.mediaFormat;
this.media = builder.media;
this.transcript = builder.transcript;
this.creationTime = builder.creationTime;
this.completionTime = builder.completionTime;
this.failureReason = builder.failureReason;
this.settings = builder.settings;
}
/**
*
* The name of the transcription job.
*
*
* @return The name of the transcription job.
*/
public String transcriptionJobName() {
return transcriptionJobName;
}
/**
*
* The status of the transcription job.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #transcriptionJobStatus} will return {@link TranscriptionJobStatus#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #transcriptionJobStatusAsString}.
*
*
* @return The status of the transcription job.
* @see TranscriptionJobStatus
*/
public TranscriptionJobStatus transcriptionJobStatus() {
return TranscriptionJobStatus.fromValue(transcriptionJobStatus);
}
/**
*
* The status of the transcription job.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #transcriptionJobStatus} will return {@link TranscriptionJobStatus#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #transcriptionJobStatusAsString}.
*
*
* @return The status of the transcription job.
* @see TranscriptionJobStatus
*/
public String transcriptionJobStatusAsString() {
return transcriptionJobStatus;
}
/**
*
* The language code for the input speech.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #languageCode} will
* return {@link LanguageCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #languageCodeAsString}.
*
*
* @return The language code for the input speech.
* @see LanguageCode
*/
public LanguageCode languageCode() {
return LanguageCode.fromValue(languageCode);
}
/**
*
* The language code for the input speech.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #languageCode} will
* return {@link LanguageCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #languageCodeAsString}.
*
*
* @return The language code for the input speech.
* @see LanguageCode
*/
public String languageCodeAsString() {
return languageCode;
}
/**
*
* The sample rate, in Hertz, of the audio track in the input media file.
*
*
* @return The sample rate, in Hertz, of the audio track in the input media file.
*/
public Integer mediaSampleRateHertz() {
return mediaSampleRateHertz;
}
/**
*
* The format of the input media file.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #mediaFormat} will
* return {@link MediaFormat#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #mediaFormatAsString}.
*
*
* @return The format of the input media file.
* @see MediaFormat
*/
public MediaFormat mediaFormat() {
return MediaFormat.fromValue(mediaFormat);
}
/**
*
* The format of the input media file.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #mediaFormat} will
* return {@link MediaFormat#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #mediaFormatAsString}.
*
*
* @return The format of the input media file.
* @see MediaFormat
*/
public String mediaFormatAsString() {
return mediaFormat;
}
/**
*
* An object that describes the input media for the transcription job.
*
*
* @return An object that describes the input media for the transcription job.
*/
public Media media() {
return media;
}
/**
*
* An object that describes the output of the transcription job.
*
*
* @return An object that describes the output of the transcription job.
*/
public Transcript transcript() {
return transcript;
}
/**
*
* A timestamp that shows when the job was created.
*
*
* @return A timestamp that shows when the job was created.
*/
public Instant creationTime() {
return creationTime;
}
/**
*
* A timestamp that shows when the job was completed.
*
*
* @return A timestamp that shows when the job was completed.
*/
public Instant completionTime() {
return completionTime;
}
/**
*
* If the TranscriptionJobStatus
field is FAILED
, this field contains information about
* why the job failed.
*
*
* @return If the TranscriptionJobStatus
field is FAILED
, this field contains information
* about why the job failed.
*/
public String failureReason() {
return failureReason;
}
/**
*
* Optional settings for the transcription job. Use these settings to turn on speaker recognition, to set the
* maximum number of speakers that should be identified and to specify a custom vocabulary to use when processing
* the transcription job.
*
*
* @return Optional settings for the transcription job. Use these settings to turn on speaker recognition, to set
* the maximum number of speakers that should be identified and to specify a custom vocabulary to use when
* processing the transcription job.
*/
public Settings settings() {
return settings;
}
@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(transcriptionJobName());
hashCode = 31 * hashCode + Objects.hashCode(transcriptionJobStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(languageCodeAsString());
hashCode = 31 * hashCode + Objects.hashCode(mediaSampleRateHertz());
hashCode = 31 * hashCode + Objects.hashCode(mediaFormatAsString());
hashCode = 31 * hashCode + Objects.hashCode(media());
hashCode = 31 * hashCode + Objects.hashCode(transcript());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(completionTime());
hashCode = 31 * hashCode + Objects.hashCode(failureReason());
hashCode = 31 * hashCode + Objects.hashCode(settings());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof TranscriptionJob)) {
return false;
}
TranscriptionJob other = (TranscriptionJob) obj;
return Objects.equals(transcriptionJobName(), other.transcriptionJobName())
&& Objects.equals(transcriptionJobStatusAsString(), other.transcriptionJobStatusAsString())
&& Objects.equals(languageCodeAsString(), other.languageCodeAsString())
&& Objects.equals(mediaSampleRateHertz(), other.mediaSampleRateHertz())
&& Objects.equals(mediaFormatAsString(), other.mediaFormatAsString()) && Objects.equals(media(), other.media())
&& Objects.equals(transcript(), other.transcript()) && Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(completionTime(), other.completionTime())
&& Objects.equals(failureReason(), other.failureReason()) && Objects.equals(settings(), other.settings());
}
/**
* 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("TranscriptionJob").add("TranscriptionJobName", transcriptionJobName())
.add("TranscriptionJobStatus", transcriptionJobStatusAsString()).add("LanguageCode", languageCodeAsString())
.add("MediaSampleRateHertz", mediaSampleRateHertz()).add("MediaFormat", mediaFormatAsString())
.add("Media", media()).add("Transcript", transcript()).add("CreationTime", creationTime())
.add("CompletionTime", completionTime()).add("FailureReason", failureReason()).add("Settings", settings())
.build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TranscriptionJobName":
return Optional.ofNullable(clazz.cast(transcriptionJobName()));
case "TranscriptionJobStatus":
return Optional.ofNullable(clazz.cast(transcriptionJobStatusAsString()));
case "LanguageCode":
return Optional.ofNullable(clazz.cast(languageCodeAsString()));
case "MediaSampleRateHertz":
return Optional.ofNullable(clazz.cast(mediaSampleRateHertz()));
case "MediaFormat":
return Optional.ofNullable(clazz.cast(mediaFormatAsString()));
case "Media":
return Optional.ofNullable(clazz.cast(media()));
case "Transcript":
return Optional.ofNullable(clazz.cast(transcript()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "CompletionTime":
return Optional.ofNullable(clazz.cast(completionTime()));
case "FailureReason":
return Optional.ofNullable(clazz.cast(failureReason()));
case "Settings":
return Optional.ofNullable(clazz.cast(settings()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function