Container for the parameters to the MergeShards operation. Merges two adjacent shards in an Amazon Kinesis stream and combines them into a single shard to reduce the stream's capacity to ingest and transport data. Two shards are considered adjacent if the union of the hash key ranges for the two shards form a contiguous set with no gaps. For example, if you have two shards, one with a hash key range of 276...381 and the other with a hash key range of 382...454, then you could merge these two shards into a single shard that would have a hash key range of 276...454. After the merge, the single child shard receives data for all hash key values covered by the two parent shards.

MergeShards is called when there is a need to reduce the overall capacity of a stream because of excess capacity that is not being used. You must specify the shard to be merged and the adjacent shard for a stream. For more information about merging shards, see Merge Two Shards in the Amazon Kinesis Streams Developer Guide.

If the stream is in the ACTIVE state, you can call MergeShards. If a stream is in the CREATING, UPDATING, or DELETING state, MergeShards returns a ResourceInUseException. If the specified stream does not exist, MergeShards returns a ResourceNotFoundException.

You can use DescribeStream to check the state of the stream, which is returned in StreamStatus.

MergeShards is an asynchronous operation. Upon receiving a MergeShards request, Amazon Kinesis immediately returns a response and sets the StreamStatus to UPDATING. After the operation is completed, Amazon Kinesis sets the StreamStatus to ACTIVE. Read and write operations continue to work while the stream is in the UPDATING state.

You use DescribeStream to determine the shard IDs that are specified in the MergeShards request.

If you try to operate on too many streams in parallel using CreateStream, DeleteStream, MergeShards or SplitShard, you will receive a LimitExceededException.

