public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Greengrass.Model.CreateSoftwareUpdateJobRequest(); if (cmdletContext.AmznClientToken != null) { request.AmznClientToken = cmdletContext.AmznClientToken; } if (cmdletContext.S3UrlSignerRole != null) { request.S3UrlSignerRole = cmdletContext.S3UrlSignerRole; } if (cmdletContext.SoftwareToUpdate != null) { request.SoftwareToUpdate = cmdletContext.SoftwareToUpdate; } if (cmdletContext.UpdateAgentLogLevel != null) { request.UpdateAgentLogLevel = cmdletContext.UpdateAgentLogLevel; } if (cmdletContext.UpdateTarget != null) { request.UpdateTargets = cmdletContext.UpdateTarget; } if (cmdletContext.UpdateTargetsArchitecture != null) { request.UpdateTargetsArchitecture = cmdletContext.UpdateTargetsArchitecture; } if (cmdletContext.UpdateTargetsOperatingSystem != null) { request.UpdateTargetsOperatingSystem = cmdletContext.UpdateTargetsOperatingSystem; } 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.Greengrass.Model.CreateSoftwareUpdateJobResponse CallAWSServiceOperation(IAmazonGreengrass client, Amazon.Greengrass.Model.CreateSoftwareUpdateJobRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Greengrass", "CreateSoftwareUpdateJob"); try { #if DESKTOP return(client.CreateSoftwareUpdateJob(request)); #elif CORECLR return(client.CreateSoftwareUpdateJobAsync(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; } }