private Amazon.Rekognition.Model.StartCelebrityRecognitionResponse CallAWSServiceOperation(IAmazonRekognition client, Amazon.Rekognition.Model.StartCelebrityRecognitionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Rekognition", "StartCelebrityRecognition"); try { #if DESKTOP return(client.StartCelebrityRecognition(request)); #elif CORECLR return(client.StartCelebrityRecognitionAsync(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.Rekognition.Model.StartCelebrityRecognitionRequest(); if (cmdletContext.ClientRequestToken != null) { request.ClientRequestToken = cmdletContext.ClientRequestToken; } if (cmdletContext.JobTag != null) { request.JobTag = cmdletContext.JobTag; } // populate NotificationChannel var requestNotificationChannelIsNull = true; request.NotificationChannel = new Amazon.Rekognition.Model.NotificationChannel(); System.String requestNotificationChannel_notificationChannel_RoleArn = null; if (cmdletContext.NotificationChannel_RoleArn != null) { requestNotificationChannel_notificationChannel_RoleArn = cmdletContext.NotificationChannel_RoleArn; } if (requestNotificationChannel_notificationChannel_RoleArn != null) { request.NotificationChannel.RoleArn = requestNotificationChannel_notificationChannel_RoleArn; requestNotificationChannelIsNull = false; } System.String requestNotificationChannel_notificationChannel_SNSTopicArn = null; if (cmdletContext.NotificationChannel_SNSTopicArn != null) { requestNotificationChannel_notificationChannel_SNSTopicArn = cmdletContext.NotificationChannel_SNSTopicArn; } if (requestNotificationChannel_notificationChannel_SNSTopicArn != null) { request.NotificationChannel.SNSTopicArn = requestNotificationChannel_notificationChannel_SNSTopicArn; requestNotificationChannelIsNull = false; } // determine if request.NotificationChannel should be set to null if (requestNotificationChannelIsNull) { request.NotificationChannel = null; } if (cmdletContext.Video != null) { request.Video = cmdletContext.Video; } 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); }