Пример #1
0
        internal virtual StartTextTranslationJobResponse StartTextTranslationJob(StartTextTranslationJobRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = StartTextTranslationJobRequestMarshaller.Instance;
            options.ResponseUnmarshaller = StartTextTranslationJobResponseUnmarshaller.Instance;

            return(Invoke <StartTextTranslationJobResponse>(request, options));
        }
Пример #2
0
        /// <summary>
        /// Initiates the asynchronous execution of the StartTextTranslationJob operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the StartTextTranslationJob operation on AmazonTranslateClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndStartTextTranslationJob
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/StartTextTranslationJob">REST API Reference for StartTextTranslationJob Operation</seealso>
        public virtual IAsyncResult BeginStartTextTranslationJob(StartTextTranslationJobRequest request, AsyncCallback callback, object state)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = StartTextTranslationJobRequestMarshaller.Instance;
            options.ResponseUnmarshaller = StartTextTranslationJobResponseUnmarshaller.Instance;

            return(BeginInvoke(request, options, callback, state));
        }
Пример #3
0
        public static async Task Main()
        {
            var contentType = "text/plain";
            var s3InputUri  = "http://doc-example-bucket.s3-website-us-west-2.amazonaws.com/";
            var s3OutputUri = "http://doc-example-bucket.s3-website-us-west-2.amazonaws.com/translated/";

            // This role must have permissions to read the source bucket and to read and
            // write to the destination bucket where the translated text will be stored.
            var dataAccessRoleArn = "arn:aws:iam::0123456789ab:role/S3TranslateRole";

            var client = new AmazonTranslateClient();

            var inputConfig = new InputDataConfig
            {
                ContentType = contentType,
                S3Uri       = s3InputUri,
            };

            var outputConfig = new OutputDataConfig
            {
                S3Uri = s3OutputUri,
            };

            var request = new StartTextTranslationJobRequest
            {
                DataAccessRoleArn = dataAccessRoleArn,
                InputDataConfig   = inputConfig,
                OutputDataConfig  = outputConfig,
            };

            var response = await StartTextTranslationAsync(client, request);

            if (response.HttpStatusCode == System.Net.HttpStatusCode.OK)
            {
                Console.WriteLine($"{response.JobId}: {response.JobStatus}");
            }
        }
Пример #4
0
        /// <summary>
        /// Starts an asynchronous batch translation job. Batch translation jobs can be used to
        /// translate large volumes of text across multiple documents at once. For more information,
        /// see <a>async</a>.
        ///
        ///
        /// <para>
        /// Batch translation jobs can be described with the <a>DescribeTextTranslationJob</a>
        /// operation, listed with the <a>ListTextTranslationJobs</a> operation, and stopped with
        /// the <a>StopTextTranslationJob</a> operation.
        /// </para>
        ///  <note>
        /// <para>
        /// Amazon Translate does not support batch translation of multiple source languages at
        /// once.
        /// </para>
        ///  </note>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the StartTextTranslationJob service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the StartTextTranslationJob service method, as returned by Translate.</returns>
        /// <exception cref="Amazon.Translate.Model.InternalServerException">
        /// An internal server error occurred. Retry your request.
        /// </exception>
        /// <exception cref="Amazon.Translate.Model.InvalidRequestException">
        /// The request that you made is invalid. Check your request to determine why it's invalid
        /// and then retry the request.
        /// </exception>
        /// <exception cref="Amazon.Translate.Model.ResourceNotFoundException">
        /// The resource you are looking for has not been found. Review the resource you're looking
        /// for and see if a different resource will accomplish your needs before retrying the
        /// revised request.
        /// </exception>
        /// <exception cref="Amazon.Translate.Model.TooManyRequestsException">
        /// You have made too many requests within a short period of time. Wait for a short time
        /// and then try your request again.
        /// </exception>
        /// <exception cref="Amazon.Translate.Model.UnsupportedLanguagePairException">
        /// Amazon Translate does not support translation from the language of the source text
        /// into the requested target language. For more information, see <a>how-to-error-msg</a>.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/StartTextTranslationJob">REST API Reference for StartTextTranslationJob Operation</seealso>
        public virtual Task <StartTextTranslationJobResponse> StartTextTranslationJobAsync(StartTextTranslationJobRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = StartTextTranslationJobRequestMarshaller.Instance;
            options.ResponseUnmarshaller = StartTextTranslationJobResponseUnmarshaller.Instance;

            return(InvokeAsync <StartTextTranslationJobResponse>(request, options, cancellationToken));
        }
Пример #5
0
        /// <summary>
        /// Start the Amazon Translate text translation job.
        /// </summary>
        /// <param name="client">The initialized AmazonTranslateClient object.</param>
        /// <param name="request">The request object that includes details such
        /// as source and destination bucket names and the IAM Role that will
        /// be used to access the buckets.</param>
        /// <returns>The StartTextTranslationResponse object that includes the
        /// details of the request response.</returns>
        public static async Task <StartTextTranslationJobResponse> StartTextTranslationAsync(AmazonTranslateClient client, StartTextTranslationJobRequest request)
        {
            var response = await client.StartTextTranslationJobAsync(request);

            return(response);
        }