MergeShards has limit of 5 transactions per second per account.

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

            if (cmdletContext.AdjacentShardToMerge != null)
            {
                request.AdjacentShardToMerge = cmdletContext.AdjacentShardToMerge;
            }
            if (cmdletContext.ShardToMerge != null)
            {
                request.ShardToMerge = cmdletContext.ShardToMerge;
            }
            if (cmdletContext.StreamName != null)
            {
                request.StreamName = cmdletContext.StreamName;
            }

            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);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// <para>This operation merges two adjacent shards in a stream and combines them into a single shard to reduce the stream's capacity to ingest
        /// and transport data. Two shards are considered adjacent if the union of the hash key ranges for the two shards form a contiguous set with no
        /// gaps. For example, if you have two shards, one with a hash key range of 276...381 and the other with a hash key range of 382...454, then you
        /// could merge these two shards into a single shard that would have a hash key range of 276...454. After the merge, the single child shard
        /// receives data for all hash key values covered by the two parent shards.</para> <para> <c>MergeShards</c> is called when there is a need to
        /// reduce the overall capacity of a stream because of excess capacity that is not being used. The operation requires that you specify the shard
        /// to be merged and the adjacent shard for a given stream. For more information about merging shards, see the <a href="http://docs.aws.amazon.com/kinesis/latest/dev/">Amazon Kinesis Developer Guide</a> .</para> <para>If the stream is in the ACTIVE
        /// state, you can call <c>MergeShards</c> . If a stream is in CREATING or UPDATING or DELETING states, then Amazon Kinesis returns a
        /// <c>ResourceInUseException</c> .
        /// If the specified stream does not exist, Amazon Kinesis returns a <c>ResourceNotFoundException</c> . </para> <para>You can use
        /// the DescribeStream operation to check the state of the stream, which is returned in <c>StreamStatus</c> .</para> <para> <c>MergeShards</c>
        /// is an asynchronous operation. Upon receiving a <c>MergeShards</c> request, Amazon Kinesis immediately returns a response and sets the
        /// <c>StreamStatus</c> to UPDATING. After the operation is completed, Amazon Kinesis sets the <c>StreamStatus</c> to ACTIVE. Read and write
        /// operations continue to work while the stream is in the UPDATING state. </para> <para>You use the DescribeStream operation to determine the
        /// shard IDs that are specified in the <c>MergeShards</c> request. </para> <para>If you try to operate on too many streams in parallel using
        /// CreateStream, DeleteStream, <c>MergeShards</c> or SplitShard, you will receive a <c>LimitExceededException</c> . </para> <para>
        /// <c>MergeShards</c> has limit of 5 transactions per second per account.</para>
        /// </summary>
        /// 
        /// <param name="mergeShardsRequest">Container for the necessary parameters to execute the MergeShards service method on AmazonKinesis.</param>
        /// 
        /// <exception cref="T:Amazon.Kinesis.Model.LimitExceededException" />
        /// <exception cref="T:Amazon.Kinesis.Model.ResourceInUseException" />
        /// <exception cref="T:Amazon.Kinesis.Model.InvalidArgumentException" />
        /// <exception cref="T:Amazon.Kinesis.Model.ResourceNotFoundException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<MergeShardsResponse> MergeShardsAsync(MergeShardsRequest mergeShardsRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new MergeShardsRequestMarshaller();
            var unmarshaller = MergeShardsResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, MergeShardsRequest, MergeShardsResponse>(mergeShardsRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
Ejemplo n.º 3
0
		internal MergeShardsResponse MergeShards(MergeShardsRequest request)
        {
            var task = MergeShardsAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initiates the asynchronous execution of the MergeShards operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the MergeShards 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<MergeShardsResponse> MergeShardsAsync(MergeShardsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new MergeShardsRequestMarshaller();
            var unmarshaller = MergeShardsResponseUnmarshaller.Instance;

            return InvokeAsync<MergeShardsRequest,MergeShardsResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Ejemplo n.º 5
0
        internal MergeShardsResponse MergeShards(MergeShardsRequest request)
        {
            var marshaller = new MergeShardsRequestMarshaller();
            var unmarshaller = MergeShardsResponseUnmarshaller.Instance;

            return Invoke<MergeShardsRequest,MergeShardsResponse>(request, marshaller, unmarshaller);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initiates the asynchronous execution of the MergeShards operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the MergeShards 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 EndMergeShards
        ///         operation.</returns>
        public IAsyncResult BeginMergeShards(MergeShardsRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new MergeShardsRequestMarshaller();
            var unmarshaller = MergeShardsResponseUnmarshaller.Instance;

            return BeginInvoke<MergeShardsRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        /// <summary>
        /// <para>This operation merges two adjacent shards in a stream and combines them into a single shard to reduce the stream's capacity to ingest
        /// and transport data. Two shards are considered adjacent if the union of the hash key ranges for the two shards form a contiguous set with no
        /// gaps. For example, if you have two shards, one with a hash key range of 276...381 and the other with a hash key range of 382...454, then you
        /// could merge these two shards into a single shard that would have a hash key range of 276...454. After the merge, the single child shard
        /// receives data for all hash key values covered by the two parent shards.</para> <para> <c>MergeShards</c> is called when there is a need to
        /// reduce the overall capacity of a stream because of excess capacity that is not being used. The operation requires that you specify the shard
        /// to be merged and the adjacent shard for a given stream. For more information about merging shards, see the <a href="http://docs.aws.amazon.com/kinesis/latest/dev/">Amazon Kinesis Developer Guide</a> .</para> <para>If the stream is in the ACTIVE
        /// state, you can call <c>MergeShards</c> . If a stream is in CREATING or UPDATING or DELETING states, then Amazon Kinesis returns a
        /// <c>ResourceInUseException</c> .
        /// If the specified stream does not exist, Amazon Kinesis returns a <c>ResourceNotFoundException</c> . </para> <para>You can use
        /// the DescribeStream operation to check the state of the stream, which is returned in <c>StreamStatus</c> .</para> <para> <c>MergeShards</c>
        /// is an asynchronous operation. Upon receiving a <c>MergeShards</c> request, Amazon Kinesis immediately returns a response and sets the
        /// <c>StreamStatus</c> to UPDATING. After the operation is completed, Amazon Kinesis sets the <c>StreamStatus</c> to ACTIVE. Read and write
        /// operations continue to work while the stream is in the UPDATING state. </para> <para>You use the DescribeStream operation to determine the
        /// shard IDs that are specified in the <c>MergeShards</c> request. </para> <para>If you try to operate on too many streams in parallel using
        /// CreateStream, DeleteStream, <c>MergeShards</c> or SplitShard, you will receive a <c>LimitExceededException</c> . </para> <para>
        /// <c>MergeShards</c> has limit of 5 transactions per second per account.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the MergeShards service method on AmazonKinesis.</param>
        /// 
        /// <exception cref="T:Amazon.Kinesis.Model.LimitExceededException" />
        /// <exception cref="T:Amazon.Kinesis.Model.ResourceInUseException" />
        /// <exception cref="T:Amazon.Kinesis.Model.InvalidArgumentException" />
        /// <exception cref="T:Amazon.Kinesis.Model.ResourceNotFoundException" />
		public MergeShardsResponse MergeShards(MergeShardsRequest request)
        {
            var task = MergeShardsAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Initiates the asynchronous execution of the MergeShards operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the MergeShards 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 MergeShardsAsync(MergeShardsRequest request, AmazonServiceCallback<MergeShardsRequest, MergeShardsResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new MergeShardsRequestMarshaller();
     var unmarshaller = MergeShardsResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<MergeShardsRequest,MergeShardsResponse> responseObject 
                     = new AmazonServiceResult<MergeShardsRequest,MergeShardsResponse>((MergeShardsRequest)req, (MergeShardsResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<MergeShardsRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
 private Amazon.Kinesis.Model.MergeShardsResponse CallAWSServiceOperation(IAmazonKinesis client, Amazon.Kinesis.Model.MergeShardsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Kinesis", "MergeShards");
     try
     {
         #if DESKTOP
         return(client.MergeShards(request));
         #elif CORECLR
         return(client.MergeShardsAsync(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;
     }
 }
Ejemplo n.º 10
0
 IAsyncResult invokeMergeShards(MergeShardsRequest mergeShardsRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new MergeShardsRequestMarshaller().Marshall(mergeShardsRequest);
     var unmarshaller = MergeShardsResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Initiates the asynchronous execution of the MergeShards operation.
 /// <seealso cref="Amazon.Kinesis.IAmazonKinesis.MergeShards"/>
 /// </summary>
 /// 
 /// <param name="mergeShardsRequest">Container for the necessary parameters to execute the MergeShards operation on AmazonKinesis.</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>
 public IAsyncResult BeginMergeShards(MergeShardsRequest mergeShardsRequest, AsyncCallback callback, object state)
 {
     return invokeMergeShards(mergeShardsRequest, callback, state, false);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// <para>This operation merges two adjacent shards in a stream and combines them into a single shard to reduce the stream's capacity to ingest
 /// and transport data. Two shards are considered adjacent if the union of the hash key ranges for the two shards form a contiguous set with no
 /// gaps. For example, if you have two shards, one with a hash key range of 276...381 and the other with a hash key range of 382...454, then you
 /// could merge these two shards into a single shard that would have a hash key range of 276...454. After the merge, the single child shard
 /// receives data for all hash key values covered by the two parent shards.</para> <para> <c>MergeShards</c> is called when there is a need to
 /// reduce the overall capacity of a stream because of excess capacity that is not being used. The operation requires that you specify the shard
 /// to be merged and the adjacent shard for a given stream. For more information about merging shards, see the <a
 /// href="http://docs.aws.amazon.com/kinesis/latest/dev/" >Amazon Kinesis Developer Guide</a> .</para> <para>If the stream is in the ACTIVE
 /// state, you can call <c>MergeShards</c> . If a stream is in CREATING or UPDATING or DELETING states, then Amazon Kinesis returns a
 /// <c>ResourceInUseException</c> .
 /// If the specified stream does not exist, Amazon Kinesis returns a <c>ResourceNotFoundException</c> . </para> <para>You can use
 /// the DescribeStream operation to check the state of the stream, which is returned in <c>StreamStatus</c> .</para> <para> <c>MergeShards</c>
 /// is an asynchronous operation. Upon receiving a <c>MergeShards</c> request, Amazon Kinesis immediately returns a response and sets the
 /// <c>StreamStatus</c> to UPDATING. After the operation is completed, Amazon Kinesis sets the <c>StreamStatus</c> to ACTIVE. Read and write
 /// operations continue to work while the stream is in the UPDATING state. </para> <para>You use the DescribeStream operation to determine the
 /// shard IDs that are specified in the <c>MergeShards</c> request. </para> <para>If you try to operate on too many streams in parallel using
 /// CreateStream, DeleteStream, <c>MergeShards</c> or SplitShard, you will receive a <c>LimitExceededException</c> . </para> <para>
 /// <c>MergeShards</c> has limit of 5 transactions per second per account.</para>
 /// </summary>
 /// 
 /// <param name="mergeShardsRequest">Container for the necessary parameters to execute the MergeShards service method on AmazonKinesis.</param>
 /// 
 /// <exception cref="LimitExceededException"/>
 /// <exception cref="ResourceInUseException"/>
 /// <exception cref="InvalidArgumentException"/>
 /// <exception cref="ResourceNotFoundException"/>
 public MergeShardsResponse MergeShards(MergeShardsRequest mergeShardsRequest)
 {
     IAsyncResult asyncResult = invokeMergeShards(mergeShardsRequest, null, null, true);
     return EndMergeShards(asyncResult);
 }