private Amazon.IoT.Model.CreateJobTemplateResponse CallAWSServiceOperation(IAmazonIoT client, Amazon.IoT.Model.CreateJobTemplateRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS IoT", "CreateJobTemplate"); try { #if DESKTOP return(client.CreateJobTemplate(request)); #elif CORECLR return(client.CreateJobTemplateAsync(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.IoT.Model.CreateJobTemplateRequest(); // populate AbortConfig var requestAbortConfigIsNull = true; request.AbortConfig = new Amazon.IoT.Model.AbortConfig(); List <Amazon.IoT.Model.AbortCriteria> requestAbortConfig_abortConfig_CriteriaList = null; if (cmdletContext.AbortConfig_CriteriaList != null) { requestAbortConfig_abortConfig_CriteriaList = cmdletContext.AbortConfig_CriteriaList; } if (requestAbortConfig_abortConfig_CriteriaList != null) { request.AbortConfig.CriteriaList = requestAbortConfig_abortConfig_CriteriaList; requestAbortConfigIsNull = false; } // determine if request.AbortConfig should be set to null if (requestAbortConfigIsNull) { request.AbortConfig = null; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.Document != null) { request.Document = cmdletContext.Document; } if (cmdletContext.DocumentSource != null) { request.DocumentSource = cmdletContext.DocumentSource; } if (cmdletContext.JobArn != null) { request.JobArn = cmdletContext.JobArn; } // populate JobExecutionsRolloutConfig var requestJobExecutionsRolloutConfigIsNull = true; request.JobExecutionsRolloutConfig = new Amazon.IoT.Model.JobExecutionsRolloutConfig(); Amazon.IoT.Model.ExponentialRolloutRate requestJobExecutionsRolloutConfig_jobExecutionsRolloutConfig_ExponentialRate = null; if (cmdletContext.JobExecutionsRolloutConfig_ExponentialRate != null) { requestJobExecutionsRolloutConfig_jobExecutionsRolloutConfig_ExponentialRate = cmdletContext.JobExecutionsRolloutConfig_ExponentialRate; } if (requestJobExecutionsRolloutConfig_jobExecutionsRolloutConfig_ExponentialRate != null) { request.JobExecutionsRolloutConfig.ExponentialRate = requestJobExecutionsRolloutConfig_jobExecutionsRolloutConfig_ExponentialRate; requestJobExecutionsRolloutConfigIsNull = false; } System.Int32?requestJobExecutionsRolloutConfig_jobExecutionsRolloutConfig_MaximumPerMinute = null; if (cmdletContext.JobExecutionsRolloutConfig_MaximumPerMinute != null) { requestJobExecutionsRolloutConfig_jobExecutionsRolloutConfig_MaximumPerMinute = cmdletContext.JobExecutionsRolloutConfig_MaximumPerMinute.Value; } if (requestJobExecutionsRolloutConfig_jobExecutionsRolloutConfig_MaximumPerMinute != null) { request.JobExecutionsRolloutConfig.MaximumPerMinute = requestJobExecutionsRolloutConfig_jobExecutionsRolloutConfig_MaximumPerMinute.Value; requestJobExecutionsRolloutConfigIsNull = false; } // determine if request.JobExecutionsRolloutConfig should be set to null if (requestJobExecutionsRolloutConfigIsNull) { request.JobExecutionsRolloutConfig = null; } if (cmdletContext.JobTemplateId != null) { request.JobTemplateId = cmdletContext.JobTemplateId; } // populate PresignedUrlConfig var requestPresignedUrlConfigIsNull = true; request.PresignedUrlConfig = new Amazon.IoT.Model.PresignedUrlConfig(); System.Int64?requestPresignedUrlConfig_presignedUrlConfig_ExpiresInSec = null; if (cmdletContext.PresignedUrlConfig_ExpiresInSec != null) { requestPresignedUrlConfig_presignedUrlConfig_ExpiresInSec = cmdletContext.PresignedUrlConfig_ExpiresInSec.Value; } if (requestPresignedUrlConfig_presignedUrlConfig_ExpiresInSec != null) { request.PresignedUrlConfig.ExpiresInSec = requestPresignedUrlConfig_presignedUrlConfig_ExpiresInSec.Value; requestPresignedUrlConfigIsNull = false; } System.String requestPresignedUrlConfig_presignedUrlConfig_RoleArn = null; if (cmdletContext.PresignedUrlConfig_RoleArn != null) { requestPresignedUrlConfig_presignedUrlConfig_RoleArn = cmdletContext.PresignedUrlConfig_RoleArn; } if (requestPresignedUrlConfig_presignedUrlConfig_RoleArn != null) { request.PresignedUrlConfig.RoleArn = requestPresignedUrlConfig_presignedUrlConfig_RoleArn; requestPresignedUrlConfigIsNull = false; } // determine if request.PresignedUrlConfig should be set to null if (requestPresignedUrlConfigIsNull) { request.PresignedUrlConfig = null; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } // populate TimeoutConfig var requestTimeoutConfigIsNull = true; request.TimeoutConfig = new Amazon.IoT.Model.TimeoutConfig(); System.Int64?requestTimeoutConfig_timeoutConfig_InProgressTimeoutInMinute = null; if (cmdletContext.TimeoutConfig_InProgressTimeoutInMinute != null) { requestTimeoutConfig_timeoutConfig_InProgressTimeoutInMinute = cmdletContext.TimeoutConfig_InProgressTimeoutInMinute.Value; } if (requestTimeoutConfig_timeoutConfig_InProgressTimeoutInMinute != null) { request.TimeoutConfig.InProgressTimeoutInMinutes = requestTimeoutConfig_timeoutConfig_InProgressTimeoutInMinute.Value; requestTimeoutConfigIsNull = false; } // determine if request.TimeoutConfig should be set to null if (requestTimeoutConfigIsNull) { request.TimeoutConfig = 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); }