예제 #1
0
 private Amazon.MediaTailor.Model.CreatePrefetchScheduleResponse CallAWSServiceOperation(IAmazonMediaTailor client, Amazon.MediaTailor.Model.CreatePrefetchScheduleRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Elemental MediaTailor", "CreatePrefetchSchedule");
     try
     {
         #if DESKTOP
         return(client.CreatePrefetchSchedule(request));
         #elif CORECLR
         return(client.CreatePrefetchScheduleAsync(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.MediaTailor.Model.CreatePrefetchScheduleRequest();


            // populate Consumption
            var requestConsumptionIsNull = true;

            request.Consumption = new Amazon.MediaTailor.Model.PrefetchConsumption();
            List <Amazon.MediaTailor.Model.AvailMatchingCriteria> requestConsumption_consumption_AvailMatchingCriterion = null;

            if (cmdletContext.Consumption_AvailMatchingCriterion != null)
            {
                requestConsumption_consumption_AvailMatchingCriterion = cmdletContext.Consumption_AvailMatchingCriterion;
            }
            if (requestConsumption_consumption_AvailMatchingCriterion != null)
            {
                request.Consumption.AvailMatchingCriteria = requestConsumption_consumption_AvailMatchingCriterion;
                requestConsumptionIsNull = false;
            }
            System.DateTime?requestConsumption_consumption_EndTime = null;
            if (cmdletContext.Consumption_EndTime != null)
            {
                requestConsumption_consumption_EndTime = cmdletContext.Consumption_EndTime.Value;
            }
            if (requestConsumption_consumption_EndTime != null)
            {
                request.Consumption.EndTime = requestConsumption_consumption_EndTime.Value;
                requestConsumptionIsNull    = false;
            }
            System.DateTime?requestConsumption_consumption_StartTime = null;
            if (cmdletContext.Consumption_StartTime != null)
            {
                requestConsumption_consumption_StartTime = cmdletContext.Consumption_StartTime.Value;
            }
            if (requestConsumption_consumption_StartTime != null)
            {
                request.Consumption.StartTime = requestConsumption_consumption_StartTime.Value;
                requestConsumptionIsNull      = false;
            }
            // determine if request.Consumption should be set to null
            if (requestConsumptionIsNull)
            {
                request.Consumption = null;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.PlaybackConfigurationName != null)
            {
                request.PlaybackConfigurationName = cmdletContext.PlaybackConfigurationName;
            }

            // populate Retrieval
            var requestRetrievalIsNull = true;

            request.Retrieval = new Amazon.MediaTailor.Model.PrefetchRetrieval();
            Dictionary <System.String, System.String> requestRetrieval_retrieval_DynamicVariable = null;

            if (cmdletContext.Retrieval_DynamicVariable != null)
            {
                requestRetrieval_retrieval_DynamicVariable = cmdletContext.Retrieval_DynamicVariable;
            }
            if (requestRetrieval_retrieval_DynamicVariable != null)
            {
                request.Retrieval.DynamicVariables = requestRetrieval_retrieval_DynamicVariable;
                requestRetrievalIsNull             = false;
            }
            System.DateTime?requestRetrieval_retrieval_EndTime = null;
            if (cmdletContext.Retrieval_EndTime != null)
            {
                requestRetrieval_retrieval_EndTime = cmdletContext.Retrieval_EndTime.Value;
            }
            if (requestRetrieval_retrieval_EndTime != null)
            {
                request.Retrieval.EndTime = requestRetrieval_retrieval_EndTime.Value;
                requestRetrievalIsNull    = false;
            }
            System.DateTime?requestRetrieval_retrieval_StartTime = null;
            if (cmdletContext.Retrieval_StartTime != null)
            {
                requestRetrieval_retrieval_StartTime = cmdletContext.Retrieval_StartTime.Value;
            }
            if (requestRetrieval_retrieval_StartTime != null)
            {
                request.Retrieval.StartTime = requestRetrieval_retrieval_StartTime.Value;
                requestRetrievalIsNull      = false;
            }
            // determine if request.Retrieval should be set to null
            if (requestRetrievalIsNull)
            {
                request.Retrieval = null;
            }
            if (cmdletContext.StreamId != null)
            {
                request.StreamId = cmdletContext.StreamId;
            }

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