Container for the parameters to the DescribeScheduledInstances operation. Describes one or more of your Scheduled Instances.
Inheritance: AmazonEC2Request
Exemple #1
0
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeScheduledInstances operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeScheduledInstances operation on AmazonEC2Client.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeScheduledInstances
        ///         operation.</returns>
        public IAsyncResult BeginDescribeScheduledInstances(DescribeScheduledInstancesRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new DescribeScheduledInstancesRequestMarshaller();
            var unmarshaller = DescribeScheduledInstancesResponseUnmarshaller.Instance;

            return BeginInvoke<DescribeScheduledInstancesRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
 internal DescribeScheduledInstancesPaginator(IAmazonEC2 client, DescribeScheduledInstancesRequest request)
 {
     this._client  = client;
     this._request = request;
 }
Exemple #3
0
        /// <summary>
        /// Describes one or more of your Scheduled Instances.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the DescribeScheduledInstances service method.</param>
        /// 
        /// <returns>The response from the DescribeScheduledInstances service method, as returned by EC2.</returns>
        public DescribeScheduledInstancesResponse DescribeScheduledInstances(DescribeScheduledInstancesRequest request)
        {
            var marshaller = new DescribeScheduledInstancesRequestMarshaller();
            var unmarshaller = DescribeScheduledInstancesResponseUnmarshaller.Instance;

            return Invoke<DescribeScheduledInstancesRequest,DescribeScheduledInstancesResponse>(request, marshaller, unmarshaller);
        }
Exemple #4
0
 /// <summary>
 /// Paginator for DescribeScheduledInstances operation
 ///</summary>
 public IDescribeScheduledInstancesPaginator DescribeScheduledInstances(DescribeScheduledInstancesRequest request)
 {
     return(new DescribeScheduledInstancesPaginator(this.client, request));
 }
Exemple #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeScheduledInstances operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeScheduledInstances operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<DescribeScheduledInstancesResponse> DescribeScheduledInstancesAsync(DescribeScheduledInstancesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DescribeScheduledInstancesRequestMarshaller();
            var unmarshaller = DescribeScheduledInstancesResponseUnmarshaller.Instance;

            return InvokeAsync<DescribeScheduledInstancesRequest,DescribeScheduledInstancesResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
 private Amazon.EC2.Model.DescribeScheduledInstancesResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.DescribeScheduledInstancesRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "DescribeScheduledInstances");
     try
     {
         #if DESKTOP
         return(client.DescribeScheduledInstances(request));
         #elif CORECLR
         return(client.DescribeScheduledInstancesAsync(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;
            var useParameterSelect = this.Select.StartsWith("^");

            // create request and set iteration invariants
            var request = new Amazon.EC2.Model.DescribeScheduledInstancesRequest();

            if (cmdletContext.Filter != null)
            {
                request.Filters = cmdletContext.Filter;
            }
            if (cmdletContext.ScheduledInstanceId != null)
            {
                request.ScheduledInstanceIds = cmdletContext.ScheduledInstanceId;
            }

            // populate SlotStartTimeRange
            var requestSlotStartTimeRangeIsNull = true;

            request.SlotStartTimeRange = new Amazon.EC2.Model.SlotStartTimeRangeRequest();
            System.DateTime?requestSlotStartTimeRange_slotStartTimeRange_UtcEarliestTime = null;
            if (cmdletContext.SlotStartTimeRange_UtcEarliestTime != null)
            {
                requestSlotStartTimeRange_slotStartTimeRange_UtcEarliestTime = cmdletContext.SlotStartTimeRange_UtcEarliestTime.Value;
            }
            if (requestSlotStartTimeRange_slotStartTimeRange_UtcEarliestTime != null)
            {
                request.SlotStartTimeRange.EarliestTimeUtc = requestSlotStartTimeRange_slotStartTimeRange_UtcEarliestTime.Value;
                requestSlotStartTimeRangeIsNull            = false;
            }
            System.DateTime?requestSlotStartTimeRange_slotStartTimeRange_UtcLatestTime = null;
            if (cmdletContext.SlotStartTimeRange_UtcLatestTime != null)
            {
                requestSlotStartTimeRange_slotStartTimeRange_UtcLatestTime = cmdletContext.SlotStartTimeRange_UtcLatestTime.Value;
            }
            if (requestSlotStartTimeRange_slotStartTimeRange_UtcLatestTime != null)
            {
                request.SlotStartTimeRange.LatestTimeUtc = requestSlotStartTimeRange_slotStartTimeRange_UtcLatestTime.Value;
                requestSlotStartTimeRangeIsNull          = false;
            }
            #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
            System.DateTime?requestSlotStartTimeRange_slotStartTimeRange_EarliestTime = null;
            if (cmdletContext.SlotStartTimeRange_EarliestTime != null)
            {
                if (cmdletContext.SlotStartTimeRange_UtcEarliestTime != null)
                {
                    throw new System.ArgumentException("Parameters SlotStartTimeRange_EarliestTime and SlotStartTimeRange_UtcEarliestTime are mutually exclusive.", nameof(this.SlotStartTimeRange_EarliestTime));
                }
                requestSlotStartTimeRange_slotStartTimeRange_EarliestTime = cmdletContext.SlotStartTimeRange_EarliestTime.Value;
            }
            if (requestSlotStartTimeRange_slotStartTimeRange_EarliestTime != null)
            {
                request.SlotStartTimeRange.EarliestTime = requestSlotStartTimeRange_slotStartTimeRange_EarliestTime.Value;
                requestSlotStartTimeRangeIsNull         = false;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
            System.DateTime?requestSlotStartTimeRange_slotStartTimeRange_LatestTime = null;
            if (cmdletContext.SlotStartTimeRange_LatestTime != null)
            {
                if (cmdletContext.SlotStartTimeRange_UtcLatestTime != null)
                {
                    throw new System.ArgumentException("Parameters SlotStartTimeRange_LatestTime and SlotStartTimeRange_UtcLatestTime are mutually exclusive.", nameof(this.SlotStartTimeRange_LatestTime));
                }
                requestSlotStartTimeRange_slotStartTimeRange_LatestTime = cmdletContext.SlotStartTimeRange_LatestTime.Value;
            }
            if (requestSlotStartTimeRange_slotStartTimeRange_LatestTime != null)
            {
                request.SlotStartTimeRange.LatestTime = requestSlotStartTimeRange_slotStartTimeRange_LatestTime.Value;
                requestSlotStartTimeRangeIsNull       = false;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            // determine if request.SlotStartTimeRange should be set to null
            if (requestSlotStartTimeRangeIsNull)
            {
                request.SlotStartTimeRange = null;
            }

            // Initialize loop variants and commence piping
            System.String _nextToken      = null;
            int?          _emitLimit      = null;
            int           _retrievedSoFar = 0;
            if (AutoIterationHelpers.HasValue(cmdletContext.NextToken))
            {
                _nextToken = cmdletContext.NextToken;
            }
            if (cmdletContext.MaxResult.HasValue)
            {
                _emitLimit = cmdletContext.MaxResult;
            }
            var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.NextToken));

            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);
            do
            {
                request.NextToken = _nextToken;
                if (_emitLimit.HasValue)
                {
                    request.MaxResults = AutoIterationHelpers.ConvertEmitLimitToInt32(_emitLimit.Value);
                }

                CmdletOutput output;

                try
                {
                    var    response       = CallAWSServiceOperation(client, request);
                    object pipelineOutput = null;
                    if (!useParameterSelect)
                    {
                        pipelineOutput = cmdletContext.Select(response, this);
                    }
                    output = new CmdletOutput
                    {
                        PipelineOutput  = pipelineOutput,
                        ServiceResponse = response
                    };
                    int _receivedThisCall = response.ScheduledInstanceSet.Count;

                    _nextToken       = response.NextToken;
                    _retrievedSoFar += _receivedThisCall;
                    if (_emitLimit.HasValue)
                    {
                        _emitLimit -= _receivedThisCall;
                    }
                }
                catch (Exception e)
                {
                    if (_retrievedSoFar == 0 || !_emitLimit.HasValue)
                    {
                        output = new CmdletOutput {
                            ErrorResponse = e
                        };
                    }
                    else
                    {
                        break;
                    }
                }

                ProcessOutput(output);
            } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken) && (!_emitLimit.HasValue || _emitLimit.Value >= 1));


            if (useParameterSelect)
            {
                WriteObject(cmdletContext.Select(null, this));
            }


            return(null);
        }