예제 #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Pinpoint.Model.UpdateVoiceChannelRequest();

            if (cmdletContext.ApplicationId != null)
            {
                request.ApplicationId = cmdletContext.ApplicationId;
            }

            // populate VoiceChannelRequest
            var requestVoiceChannelRequestIsNull = true;

            request.VoiceChannelRequest = new Amazon.Pinpoint.Model.VoiceChannelRequest();
            System.Boolean?requestVoiceChannelRequest_voiceChannelRequest_Enabled = null;
            if (cmdletContext.VoiceChannelRequest_Enabled != null)
            {
                requestVoiceChannelRequest_voiceChannelRequest_Enabled = cmdletContext.VoiceChannelRequest_Enabled.Value;
            }
            if (requestVoiceChannelRequest_voiceChannelRequest_Enabled != null)
            {
                request.VoiceChannelRequest.Enabled = requestVoiceChannelRequest_voiceChannelRequest_Enabled.Value;
                requestVoiceChannelRequestIsNull    = false;
            }
            // determine if request.VoiceChannelRequest should be set to null
            if (requestVoiceChannelRequestIsNull)
            {
                request.VoiceChannelRequest = 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);
        }
예제 #2
0
 private Amazon.Pinpoint.Model.UpdateVoiceChannelResponse CallAWSServiceOperation(IAmazonPinpoint client, Amazon.Pinpoint.Model.UpdateVoiceChannelRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Pinpoint", "UpdateVoiceChannel");
     try
     {
         #if DESKTOP
         return(client.UpdateVoiceChannel(request));
         #elif CORECLR
         return(client.UpdateVoiceChannelAsync(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;
     }
 }