public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.AppStream.Model.CreateUpdatedImageRequest(); if (cmdletContext.DryRun != null) { request.DryRun = cmdletContext.DryRun.Value; } if (cmdletContext.ExistingImageName != null) { request.ExistingImageName = cmdletContext.ExistingImageName; } if (cmdletContext.NewImageDescription != null) { request.NewImageDescription = cmdletContext.NewImageDescription; } if (cmdletContext.NewImageDisplayName != null) { request.NewImageDisplayName = cmdletContext.NewImageDisplayName; } if (cmdletContext.NewImageName != null) { request.NewImageName = cmdletContext.NewImageName; } if (cmdletContext.NewImageTag != null) { request.NewImageTags = cmdletContext.NewImageTag; } 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); }
private Amazon.AppStream.Model.CreateUpdatedImageResponse CallAWSServiceOperation(IAmazonAppStream client, Amazon.AppStream.Model.CreateUpdatedImageRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon AppStream", "CreateUpdatedImage"); try { #if DESKTOP return(client.CreateUpdatedImage(request)); #elif CORECLR return(client.CreateUpdatedImageAsync(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; } }