Struct aws_sdk_translate::Client
source · [−]pub struct Client { /* private fields */ }Expand description
Client for Amazon Translate
Client for invoking operations on Amazon Translate. Each operation on Amazon Translate is a method on this
this struct. .send() MUST be invoked on the generated operations to dispatch the request to the service.
Examples
Constructing a client and invoking an operation
// create a shared configuration. This can be used & shared between multiple service clients.
let shared_config = aws_config::load_from_env().await;
let client = aws_sdk_translate::Client::new(&shared_config);
// invoke an operation
/* let rsp = client
.<operation_name>().
.<param>("some value")
.send().await; */Constructing a client with custom configuration
use aws_config::RetryConfig;
let shared_config = aws_config::load_from_env().await;
let config = aws_sdk_translate::config::Builder::from(&shared_config)
.retry_config(RetryConfig::disabled())
.build();
let client = aws_sdk_translate::Client::from_conf(config);Implementations
sourceimpl Client
impl Client
sourcepub fn with_config(
client: Client<DynConnector, DynMiddleware<DynConnector>>,
conf: Config
) -> Self
pub fn with_config(
client: Client<DynConnector, DynMiddleware<DynConnector>>,
conf: Config
) -> Self
Creates a client with the given service configuration.
sourceimpl Client
impl Client
sourcepub fn create_parallel_data(&self) -> CreateParallelData
pub fn create_parallel_data(&self) -> CreateParallelData
Constructs a fluent builder for the CreateParallelData operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):A custom name for the parallel data resource in Amazon Translate. You must assign a name that is unique in the account and region.
description(impl Into<String>)/set_description(Option<String>):A custom description for the parallel data resource in Amazon Translate.
parallel_data_config(ParallelDataConfig)/set_parallel_data_config(Option<ParallelDataConfig>):Specifies the format and S3 location of the parallel data input file.
encryption_key(EncryptionKey)/set_encryption_key(Option<EncryptionKey>):The encryption key used to encrypt this object.
client_token(impl Into<String>)/set_client_token(Option<String>):A unique identifier for the request. This token is automatically generated when you use Amazon Translate through an AWS SDK.
- On success, responds with
CreateParallelDataOutputwith field(s):name(Option<String>):The custom name that you assigned to the parallel data resource.
status(Option<ParallelDataStatus>):The status of the parallel data resource. When the resource is ready for you to use, the status is
ACTIVE.
- On failure, responds with
SdkError<CreateParallelDataError>
sourcepub fn delete_parallel_data(&self) -> DeleteParallelData
pub fn delete_parallel_data(&self) -> DeleteParallelData
Constructs a fluent builder for the DeleteParallelData operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):The name of the parallel data resource that is being deleted.
- On success, responds with
DeleteParallelDataOutputwith field(s):name(Option<String>):The name of the parallel data resource that is being deleted.
status(Option<ParallelDataStatus>):The status of the parallel data deletion.
- On failure, responds with
SdkError<DeleteParallelDataError>
sourcepub fn delete_terminology(&self) -> DeleteTerminology
pub fn delete_terminology(&self) -> DeleteTerminology
Constructs a fluent builder for the DeleteTerminology operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):The name of the custom terminology being deleted.
- On success, responds with
DeleteTerminologyOutput - On failure, responds with
SdkError<DeleteTerminologyError>
sourcepub fn describe_text_translation_job(&self) -> DescribeTextTranslationJob
pub fn describe_text_translation_job(&self) -> DescribeTextTranslationJob
Constructs a fluent builder for the DescribeTextTranslationJob operation.
- The fluent builder is configurable:
job_id(impl Into<String>)/set_job_id(Option<String>):The identifier that Amazon Translate generated for the job. The
StartTextTranslationJoboperation returns this identifier in its response.
- On success, responds with
DescribeTextTranslationJobOutputwith field(s):text_translation_job_properties(Option<TextTranslationJobProperties>):An object that contains the properties associated with an asynchronous batch translation job.
- On failure, responds with
SdkError<DescribeTextTranslationJobError>
sourcepub fn get_parallel_data(&self) -> GetParallelData
pub fn get_parallel_data(&self) -> GetParallelData
Constructs a fluent builder for the GetParallelData operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):The name of the parallel data resource that is being retrieved.
- On success, responds with
GetParallelDataOutputwith field(s):parallel_data_properties(Option<ParallelDataProperties>):The properties of the parallel data resource that is being retrieved.
data_location(Option<ParallelDataDataLocation>):The Amazon S3 location of the most recent parallel data input file that was successfully imported into Amazon Translate. The location is returned as a presigned URL that has a 30 minute expiration.
Amazon Translate doesn’t scan all input files for the risk of CSV injection attacks.
CSV injection occurs when a .csv or .tsv file is altered so that a record contains malicious code. The record begins with a special character, such as =, +, -, or @. When the file is opened in a spreadsheet program, the program might interpret the record as a formula and run the code within it.
Before you download an input file from Amazon S3, ensure that you recognize the file and trust its creator.
auxiliary_data_location(Option<ParallelDataDataLocation>):The Amazon S3 location of a file that provides any errors or warnings that were produced by your input file. This file was created when Amazon Translate attempted to create a parallel data resource. The location is returned as a presigned URL to that has a 30 minute expiration.
latest_update_attempt_auxiliary_data_location(Option<ParallelDataDataLocation>):The Amazon S3 location of a file that provides any errors or warnings that were produced by your input file. This file was created when Amazon Translate attempted to update a parallel data resource. The location is returned as a presigned URL to that has a 30 minute expiration.
- On failure, responds with
SdkError<GetParallelDataError>
sourcepub fn get_terminology(&self) -> GetTerminology
pub fn get_terminology(&self) -> GetTerminology
Constructs a fluent builder for the GetTerminology operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):The name of the custom terminology being retrieved.
terminology_data_format(TerminologyDataFormat)/set_terminology_data_format(Option<TerminologyDataFormat>):The data format of the custom terminology being retrieved.
If you don’t specify this parameter, Amazon Translate returns a file that has the same format as the file that was imported to create the terminology.
If you specify this parameter when you retrieve a multi-directional terminology resource, you must specify the same format as that of the input file that was imported to create it. Otherwise, Amazon Translate throws an error.
- On success, responds with
GetTerminologyOutputwith field(s):terminology_properties(Option<TerminologyProperties>):The properties of the custom terminology being retrieved.
terminology_data_location(Option<TerminologyDataLocation>):The Amazon S3 location of the most recent custom terminology input file that was successfully imported into Amazon Translate. The location is returned as a presigned URL that has a 30 minute expiration.
Amazon Translate doesn’t scan all input files for the risk of CSV injection attacks.
CSV injection occurs when a .csv or .tsv file is altered so that a record contains malicious code. The record begins with a special character, such as =, +, -, or @. When the file is opened in a spreadsheet program, the program might interpret the record as a formula and run the code within it.
Before you download an input file from Amazon S3, ensure that you recognize the file and trust its creator.
auxiliary_data_location(Option<TerminologyDataLocation>):The Amazon S3 location of a file that provides any errors or warnings that were produced by your input file. This file was created when Amazon Translate attempted to create a terminology resource. The location is returned as a presigned URL to that has a 30 minute expiration.
- On failure, responds with
SdkError<GetTerminologyError>
sourcepub fn import_terminology(&self) -> ImportTerminology
pub fn import_terminology(&self) -> ImportTerminology
Constructs a fluent builder for the ImportTerminology operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):The name of the custom terminology being imported.
merge_strategy(MergeStrategy)/set_merge_strategy(Option<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.
description(impl Into<String>)/set_description(Option<String>):The description of the custom terminology being imported.
terminology_data(TerminologyData)/set_terminology_data(Option<TerminologyData>):The terminology data for the custom terminology being imported.
encryption_key(EncryptionKey)/set_encryption_key(Option<EncryptionKey>):The encryption key for the custom terminology being imported.
- On success, responds with
ImportTerminologyOutputwith field(s):terminology_properties(Option<TerminologyProperties>):The properties of the custom terminology being imported.
auxiliary_data_location(Option<TerminologyDataLocation>):The Amazon S3 location of a file that provides any errors or warnings that were produced by your input file. This file was created when Amazon Translate attempted to create a terminology resource. The location is returned as a presigned URL to that has a 30 minute expiration.
- On failure, responds with
SdkError<ImportTerminologyError>
sourcepub fn list_parallel_data(&self) -> ListParallelData
pub fn list_parallel_data(&self) -> ListParallelData
Constructs a fluent builder for the ListParallelData operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
next_token(impl Into<String>)/set_next_token(Option<String>):A string that specifies the next page of results to return in a paginated response.
max_results(i32)/set_max_results(Option<i32>):The maximum number of parallel data resources returned for each request.
- On success, responds with
ListParallelDataOutputwith field(s):parallel_data_properties_list(Option<Vec<ParallelDataProperties>>):The properties of the parallel data resources returned by this request.
next_token(Option<String>):The string to use in a subsequent request to get the next page of results in a paginated response. This value is null if there are no additional pages.
- On failure, responds with
SdkError<ListParallelDataError>
sourcepub fn list_terminologies(&self) -> ListTerminologies
pub fn list_terminologies(&self) -> ListTerminologies
Constructs a fluent builder for the ListTerminologies operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
next_token(impl Into<String>)/set_next_token(Option<String>):If the result of the request to ListTerminologies was truncated, include the NextToken to fetch the next group of custom terminologies.
max_results(i32)/set_max_results(Option<i32>):The maximum number of custom terminologies returned per list request.
- On success, responds with
ListTerminologiesOutputwith field(s):terminology_properties_list(Option<Vec<TerminologyProperties>>):The properties list of the custom terminologies returned on the list request.
next_token(Option<String>):If the response to the ListTerminologies was truncated, the NextToken fetches the next group of custom terminologies.
- On failure, responds with
SdkError<ListTerminologiesError>
sourcepub fn list_text_translation_jobs(&self) -> ListTextTranslationJobs
pub fn list_text_translation_jobs(&self) -> ListTextTranslationJobs
Constructs a fluent builder for the ListTextTranslationJobs operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
filter(TextTranslationJobFilter)/set_filter(Option<TextTranslationJobFilter>):The parameters that specify which batch translation jobs to retrieve. Filters include job name, job status, and submission time. You can only set one filter at a time.
next_token(impl Into<String>)/set_next_token(Option<String>):The token to request the next page of results.
max_results(i32)/set_max_results(Option<i32>):The maximum number of results to return in each page. The default value is 100.
- On success, responds with
ListTextTranslationJobsOutputwith field(s):text_translation_job_properties_list(Option<Vec<TextTranslationJobProperties>>):A list containing the properties of each job that is returned.
next_token(Option<String>):The token to use to retrieve the next page of results. This value is
nullwhen there are no more results to return.
- On failure, responds with
SdkError<ListTextTranslationJobsError>
sourcepub fn start_text_translation_job(&self) -> StartTextTranslationJob
pub fn start_text_translation_job(&self) -> StartTextTranslationJob
Constructs a fluent builder for the StartTextTranslationJob operation.
- The fluent builder is configurable:
job_name(impl Into<String>)/set_job_name(Option<String>):The name of the batch translation job to be performed.
input_data_config(InputDataConfig)/set_input_data_config(Option<InputDataConfig>):Specifies the format and S3 location of the input documents for the translation job.
output_data_config(OutputDataConfig)/set_output_data_config(Option<OutputDataConfig>):Specifies the S3 folder to which your job output will be saved.
data_access_role_arn(impl Into<String>)/set_data_access_role_arn(Option<String>):The Amazon Resource Name (ARN) of an AWS Identity Access and Management (IAM) role that grants Amazon Translate read access to your input data. For more information, see
identity-and-access-management.source_language_code(impl Into<String>)/set_source_language_code(Option<String>):The language code of the input language. For a list of language codes, see
what-is-languages.Amazon Translate does not automatically detect a source language during batch translation jobs.
target_language_codes(Vec<String>)/set_target_language_codes(Option<Vec<String>>):The language code of the output language.
terminology_names(Vec<String>)/set_terminology_names(Option<Vec<String>>):The name of a custom terminology resource to add to the translation job. This resource lists examples source terms and the desired translation for each term.
This parameter accepts only one custom terminology resource.
For a list of available custom terminology resources, use the
ListTerminologiesoperation.For more information, see
how-custom-terminology.parallel_data_names(Vec<String>)/set_parallel_data_names(Option<Vec<String>>):The name of a parallel data resource to add to the translation job. This resource consists of examples that show how you want segments of text to be translated. When you add parallel data to a translation job, you create an Active Custom Translation job.
This parameter accepts only one parallel data resource.
Active Custom Translation jobs are priced at a higher rate than other jobs that don’t use parallel data. For more information, see Amazon Translate pricing.
For a list of available parallel data resources, use the
ListParallelDataoperation.For more information, see
customizing-translations-parallel-data.client_token(impl Into<String>)/set_client_token(Option<String>):A unique identifier for the request. This token is auto-generated when using the Amazon Translate SDK.
settings(TranslationSettings)/set_settings(Option<TranslationSettings>):Settings to configure your translation output, including the option to mask profane words and phrases.
- On success, responds with
StartTextTranslationJobOutputwith field(s):job_id(Option<String>):The identifier generated for the job. To get the status of a job, use this ID with the
DescribeTextTranslationJoboperation.job_status(Option<JobStatus>):The status of the job. Possible values include:
-
SUBMITTED- The job has been received and is queued for processing. -
IN_PROGRESS- Amazon Translate is processing the job. -
COMPLETED- The job was successfully completed and the output is available. -
COMPLETED_WITH_ERROR- The job was completed with errors. The errors can be analyzed in the job’s output. -
FAILED- The job did not complete. To get details, use theDescribeTextTranslationJoboperation. -
STOP_REQUESTED- The user who started the job has requested that it be stopped. -
STOPPED- The job has been stopped.
-
- On failure, responds with
SdkError<StartTextTranslationJobError>
sourcepub fn stop_text_translation_job(&self) -> StopTextTranslationJob
pub fn stop_text_translation_job(&self) -> StopTextTranslationJob
Constructs a fluent builder for the StopTextTranslationJob operation.
- The fluent builder is configurable:
job_id(impl Into<String>)/set_job_id(Option<String>):The job ID of the job to be stopped.
- On success, responds with
StopTextTranslationJobOutputwith field(s):job_id(Option<String>):The job ID of the stopped batch translation job.
job_status(Option<JobStatus>):The status of the designated job. Upon successful completion, the job’s status will be
STOPPED.
- On failure, responds with
SdkError<StopTextTranslationJobError>
sourcepub fn translate_text(&self) -> TranslateText
pub fn translate_text(&self) -> TranslateText
Constructs a fluent builder for the TranslateText operation.
- The fluent builder is configurable:
text(impl Into<String>)/set_text(Option<String>):The text to translate. The text string can be a maximum of 5,000 bytes long. Depending on your character set, this may be fewer than 5,000 characters.
terminology_names(Vec<String>)/set_terminology_names(Option<Vec<String>>):The name of the terminology list file to be used in the TranslateText request. You can use 1 terminology list at most in a
TranslateTextrequest. Terminology lists can contain a maximum of 256 terms.source_language_code(impl Into<String>)/set_source_language_code(Option<String>):The language code for the language of the source text. The language must be a language supported by Amazon Translate. For a list of language codes, see
what-is-languages.To have Amazon Translate determine the source language of your text, you can specify
autoin theSourceLanguageCodefield. If you specifyauto, Amazon Translate will call Amazon Comprehend to determine the source language.target_language_code(impl Into<String>)/set_target_language_code(Option<String>):The language code requested for the language of the target text. The language must be a language supported by Amazon Translate.
settings(TranslationSettings)/set_settings(Option<TranslationSettings>):Settings to configure your translation output, including the option to mask profane words and phrases.
- On success, responds with
TranslateTextOutputwith field(s):translated_text(Option<String>):The translated text.
source_language_code(Option<String>):The language code for the language of the source text.
target_language_code(Option<String>):The language code for the language of the target text.
applied_terminologies(Option<Vec<AppliedTerminology>>):The names of the custom terminologies applied to the input text by Amazon Translate for the translated text response.
applied_settings(Option<TranslationSettings>):Settings that configure the translation output.
- On failure, responds with
SdkError<TranslateTextError>
sourcepub fn update_parallel_data(&self) -> UpdateParallelData
pub fn update_parallel_data(&self) -> UpdateParallelData
Constructs a fluent builder for the UpdateParallelData operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):The name of the parallel data resource being updated.
description(impl Into<String>)/set_description(Option<String>):A custom description for the parallel data resource in Amazon Translate.
parallel_data_config(ParallelDataConfig)/set_parallel_data_config(Option<ParallelDataConfig>):Specifies the format and S3 location of the parallel data input file.
client_token(impl Into<String>)/set_client_token(Option<String>):A unique identifier for the request. This token is automatically generated when you use Amazon Translate through an AWS SDK.
- On success, responds with
UpdateParallelDataOutputwith field(s):name(Option<String>):The name of the parallel data resource being updated.
status(Option<ParallelDataStatus>):The status of the parallel data resource that you are attempting to update. Your update request is accepted only if this status is either
ACTIVEorFAILED.latest_update_attempt_status(Option<ParallelDataStatus>):The status of the parallel data update attempt. When the updated parallel data resource is ready for you to use, the status is
ACTIVE.latest_update_attempt_at(Option<DateTime>):The time that the most recent update was attempted.
- On failure, responds with
SdkError<UpdateParallelDataError>
sourceimpl Client
impl Client
sourcepub fn from_conf_conn<C, E>(conf: Config, conn: C) -> Self where
C: SmithyConnector<Error = E> + Send + 'static,
E: Into<ConnectorError>,
pub fn from_conf_conn<C, E>(conf: Config, conn: C) -> Self where
C: SmithyConnector<Error = E> + Send + 'static,
E: Into<ConnectorError>,
Creates a client with the given service config and connector override.
Trait Implementations
sourceimpl From<Client<DynConnector, DynMiddleware<DynConnector>, Standard>> for Client
impl From<Client<DynConnector, DynMiddleware<DynConnector>, Standard>> for Client
sourcefn from(client: Client<DynConnector, DynMiddleware<DynConnector>>) -> Self
fn from(client: Client<DynConnector, DynMiddleware<DynConnector>>) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more