Ci sono altri AWS SDK esempi disponibili nel repository AWS Doc SDK Examples GitHub .
Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Utilizzare DescribeTextTranslationJob
con un AWS SDK o CLI
I seguenti esempi di codice mostrano come utilizzareDescribeTextTranslationJob
.
Gli esempi di operazioni sono estratti di codice da programmi più grandi e devono essere eseguiti nel contesto. È possibile visualizzare questa operazione nel contesto nel seguente esempio di codice:
- .NET
-
- AWS SDK for .NET
-
using System;
using System.Threading.Tasks;
using Amazon.Translate;
using Amazon.Translate.Model;
/// <summary>
/// The following example shows how to retrieve the details of
/// a text translation job using Amazon Translate.
/// </summary>
public class DescribeTextTranslation
{
public static async Task Main()
{
var client = new AmazonTranslateClient();
// The Job Id is generated when the text translation job is started
// with a call to the StartTextTranslationJob method.
var jobId = "1234567890abcdef01234567890abcde";
var request = new DescribeTextTranslationJobRequest
{
JobId = jobId,
};
var jobProperties = await DescribeTranslationJobAsync(client, request);
DisplayTranslationJobDetails(jobProperties);
}
/// <summary>
/// Retrieve information about an Amazon Translate text translation job.
/// </summary>
/// <param name="client">The initialized Amazon Translate client object.</param>
/// <param name="request">The DescribeTextTranslationJobRequest object.</param>
/// <returns>The TextTranslationJobProperties object containing
/// information about the text translation job..</returns>
public static async Task<TextTranslationJobProperties> DescribeTranslationJobAsync(
AmazonTranslateClient client,
DescribeTextTranslationJobRequest request)
{
var response = await client.DescribeTextTranslationJobAsync(request);
if (response.HttpStatusCode == System.Net.HttpStatusCode.OK)
{
return response.TextTranslationJobProperties;
}
else
{
return null;
}
}
/// <summary>
/// Displays the properties of the text translation job.
/// </summary>
/// <param name="jobProperties">The properties of the text translation
/// job returned by the call to DescribeTextTranslationJobAsync.</param>
public static void DisplayTranslationJobDetails(TextTranslationJobProperties jobProperties)
{
if (jobProperties is null)
{
Console.WriteLine("No text translation job properties found.");
return;
}
// Display the details of the text translation job.
Console.WriteLine($"{jobProperties.JobId}: {jobProperties.JobName}");
}
}
- SAP ABAP
-
- SDKper SAP ABAP
-
"Gets the properties associated with an asynchronous batch translation job."
"Includes properties such as name, ID, status, source and target languages, and input/output Amazon Simple Storage Service (Amazon S3) buckets."
TRY.
oo_result = lo_xl8->describetexttranslationjob( "oo_result is returned for testing purposes."
EXPORTING
iv_jobid = iv_jobid
).
MESSAGE 'Job description retrieved.' TYPE 'I'.
CATCH /aws1/cx_xl8internalserverex .
MESSAGE 'An internal server error occurred. Retry your request.' TYPE 'E'.
CATCH /aws1/cx_xl8resourcenotfoundex .
MESSAGE 'The resource you are looking for has not been found.' TYPE 'E'.
CATCH /aws1/cx_xl8toomanyrequestsex.
MESSAGE 'You have made too many requests within a short period of time.' TYPE 'E'.
ENDTRY.