コード例 #1
0
 private Amazon.RoboMaker.Model.UpdateWorldTemplateResponse CallAWSServiceOperation(IAmazonRoboMaker client, Amazon.RoboMaker.Model.UpdateWorldTemplateRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS RoboMaker", "UpdateWorldTemplate");
     try
     {
         #if DESKTOP
         return(client.UpdateWorldTemplate(request));
         #elif CORECLR
         return(client.UpdateWorldTemplateAsync(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.RoboMaker.Model.UpdateWorldTemplateRequest();

            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.Template != null)
            {
                request.Template = cmdletContext.Template;
            }
            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);
        }