github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/kinesis/getStream.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package kinesis
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Use this data source to get information about a Kinesis Stream for use in other
    15  // resources.
    16  //
    17  // For more details, see the [Amazon Kinesis Documentation](https://aws.amazon.com/documentation/kinesis/).
    18  //
    19  // ## Example Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kinesis"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := kinesis.LookupStream(ctx, &kinesis.LookupStreamArgs{
    35  //				Name: "stream-name",
    36  //			}, nil)
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			return nil
    41  //		})
    42  //	}
    43  //
    44  // ```
    45  // <!--End PulumiCodeChooser -->
    46  func LookupStream(ctx *pulumi.Context, args *LookupStreamArgs, opts ...pulumi.InvokeOption) (*LookupStreamResult, error) {
    47  	opts = internal.PkgInvokeDefaultOpts(opts)
    48  	var rv LookupStreamResult
    49  	err := ctx.Invoke("aws:kinesis/getStream:getStream", args, &rv, opts...)
    50  	if err != nil {
    51  		return nil, err
    52  	}
    53  	return &rv, nil
    54  }
    55  
    56  // A collection of arguments for invoking getStream.
    57  type LookupStreamArgs struct {
    58  	// Name of the Kinesis Stream.
    59  	Name string `pulumi:"name"`
    60  	// Map of tags to assigned to the stream.
    61  	Tags map[string]string `pulumi:"tags"`
    62  }
    63  
    64  // A collection of values returned by getStream.
    65  type LookupStreamResult struct {
    66  	// ARN of the Kinesis Stream (same as id).
    67  	Arn string `pulumi:"arn"`
    68  	// List of shard ids in the CLOSED state. See [Shard State](https://docs.aws.amazon.com/streams/latest/dev/kinesis-using-sdk-java-after-resharding.html#kinesis-using-sdk-java-resharding-data-routing) for more.
    69  	ClosedShards []string `pulumi:"closedShards"`
    70  	// Approximate UNIX timestamp that the stream was created.
    71  	CreationTimestamp int `pulumi:"creationTimestamp"`
    72  	// The provider-assigned unique ID for this managed resource.
    73  	Id string `pulumi:"id"`
    74  	// Name of the Kinesis Stream.
    75  	Name string `pulumi:"name"`
    76  	// List of shard ids in the OPEN state. See [Shard State](https://docs.aws.amazon.com/streams/latest/dev/kinesis-using-sdk-java-after-resharding.html#kinesis-using-sdk-java-resharding-data-routing) for more.
    77  	OpenShards []string `pulumi:"openShards"`
    78  	// Length of time (in hours) data records are accessible after they are added to the stream.
    79  	RetentionPeriod int `pulumi:"retentionPeriod"`
    80  	// List of shard-level CloudWatch metrics which are enabled for the stream. See [Monitoring with CloudWatch](https://docs.aws.amazon.com/streams/latest/dev/monitoring-with-cloudwatch.html) for more.
    81  	ShardLevelMetrics []string `pulumi:"shardLevelMetrics"`
    82  	// Current status of the stream. The stream status is one of CREATING, DELETING, ACTIVE, or UPDATING.
    83  	Status string `pulumi:"status"`
    84  	// [Capacity mode](https://docs.aws.amazon.com/streams/latest/dev/how-do-i-size-a-stream.html) of the data stream. Detailed below.
    85  	StreamModeDetails []GetStreamStreamModeDetail `pulumi:"streamModeDetails"`
    86  	// Map of tags to assigned to the stream.
    87  	Tags map[string]string `pulumi:"tags"`
    88  }
    89  
    90  func LookupStreamOutput(ctx *pulumi.Context, args LookupStreamOutputArgs, opts ...pulumi.InvokeOption) LookupStreamResultOutput {
    91  	return pulumi.ToOutputWithContext(context.Background(), args).
    92  		ApplyT(func(v interface{}) (LookupStreamResult, error) {
    93  			args := v.(LookupStreamArgs)
    94  			r, err := LookupStream(ctx, &args, opts...)
    95  			var s LookupStreamResult
    96  			if r != nil {
    97  				s = *r
    98  			}
    99  			return s, err
   100  		}).(LookupStreamResultOutput)
   101  }
   102  
   103  // A collection of arguments for invoking getStream.
   104  type LookupStreamOutputArgs struct {
   105  	// Name of the Kinesis Stream.
   106  	Name pulumi.StringInput `pulumi:"name"`
   107  	// Map of tags to assigned to the stream.
   108  	Tags pulumi.StringMapInput `pulumi:"tags"`
   109  }
   110  
   111  func (LookupStreamOutputArgs) ElementType() reflect.Type {
   112  	return reflect.TypeOf((*LookupStreamArgs)(nil)).Elem()
   113  }
   114  
   115  // A collection of values returned by getStream.
   116  type LookupStreamResultOutput struct{ *pulumi.OutputState }
   117  
   118  func (LookupStreamResultOutput) ElementType() reflect.Type {
   119  	return reflect.TypeOf((*LookupStreamResult)(nil)).Elem()
   120  }
   121  
   122  func (o LookupStreamResultOutput) ToLookupStreamResultOutput() LookupStreamResultOutput {
   123  	return o
   124  }
   125  
   126  func (o LookupStreamResultOutput) ToLookupStreamResultOutputWithContext(ctx context.Context) LookupStreamResultOutput {
   127  	return o
   128  }
   129  
   130  // ARN of the Kinesis Stream (same as id).
   131  func (o LookupStreamResultOutput) Arn() pulumi.StringOutput {
   132  	return o.ApplyT(func(v LookupStreamResult) string { return v.Arn }).(pulumi.StringOutput)
   133  }
   134  
   135  // List of shard ids in the CLOSED state. See [Shard State](https://docs.aws.amazon.com/streams/latest/dev/kinesis-using-sdk-java-after-resharding.html#kinesis-using-sdk-java-resharding-data-routing) for more.
   136  func (o LookupStreamResultOutput) ClosedShards() pulumi.StringArrayOutput {
   137  	return o.ApplyT(func(v LookupStreamResult) []string { return v.ClosedShards }).(pulumi.StringArrayOutput)
   138  }
   139  
   140  // Approximate UNIX timestamp that the stream was created.
   141  func (o LookupStreamResultOutput) CreationTimestamp() pulumi.IntOutput {
   142  	return o.ApplyT(func(v LookupStreamResult) int { return v.CreationTimestamp }).(pulumi.IntOutput)
   143  }
   144  
   145  // The provider-assigned unique ID for this managed resource.
   146  func (o LookupStreamResultOutput) Id() pulumi.StringOutput {
   147  	return o.ApplyT(func(v LookupStreamResult) string { return v.Id }).(pulumi.StringOutput)
   148  }
   149  
   150  // Name of the Kinesis Stream.
   151  func (o LookupStreamResultOutput) Name() pulumi.StringOutput {
   152  	return o.ApplyT(func(v LookupStreamResult) string { return v.Name }).(pulumi.StringOutput)
   153  }
   154  
   155  // List of shard ids in the OPEN state. See [Shard State](https://docs.aws.amazon.com/streams/latest/dev/kinesis-using-sdk-java-after-resharding.html#kinesis-using-sdk-java-resharding-data-routing) for more.
   156  func (o LookupStreamResultOutput) OpenShards() pulumi.StringArrayOutput {
   157  	return o.ApplyT(func(v LookupStreamResult) []string { return v.OpenShards }).(pulumi.StringArrayOutput)
   158  }
   159  
   160  // Length of time (in hours) data records are accessible after they are added to the stream.
   161  func (o LookupStreamResultOutput) RetentionPeriod() pulumi.IntOutput {
   162  	return o.ApplyT(func(v LookupStreamResult) int { return v.RetentionPeriod }).(pulumi.IntOutput)
   163  }
   164  
   165  // List of shard-level CloudWatch metrics which are enabled for the stream. See [Monitoring with CloudWatch](https://docs.aws.amazon.com/streams/latest/dev/monitoring-with-cloudwatch.html) for more.
   166  func (o LookupStreamResultOutput) ShardLevelMetrics() pulumi.StringArrayOutput {
   167  	return o.ApplyT(func(v LookupStreamResult) []string { return v.ShardLevelMetrics }).(pulumi.StringArrayOutput)
   168  }
   169  
   170  // Current status of the stream. The stream status is one of CREATING, DELETING, ACTIVE, or UPDATING.
   171  func (o LookupStreamResultOutput) Status() pulumi.StringOutput {
   172  	return o.ApplyT(func(v LookupStreamResult) string { return v.Status }).(pulumi.StringOutput)
   173  }
   174  
   175  // [Capacity mode](https://docs.aws.amazon.com/streams/latest/dev/how-do-i-size-a-stream.html) of the data stream. Detailed below.
   176  func (o LookupStreamResultOutput) StreamModeDetails() GetStreamStreamModeDetailArrayOutput {
   177  	return o.ApplyT(func(v LookupStreamResult) []GetStreamStreamModeDetail { return v.StreamModeDetails }).(GetStreamStreamModeDetailArrayOutput)
   178  }
   179  
   180  // Map of tags to assigned to the stream.
   181  func (o LookupStreamResultOutput) Tags() pulumi.StringMapOutput {
   182  	return o.ApplyT(func(v LookupStreamResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   183  }
   184  
   185  func init() {
   186  	pulumi.RegisterOutputType(LookupStreamResultOutput{})
   187  }