private Amazon.Translate.Model.CreateParallelDataResponse CallAWSServiceOperation(IAmazonTranslate client, Amazon.Translate.Model.CreateParallelDataRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Translate", "CreateParallelData"); try { #if DESKTOP return(client.CreateParallelData(request)); #elif CORECLR return(client.CreateParallelDataAsync(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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Translate.Model.CreateParallelDataRequest(); if (cmdletContext.ClientToken != null) { request.ClientToken = cmdletContext.ClientToken; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } // populate EncryptionKey var requestEncryptionKeyIsNull = true; request.EncryptionKey = new Amazon.Translate.Model.EncryptionKey(); System.String requestEncryptionKey_encryptionKey_Id = null; if (cmdletContext.EncryptionKey_Id != null) { requestEncryptionKey_encryptionKey_Id = cmdletContext.EncryptionKey_Id; } if (requestEncryptionKey_encryptionKey_Id != null) { request.EncryptionKey.Id = requestEncryptionKey_encryptionKey_Id; requestEncryptionKeyIsNull = false; } Amazon.Translate.EncryptionKeyType requestEncryptionKey_encryptionKey_Type = null; if (cmdletContext.EncryptionKey_Type != null) { requestEncryptionKey_encryptionKey_Type = cmdletContext.EncryptionKey_Type; } if (requestEncryptionKey_encryptionKey_Type != null) { request.EncryptionKey.Type = requestEncryptionKey_encryptionKey_Type; requestEncryptionKeyIsNull = false; } // determine if request.EncryptionKey should be set to null if (requestEncryptionKeyIsNull) { request.EncryptionKey = null; } 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); }