private Amazon.RoboMaker.Model.CreateSimulationJobResponse CallAWSServiceOperation(IAmazonRoboMaker client, Amazon.RoboMaker.Model.CreateSimulationJobRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS RoboMaker", "CreateSimulationJob"); try { #if DESKTOP return(client.CreateSimulationJob(request)); #elif CORECLR return(client.CreateSimulationJobAsync(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.CreateSimulationJobRequest(); if (cmdletContext.ClientRequestToken != null) { request.ClientRequestToken = cmdletContext.ClientRequestToken; } // populate Compute var requestComputeIsNull = true; request.Compute = new Amazon.RoboMaker.Model.Compute(); System.Int32?requestCompute_compute_SimulationUnitLimit = null; if (cmdletContext.Compute_SimulationUnitLimit != null) { requestCompute_compute_SimulationUnitLimit = cmdletContext.Compute_SimulationUnitLimit.Value; } if (requestCompute_compute_SimulationUnitLimit != null) { request.Compute.SimulationUnitLimit = requestCompute_compute_SimulationUnitLimit.Value; requestComputeIsNull = false; } // determine if request.Compute should be set to null if (requestComputeIsNull) { request.Compute = null; } if (cmdletContext.DataSource != null) { request.DataSources = cmdletContext.DataSource; } if (cmdletContext.FailureBehavior != null) { request.FailureBehavior = cmdletContext.FailureBehavior; } if (cmdletContext.IamRole != null) { request.IamRole = cmdletContext.IamRole; } // populate LoggingConfig var requestLoggingConfigIsNull = true; request.LoggingConfig = new Amazon.RoboMaker.Model.LoggingConfig(); System.Boolean?requestLoggingConfig_loggingConfig_RecordAllRosTopic = null; if (cmdletContext.LoggingConfig_RecordAllRosTopic != null) { requestLoggingConfig_loggingConfig_RecordAllRosTopic = cmdletContext.LoggingConfig_RecordAllRosTopic.Value; } if (requestLoggingConfig_loggingConfig_RecordAllRosTopic != null) { request.LoggingConfig.RecordAllRosTopics = requestLoggingConfig_loggingConfig_RecordAllRosTopic.Value; requestLoggingConfigIsNull = false; } // determine if request.LoggingConfig should be set to null if (requestLoggingConfigIsNull) { request.LoggingConfig = null; } if (cmdletContext.MaxJobDurationInSecond != null) { request.MaxJobDurationInSeconds = cmdletContext.MaxJobDurationInSecond.Value; } if (cmdletContext.OutputLocation != null) { request.OutputLocation = cmdletContext.OutputLocation; } if (cmdletContext.RobotApplication != null) { request.RobotApplications = cmdletContext.RobotApplication; } if (cmdletContext.SimulationApplication != null) { request.SimulationApplications = cmdletContext.SimulationApplication; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.VpcConfig != null) { request.VpcConfig = cmdletContext.VpcConfig; } 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); }