private Amazon.Glue.Model.StartJobRunResponse CallAWSServiceOperation(IAmazonGlue client, Amazon.Glue.Model.StartJobRunRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Glue", "StartJobRun"); try { #if DESKTOP return(client.StartJobRun(request)); #elif CORECLR return(client.StartJobRunAsync(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.Glue.Model.StartJobRunRequest(); #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute if (cmdletContext.AllocatedCapacity != null) { request.AllocatedCapacity = cmdletContext.AllocatedCapacity.Value; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute if (cmdletContext.Argument != null) { request.Arguments = cmdletContext.Argument; } if (cmdletContext.JobName != null) { request.JobName = cmdletContext.JobName; } if (cmdletContext.JobRunId != null) { request.JobRunId = cmdletContext.JobRunId; } if (cmdletContext.MaxCapacity != null) { request.MaxCapacity = cmdletContext.MaxCapacity.Value; } // populate NotificationProperty var requestNotificationPropertyIsNull = true; request.NotificationProperty = new Amazon.Glue.Model.NotificationProperty(); System.Int32?requestNotificationProperty_notificationProperty_NotifyDelayAfter = null; if (cmdletContext.NotificationProperty_NotifyDelayAfter != null) { requestNotificationProperty_notificationProperty_NotifyDelayAfter = cmdletContext.NotificationProperty_NotifyDelayAfter.Value; } if (requestNotificationProperty_notificationProperty_NotifyDelayAfter != null) { request.NotificationProperty.NotifyDelayAfter = requestNotificationProperty_notificationProperty_NotifyDelayAfter.Value; requestNotificationPropertyIsNull = false; } // determine if request.NotificationProperty should be set to null if (requestNotificationPropertyIsNull) { request.NotificationProperty = null; } if (cmdletContext.NumberOfWorker != null) { request.NumberOfWorkers = cmdletContext.NumberOfWorker.Value; } if (cmdletContext.SecurityConfiguration != null) { request.SecurityConfiguration = cmdletContext.SecurityConfiguration; } if (cmdletContext.Timeout != null) { request.Timeout = cmdletContext.Timeout.Value; } if (cmdletContext.WorkerType != null) { request.WorkerType = cmdletContext.WorkerType; } 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); }