Esempio n. 1
0
 /// <summary>
 /// Paginator for DescribeUpdateActions operation
 ///</summary>
 public IDescribeUpdateActionsPaginator DescribeUpdateActions(DescribeUpdateActionsRequest request)
 {
     return(new DescribeUpdateActionsPaginator(this.client, request));
 }
 private Amazon.ElastiCache.Model.DescribeUpdateActionsResponse CallAWSServiceOperation(IAmazonElastiCache client, Amazon.ElastiCache.Model.DescribeUpdateActionsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon ElastiCache", "DescribeUpdateActions");
     try
     {
         #if DESKTOP
         return(client.DescribeUpdateActions(request));
         #elif CORECLR
         return(client.DescribeUpdateActionsAsync(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;

            #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
            var useParameterSelect = this.Select.StartsWith("^") || this.PassThru.IsPresent;
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute

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

            if (cmdletContext.CacheClusterId != null)
            {
                request.CacheClusterIds = cmdletContext.CacheClusterId;
            }
            if (cmdletContext.Engine != null)
            {
                request.Engine = cmdletContext.Engine;
            }
            if (cmdletContext.MaxRecord != null)
            {
                request.MaxRecords = AutoIterationHelpers.ConvertEmitLimitToServiceTypeInt32(cmdletContext.MaxRecord.Value);
            }
            if (cmdletContext.ReplicationGroupId != null)
            {
                request.ReplicationGroupIds = cmdletContext.ReplicationGroupId;
            }
            if (cmdletContext.ServiceUpdateName != null)
            {
                request.ServiceUpdateName = cmdletContext.ServiceUpdateName;
            }
            if (cmdletContext.ServiceUpdateStatus != null)
            {
                request.ServiceUpdateStatus = cmdletContext.ServiceUpdateStatus;
            }

            // populate ServiceUpdateTimeRange
            var requestServiceUpdateTimeRangeIsNull = true;
            request.ServiceUpdateTimeRange = new Amazon.ElastiCache.Model.TimeRangeFilter();
            System.DateTime?requestServiceUpdateTimeRange_serviceUpdateTimeRange_EndTime = null;
            if (cmdletContext.ServiceUpdateTimeRange_EndTime != null)
            {
                requestServiceUpdateTimeRange_serviceUpdateTimeRange_EndTime = cmdletContext.ServiceUpdateTimeRange_EndTime.Value;
            }
            if (requestServiceUpdateTimeRange_serviceUpdateTimeRange_EndTime != null)
            {
                request.ServiceUpdateTimeRange.EndTime = requestServiceUpdateTimeRange_serviceUpdateTimeRange_EndTime.Value;
                requestServiceUpdateTimeRangeIsNull    = false;
            }
            System.DateTime?requestServiceUpdateTimeRange_serviceUpdateTimeRange_StartTime = null;
            if (cmdletContext.ServiceUpdateTimeRange_StartTime != null)
            {
                requestServiceUpdateTimeRange_serviceUpdateTimeRange_StartTime = cmdletContext.ServiceUpdateTimeRange_StartTime.Value;
            }
            if (requestServiceUpdateTimeRange_serviceUpdateTimeRange_StartTime != null)
            {
                request.ServiceUpdateTimeRange.StartTime = requestServiceUpdateTimeRange_serviceUpdateTimeRange_StartTime.Value;
                requestServiceUpdateTimeRangeIsNull      = false;
            }
            // determine if request.ServiceUpdateTimeRange should be set to null
            if (requestServiceUpdateTimeRangeIsNull)
            {
                request.ServiceUpdateTimeRange = null;
            }
            if (cmdletContext.ShowNodeLevelUpdateStatus != null)
            {
                request.ShowNodeLevelUpdateStatus = cmdletContext.ShowNodeLevelUpdateStatus.Value;
            }
            if (cmdletContext.UpdateActionStatus != null)
            {
                request.UpdateActionStatus = cmdletContext.UpdateActionStatus;
            }

            // Initialize loop variant and commence piping
            var _nextToken             = cmdletContext.Marker;
            var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.Marker));

            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);
            do
            {
                request.Marker = _nextToken;

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

                    _nextToken = response.Marker;
                }
                catch (Exception e)
                {
                    output = new CmdletOutput {
                        ErrorResponse = e
                    };
                }

                ProcessOutput(output);
            } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken));

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


            return(null);
        }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext      = context as CmdletContext;
            var useParameterSelect = this.Select.StartsWith("^") || this.PassThru.IsPresent;

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

            if (cmdletContext.CacheClusterId != null)
            {
                request.CacheClusterIds = cmdletContext.CacheClusterId;
            }
            if (cmdletContext.Engine != null)
            {
                request.Engine = cmdletContext.Engine;
            }
            if (cmdletContext.ReplicationGroupId != null)
            {
                request.ReplicationGroupIds = cmdletContext.ReplicationGroupId;
            }
            if (cmdletContext.ServiceUpdateName != null)
            {
                request.ServiceUpdateName = cmdletContext.ServiceUpdateName;
            }
            if (cmdletContext.ServiceUpdateStatus != null)
            {
                request.ServiceUpdateStatus = cmdletContext.ServiceUpdateStatus;
            }

            // populate ServiceUpdateTimeRange
            var requestServiceUpdateTimeRangeIsNull = true;

            request.ServiceUpdateTimeRange = new Amazon.ElastiCache.Model.TimeRangeFilter();
            System.DateTime?requestServiceUpdateTimeRange_serviceUpdateTimeRange_EndTime = null;
            if (cmdletContext.ServiceUpdateTimeRange_EndTime != null)
            {
                requestServiceUpdateTimeRange_serviceUpdateTimeRange_EndTime = cmdletContext.ServiceUpdateTimeRange_EndTime.Value;
            }
            if (requestServiceUpdateTimeRange_serviceUpdateTimeRange_EndTime != null)
            {
                request.ServiceUpdateTimeRange.EndTime = requestServiceUpdateTimeRange_serviceUpdateTimeRange_EndTime.Value;
                requestServiceUpdateTimeRangeIsNull    = false;
            }
            System.DateTime?requestServiceUpdateTimeRange_serviceUpdateTimeRange_StartTime = null;
            if (cmdletContext.ServiceUpdateTimeRange_StartTime != null)
            {
                requestServiceUpdateTimeRange_serviceUpdateTimeRange_StartTime = cmdletContext.ServiceUpdateTimeRange_StartTime.Value;
            }
            if (requestServiceUpdateTimeRange_serviceUpdateTimeRange_StartTime != null)
            {
                request.ServiceUpdateTimeRange.StartTime = requestServiceUpdateTimeRange_serviceUpdateTimeRange_StartTime.Value;
                requestServiceUpdateTimeRangeIsNull      = false;
            }
            // determine if request.ServiceUpdateTimeRange should be set to null
            if (requestServiceUpdateTimeRangeIsNull)
            {
                request.ServiceUpdateTimeRange = null;
            }
            if (cmdletContext.ShowNodeLevelUpdateStatus != null)
            {
                request.ShowNodeLevelUpdateStatus = cmdletContext.ShowNodeLevelUpdateStatus.Value;
            }
            if (cmdletContext.UpdateActionStatus != null)
            {
                request.UpdateActionStatus = cmdletContext.UpdateActionStatus;
            }

            // Initialize loop variants and commence piping
            System.String _nextToken      = null;
            int?          _emitLimit      = null;
            int           _retrievedSoFar = 0;

            if (AutoIterationHelpers.HasValue(cmdletContext.Marker))
            {
                _nextToken = cmdletContext.Marker;
            }
            if (cmdletContext.MaxRecord.HasValue)
            {
                _emitLimit = cmdletContext.MaxRecord;
            }
            var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.Marker));

            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            do
            {
                request.Marker = _nextToken;
                if (_emitLimit.HasValue)
                {
                    request.MaxRecords = 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.UpdateActions.Count;

                    _nextToken       = response.Marker;
                    _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);
        }
Esempio n. 5
0
 internal DescribeUpdateActionsPaginator(IAmazonElastiCache client, DescribeUpdateActionsRequest request)
 {
     this._client  = client;
     this._request = request;
 }