示例#1
0
 private Amazon.TranscribeService.Model.CreateLanguageModelResponse CallAWSServiceOperation(IAmazonTranscribeService client, Amazon.TranscribeService.Model.CreateLanguageModelRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Transcribe Service", "CreateLanguageModel");
     try
     {
         #if DESKTOP
         return(client.CreateLanguageModel(request));
         #elif CORECLR
         return(client.CreateLanguageModelAsync(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.TranscribeService.Model.CreateLanguageModelRequest();

            if (cmdletContext.BaseModelName != null)
            {
                request.BaseModelName = cmdletContext.BaseModelName;
            }

            // populate InputDataConfig
            var requestInputDataConfigIsNull = true;

            request.InputDataConfig = new Amazon.TranscribeService.Model.InputDataConfig();
            System.String requestInputDataConfig_inputDataConfig_DataAccessRoleArn = null;
            if (cmdletContext.InputDataConfig_DataAccessRoleArn != null)
            {
                requestInputDataConfig_inputDataConfig_DataAccessRoleArn = cmdletContext.InputDataConfig_DataAccessRoleArn;
            }
            if (requestInputDataConfig_inputDataConfig_DataAccessRoleArn != null)
            {
                request.InputDataConfig.DataAccessRoleArn = requestInputDataConfig_inputDataConfig_DataAccessRoleArn;
                requestInputDataConfigIsNull = false;
            }
            System.String requestInputDataConfig_inputDataConfig_S3Uri = null;
            if (cmdletContext.InputDataConfig_S3Uri != null)
            {
                requestInputDataConfig_inputDataConfig_S3Uri = cmdletContext.InputDataConfig_S3Uri;
            }
            if (requestInputDataConfig_inputDataConfig_S3Uri != null)
            {
                request.InputDataConfig.S3Uri = requestInputDataConfig_inputDataConfig_S3Uri;
                requestInputDataConfigIsNull  = false;
            }
            System.String requestInputDataConfig_inputDataConfig_TuningDataS3Uri = null;
            if (cmdletContext.InputDataConfig_TuningDataS3Uri != null)
            {
                requestInputDataConfig_inputDataConfig_TuningDataS3Uri = cmdletContext.InputDataConfig_TuningDataS3Uri;
            }
            if (requestInputDataConfig_inputDataConfig_TuningDataS3Uri != null)
            {
                request.InputDataConfig.TuningDataS3Uri = requestInputDataConfig_inputDataConfig_TuningDataS3Uri;
                requestInputDataConfigIsNull            = false;
            }
            // determine if request.InputDataConfig should be set to null
            if (requestInputDataConfigIsNull)
            {
                request.InputDataConfig = null;
            }
            if (cmdletContext.LanguageCode != null)
            {
                request.LanguageCode = cmdletContext.LanguageCode;
            }
            if (cmdletContext.ModelName != null)
            {
                request.ModelName = cmdletContext.ModelName;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            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);
        }