private Amazon.RoboMaker.Model.CreateWorldTemplateResponse CallAWSServiceOperation(IAmazonRoboMaker client, Amazon.RoboMaker.Model.CreateWorldTemplateRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS RoboMaker", "CreateWorldTemplate");
     try
     {
         #if DESKTOP
         return(client.CreateWorldTemplate(request));
         #elif CORECLR
         return(client.CreateWorldTemplateAsync(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.RoboMaker.Model.CreateWorldTemplateRequest();

            if (cmdletContext.ClientRequestToken != null)
            {
                request.ClientRequestToken = cmdletContext.ClientRequestToken;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }
            if (cmdletContext.TemplateBody != null)
            {
                request.TemplateBody = cmdletContext.TemplateBody;
            }

            // populate TemplateLocation
            var requestTemplateLocationIsNull = true;

            request.TemplateLocation = new Amazon.RoboMaker.Model.TemplateLocation();
            System.String requestTemplateLocation_templateLocation_S3Bucket = null;
            if (cmdletContext.TemplateLocation_S3Bucket != null)
            {
                requestTemplateLocation_templateLocation_S3Bucket = cmdletContext.TemplateLocation_S3Bucket;
            }
            if (requestTemplateLocation_templateLocation_S3Bucket != null)
            {
                request.TemplateLocation.S3Bucket = requestTemplateLocation_templateLocation_S3Bucket;
                requestTemplateLocationIsNull     = false;
            }
            System.String requestTemplateLocation_templateLocation_S3Key = null;
            if (cmdletContext.TemplateLocation_S3Key != null)
            {
                requestTemplateLocation_templateLocation_S3Key = cmdletContext.TemplateLocation_S3Key;
            }
            if (requestTemplateLocation_templateLocation_S3Key != null)
            {
                request.TemplateLocation.S3Key = requestTemplateLocation_templateLocation_S3Key;
                requestTemplateLocationIsNull  = false;
            }
            // determine if request.TemplateLocation should be set to null
            if (requestTemplateLocationIsNull)
            {
                request.TemplateLocation = 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);
        }