Exemple #1
0
 public SingleTranslateCommandHandler(HttpClient http, IAmazonTranslate translate, IAmazonS3 s3, IOptions <TranslateOptions> options, ILogger <SingleTranslateCommandHandler> logger)
 {
     _http      = http ?? throw new ArgumentNullException(nameof(http));
     _translate = translate ?? throw new ArgumentNullException(nameof(translate));
     _s3        = s3 ?? throw new ArgumentNullException(nameof(s3));
     _options   = options?.Value ?? throw new ArgumentNullException(nameof(options));
     _logger    = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Exemple #2
0
        //--- Constructors ---
        public Logic(IAmazonPolly pollyClient, IAmazonS3 s3Client, IAmazonSimpleNotificationService snsClient, IAmazonTranslate translateClient, ILogger logger, string s3BucketName, string notificationSnsTopic, HttpClient httpClient)
        {
            _pollyClient     = pollyClient ?? throw new ArgumentNullException(nameof(pollyClient));
            _s3Client        = s3Client ?? throw new ArgumentNullException(nameof(s3Client));
            _snsClient       = snsClient ?? throw new ArgumentNullException(nameof(snsClient));
            _translateClient = translateClient ?? throw new ArgumentNullException(nameof(translateClient));
            _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
            _httpClient      = httpClient ?? throw new ArgumentNullException(nameof(httpClient));

            // All the audio files should be stored here.  You can check it out in the Amazon S3 Console.
            _s3BucketName         = s3BucketName ?? throw new ArgumentNullException(nameof(s3BucketName));
            _notificationSnsTopic = notificationSnsTopic ?? throw new ArgumentNullException(nameof(notificationSnsTopic));
        }
 private Amazon.Translate.Model.TranslateTextResponse CallAWSServiceOperation(IAmazonTranslate client, Amazon.Translate.Model.TranslateTextRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Translate", "TranslateText");
     try
     {
         #if DESKTOP
         return(client.TranslateText(request));
         #elif CORECLR
         return(client.TranslateTextAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
Exemple #4
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            Client = CreateClient(_CurrentCredentials, _RegionEndpoint);
        }
Exemple #5
0
 internal ListTextTranslationJobsPaginator(IAmazonTranslate client, ListTextTranslationJobsRequest request)
 {
     this._client  = client;
     this._request = request;
 }
 internal ListTerminologiesPaginator(IAmazonTranslate client, ListTerminologiesRequest request)
 {
     this._client  = client;
     this._request = request;
 }
 internal TranslatePaginatorFactory(IAmazonTranslate client)
 {
     this.client = client;
 }
Exemple #8
0
        public async Task HandleAsync_uses_Amazon_Translate_to_translate_text([Frozen] IAmazonTranslate translate, SingleTranslateCommandHandler sut, IDispatcher dispatcher, ICommandContext <TranslateEducationCommand> context)
        {
            await sut.HandleAsync(dispatcher, context);

            Mock.Get(translate).Verify(p => p.TranslateTextAsync(It.IsAny <TranslateTextRequest>(), It.IsAny <CancellationToken>()));
        }
Exemple #9
0
 internal ListParallelDataPaginator(IAmazonTranslate client, ListParallelDataRequest request)
 {
     this._client  = client;
     this._request = request;
 }
Exemple #10
0
 public AmazonTranslateTranslator(IAmazonTranslate translate, ILogger <AmazonTranslateTranslator> logger)
 {
     _translate = translate ?? throw new ArgumentNullException(nameof(translate));
     _logger    = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public TranslateService(IAmazonTranslate translate)
 {
     this.translate = translate;
 }