github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/kinesis/streamConsumer.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  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Provides a resource to manage a Kinesis Stream Consumer.
    16  //
    17  // > **Note:** You can register up to 20 consumers per stream. A given consumer can only be registered with one stream at a time.
    18  //
    19  // For more details, see the [Amazon Kinesis Stream Consumer Documentation](https://docs.aws.amazon.com/streams/latest/dev/amazon-kinesis-consumers.html).
    20  //
    21  // ## Example Usage
    22  //
    23  // <!--Start PulumiCodeChooser -->
    24  // ```go
    25  // package main
    26  //
    27  // import (
    28  //
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kinesis"
    30  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    31  //
    32  // )
    33  //
    34  //	func main() {
    35  //		pulumi.Run(func(ctx *pulumi.Context) error {
    36  //			example, err := kinesis.NewStream(ctx, "example", &kinesis.StreamArgs{
    37  //				Name:       pulumi.String("example-stream"),
    38  //				ShardCount: pulumi.Int(1),
    39  //			})
    40  //			if err != nil {
    41  //				return err
    42  //			}
    43  //			_, err = kinesis.NewStreamConsumer(ctx, "example", &kinesis.StreamConsumerArgs{
    44  //				Name:      pulumi.String("example-consumer"),
    45  //				StreamArn: example.Arn,
    46  //			})
    47  //			if err != nil {
    48  //				return err
    49  //			}
    50  //			return nil
    51  //		})
    52  //	}
    53  //
    54  // ```
    55  // <!--End PulumiCodeChooser -->
    56  //
    57  // ## Import
    58  //
    59  // Using `pulumi import`, import Kinesis Stream Consumers using the Amazon Resource Name (ARN). For example:
    60  //
    61  // ```sh
    62  // $ pulumi import aws:kinesis/streamConsumer:StreamConsumer example arn:aws:kinesis:us-west-2:123456789012:stream/example/consumer/example:1616044553
    63  // ```
    64  type StreamConsumer struct {
    65  	pulumi.CustomResourceState
    66  
    67  	// Amazon Resource Name (ARN) of the stream consumer.
    68  	Arn pulumi.StringOutput `pulumi:"arn"`
    69  	// Approximate timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) of when the stream consumer was created.
    70  	CreationTimestamp pulumi.StringOutput `pulumi:"creationTimestamp"`
    71  	// Name of the stream consumer.
    72  	Name pulumi.StringOutput `pulumi:"name"`
    73  	// Amazon Resource Name (ARN) of the data stream the consumer is registered with.
    74  	StreamArn pulumi.StringOutput `pulumi:"streamArn"`
    75  }
    76  
    77  // NewStreamConsumer registers a new resource with the given unique name, arguments, and options.
    78  func NewStreamConsumer(ctx *pulumi.Context,
    79  	name string, args *StreamConsumerArgs, opts ...pulumi.ResourceOption) (*StreamConsumer, error) {
    80  	if args == nil {
    81  		return nil, errors.New("missing one or more required arguments")
    82  	}
    83  
    84  	if args.StreamArn == nil {
    85  		return nil, errors.New("invalid value for required argument 'StreamArn'")
    86  	}
    87  	opts = internal.PkgResourceDefaultOpts(opts)
    88  	var resource StreamConsumer
    89  	err := ctx.RegisterResource("aws:kinesis/streamConsumer:StreamConsumer", name, args, &resource, opts...)
    90  	if err != nil {
    91  		return nil, err
    92  	}
    93  	return &resource, nil
    94  }
    95  
    96  // GetStreamConsumer gets an existing StreamConsumer resource's state with the given name, ID, and optional
    97  // state properties that are used to uniquely qualify the lookup (nil if not required).
    98  func GetStreamConsumer(ctx *pulumi.Context,
    99  	name string, id pulumi.IDInput, state *StreamConsumerState, opts ...pulumi.ResourceOption) (*StreamConsumer, error) {
   100  	var resource StreamConsumer
   101  	err := ctx.ReadResource("aws:kinesis/streamConsumer:StreamConsumer", name, id, state, &resource, opts...)
   102  	if err != nil {
   103  		return nil, err
   104  	}
   105  	return &resource, nil
   106  }
   107  
   108  // Input properties used for looking up and filtering StreamConsumer resources.
   109  type streamConsumerState struct {
   110  	// Amazon Resource Name (ARN) of the stream consumer.
   111  	Arn *string `pulumi:"arn"`
   112  	// Approximate timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) of when the stream consumer was created.
   113  	CreationTimestamp *string `pulumi:"creationTimestamp"`
   114  	// Name of the stream consumer.
   115  	Name *string `pulumi:"name"`
   116  	// Amazon Resource Name (ARN) of the data stream the consumer is registered with.
   117  	StreamArn *string `pulumi:"streamArn"`
   118  }
   119  
   120  type StreamConsumerState struct {
   121  	// Amazon Resource Name (ARN) of the stream consumer.
   122  	Arn pulumi.StringPtrInput
   123  	// Approximate timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) of when the stream consumer was created.
   124  	CreationTimestamp pulumi.StringPtrInput
   125  	// Name of the stream consumer.
   126  	Name pulumi.StringPtrInput
   127  	// Amazon Resource Name (ARN) of the data stream the consumer is registered with.
   128  	StreamArn pulumi.StringPtrInput
   129  }
   130  
   131  func (StreamConsumerState) ElementType() reflect.Type {
   132  	return reflect.TypeOf((*streamConsumerState)(nil)).Elem()
   133  }
   134  
   135  type streamConsumerArgs struct {
   136  	// Name of the stream consumer.
   137  	Name *string `pulumi:"name"`
   138  	// Amazon Resource Name (ARN) of the data stream the consumer is registered with.
   139  	StreamArn string `pulumi:"streamArn"`
   140  }
   141  
   142  // The set of arguments for constructing a StreamConsumer resource.
   143  type StreamConsumerArgs struct {
   144  	// Name of the stream consumer.
   145  	Name pulumi.StringPtrInput
   146  	// Amazon Resource Name (ARN) of the data stream the consumer is registered with.
   147  	StreamArn pulumi.StringInput
   148  }
   149  
   150  func (StreamConsumerArgs) ElementType() reflect.Type {
   151  	return reflect.TypeOf((*streamConsumerArgs)(nil)).Elem()
   152  }
   153  
   154  type StreamConsumerInput interface {
   155  	pulumi.Input
   156  
   157  	ToStreamConsumerOutput() StreamConsumerOutput
   158  	ToStreamConsumerOutputWithContext(ctx context.Context) StreamConsumerOutput
   159  }
   160  
   161  func (*StreamConsumer) ElementType() reflect.Type {
   162  	return reflect.TypeOf((**StreamConsumer)(nil)).Elem()
   163  }
   164  
   165  func (i *StreamConsumer) ToStreamConsumerOutput() StreamConsumerOutput {
   166  	return i.ToStreamConsumerOutputWithContext(context.Background())
   167  }
   168  
   169  func (i *StreamConsumer) ToStreamConsumerOutputWithContext(ctx context.Context) StreamConsumerOutput {
   170  	return pulumi.ToOutputWithContext(ctx, i).(StreamConsumerOutput)
   171  }
   172  
   173  // StreamConsumerArrayInput is an input type that accepts StreamConsumerArray and StreamConsumerArrayOutput values.
   174  // You can construct a concrete instance of `StreamConsumerArrayInput` via:
   175  //
   176  //	StreamConsumerArray{ StreamConsumerArgs{...} }
   177  type StreamConsumerArrayInput interface {
   178  	pulumi.Input
   179  
   180  	ToStreamConsumerArrayOutput() StreamConsumerArrayOutput
   181  	ToStreamConsumerArrayOutputWithContext(context.Context) StreamConsumerArrayOutput
   182  }
   183  
   184  type StreamConsumerArray []StreamConsumerInput
   185  
   186  func (StreamConsumerArray) ElementType() reflect.Type {
   187  	return reflect.TypeOf((*[]*StreamConsumer)(nil)).Elem()
   188  }
   189  
   190  func (i StreamConsumerArray) ToStreamConsumerArrayOutput() StreamConsumerArrayOutput {
   191  	return i.ToStreamConsumerArrayOutputWithContext(context.Background())
   192  }
   193  
   194  func (i StreamConsumerArray) ToStreamConsumerArrayOutputWithContext(ctx context.Context) StreamConsumerArrayOutput {
   195  	return pulumi.ToOutputWithContext(ctx, i).(StreamConsumerArrayOutput)
   196  }
   197  
   198  // StreamConsumerMapInput is an input type that accepts StreamConsumerMap and StreamConsumerMapOutput values.
   199  // You can construct a concrete instance of `StreamConsumerMapInput` via:
   200  //
   201  //	StreamConsumerMap{ "key": StreamConsumerArgs{...} }
   202  type StreamConsumerMapInput interface {
   203  	pulumi.Input
   204  
   205  	ToStreamConsumerMapOutput() StreamConsumerMapOutput
   206  	ToStreamConsumerMapOutputWithContext(context.Context) StreamConsumerMapOutput
   207  }
   208  
   209  type StreamConsumerMap map[string]StreamConsumerInput
   210  
   211  func (StreamConsumerMap) ElementType() reflect.Type {
   212  	return reflect.TypeOf((*map[string]*StreamConsumer)(nil)).Elem()
   213  }
   214  
   215  func (i StreamConsumerMap) ToStreamConsumerMapOutput() StreamConsumerMapOutput {
   216  	return i.ToStreamConsumerMapOutputWithContext(context.Background())
   217  }
   218  
   219  func (i StreamConsumerMap) ToStreamConsumerMapOutputWithContext(ctx context.Context) StreamConsumerMapOutput {
   220  	return pulumi.ToOutputWithContext(ctx, i).(StreamConsumerMapOutput)
   221  }
   222  
   223  type StreamConsumerOutput struct{ *pulumi.OutputState }
   224  
   225  func (StreamConsumerOutput) ElementType() reflect.Type {
   226  	return reflect.TypeOf((**StreamConsumer)(nil)).Elem()
   227  }
   228  
   229  func (o StreamConsumerOutput) ToStreamConsumerOutput() StreamConsumerOutput {
   230  	return o
   231  }
   232  
   233  func (o StreamConsumerOutput) ToStreamConsumerOutputWithContext(ctx context.Context) StreamConsumerOutput {
   234  	return o
   235  }
   236  
   237  // Amazon Resource Name (ARN) of the stream consumer.
   238  func (o StreamConsumerOutput) Arn() pulumi.StringOutput {
   239  	return o.ApplyT(func(v *StreamConsumer) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   240  }
   241  
   242  // Approximate timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) of when the stream consumer was created.
   243  func (o StreamConsumerOutput) CreationTimestamp() pulumi.StringOutput {
   244  	return o.ApplyT(func(v *StreamConsumer) pulumi.StringOutput { return v.CreationTimestamp }).(pulumi.StringOutput)
   245  }
   246  
   247  // Name of the stream consumer.
   248  func (o StreamConsumerOutput) Name() pulumi.StringOutput {
   249  	return o.ApplyT(func(v *StreamConsumer) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   250  }
   251  
   252  // Amazon Resource Name (ARN) of the data stream the consumer is registered with.
   253  func (o StreamConsumerOutput) StreamArn() pulumi.StringOutput {
   254  	return o.ApplyT(func(v *StreamConsumer) pulumi.StringOutput { return v.StreamArn }).(pulumi.StringOutput)
   255  }
   256  
   257  type StreamConsumerArrayOutput struct{ *pulumi.OutputState }
   258  
   259  func (StreamConsumerArrayOutput) ElementType() reflect.Type {
   260  	return reflect.TypeOf((*[]*StreamConsumer)(nil)).Elem()
   261  }
   262  
   263  func (o StreamConsumerArrayOutput) ToStreamConsumerArrayOutput() StreamConsumerArrayOutput {
   264  	return o
   265  }
   266  
   267  func (o StreamConsumerArrayOutput) ToStreamConsumerArrayOutputWithContext(ctx context.Context) StreamConsumerArrayOutput {
   268  	return o
   269  }
   270  
   271  func (o StreamConsumerArrayOutput) Index(i pulumi.IntInput) StreamConsumerOutput {
   272  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *StreamConsumer {
   273  		return vs[0].([]*StreamConsumer)[vs[1].(int)]
   274  	}).(StreamConsumerOutput)
   275  }
   276  
   277  type StreamConsumerMapOutput struct{ *pulumi.OutputState }
   278  
   279  func (StreamConsumerMapOutput) ElementType() reflect.Type {
   280  	return reflect.TypeOf((*map[string]*StreamConsumer)(nil)).Elem()
   281  }
   282  
   283  func (o StreamConsumerMapOutput) ToStreamConsumerMapOutput() StreamConsumerMapOutput {
   284  	return o
   285  }
   286  
   287  func (o StreamConsumerMapOutput) ToStreamConsumerMapOutputWithContext(ctx context.Context) StreamConsumerMapOutput {
   288  	return o
   289  }
   290  
   291  func (o StreamConsumerMapOutput) MapIndex(k pulumi.StringInput) StreamConsumerOutput {
   292  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *StreamConsumer {
   293  		return vs[0].(map[string]*StreamConsumer)[vs[1].(string)]
   294  	}).(StreamConsumerOutput)
   295  }
   296  
   297  func init() {
   298  	pulumi.RegisterInputType(reflect.TypeOf((*StreamConsumerInput)(nil)).Elem(), &StreamConsumer{})
   299  	pulumi.RegisterInputType(reflect.TypeOf((*StreamConsumerArrayInput)(nil)).Elem(), StreamConsumerArray{})
   300  	pulumi.RegisterInputType(reflect.TypeOf((*StreamConsumerMapInput)(nil)).Elem(), StreamConsumerMap{})
   301  	pulumi.RegisterOutputType(StreamConsumerOutput{})
   302  	pulumi.RegisterOutputType(StreamConsumerArrayOutput{})
   303  	pulumi.RegisterOutputType(StreamConsumerMapOutput{})
   304  }