github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudwatch/eventBus.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 cloudwatch
     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  // Provides an EventBridge event bus resource.
    15  //
    16  // > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.
    17  //
    18  // ## Example Usage
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := cloudwatch.NewEventBus(ctx, "messenger", &cloudwatch.EventBusArgs{
    34  //				Name: pulumi.String("chat-messages"),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  //
    46  // <!--Start PulumiCodeChooser -->
    47  // ```go
    48  // package main
    49  //
    50  // import (
    51  //
    52  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
    53  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    54  //
    55  // )
    56  //
    57  //	func main() {
    58  //		pulumi.Run(func(ctx *pulumi.Context) error {
    59  //			examplepartner, err := cloudwatch.GetEventSource(ctx, &cloudwatch.GetEventSourceArgs{
    60  //				NamePrefix: pulumi.StringRef("aws.partner/examplepartner.com"),
    61  //			}, nil)
    62  //			if err != nil {
    63  //				return err
    64  //			}
    65  //			_, err = cloudwatch.NewEventBus(ctx, "examplepartner", &cloudwatch.EventBusArgs{
    66  //				Name:            pulumi.String(examplepartner.Name),
    67  //				EventSourceName: pulumi.String(examplepartner.Name),
    68  //			})
    69  //			if err != nil {
    70  //				return err
    71  //			}
    72  //			return nil
    73  //		})
    74  //	}
    75  //
    76  // ```
    77  // <!--End PulumiCodeChooser -->
    78  //
    79  // ## Import
    80  //
    81  // Using `pulumi import`, import EventBridge event buses using the `name` (which can also be a partner event source name). For example:
    82  //
    83  // ```sh
    84  // $ pulumi import aws:cloudwatch/eventBus:EventBus messenger chat-messages
    85  // ```
    86  type EventBus struct {
    87  	pulumi.CustomResourceState
    88  
    89  	// The Amazon Resource Name (ARN) of the event bus.
    90  	Arn pulumi.StringOutput `pulumi:"arn"`
    91  	// The partner event source that the new event bus will be matched with. Must match `name`.
    92  	EventSourceName pulumi.StringPtrOutput `pulumi:"eventSourceName"`
    93  	// The name of the new event bus. The names of custom event buses can't contain the / character. To create a partner event bus, ensure the `name` matches the `eventSourceName`.
    94  	Name pulumi.StringOutput `pulumi:"name"`
    95  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    96  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    97  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    98  	//
    99  	// Deprecated: Please use `tags` instead.
   100  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   101  }
   102  
   103  // NewEventBus registers a new resource with the given unique name, arguments, and options.
   104  func NewEventBus(ctx *pulumi.Context,
   105  	name string, args *EventBusArgs, opts ...pulumi.ResourceOption) (*EventBus, error) {
   106  	if args == nil {
   107  		args = &EventBusArgs{}
   108  	}
   109  
   110  	opts = internal.PkgResourceDefaultOpts(opts)
   111  	var resource EventBus
   112  	err := ctx.RegisterResource("aws:cloudwatch/eventBus:EventBus", name, args, &resource, opts...)
   113  	if err != nil {
   114  		return nil, err
   115  	}
   116  	return &resource, nil
   117  }
   118  
   119  // GetEventBus gets an existing EventBus resource's state with the given name, ID, and optional
   120  // state properties that are used to uniquely qualify the lookup (nil if not required).
   121  func GetEventBus(ctx *pulumi.Context,
   122  	name string, id pulumi.IDInput, state *EventBusState, opts ...pulumi.ResourceOption) (*EventBus, error) {
   123  	var resource EventBus
   124  	err := ctx.ReadResource("aws:cloudwatch/eventBus:EventBus", name, id, state, &resource, opts...)
   125  	if err != nil {
   126  		return nil, err
   127  	}
   128  	return &resource, nil
   129  }
   130  
   131  // Input properties used for looking up and filtering EventBus resources.
   132  type eventBusState struct {
   133  	// The Amazon Resource Name (ARN) of the event bus.
   134  	Arn *string `pulumi:"arn"`
   135  	// The partner event source that the new event bus will be matched with. Must match `name`.
   136  	EventSourceName *string `pulumi:"eventSourceName"`
   137  	// The name of the new event bus. The names of custom event buses can't contain the / character. To create a partner event bus, ensure the `name` matches the `eventSourceName`.
   138  	Name *string `pulumi:"name"`
   139  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   140  	Tags map[string]string `pulumi:"tags"`
   141  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   142  	//
   143  	// Deprecated: Please use `tags` instead.
   144  	TagsAll map[string]string `pulumi:"tagsAll"`
   145  }
   146  
   147  type EventBusState struct {
   148  	// The Amazon Resource Name (ARN) of the event bus.
   149  	Arn pulumi.StringPtrInput
   150  	// The partner event source that the new event bus will be matched with. Must match `name`.
   151  	EventSourceName pulumi.StringPtrInput
   152  	// The name of the new event bus. The names of custom event buses can't contain the / character. To create a partner event bus, ensure the `name` matches the `eventSourceName`.
   153  	Name pulumi.StringPtrInput
   154  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   155  	Tags pulumi.StringMapInput
   156  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   157  	//
   158  	// Deprecated: Please use `tags` instead.
   159  	TagsAll pulumi.StringMapInput
   160  }
   161  
   162  func (EventBusState) ElementType() reflect.Type {
   163  	return reflect.TypeOf((*eventBusState)(nil)).Elem()
   164  }
   165  
   166  type eventBusArgs struct {
   167  	// The partner event source that the new event bus will be matched with. Must match `name`.
   168  	EventSourceName *string `pulumi:"eventSourceName"`
   169  	// The name of the new event bus. The names of custom event buses can't contain the / character. To create a partner event bus, ensure the `name` matches the `eventSourceName`.
   170  	Name *string `pulumi:"name"`
   171  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   172  	Tags map[string]string `pulumi:"tags"`
   173  }
   174  
   175  // The set of arguments for constructing a EventBus resource.
   176  type EventBusArgs struct {
   177  	// The partner event source that the new event bus will be matched with. Must match `name`.
   178  	EventSourceName pulumi.StringPtrInput
   179  	// The name of the new event bus. The names of custom event buses can't contain the / character. To create a partner event bus, ensure the `name` matches the `eventSourceName`.
   180  	Name pulumi.StringPtrInput
   181  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   182  	Tags pulumi.StringMapInput
   183  }
   184  
   185  func (EventBusArgs) ElementType() reflect.Type {
   186  	return reflect.TypeOf((*eventBusArgs)(nil)).Elem()
   187  }
   188  
   189  type EventBusInput interface {
   190  	pulumi.Input
   191  
   192  	ToEventBusOutput() EventBusOutput
   193  	ToEventBusOutputWithContext(ctx context.Context) EventBusOutput
   194  }
   195  
   196  func (*EventBus) ElementType() reflect.Type {
   197  	return reflect.TypeOf((**EventBus)(nil)).Elem()
   198  }
   199  
   200  func (i *EventBus) ToEventBusOutput() EventBusOutput {
   201  	return i.ToEventBusOutputWithContext(context.Background())
   202  }
   203  
   204  func (i *EventBus) ToEventBusOutputWithContext(ctx context.Context) EventBusOutput {
   205  	return pulumi.ToOutputWithContext(ctx, i).(EventBusOutput)
   206  }
   207  
   208  // EventBusArrayInput is an input type that accepts EventBusArray and EventBusArrayOutput values.
   209  // You can construct a concrete instance of `EventBusArrayInput` via:
   210  //
   211  //	EventBusArray{ EventBusArgs{...} }
   212  type EventBusArrayInput interface {
   213  	pulumi.Input
   214  
   215  	ToEventBusArrayOutput() EventBusArrayOutput
   216  	ToEventBusArrayOutputWithContext(context.Context) EventBusArrayOutput
   217  }
   218  
   219  type EventBusArray []EventBusInput
   220  
   221  func (EventBusArray) ElementType() reflect.Type {
   222  	return reflect.TypeOf((*[]*EventBus)(nil)).Elem()
   223  }
   224  
   225  func (i EventBusArray) ToEventBusArrayOutput() EventBusArrayOutput {
   226  	return i.ToEventBusArrayOutputWithContext(context.Background())
   227  }
   228  
   229  func (i EventBusArray) ToEventBusArrayOutputWithContext(ctx context.Context) EventBusArrayOutput {
   230  	return pulumi.ToOutputWithContext(ctx, i).(EventBusArrayOutput)
   231  }
   232  
   233  // EventBusMapInput is an input type that accepts EventBusMap and EventBusMapOutput values.
   234  // You can construct a concrete instance of `EventBusMapInput` via:
   235  //
   236  //	EventBusMap{ "key": EventBusArgs{...} }
   237  type EventBusMapInput interface {
   238  	pulumi.Input
   239  
   240  	ToEventBusMapOutput() EventBusMapOutput
   241  	ToEventBusMapOutputWithContext(context.Context) EventBusMapOutput
   242  }
   243  
   244  type EventBusMap map[string]EventBusInput
   245  
   246  func (EventBusMap) ElementType() reflect.Type {
   247  	return reflect.TypeOf((*map[string]*EventBus)(nil)).Elem()
   248  }
   249  
   250  func (i EventBusMap) ToEventBusMapOutput() EventBusMapOutput {
   251  	return i.ToEventBusMapOutputWithContext(context.Background())
   252  }
   253  
   254  func (i EventBusMap) ToEventBusMapOutputWithContext(ctx context.Context) EventBusMapOutput {
   255  	return pulumi.ToOutputWithContext(ctx, i).(EventBusMapOutput)
   256  }
   257  
   258  type EventBusOutput struct{ *pulumi.OutputState }
   259  
   260  func (EventBusOutput) ElementType() reflect.Type {
   261  	return reflect.TypeOf((**EventBus)(nil)).Elem()
   262  }
   263  
   264  func (o EventBusOutput) ToEventBusOutput() EventBusOutput {
   265  	return o
   266  }
   267  
   268  func (o EventBusOutput) ToEventBusOutputWithContext(ctx context.Context) EventBusOutput {
   269  	return o
   270  }
   271  
   272  // The Amazon Resource Name (ARN) of the event bus.
   273  func (o EventBusOutput) Arn() pulumi.StringOutput {
   274  	return o.ApplyT(func(v *EventBus) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   275  }
   276  
   277  // The partner event source that the new event bus will be matched with. Must match `name`.
   278  func (o EventBusOutput) EventSourceName() pulumi.StringPtrOutput {
   279  	return o.ApplyT(func(v *EventBus) pulumi.StringPtrOutput { return v.EventSourceName }).(pulumi.StringPtrOutput)
   280  }
   281  
   282  // The name of the new event bus. The names of custom event buses can't contain the / character. To create a partner event bus, ensure the `name` matches the `eventSourceName`.
   283  func (o EventBusOutput) Name() pulumi.StringOutput {
   284  	return o.ApplyT(func(v *EventBus) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   285  }
   286  
   287  // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   288  func (o EventBusOutput) Tags() pulumi.StringMapOutput {
   289  	return o.ApplyT(func(v *EventBus) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   290  }
   291  
   292  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   293  //
   294  // Deprecated: Please use `tags` instead.
   295  func (o EventBusOutput) TagsAll() pulumi.StringMapOutput {
   296  	return o.ApplyT(func(v *EventBus) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   297  }
   298  
   299  type EventBusArrayOutput struct{ *pulumi.OutputState }
   300  
   301  func (EventBusArrayOutput) ElementType() reflect.Type {
   302  	return reflect.TypeOf((*[]*EventBus)(nil)).Elem()
   303  }
   304  
   305  func (o EventBusArrayOutput) ToEventBusArrayOutput() EventBusArrayOutput {
   306  	return o
   307  }
   308  
   309  func (o EventBusArrayOutput) ToEventBusArrayOutputWithContext(ctx context.Context) EventBusArrayOutput {
   310  	return o
   311  }
   312  
   313  func (o EventBusArrayOutput) Index(i pulumi.IntInput) EventBusOutput {
   314  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EventBus {
   315  		return vs[0].([]*EventBus)[vs[1].(int)]
   316  	}).(EventBusOutput)
   317  }
   318  
   319  type EventBusMapOutput struct{ *pulumi.OutputState }
   320  
   321  func (EventBusMapOutput) ElementType() reflect.Type {
   322  	return reflect.TypeOf((*map[string]*EventBus)(nil)).Elem()
   323  }
   324  
   325  func (o EventBusMapOutput) ToEventBusMapOutput() EventBusMapOutput {
   326  	return o
   327  }
   328  
   329  func (o EventBusMapOutput) ToEventBusMapOutputWithContext(ctx context.Context) EventBusMapOutput {
   330  	return o
   331  }
   332  
   333  func (o EventBusMapOutput) MapIndex(k pulumi.StringInput) EventBusOutput {
   334  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EventBus {
   335  		return vs[0].(map[string]*EventBus)[vs[1].(string)]
   336  	}).(EventBusOutput)
   337  }
   338  
   339  func init() {
   340  	pulumi.RegisterInputType(reflect.TypeOf((*EventBusInput)(nil)).Elem(), &EventBus{})
   341  	pulumi.RegisterInputType(reflect.TypeOf((*EventBusArrayInput)(nil)).Elem(), EventBusArray{})
   342  	pulumi.RegisterInputType(reflect.TypeOf((*EventBusMapInput)(nil)).Elem(), EventBusMap{})
   343  	pulumi.RegisterOutputType(EventBusOutput{})
   344  	pulumi.RegisterOutputType(EventBusArrayOutput{})
   345  	pulumi.RegisterOutputType(EventBusMapOutput{})
   346  }