Container for the parameters to the UpdateShardCount operation. Updates the shard count of the specified stream to the specified number of shards.

Updating the shard count is an asynchronous operation. Upon receiving the request, Amazon Kinesis returns immediately and sets the status of the stream to UPDATING. After the update is complete, Amazon Kinesis sets the status of the stream back to ACTIVE. Depending on the size of the stream, the scaling action could take a few minutes to complete. You can continue to read and write data to your stream while its status is UPDATING.

To update the shard count, Amazon Kinesis performs splits and merges and individual shards. This can cause short-lived shards to be created, in addition to the final shards. We recommend that you double or halve the shard count, as this results in the fewest number of splits or merges.

This operation has a rate limit of twice per rolling 24 hour period. You cannot scale above double your current shard count, scale below half your current shard count, or exceed the shard limits for your account.

For the default limits for an AWS account, see Streams Limits in the Amazon Kinesis Streams Developer Guide. If you need to increase a limit, contact AWS Support.

Inheritance: AmazonKinesisRequest
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Kinesis.Model.UpdateShardCountRequest();

            if (cmdletContext.ScalingType != null)
            {
                request.ScalingType = cmdletContext.ScalingType;
            }
            if (cmdletContext.StreamName != null)
            {
                request.StreamName = cmdletContext.StreamName;
            }
            if (cmdletContext.TargetShardCount != null)
            {
                request.TargetShardCount = cmdletContext.TargetShardCount.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);
        }
 private Amazon.Kinesis.Model.UpdateShardCountResponse CallAWSServiceOperation(IAmazonKinesis client, Amazon.Kinesis.Model.UpdateShardCountRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Kinesis", "UpdateShardCount");
     try
     {
         #if DESKTOP
         return(client.UpdateShardCount(request));
         #elif CORECLR
         return(client.UpdateShardCountAsync(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;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Initiates the asynchronous execution of the UpdateShardCount operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the UpdateShardCount 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<UpdateShardCountResponse> UpdateShardCountAsync(UpdateShardCountRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new UpdateShardCountRequestMarshaller();
            var unmarshaller = UpdateShardCountResponseUnmarshaller.Instance;

            return InvokeAsync<UpdateShardCountRequest,UpdateShardCountResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Exemplo n.º 4
0
        internal UpdateShardCountResponse UpdateShardCount(UpdateShardCountRequest request)
        {
            var marshaller = new UpdateShardCountRequestMarshaller();
            var unmarshaller = UpdateShardCountResponseUnmarshaller.Instance;

            return Invoke<UpdateShardCountRequest,UpdateShardCountResponse>(request, marshaller, unmarshaller);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Initiates the asynchronous execution of the UpdateShardCount operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the UpdateShardCount operation on AmazonKinesisClient.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">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>
 public void UpdateShardCountAsync(UpdateShardCountRequest request, AmazonServiceCallback<UpdateShardCountRequest, UpdateShardCountResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new UpdateShardCountRequestMarshaller();
     var unmarshaller = UpdateShardCountResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<UpdateShardCountRequest,UpdateShardCountResponse> responseObject 
                     = new AmazonServiceResult<UpdateShardCountRequest,UpdateShardCountResponse>((UpdateShardCountRequest)req, (UpdateShardCountResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<UpdateShardCountRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Initiates the asynchronous execution of the UpdateShardCount operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the UpdateShardCount operation on AmazonKinesisClient.</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 EndUpdateShardCount
        ///         operation.</returns>
        public IAsyncResult BeginUpdateShardCount(UpdateShardCountRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new UpdateShardCountRequestMarshaller();
            var unmarshaller = UpdateShardCountResponseUnmarshaller.Instance;

            return BeginInvoke<UpdateShardCountRequest>(request, marshaller, unmarshaller,
                callback, state);
        }