/// <summary> /// Returns a shard iterator. A shard iterator provides information about how to retrieve /// the stream records from within a shard. Use the shard iterator in a subsequent <code>GetRecords</code> /// request to read the stream records from the shard. /// /// <note> /// <para> /// A shard iterator expires 15 minutes after it is returned to the requester. /// </para> /// </note> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetShardIterator service method.</param> /// /// <returns>The response from the GetShardIterator service method, as returned by DynamoDBStreams.</returns> /// <exception cref="Amazon.DynamoDBv2.Model.InternalServerErrorException"> /// An error occurred on the server side. /// </exception> /// <exception cref="Amazon.DynamoDBv2.Model.ResourceNotFoundException"> /// The operation tried to access a nonexistent stream. /// </exception> /// <exception cref="Amazon.DynamoDBv2.Model.TrimmedDataAccessException"> /// The operation attempted to read past the oldest stream record in a shard. /// /// /// <para> /// In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose /// age exceeds this limit are subject to removal (trimming) from the stream. You might /// receive a TrimmedDataAccessException if: /// </para> /// <ul> <li>You request a shard iterator with a sequence number older than the trim /// point (24 hours).</li> <li>You obtain a shard iterator, but before you use the iterator /// in a <i>GetRecords</i> request, a stream record in the shard exceeds the 24 hour period /// and is trimmed. This causes the iterator to access a record that no longer exists.</li> /// </ul> /// </exception> public GetShardIteratorResponse GetShardIterator(GetShardIteratorRequest request) { var marshaller = new GetShardIteratorRequestMarshaller(); var unmarshaller = GetShardIteratorResponseUnmarshaller.Instance; return(Invoke <GetShardIteratorRequest, GetShardIteratorResponse>(request, marshaller, unmarshaller)); }
public void GetShardIteratorMarshallTest() { var request = InstantiateClassGenerator.Execute <GetShardIteratorRequest>(); var marshaller = new GetShardIteratorRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson <GetShardIteratorRequest>(request, jsonRequest); var webResponse = new WebResponseData { Headers = { { "x-amzn-RequestId", Guid.NewGuid().ToString() }, { "x-amz-crc32", "0" } } }; var jsonResponse = new JsonSampleGenerator(service_model, service_model.FindOperation("GetShardIterator").ResponseStructure).Execute(); webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()); UnmarshallerContext context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), false, webResponse); var response = GetShardIteratorResponseUnmarshaller.Instance.Unmarshall(context) as GetShardIteratorResponse; InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); }
/// <summary> /// Initiates the asynchronous execution of the GetShardIterator operation. /// <seealso cref="Amazon.Kinesis.IAmazonKinesis.GetShardIterator"/> /// </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, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetShardIteratorRequestMarshaller(); var unmarshaller = GetShardIteratorResponseUnmarshaller.GetInstance(); return(Invoke <IRequest, GetShardIteratorRequest, GetShardIteratorResponse>(request, marshaller, unmarshaller, signer, cancellationToken)); }
public void GetShardIterator_TrimmedDataAccessExceptionMarshallTest() { var operation = service_model.FindOperation("GetShardIterator"); var request = InstantiateClassGenerator.Execute <GetShardIteratorRequest>(); var marshaller = new GetShardIteratorRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson <GetShardIteratorRequest>(request, jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("TrimmedDataAccessException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { { "x-amzn-RequestId", Guid.NewGuid().ToString() }, { "x-amz-crc32", "0" }, { "x-amzn-ErrorType", "TrimmedDataAccessException" }, { "Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString() } } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = GetShardIteratorResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); }
/// <summary> /// Initiates the asynchronous execution of the GetShardIterator operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetShardIterator operation on AmazonDynamoDBStreamsClient.</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> /// 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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/streams-dynamodb-2012-08-10/GetShardIterator">REST API Reference for GetShardIterator Operation</seealso> public virtual 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)); }
/// <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); }
/// <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); }
public void GetShardIteratorMarshallTest() { var request = InstantiateClassGenerator.Execute<GetShardIteratorRequest>(); var marshaller = new GetShardIteratorRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<GetShardIteratorRequest>(request,jsonRequest); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"} } }; var jsonResponse = new JsonSampleGenerator(service_model, service_model.FindOperation("GetShardIterator").ResponseStructure).Execute(); webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()); UnmarshallerContext context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), false, webResponse); var response = GetShardIteratorResponseUnmarshaller.Instance.Unmarshall(context) as GetShardIteratorResponse; InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); }
/// <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> /// 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; }