private Amazon.MTurk.Model.SendTestEventNotificationResponse CallAWSServiceOperation(IAmazonMTurk client, Amazon.MTurk.Model.SendTestEventNotificationRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon MTurk Service", "SendTestEventNotification"); try { #if DESKTOP return(client.SendTestEventNotification(request)); #elif CORECLR return(client.SendTestEventNotificationAsync(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.MTurk.Model.SendTestEventNotificationRequest(); // populate Notification var requestNotificationIsNull = true; request.Notification = new Amazon.MTurk.Model.NotificationSpecification(); System.String requestNotification_notification_Destination = null; if (cmdletContext.Notification_Destination != null) { requestNotification_notification_Destination = cmdletContext.Notification_Destination; } if (requestNotification_notification_Destination != null) { request.Notification.Destination = requestNotification_notification_Destination; requestNotificationIsNull = false; } List <System.String> requestNotification_notification_EventType = null; if (cmdletContext.Notification_EventType != null) { requestNotification_notification_EventType = cmdletContext.Notification_EventType; } if (requestNotification_notification_EventType != null) { request.Notification.EventTypes = requestNotification_notification_EventType; requestNotificationIsNull = false; } Amazon.MTurk.NotificationTransport requestNotification_notification_Transport = null; if (cmdletContext.Notification_Transport != null) { requestNotification_notification_Transport = cmdletContext.Notification_Transport; } if (requestNotification_notification_Transport != null) { request.Notification.Transport = requestNotification_notification_Transport; requestNotificationIsNull = false; } System.String requestNotification_notification_Version = null; if (cmdletContext.Notification_Version != null) { requestNotification_notification_Version = cmdletContext.Notification_Version; } if (requestNotification_notification_Version != null) { request.Notification.Version = requestNotification_notification_Version; requestNotificationIsNull = false; } // determine if request.Notification should be set to null if (requestNotificationIsNull) { request.Notification = null; } if (cmdletContext.TestEventType != null) { request.TestEventType = cmdletContext.TestEventType; } 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); }