コード例 #1
0
 private Amazon.AlexaForBusiness.Model.SendAnnouncementResponse CallAWSServiceOperation(IAmazonAlexaForBusiness client, Amazon.AlexaForBusiness.Model.SendAnnouncementRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Alexa For Business", "SendAnnouncement");
     try
     {
         #if DESKTOP
         return(client.SendAnnouncement(request));
         #elif CORECLR
         return(client.SendAnnouncementAsync(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;
     }
 }
コード例 #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.AlexaForBusiness.Model.SendAnnouncementRequest();

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

            // populate Content
            var requestContentIsNull = true;

            request.Content = new Amazon.AlexaForBusiness.Model.Content();
            List <Amazon.AlexaForBusiness.Model.Audio> requestContent_content_AudioList = null;

            if (cmdletContext.Content_AudioList != null)
            {
                requestContent_content_AudioList = cmdletContext.Content_AudioList;
            }
            if (requestContent_content_AudioList != null)
            {
                request.Content.AudioList = requestContent_content_AudioList;
                requestContentIsNull      = false;
            }
            List <Amazon.AlexaForBusiness.Model.Ssml> requestContent_content_SsmlList = null;

            if (cmdletContext.Content_SsmlList != null)
            {
                requestContent_content_SsmlList = cmdletContext.Content_SsmlList;
            }
            if (requestContent_content_SsmlList != null)
            {
                request.Content.SsmlList = requestContent_content_SsmlList;
                requestContentIsNull     = false;
            }
            List <Amazon.AlexaForBusiness.Model.Text> requestContent_content_TextList = null;

            if (cmdletContext.Content_TextList != null)
            {
                requestContent_content_TextList = cmdletContext.Content_TextList;
            }
            if (requestContent_content_TextList != null)
            {
                request.Content.TextList = requestContent_content_TextList;
                requestContentIsNull     = false;
            }
            // determine if request.Content should be set to null
            if (requestContentIsNull)
            {
                request.Content = null;
            }
            if (cmdletContext.RoomFilter != null)
            {
                request.RoomFilters = cmdletContext.RoomFilter;
            }
            if (cmdletContext.TimeToLiveInSecond != null)
            {
                request.TimeToLiveInSeconds = cmdletContext.TimeToLiveInSecond.Value;
            }

            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);
        }