예제 #1
0
 private Amazon.Translate.Model.UpdateParallelDataResponse CallAWSServiceOperation(IAmazonTranslate client, Amazon.Translate.Model.UpdateParallelDataRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Translate", "UpdateParallelData");
     try
     {
         #if DESKTOP
         return(client.UpdateParallelData(request));
         #elif CORECLR
         return(client.UpdateParallelDataAsync(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;
     }
 }
예제 #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Translate.Model.UpdateParallelDataRequest();

            if (cmdletContext.ClientToken != null)
            {
                request.ClientToken = cmdletContext.ClientToken;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }

            // populate ParallelDataConfig
            var requestParallelDataConfigIsNull = true;

            request.ParallelDataConfig = new Amazon.Translate.Model.ParallelDataConfig();
            Amazon.Translate.ParallelDataFormat requestParallelDataConfig_parallelDataConfig_Format = null;
            if (cmdletContext.ParallelDataConfig_Format != null)
            {
                requestParallelDataConfig_parallelDataConfig_Format = cmdletContext.ParallelDataConfig_Format;
            }
            if (requestParallelDataConfig_parallelDataConfig_Format != null)
            {
                request.ParallelDataConfig.Format = requestParallelDataConfig_parallelDataConfig_Format;
                requestParallelDataConfigIsNull   = false;
            }
            System.String requestParallelDataConfig_parallelDataConfig_S3Uri = null;
            if (cmdletContext.ParallelDataConfig_S3Uri != null)
            {
                requestParallelDataConfig_parallelDataConfig_S3Uri = cmdletContext.ParallelDataConfig_S3Uri;
            }
            if (requestParallelDataConfig_parallelDataConfig_S3Uri != null)
            {
                request.ParallelDataConfig.S3Uri = requestParallelDataConfig_parallelDataConfig_S3Uri;
                requestParallelDataConfigIsNull  = false;
            }
            // determine if request.ParallelDataConfig should be set to null
            if (requestParallelDataConfigIsNull)
            {
                request.ParallelDataConfig = null;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }