GetRecordsResponse GetRecords (AmazonKinesisClient client, string shardId) { var siRequest = new GetShardIteratorRequest (); siRequest.ShardId = shardId; siRequest.StreamName = "Test1"; siRequest.ShardIteratorType = "TRIM_HORIZON"; var siResponse = client.GetShardIterator (siRequest); var request = new GetRecordsRequest (); request.ShardIterator = siResponse.ShardIterator; return client.GetRecords (request); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Kinesis.Model.GetShardIteratorRequest(); if (cmdletContext.ShardId != null) { request.ShardId = cmdletContext.ShardId; } if (cmdletContext.ShardIteratorType != null) { request.ShardIteratorType = cmdletContext.ShardIteratorType; } if (cmdletContext.StartingSequenceNumber != null) { request.StartingSequenceNumber = cmdletContext.StartingSequenceNumber; } if (cmdletContext.StreamName != null) { request.StreamName = cmdletContext.StreamName; } if (cmdletContext.Timestamp != null) { request.Timestamp = cmdletContext.Timestamp.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); }
/// <summary> /// <para>This operation returns a shard iterator in <c>ShardIterator</c> . The shard iterator specifies the position in the shard from which /// you want to start reading data records sequentially. A shard iterator specifies this position using the sequence number of a data record in /// a shard. A sequence number is the identifier associated with every record ingested in the Amazon Kinesis stream. The sequence number is /// assigned by the Amazon Kinesis service when a record is put into the stream. </para> <para>You must specify the shard iterator type in the /// <c>GetShardIterator</c> request. For example, you can set the <c>ShardIteratorType</c> parameter to read exactly from the position denoted /// by a specific sequence number by using the AT_SEQUENCE_NUMBER shard iterator type, or right after the sequence number by using the /// AFTER_SEQUENCE_NUMBER shard iterator type, using sequence numbers returned by earlier PutRecord, GetRecords or DescribeStream requests. You /// can specify the shard iterator type TRIM_HORIZON in the request to cause <c>ShardIterator</c> to point to the last untrimmed record in the /// shard in the system, which is the oldest data record in the shard. Or you can point to just after the most recent record in the shard, by /// using the shard iterator type LATEST, so that you always read the most recent data in the shard. </para> <para> <b>Note:</b> Each shard /// iterator expires five minutes after it is returned to the requester.</para> <para>When you repeatedly read from an Amazon Kinesis stream use /// a GetShardIterator request to get the first shard iterator to to use in your first <c>GetRecords</c> request and then use the shard iterator /// returned by the <c>GetRecords</c> request in <c>NextShardIterator</c> for subsequent reads. A new shard iterator is returned by every /// <c>GetRecords</c> request in <c>NextShardIterator</c> , /// which you use in the <c>ShardIterator</c> parameter of the next <c>GetRecords</c> request. </para> <para>If a /// <c>GetShardIterator</c> request is made too often, you will receive a <c>ProvisionedThroughputExceededException</c> . /// For more information about throughput limits, see the <a href="http://docs.aws.amazon.com/kinesis/latest/dev/">Amazon Kinesis /// Developer Guide</a> . </para> <para> <c>GetShardIterator</c> can return <c>null</c> for its <c>ShardIterator</c> to indicate that the shard /// has been closed and that the requested iterator will return no more data. A shard can be closed by a SplitShard or MergeShards /// operation.</para> <para> <c>GetShardIterator</c> has a limit of 5 transactions per second per account per shard.</para> /// </summary> /// /// <param name="getShardIteratorRequest">Container for the necessary parameters to execute the GetShardIterator service method on /// AmazonKinesis.</param> /// /// <returns>The response from the GetShardIterator service method, as returned by AmazonKinesis.</returns> /// /// <exception cref="T:Amazon.Kinesis.Model.ProvisionedThroughputExceededException" /> /// <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<GetShardIteratorResponse> GetShardIteratorAsync(GetShardIteratorRequest getShardIteratorRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetShardIteratorRequestMarshaller(); var unmarshaller = GetShardIteratorResponseUnmarshaller.GetInstance(); return Invoke<IRequest, GetShardIteratorRequest, GetShardIteratorResponse>(getShardIteratorRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal GetShardIteratorResponse GetShardIterator(GetShardIteratorRequest request) { var task = GetShardIteratorAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// Initiates the asynchronous execution of the GetShardIterator operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetShardIterator 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<GetShardIteratorResponse> GetShardIteratorAsync(GetShardIteratorRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetShardIteratorRequestMarshaller(); var unmarshaller = GetShardIteratorResponseUnmarshaller.Instance; return InvokeAsync<GetShardIteratorRequest,GetShardIteratorResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal GetShardIteratorResponse GetShardIterator(GetShardIteratorRequest request) { var marshaller = new GetShardIteratorRequestMarshaller(); var unmarshaller = GetShardIteratorResponseUnmarshaller.Instance; return Invoke<GetShardIteratorRequest,GetShardIteratorResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the GetShardIterator operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetShardIterator 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 EndGetShardIterator /// operation.</returns> public IAsyncResult BeginGetShardIterator(GetShardIteratorRequest request, AsyncCallback callback, object state) { var marshaller = new GetShardIteratorRequestMarshaller(); var unmarshaller = GetShardIteratorResponseUnmarshaller.Instance; return BeginInvoke<GetShardIteratorRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// <para>This operation returns a shard iterator in <c>ShardIterator</c> . The shard iterator specifies the position in the shard from which /// you want to start reading data records sequentially. A shard iterator specifies this position using the sequence number of a data record in /// a shard. A sequence number is the identifier associated with every record ingested in the Amazon Kinesis stream. The sequence number is /// assigned by the Amazon Kinesis service when a record is put into the stream. </para> <para>You must specify the shard iterator type in the /// <c>GetShardIterator</c> request. For example, you can set the <c>ShardIteratorType</c> parameter to read exactly from the position denoted /// by a specific sequence number by using the AT_SEQUENCE_NUMBER shard iterator type, or right after the sequence number by using the /// AFTER_SEQUENCE_NUMBER shard iterator type, using sequence numbers returned by earlier PutRecord, GetRecords or DescribeStream requests. You /// can specify the shard iterator type TRIM_HORIZON in the request to cause <c>ShardIterator</c> to point to the last untrimmed record in the /// shard in the system, which is the oldest data record in the shard. Or you can point to just after the most recent record in the shard, by /// using the shard iterator type LATEST, so that you always read the most recent data in the shard. </para> <para> <b>Note:</b> Each shard /// iterator expires five minutes after it is returned to the requester.</para> <para>When you repeatedly read from an Amazon Kinesis stream use /// a GetShardIterator request to get the first shard iterator to to use in your first <c>GetRecords</c> request and then use the shard iterator /// returned by the <c>GetRecords</c> request in <c>NextShardIterator</c> for subsequent reads. A new shard iterator is returned by every /// <c>GetRecords</c> request in <c>NextShardIterator</c> , /// which you use in the <c>ShardIterator</c> parameter of the next <c>GetRecords</c> request. </para> <para>If a /// <c>GetShardIterator</c> request is made too often, you will receive a <c>ProvisionedThroughputExceededException</c> . /// For more information about throughput limits, see the <a href="http://docs.aws.amazon.com/kinesis/latest/dev/">Amazon Kinesis /// Developer Guide</a> . </para> <para> <c>GetShardIterator</c> can return <c>null</c> for its <c>ShardIterator</c> to indicate that the shard /// has been closed and that the requested iterator will return no more data. A shard can be closed by a SplitShard or MergeShards /// operation.</para> <para> <c>GetShardIterator</c> has a limit of 5 transactions per second per account per open shard.</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetShardIterator service method on /// AmazonKinesis.</param> /// /// <returns>The response from the GetShardIterator service method, as returned by AmazonKinesis.</returns> /// /// <exception cref="T:Amazon.Kinesis.Model.ProvisionedThroughputExceededException" /> /// <exception cref="T:Amazon.Kinesis.Model.InvalidArgumentException" /> /// <exception cref="T:Amazon.Kinesis.Model.ResourceNotFoundException" /> public GetShardIteratorResponse GetShardIterator(GetShardIteratorRequest request) { var task = GetShardIteratorAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the GetShardIterator operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetShardIterator 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 GetShardIteratorAsync(GetShardIteratorRequest request, AmazonServiceCallback<GetShardIteratorRequest, GetShardIteratorResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new GetShardIteratorRequestMarshaller(); var unmarshaller = GetShardIteratorResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<GetShardIteratorRequest,GetShardIteratorResponse> responseObject = new AmazonServiceResult<GetShardIteratorRequest,GetShardIteratorResponse>((GetShardIteratorRequest)req, (GetShardIteratorResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<GetShardIteratorRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
IAsyncResult invokeGetShardIterator(GetShardIteratorRequest getShardIteratorRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new GetShardIteratorRequestMarshaller().Marshall(getShardIteratorRequest); var unmarshaller = GetShardIteratorResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the GetShardIterator operation. /// <seealso cref="Amazon.Kinesis.IAmazonKinesis.GetShardIterator"/> /// </summary> /// /// <param name="getShardIteratorRequest">Container for the necessary parameters to execute the GetShardIterator 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> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetShardIterator /// operation.</returns> public IAsyncResult BeginGetShardIterator(GetShardIteratorRequest getShardIteratorRequest, AsyncCallback callback, object state) { return invokeGetShardIterator(getShardIteratorRequest, callback, state, false); }
/// <summary> /// <para>This operation returns a shard iterator in <c>ShardIterator</c> . The shard iterator specifies the position in the shard from which /// you want to start reading data records sequentially. A shard iterator specifies this position using the sequence number of a data record in /// a shard. A sequence number is the identifier associated with every record ingested in the Amazon Kinesis stream. The sequence number is /// assigned by the Amazon Kinesis service when a record is put into the stream. </para> <para>You must specify the shard iterator type in the /// <c>GetShardIterator</c> request. For example, you can set the <c>ShardIteratorType</c> parameter to read exactly from the position denoted /// by a specific sequence number by using the AT_SEQUENCE_NUMBER shard iterator type, or right after the sequence number by using the /// AFTER_SEQUENCE_NUMBER shard iterator type, using sequence numbers returned by earlier PutRecord, GetRecords or DescribeStream requests. You /// can specify the shard iterator type TRIM_HORIZON in the request to cause <c>ShardIterator</c> to point to the last untrimmed record in the /// shard in the system, which is the oldest data record in the shard. Or you can point to just after the most recent record in the shard, by /// using the shard iterator type LATEST, so that you always read the most recent data in the shard. </para> <para> <b>Note:</b> Each shard /// iterator expires five minutes after it is returned to the requester.</para> <para>When you repeatedly read from an Amazon Kinesis stream use /// a GetShardIterator request to get the first shard iterator to to use in your first <c>GetRecords</c> request and then use the shard iterator /// returned by the <c>GetRecords</c> request in <c>NextShardIterator</c> for subsequent reads. A new shard iterator is returned by every /// <c>GetRecords</c> request in <c>NextShardIterator</c> , /// which you use in the <c>ShardIterator</c> parameter of the next <c>GetRecords</c> request. </para> <para>If a /// <c>GetShardIterator</c> request is made too often, you will receive a <c>ProvisionedThroughputExceededException</c> . /// For more information about throughput limits, see the <a href="http://docs.aws.amazon.com/kinesis/latest/dev/" >Amazon Kinesis /// Developer Guide</a> . </para> <para> <c>GetShardIterator</c> can return <c>null</c> for its <c>ShardIterator</c> to indicate that the shard /// has been closed and that the requested iterator will return no more data. A shard can be closed by a SplitShard or MergeShards /// operation.</para> <para> <c>GetShardIterator</c> has a limit of 5 transactions per second per account per open shard.</para> /// </summary> /// /// <param name="getShardIteratorRequest">Container for the necessary parameters to execute the GetShardIterator service method on /// AmazonKinesis.</param> /// /// <returns>The response from the GetShardIterator service method, as returned by AmazonKinesis.</returns> /// /// <exception cref="ProvisionedThroughputExceededException"/> /// <exception cref="InvalidArgumentException"/> /// <exception cref="ResourceNotFoundException"/> public GetShardIteratorResponse GetShardIterator(GetShardIteratorRequest getShardIteratorRequest) { IAsyncResult asyncResult = invokeGetShardIterator(getShardIteratorRequest, null, null, true); return EndGetShardIterator(asyncResult); }
private Amazon.Kinesis.Model.GetShardIteratorResponse CallAWSServiceOperation(IAmazonKinesis client, Amazon.Kinesis.Model.GetShardIteratorRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Kinesis", "GetShardIterator"); try { #if DESKTOP return(client.GetShardIterator(request)); #elif CORECLR return(client.GetShardIteratorAsync(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; } }