github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudwatch/eventEndpoint.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  	"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 create an EventBridge Global Endpoint.
    16  //
    17  // > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.
    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/cloudwatch"
    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 := cloudwatch.NewEventEndpoint(ctx, "this", &cloudwatch.EventEndpointArgs{
    35  //				Name:    pulumi.String("global-endpoint"),
    36  //				RoleArn: pulumi.Any(replication.Arn),
    37  //				EventBuses: cloudwatch.EventEndpointEventBusArray{
    38  //					&cloudwatch.EventEndpointEventBusArgs{
    39  //						EventBusArn: pulumi.Any(primary.Arn),
    40  //					},
    41  //					&cloudwatch.EventEndpointEventBusArgs{
    42  //						EventBusArn: pulumi.Any(secondary.Arn),
    43  //					},
    44  //				},
    45  //				ReplicationConfig: &cloudwatch.EventEndpointReplicationConfigArgs{
    46  //					State: pulumi.String("DISABLED"),
    47  //				},
    48  //				RoutingConfig: &cloudwatch.EventEndpointRoutingConfigArgs{
    49  //					FailoverConfig: &cloudwatch.EventEndpointRoutingConfigFailoverConfigArgs{
    50  //						Primary: &cloudwatch.EventEndpointRoutingConfigFailoverConfigPrimaryArgs{
    51  //							HealthCheck: pulumi.Any(primaryAwsRoute53HealthCheck.Arn),
    52  //						},
    53  //						Secondary: &cloudwatch.EventEndpointRoutingConfigFailoverConfigSecondaryArgs{
    54  //							Route: pulumi.String("us-east-2"),
    55  //						},
    56  //					},
    57  //				},
    58  //			})
    59  //			if err != nil {
    60  //				return err
    61  //			}
    62  //			return nil
    63  //		})
    64  //	}
    65  //
    66  // ```
    67  // <!--End PulumiCodeChooser -->
    68  //
    69  // ## Import
    70  //
    71  // Using `pulumi import`, import EventBridge Global Endpoints using the `name`. For example:
    72  //
    73  // ```sh
    74  // $ pulumi import aws:cloudwatch/eventEndpoint:EventEndpoint imported_endpoint example-endpoint
    75  // ```
    76  type EventEndpoint struct {
    77  	pulumi.CustomResourceState
    78  
    79  	// The ARN of the endpoint that was created.
    80  	Arn pulumi.StringOutput `pulumi:"arn"`
    81  	// A description of the global endpoint.
    82  	Description pulumi.StringPtrOutput `pulumi:"description"`
    83  	// The URL of the endpoint that was created.
    84  	EndpointUrl pulumi.StringOutput `pulumi:"endpointUrl"`
    85  	// The event buses to use. The names of the event buses must be identical in each Region. Exactly two event buses are required. Documented below.
    86  	EventBuses EventEndpointEventBusArrayOutput `pulumi:"eventBuses"`
    87  	// The name of the global endpoint.
    88  	Name pulumi.StringOutput `pulumi:"name"`
    89  	// Parameters used for replication. Documented below.
    90  	ReplicationConfig EventEndpointReplicationConfigPtrOutput `pulumi:"replicationConfig"`
    91  	// The ARN of the IAM role used for replication between event buses.
    92  	RoleArn pulumi.StringPtrOutput `pulumi:"roleArn"`
    93  	// Parameters used for routing, including the health check and secondary Region. Documented below.
    94  	RoutingConfig EventEndpointRoutingConfigOutput `pulumi:"routingConfig"`
    95  }
    96  
    97  // NewEventEndpoint registers a new resource with the given unique name, arguments, and options.
    98  func NewEventEndpoint(ctx *pulumi.Context,
    99  	name string, args *EventEndpointArgs, opts ...pulumi.ResourceOption) (*EventEndpoint, error) {
   100  	if args == nil {
   101  		return nil, errors.New("missing one or more required arguments")
   102  	}
   103  
   104  	if args.EventBuses == nil {
   105  		return nil, errors.New("invalid value for required argument 'EventBuses'")
   106  	}
   107  	if args.RoutingConfig == nil {
   108  		return nil, errors.New("invalid value for required argument 'RoutingConfig'")
   109  	}
   110  	opts = internal.PkgResourceDefaultOpts(opts)
   111  	var resource EventEndpoint
   112  	err := ctx.RegisterResource("aws:cloudwatch/eventEndpoint:EventEndpoint", name, args, &resource, opts...)
   113  	if err != nil {
   114  		return nil, err
   115  	}
   116  	return &resource, nil
   117  }
   118  
   119  // GetEventEndpoint gets an existing EventEndpoint 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 GetEventEndpoint(ctx *pulumi.Context,
   122  	name string, id pulumi.IDInput, state *EventEndpointState, opts ...pulumi.ResourceOption) (*EventEndpoint, error) {
   123  	var resource EventEndpoint
   124  	err := ctx.ReadResource("aws:cloudwatch/eventEndpoint:EventEndpoint", 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 EventEndpoint resources.
   132  type eventEndpointState struct {
   133  	// The ARN of the endpoint that was created.
   134  	Arn *string `pulumi:"arn"`
   135  	// A description of the global endpoint.
   136  	Description *string `pulumi:"description"`
   137  	// The URL of the endpoint that was created.
   138  	EndpointUrl *string `pulumi:"endpointUrl"`
   139  	// The event buses to use. The names of the event buses must be identical in each Region. Exactly two event buses are required. Documented below.
   140  	EventBuses []EventEndpointEventBus `pulumi:"eventBuses"`
   141  	// The name of the global endpoint.
   142  	Name *string `pulumi:"name"`
   143  	// Parameters used for replication. Documented below.
   144  	ReplicationConfig *EventEndpointReplicationConfig `pulumi:"replicationConfig"`
   145  	// The ARN of the IAM role used for replication between event buses.
   146  	RoleArn *string `pulumi:"roleArn"`
   147  	// Parameters used for routing, including the health check and secondary Region. Documented below.
   148  	RoutingConfig *EventEndpointRoutingConfig `pulumi:"routingConfig"`
   149  }
   150  
   151  type EventEndpointState struct {
   152  	// The ARN of the endpoint that was created.
   153  	Arn pulumi.StringPtrInput
   154  	// A description of the global endpoint.
   155  	Description pulumi.StringPtrInput
   156  	// The URL of the endpoint that was created.
   157  	EndpointUrl pulumi.StringPtrInput
   158  	// The event buses to use. The names of the event buses must be identical in each Region. Exactly two event buses are required. Documented below.
   159  	EventBuses EventEndpointEventBusArrayInput
   160  	// The name of the global endpoint.
   161  	Name pulumi.StringPtrInput
   162  	// Parameters used for replication. Documented below.
   163  	ReplicationConfig EventEndpointReplicationConfigPtrInput
   164  	// The ARN of the IAM role used for replication between event buses.
   165  	RoleArn pulumi.StringPtrInput
   166  	// Parameters used for routing, including the health check and secondary Region. Documented below.
   167  	RoutingConfig EventEndpointRoutingConfigPtrInput
   168  }
   169  
   170  func (EventEndpointState) ElementType() reflect.Type {
   171  	return reflect.TypeOf((*eventEndpointState)(nil)).Elem()
   172  }
   173  
   174  type eventEndpointArgs struct {
   175  	// A description of the global endpoint.
   176  	Description *string `pulumi:"description"`
   177  	// The event buses to use. The names of the event buses must be identical in each Region. Exactly two event buses are required. Documented below.
   178  	EventBuses []EventEndpointEventBus `pulumi:"eventBuses"`
   179  	// The name of the global endpoint.
   180  	Name *string `pulumi:"name"`
   181  	// Parameters used for replication. Documented below.
   182  	ReplicationConfig *EventEndpointReplicationConfig `pulumi:"replicationConfig"`
   183  	// The ARN of the IAM role used for replication between event buses.
   184  	RoleArn *string `pulumi:"roleArn"`
   185  	// Parameters used for routing, including the health check and secondary Region. Documented below.
   186  	RoutingConfig EventEndpointRoutingConfig `pulumi:"routingConfig"`
   187  }
   188  
   189  // The set of arguments for constructing a EventEndpoint resource.
   190  type EventEndpointArgs struct {
   191  	// A description of the global endpoint.
   192  	Description pulumi.StringPtrInput
   193  	// The event buses to use. The names of the event buses must be identical in each Region. Exactly two event buses are required. Documented below.
   194  	EventBuses EventEndpointEventBusArrayInput
   195  	// The name of the global endpoint.
   196  	Name pulumi.StringPtrInput
   197  	// Parameters used for replication. Documented below.
   198  	ReplicationConfig EventEndpointReplicationConfigPtrInput
   199  	// The ARN of the IAM role used for replication between event buses.
   200  	RoleArn pulumi.StringPtrInput
   201  	// Parameters used for routing, including the health check and secondary Region. Documented below.
   202  	RoutingConfig EventEndpointRoutingConfigInput
   203  }
   204  
   205  func (EventEndpointArgs) ElementType() reflect.Type {
   206  	return reflect.TypeOf((*eventEndpointArgs)(nil)).Elem()
   207  }
   208  
   209  type EventEndpointInput interface {
   210  	pulumi.Input
   211  
   212  	ToEventEndpointOutput() EventEndpointOutput
   213  	ToEventEndpointOutputWithContext(ctx context.Context) EventEndpointOutput
   214  }
   215  
   216  func (*EventEndpoint) ElementType() reflect.Type {
   217  	return reflect.TypeOf((**EventEndpoint)(nil)).Elem()
   218  }
   219  
   220  func (i *EventEndpoint) ToEventEndpointOutput() EventEndpointOutput {
   221  	return i.ToEventEndpointOutputWithContext(context.Background())
   222  }
   223  
   224  func (i *EventEndpoint) ToEventEndpointOutputWithContext(ctx context.Context) EventEndpointOutput {
   225  	return pulumi.ToOutputWithContext(ctx, i).(EventEndpointOutput)
   226  }
   227  
   228  // EventEndpointArrayInput is an input type that accepts EventEndpointArray and EventEndpointArrayOutput values.
   229  // You can construct a concrete instance of `EventEndpointArrayInput` via:
   230  //
   231  //	EventEndpointArray{ EventEndpointArgs{...} }
   232  type EventEndpointArrayInput interface {
   233  	pulumi.Input
   234  
   235  	ToEventEndpointArrayOutput() EventEndpointArrayOutput
   236  	ToEventEndpointArrayOutputWithContext(context.Context) EventEndpointArrayOutput
   237  }
   238  
   239  type EventEndpointArray []EventEndpointInput
   240  
   241  func (EventEndpointArray) ElementType() reflect.Type {
   242  	return reflect.TypeOf((*[]*EventEndpoint)(nil)).Elem()
   243  }
   244  
   245  func (i EventEndpointArray) ToEventEndpointArrayOutput() EventEndpointArrayOutput {
   246  	return i.ToEventEndpointArrayOutputWithContext(context.Background())
   247  }
   248  
   249  func (i EventEndpointArray) ToEventEndpointArrayOutputWithContext(ctx context.Context) EventEndpointArrayOutput {
   250  	return pulumi.ToOutputWithContext(ctx, i).(EventEndpointArrayOutput)
   251  }
   252  
   253  // EventEndpointMapInput is an input type that accepts EventEndpointMap and EventEndpointMapOutput values.
   254  // You can construct a concrete instance of `EventEndpointMapInput` via:
   255  //
   256  //	EventEndpointMap{ "key": EventEndpointArgs{...} }
   257  type EventEndpointMapInput interface {
   258  	pulumi.Input
   259  
   260  	ToEventEndpointMapOutput() EventEndpointMapOutput
   261  	ToEventEndpointMapOutputWithContext(context.Context) EventEndpointMapOutput
   262  }
   263  
   264  type EventEndpointMap map[string]EventEndpointInput
   265  
   266  func (EventEndpointMap) ElementType() reflect.Type {
   267  	return reflect.TypeOf((*map[string]*EventEndpoint)(nil)).Elem()
   268  }
   269  
   270  func (i EventEndpointMap) ToEventEndpointMapOutput() EventEndpointMapOutput {
   271  	return i.ToEventEndpointMapOutputWithContext(context.Background())
   272  }
   273  
   274  func (i EventEndpointMap) ToEventEndpointMapOutputWithContext(ctx context.Context) EventEndpointMapOutput {
   275  	return pulumi.ToOutputWithContext(ctx, i).(EventEndpointMapOutput)
   276  }
   277  
   278  type EventEndpointOutput struct{ *pulumi.OutputState }
   279  
   280  func (EventEndpointOutput) ElementType() reflect.Type {
   281  	return reflect.TypeOf((**EventEndpoint)(nil)).Elem()
   282  }
   283  
   284  func (o EventEndpointOutput) ToEventEndpointOutput() EventEndpointOutput {
   285  	return o
   286  }
   287  
   288  func (o EventEndpointOutput) ToEventEndpointOutputWithContext(ctx context.Context) EventEndpointOutput {
   289  	return o
   290  }
   291  
   292  // The ARN of the endpoint that was created.
   293  func (o EventEndpointOutput) Arn() pulumi.StringOutput {
   294  	return o.ApplyT(func(v *EventEndpoint) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   295  }
   296  
   297  // A description of the global endpoint.
   298  func (o EventEndpointOutput) Description() pulumi.StringPtrOutput {
   299  	return o.ApplyT(func(v *EventEndpoint) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   300  }
   301  
   302  // The URL of the endpoint that was created.
   303  func (o EventEndpointOutput) EndpointUrl() pulumi.StringOutput {
   304  	return o.ApplyT(func(v *EventEndpoint) pulumi.StringOutput { return v.EndpointUrl }).(pulumi.StringOutput)
   305  }
   306  
   307  // The event buses to use. The names of the event buses must be identical in each Region. Exactly two event buses are required. Documented below.
   308  func (o EventEndpointOutput) EventBuses() EventEndpointEventBusArrayOutput {
   309  	return o.ApplyT(func(v *EventEndpoint) EventEndpointEventBusArrayOutput { return v.EventBuses }).(EventEndpointEventBusArrayOutput)
   310  }
   311  
   312  // The name of the global endpoint.
   313  func (o EventEndpointOutput) Name() pulumi.StringOutput {
   314  	return o.ApplyT(func(v *EventEndpoint) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   315  }
   316  
   317  // Parameters used for replication. Documented below.
   318  func (o EventEndpointOutput) ReplicationConfig() EventEndpointReplicationConfigPtrOutput {
   319  	return o.ApplyT(func(v *EventEndpoint) EventEndpointReplicationConfigPtrOutput { return v.ReplicationConfig }).(EventEndpointReplicationConfigPtrOutput)
   320  }
   321  
   322  // The ARN of the IAM role used for replication between event buses.
   323  func (o EventEndpointOutput) RoleArn() pulumi.StringPtrOutput {
   324  	return o.ApplyT(func(v *EventEndpoint) pulumi.StringPtrOutput { return v.RoleArn }).(pulumi.StringPtrOutput)
   325  }
   326  
   327  // Parameters used for routing, including the health check and secondary Region. Documented below.
   328  func (o EventEndpointOutput) RoutingConfig() EventEndpointRoutingConfigOutput {
   329  	return o.ApplyT(func(v *EventEndpoint) EventEndpointRoutingConfigOutput { return v.RoutingConfig }).(EventEndpointRoutingConfigOutput)
   330  }
   331  
   332  type EventEndpointArrayOutput struct{ *pulumi.OutputState }
   333  
   334  func (EventEndpointArrayOutput) ElementType() reflect.Type {
   335  	return reflect.TypeOf((*[]*EventEndpoint)(nil)).Elem()
   336  }
   337  
   338  func (o EventEndpointArrayOutput) ToEventEndpointArrayOutput() EventEndpointArrayOutput {
   339  	return o
   340  }
   341  
   342  func (o EventEndpointArrayOutput) ToEventEndpointArrayOutputWithContext(ctx context.Context) EventEndpointArrayOutput {
   343  	return o
   344  }
   345  
   346  func (o EventEndpointArrayOutput) Index(i pulumi.IntInput) EventEndpointOutput {
   347  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EventEndpoint {
   348  		return vs[0].([]*EventEndpoint)[vs[1].(int)]
   349  	}).(EventEndpointOutput)
   350  }
   351  
   352  type EventEndpointMapOutput struct{ *pulumi.OutputState }
   353  
   354  func (EventEndpointMapOutput) ElementType() reflect.Type {
   355  	return reflect.TypeOf((*map[string]*EventEndpoint)(nil)).Elem()
   356  }
   357  
   358  func (o EventEndpointMapOutput) ToEventEndpointMapOutput() EventEndpointMapOutput {
   359  	return o
   360  }
   361  
   362  func (o EventEndpointMapOutput) ToEventEndpointMapOutputWithContext(ctx context.Context) EventEndpointMapOutput {
   363  	return o
   364  }
   365  
   366  func (o EventEndpointMapOutput) MapIndex(k pulumi.StringInput) EventEndpointOutput {
   367  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EventEndpoint {
   368  		return vs[0].(map[string]*EventEndpoint)[vs[1].(string)]
   369  	}).(EventEndpointOutput)
   370  }
   371  
   372  func init() {
   373  	pulumi.RegisterInputType(reflect.TypeOf((*EventEndpointInput)(nil)).Elem(), &EventEndpoint{})
   374  	pulumi.RegisterInputType(reflect.TypeOf((*EventEndpointArrayInput)(nil)).Elem(), EventEndpointArray{})
   375  	pulumi.RegisterInputType(reflect.TypeOf((*EventEndpointMapInput)(nil)).Elem(), EventEndpointMap{})
   376  	pulumi.RegisterOutputType(EventEndpointOutput{})
   377  	pulumi.RegisterOutputType(EventEndpointArrayOutput{})
   378  	pulumi.RegisterOutputType(EventEndpointMapOutput{})
   379  }