private Amazon.MTurk.Model.UpdateNotificationSettingsResponse CallAWSServiceOperation(IAmazonMTurk client, Amazon.MTurk.Model.UpdateNotificationSettingsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon MTurk Service", "UpdateNotificationSettings"); try { #if DESKTOP return(client.UpdateNotificationSettings(request)); #elif CORECLR return(client.UpdateNotificationSettingsAsync(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.UpdateNotificationSettingsRequest(); if (cmdletContext.Active != null) { request.Active = cmdletContext.Active.Value; } if (cmdletContext.HITTypeId != null) { request.HITTypeId = cmdletContext.HITTypeId; } // 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; } 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); }