public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Kinesis.Model.DescribeStreamRequest(); if (cmdletContext.ExclusiveStartShardId != null) { request.ExclusiveStartShardId = cmdletContext.ExclusiveStartShardId; } if (cmdletContext.Limit != null) { request.Limit = cmdletContext.Limit.Value; } 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); }
/// <summary> /// <para>This operation returns the following information about the stream: the current status of the stream, the stream Amazon Resource Name /// (ARN), and an array of shard objects that comprise the stream. For each shard object there is information about the hash key and sequence /// number ranges that the shard spans, and the IDs of any earlier shards that played in a role in a MergeShards or SplitShard operation that /// created the 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 can limit the number of returned /// shards using the <c>Limit</c> parameter. The number of shards in a stream may be too large to return from a single call to /// <c>DescribeStream</c> . /// You can detect this by using the <c>HasMoreShards</c> flag in the returned output. <c>HasMoreShards</c> is set to <c>true</c> /// when there is more data available. </para> <para>If there are more shards available, you can request more shards by using the shard ID of /// the last shard returned by the <c>DescribeStream</c> request, in the <c>ExclusiveStartShardId</c> parameter in a subsequent request to /// <c>DescribeStream</c> . /// /// <c>DescribeStream</c> is a paginated operation. </para> <para> <c>DescribeStream</c> has a limit of 10 transactions per /// second per account.</para> /// </summary> /// /// <param name="describeStreamRequest">Container for the necessary parameters to execute the DescribeStream service method on /// AmazonKinesis.</param> /// /// <returns>The response from the DescribeStream service method, as returned by AmazonKinesis.</returns> /// /// <exception cref="T:Amazon.Kinesis.Model.LimitExceededException" /> /// <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<DescribeStreamResponse> DescribeStreamAsync(DescribeStreamRequest describeStreamRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DescribeStreamRequestMarshaller(); var unmarshaller = DescribeStreamResponseUnmarshaller.GetInstance(); return Invoke<IRequest, DescribeStreamRequest, DescribeStreamResponse>(describeStreamRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal DescribeStreamResponse DescribeStream(DescribeStreamRequest request) { var task = DescribeStreamAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// Initiates the asynchronous execution of the DescribeStream operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeStream 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<DescribeStreamResponse> DescribeStreamAsync(DescribeStreamRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DescribeStreamRequestMarshaller(); var unmarshaller = DescribeStreamResponseUnmarshaller.Instance; return InvokeAsync<DescribeStreamRequest,DescribeStreamResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal DescribeStreamResponse DescribeStream(DescribeStreamRequest request) { var marshaller = new DescribeStreamRequestMarshaller(); var unmarshaller = DescribeStreamResponseUnmarshaller.Instance; return Invoke<DescribeStreamRequest,DescribeStreamResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the DescribeStream operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeStream 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 EndDescribeStream /// operation.</returns> public IAsyncResult BeginDescribeStream(DescribeStreamRequest request, AsyncCallback callback, object state) { var marshaller = new DescribeStreamRequestMarshaller(); var unmarshaller = DescribeStreamResponseUnmarshaller.Instance; return BeginInvoke<DescribeStreamRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// <para>This operation returns the following information about the stream: the current status of the stream, the stream Amazon Resource Name /// (ARN), and an array of shard objects that comprise the stream. For each shard object there is information about the hash key and sequence /// number ranges that the shard spans, and the IDs of any earlier shards that played in a role in a MergeShards or SplitShard operation that /// created the 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 can limit the number of returned /// shards using the <c>Limit</c> parameter. The number of shards in a stream may be too large to return from a single call to /// <c>DescribeStream</c> . /// You can detect this by using the <c>HasMoreShards</c> flag in the returned output. <c>HasMoreShards</c> is set to <c>true</c> /// when there is more data available. </para> <para>If there are more shards available, you can request more shards by using the shard ID of /// the last shard returned by the <c>DescribeStream</c> request, in the <c>ExclusiveStartShardId</c> parameter in a subsequent request to /// <c>DescribeStream</c> . /// /// <c>DescribeStream</c> is a paginated operation. </para> <para> <c>DescribeStream</c> has a limit of 10 transactions per /// second per account.</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeStream service method on /// AmazonKinesis.</param> /// /// <returns>The response from the DescribeStream service method, as returned by AmazonKinesis.</returns> /// /// <exception cref="T:Amazon.Kinesis.Model.LimitExceededException" /> /// <exception cref="T:Amazon.Kinesis.Model.ResourceNotFoundException" /> public DescribeStreamResponse DescribeStream(DescribeStreamRequest request) { var task = DescribeStreamAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the DescribeStream operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeStream 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 DescribeStreamAsync(DescribeStreamRequest request, AmazonServiceCallback<DescribeStreamRequest, DescribeStreamResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new DescribeStreamRequestMarshaller(); var unmarshaller = DescribeStreamResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<DescribeStreamRequest,DescribeStreamResponse> responseObject = new AmazonServiceResult<DescribeStreamRequest,DescribeStreamResponse>((DescribeStreamRequest)req, (DescribeStreamResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<DescribeStreamRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
IAsyncResult invokeDescribeStream(DescribeStreamRequest describeStreamRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new DescribeStreamRequestMarshaller().Marshall(describeStreamRequest); var unmarshaller = DescribeStreamResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the DescribeStream operation. /// <seealso cref="Amazon.Kinesis.IAmazonKinesis.DescribeStream"/> /// </summary> /// /// <param name="describeStreamRequest">Container for the necessary parameters to execute the DescribeStream 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 EndDescribeStream /// operation.</returns> public IAsyncResult BeginDescribeStream(DescribeStreamRequest describeStreamRequest, AsyncCallback callback, object state) { return invokeDescribeStream(describeStreamRequest, callback, state, false); }
/// <summary> /// <para>This operation returns the following information about the stream: the current status of the stream, the stream Amazon Resource Name /// (ARN), and an array of shard objects that comprise the stream. For each shard object there is information about the hash key and sequence /// number ranges that the shard spans, and the IDs of any earlier shards that played in a role in a MergeShards or SplitShard operation that /// created the 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 can limit the number of returned /// shards using the <c>Limit</c> parameter. The number of shards in a stream may be too large to return from a single call to /// <c>DescribeStream</c> . /// You can detect this by using the <c>HasMoreShards</c> flag in the returned output. <c>HasMoreShards</c> is set to <c>true</c> /// when there is more data available. </para> <para>If there are more shards available, you can request more shards by using the shard ID of /// the last shard returned by the <c>DescribeStream</c> request, in the <c>ExclusiveStartShardId</c> parameter in a subsequent request to /// <c>DescribeStream</c> . /// /// <c>DescribeStream</c> is a paginated operation. </para> <para> <c>DescribeStream</c> has a limit of 10 transactions per /// second per account.</para> /// </summary> /// /// <param name="describeStreamRequest">Container for the necessary parameters to execute the DescribeStream service method on /// AmazonKinesis.</param> /// /// <returns>The response from the DescribeStream service method, as returned by AmazonKinesis.</returns> /// /// <exception cref="LimitExceededException"/> /// <exception cref="ResourceNotFoundException"/> public DescribeStreamResponse DescribeStream(DescribeStreamRequest describeStreamRequest) { IAsyncResult asyncResult = invokeDescribeStream(describeStreamRequest, null, null, true); return EndDescribeStream(asyncResult); }
static DescribeStreamResponse DescribeStream(IAmazonKinesis kinesisClient, string streamName) { var request = new DescribeStreamRequest { StreamName = streamName }; try { var response = kinesisClient.DescribeStream(request); return response; } catch (ResourceNotFoundException) { return null; } }
/// <summary> /// This method waits a maximum of 10 minutes for the specified stream to become active. /// <param name="myStreamName">Name of the stream whose active status is waited upon.</param> /// </summary> private static void WaitForStreamToBecomeAvailable(string myStreamName) { var deadline = DateTime.UtcNow + TimeSpan.FromMinutes(10); while (DateTime.UtcNow < deadline) { DescribeStreamRequest describeStreamReq = new DescribeStreamRequest(); describeStreamReq.StreamName = myStreamName; DescribeStreamResult describeResult = kinesisClient.DescribeStream(describeStreamReq); string streamStatus = describeResult.StreamDescription.StreamStatus; Console.Error.WriteLine(" - current state: " + streamStatus); if (streamStatus == StreamStatus.ACTIVE) { return; } Thread.Sleep(TimeSpan.FromSeconds(20)); } throw new Exception("Stream " + myStreamName + " never went active."); }
private Amazon.Kinesis.Model.DescribeStreamResponse CallAWSServiceOperation(IAmazonKinesis client, Amazon.Kinesis.Model.DescribeStreamRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Kinesis", "DescribeStream"); try { #if DESKTOP return(client.DescribeStream(request)); #elif CORECLR return(client.DescribeStreamAsync(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; } }