github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudwatch/eventApiDestination.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 an EventBridge event API Destination resource.
    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.NewEventApiDestination(ctx, "test", &cloudwatch.EventApiDestinationArgs{
    35  //				Name:                         pulumi.String("api-destination"),
    36  //				Description:                  pulumi.String("An API Destination"),
    37  //				InvocationEndpoint:           pulumi.String("https://api.destination.com/endpoint"),
    38  //				HttpMethod:                   pulumi.String("POST"),
    39  //				InvocationRateLimitPerSecond: pulumi.Int(20),
    40  //				ConnectionArn:                pulumi.Any(testAwsCloudwatchEventConnection.Arn),
    41  //			})
    42  //			if err != nil {
    43  //				return err
    44  //			}
    45  //			return nil
    46  //		})
    47  //	}
    48  //
    49  // ```
    50  // <!--End PulumiCodeChooser -->
    51  //
    52  // ## Import
    53  //
    54  // Using `pulumi import`, import EventBridge API Destinations using the `name`. For example:
    55  //
    56  // ```sh
    57  // $ pulumi import aws:cloudwatch/eventApiDestination:EventApiDestination test api-destination
    58  // ```
    59  type EventApiDestination struct {
    60  	pulumi.CustomResourceState
    61  
    62  	// The Amazon Resource Name (ARN) of the event API Destination.
    63  	Arn pulumi.StringOutput `pulumi:"arn"`
    64  	// ARN of the EventBridge Connection to use for the API Destination.
    65  	ConnectionArn pulumi.StringOutput `pulumi:"connectionArn"`
    66  	// The description of the new API Destination. Maximum of 512 characters.
    67  	Description pulumi.StringPtrOutput `pulumi:"description"`
    68  	// Select the HTTP method used for the invocation endpoint, such as GET, POST, PUT, etc.
    69  	HttpMethod pulumi.StringOutput `pulumi:"httpMethod"`
    70  	// URL endpoint to invoke as a target. This could be a valid endpoint generated by a partner service. You can include "*" as path parameters wildcards to be set from the Target HttpParameters.
    71  	InvocationEndpoint pulumi.StringOutput `pulumi:"invocationEndpoint"`
    72  	// Enter the maximum number of invocations per second to allow for this destination. Enter a value greater than 0 (default 300).
    73  	InvocationRateLimitPerSecond pulumi.IntPtrOutput `pulumi:"invocationRateLimitPerSecond"`
    74  	// The name of the new API Destination. The name must be unique for your account. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.
    75  	Name pulumi.StringOutput `pulumi:"name"`
    76  }
    77  
    78  // NewEventApiDestination registers a new resource with the given unique name, arguments, and options.
    79  func NewEventApiDestination(ctx *pulumi.Context,
    80  	name string, args *EventApiDestinationArgs, opts ...pulumi.ResourceOption) (*EventApiDestination, error) {
    81  	if args == nil {
    82  		return nil, errors.New("missing one or more required arguments")
    83  	}
    84  
    85  	if args.ConnectionArn == nil {
    86  		return nil, errors.New("invalid value for required argument 'ConnectionArn'")
    87  	}
    88  	if args.HttpMethod == nil {
    89  		return nil, errors.New("invalid value for required argument 'HttpMethod'")
    90  	}
    91  	if args.InvocationEndpoint == nil {
    92  		return nil, errors.New("invalid value for required argument 'InvocationEndpoint'")
    93  	}
    94  	opts = internal.PkgResourceDefaultOpts(opts)
    95  	var resource EventApiDestination
    96  	err := ctx.RegisterResource("aws:cloudwatch/eventApiDestination:EventApiDestination", name, args, &resource, opts...)
    97  	if err != nil {
    98  		return nil, err
    99  	}
   100  	return &resource, nil
   101  }
   102  
   103  // GetEventApiDestination gets an existing EventApiDestination resource's state with the given name, ID, and optional
   104  // state properties that are used to uniquely qualify the lookup (nil if not required).
   105  func GetEventApiDestination(ctx *pulumi.Context,
   106  	name string, id pulumi.IDInput, state *EventApiDestinationState, opts ...pulumi.ResourceOption) (*EventApiDestination, error) {
   107  	var resource EventApiDestination
   108  	err := ctx.ReadResource("aws:cloudwatch/eventApiDestination:EventApiDestination", name, id, state, &resource, opts...)
   109  	if err != nil {
   110  		return nil, err
   111  	}
   112  	return &resource, nil
   113  }
   114  
   115  // Input properties used for looking up and filtering EventApiDestination resources.
   116  type eventApiDestinationState struct {
   117  	// The Amazon Resource Name (ARN) of the event API Destination.
   118  	Arn *string `pulumi:"arn"`
   119  	// ARN of the EventBridge Connection to use for the API Destination.
   120  	ConnectionArn *string `pulumi:"connectionArn"`
   121  	// The description of the new API Destination. Maximum of 512 characters.
   122  	Description *string `pulumi:"description"`
   123  	// Select the HTTP method used for the invocation endpoint, such as GET, POST, PUT, etc.
   124  	HttpMethod *string `pulumi:"httpMethod"`
   125  	// URL endpoint to invoke as a target. This could be a valid endpoint generated by a partner service. You can include "*" as path parameters wildcards to be set from the Target HttpParameters.
   126  	InvocationEndpoint *string `pulumi:"invocationEndpoint"`
   127  	// Enter the maximum number of invocations per second to allow for this destination. Enter a value greater than 0 (default 300).
   128  	InvocationRateLimitPerSecond *int `pulumi:"invocationRateLimitPerSecond"`
   129  	// The name of the new API Destination. The name must be unique for your account. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.
   130  	Name *string `pulumi:"name"`
   131  }
   132  
   133  type EventApiDestinationState struct {
   134  	// The Amazon Resource Name (ARN) of the event API Destination.
   135  	Arn pulumi.StringPtrInput
   136  	// ARN of the EventBridge Connection to use for the API Destination.
   137  	ConnectionArn pulumi.StringPtrInput
   138  	// The description of the new API Destination. Maximum of 512 characters.
   139  	Description pulumi.StringPtrInput
   140  	// Select the HTTP method used for the invocation endpoint, such as GET, POST, PUT, etc.
   141  	HttpMethod pulumi.StringPtrInput
   142  	// URL endpoint to invoke as a target. This could be a valid endpoint generated by a partner service. You can include "*" as path parameters wildcards to be set from the Target HttpParameters.
   143  	InvocationEndpoint pulumi.StringPtrInput
   144  	// Enter the maximum number of invocations per second to allow for this destination. Enter a value greater than 0 (default 300).
   145  	InvocationRateLimitPerSecond pulumi.IntPtrInput
   146  	// The name of the new API Destination. The name must be unique for your account. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.
   147  	Name pulumi.StringPtrInput
   148  }
   149  
   150  func (EventApiDestinationState) ElementType() reflect.Type {
   151  	return reflect.TypeOf((*eventApiDestinationState)(nil)).Elem()
   152  }
   153  
   154  type eventApiDestinationArgs struct {
   155  	// ARN of the EventBridge Connection to use for the API Destination.
   156  	ConnectionArn string `pulumi:"connectionArn"`
   157  	// The description of the new API Destination. Maximum of 512 characters.
   158  	Description *string `pulumi:"description"`
   159  	// Select the HTTP method used for the invocation endpoint, such as GET, POST, PUT, etc.
   160  	HttpMethod string `pulumi:"httpMethod"`
   161  	// URL endpoint to invoke as a target. This could be a valid endpoint generated by a partner service. You can include "*" as path parameters wildcards to be set from the Target HttpParameters.
   162  	InvocationEndpoint string `pulumi:"invocationEndpoint"`
   163  	// Enter the maximum number of invocations per second to allow for this destination. Enter a value greater than 0 (default 300).
   164  	InvocationRateLimitPerSecond *int `pulumi:"invocationRateLimitPerSecond"`
   165  	// The name of the new API Destination. The name must be unique for your account. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.
   166  	Name *string `pulumi:"name"`
   167  }
   168  
   169  // The set of arguments for constructing a EventApiDestination resource.
   170  type EventApiDestinationArgs struct {
   171  	// ARN of the EventBridge Connection to use for the API Destination.
   172  	ConnectionArn pulumi.StringInput
   173  	// The description of the new API Destination. Maximum of 512 characters.
   174  	Description pulumi.StringPtrInput
   175  	// Select the HTTP method used for the invocation endpoint, such as GET, POST, PUT, etc.
   176  	HttpMethod pulumi.StringInput
   177  	// URL endpoint to invoke as a target. This could be a valid endpoint generated by a partner service. You can include "*" as path parameters wildcards to be set from the Target HttpParameters.
   178  	InvocationEndpoint pulumi.StringInput
   179  	// Enter the maximum number of invocations per second to allow for this destination. Enter a value greater than 0 (default 300).
   180  	InvocationRateLimitPerSecond pulumi.IntPtrInput
   181  	// The name of the new API Destination. The name must be unique for your account. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.
   182  	Name pulumi.StringPtrInput
   183  }
   184  
   185  func (EventApiDestinationArgs) ElementType() reflect.Type {
   186  	return reflect.TypeOf((*eventApiDestinationArgs)(nil)).Elem()
   187  }
   188  
   189  type EventApiDestinationInput interface {
   190  	pulumi.Input
   191  
   192  	ToEventApiDestinationOutput() EventApiDestinationOutput
   193  	ToEventApiDestinationOutputWithContext(ctx context.Context) EventApiDestinationOutput
   194  }
   195  
   196  func (*EventApiDestination) ElementType() reflect.Type {
   197  	return reflect.TypeOf((**EventApiDestination)(nil)).Elem()
   198  }
   199  
   200  func (i *EventApiDestination) ToEventApiDestinationOutput() EventApiDestinationOutput {
   201  	return i.ToEventApiDestinationOutputWithContext(context.Background())
   202  }
   203  
   204  func (i *EventApiDestination) ToEventApiDestinationOutputWithContext(ctx context.Context) EventApiDestinationOutput {
   205  	return pulumi.ToOutputWithContext(ctx, i).(EventApiDestinationOutput)
   206  }
   207  
   208  // EventApiDestinationArrayInput is an input type that accepts EventApiDestinationArray and EventApiDestinationArrayOutput values.
   209  // You can construct a concrete instance of `EventApiDestinationArrayInput` via:
   210  //
   211  //	EventApiDestinationArray{ EventApiDestinationArgs{...} }
   212  type EventApiDestinationArrayInput interface {
   213  	pulumi.Input
   214  
   215  	ToEventApiDestinationArrayOutput() EventApiDestinationArrayOutput
   216  	ToEventApiDestinationArrayOutputWithContext(context.Context) EventApiDestinationArrayOutput
   217  }
   218  
   219  type EventApiDestinationArray []EventApiDestinationInput
   220  
   221  func (EventApiDestinationArray) ElementType() reflect.Type {
   222  	return reflect.TypeOf((*[]*EventApiDestination)(nil)).Elem()
   223  }
   224  
   225  func (i EventApiDestinationArray) ToEventApiDestinationArrayOutput() EventApiDestinationArrayOutput {
   226  	return i.ToEventApiDestinationArrayOutputWithContext(context.Background())
   227  }
   228  
   229  func (i EventApiDestinationArray) ToEventApiDestinationArrayOutputWithContext(ctx context.Context) EventApiDestinationArrayOutput {
   230  	return pulumi.ToOutputWithContext(ctx, i).(EventApiDestinationArrayOutput)
   231  }
   232  
   233  // EventApiDestinationMapInput is an input type that accepts EventApiDestinationMap and EventApiDestinationMapOutput values.
   234  // You can construct a concrete instance of `EventApiDestinationMapInput` via:
   235  //
   236  //	EventApiDestinationMap{ "key": EventApiDestinationArgs{...} }
   237  type EventApiDestinationMapInput interface {
   238  	pulumi.Input
   239  
   240  	ToEventApiDestinationMapOutput() EventApiDestinationMapOutput
   241  	ToEventApiDestinationMapOutputWithContext(context.Context) EventApiDestinationMapOutput
   242  }
   243  
   244  type EventApiDestinationMap map[string]EventApiDestinationInput
   245  
   246  func (EventApiDestinationMap) ElementType() reflect.Type {
   247  	return reflect.TypeOf((*map[string]*EventApiDestination)(nil)).Elem()
   248  }
   249  
   250  func (i EventApiDestinationMap) ToEventApiDestinationMapOutput() EventApiDestinationMapOutput {
   251  	return i.ToEventApiDestinationMapOutputWithContext(context.Background())
   252  }
   253  
   254  func (i EventApiDestinationMap) ToEventApiDestinationMapOutputWithContext(ctx context.Context) EventApiDestinationMapOutput {
   255  	return pulumi.ToOutputWithContext(ctx, i).(EventApiDestinationMapOutput)
   256  }
   257  
   258  type EventApiDestinationOutput struct{ *pulumi.OutputState }
   259  
   260  func (EventApiDestinationOutput) ElementType() reflect.Type {
   261  	return reflect.TypeOf((**EventApiDestination)(nil)).Elem()
   262  }
   263  
   264  func (o EventApiDestinationOutput) ToEventApiDestinationOutput() EventApiDestinationOutput {
   265  	return o
   266  }
   267  
   268  func (o EventApiDestinationOutput) ToEventApiDestinationOutputWithContext(ctx context.Context) EventApiDestinationOutput {
   269  	return o
   270  }
   271  
   272  // The Amazon Resource Name (ARN) of the event API Destination.
   273  func (o EventApiDestinationOutput) Arn() pulumi.StringOutput {
   274  	return o.ApplyT(func(v *EventApiDestination) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   275  }
   276  
   277  // ARN of the EventBridge Connection to use for the API Destination.
   278  func (o EventApiDestinationOutput) ConnectionArn() pulumi.StringOutput {
   279  	return o.ApplyT(func(v *EventApiDestination) pulumi.StringOutput { return v.ConnectionArn }).(pulumi.StringOutput)
   280  }
   281  
   282  // The description of the new API Destination. Maximum of 512 characters.
   283  func (o EventApiDestinationOutput) Description() pulumi.StringPtrOutput {
   284  	return o.ApplyT(func(v *EventApiDestination) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   285  }
   286  
   287  // Select the HTTP method used for the invocation endpoint, such as GET, POST, PUT, etc.
   288  func (o EventApiDestinationOutput) HttpMethod() pulumi.StringOutput {
   289  	return o.ApplyT(func(v *EventApiDestination) pulumi.StringOutput { return v.HttpMethod }).(pulumi.StringOutput)
   290  }
   291  
   292  // URL endpoint to invoke as a target. This could be a valid endpoint generated by a partner service. You can include "*" as path parameters wildcards to be set from the Target HttpParameters.
   293  func (o EventApiDestinationOutput) InvocationEndpoint() pulumi.StringOutput {
   294  	return o.ApplyT(func(v *EventApiDestination) pulumi.StringOutput { return v.InvocationEndpoint }).(pulumi.StringOutput)
   295  }
   296  
   297  // Enter the maximum number of invocations per second to allow for this destination. Enter a value greater than 0 (default 300).
   298  func (o EventApiDestinationOutput) InvocationRateLimitPerSecond() pulumi.IntPtrOutput {
   299  	return o.ApplyT(func(v *EventApiDestination) pulumi.IntPtrOutput { return v.InvocationRateLimitPerSecond }).(pulumi.IntPtrOutput)
   300  }
   301  
   302  // The name of the new API Destination. The name must be unique for your account. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.
   303  func (o EventApiDestinationOutput) Name() pulumi.StringOutput {
   304  	return o.ApplyT(func(v *EventApiDestination) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   305  }
   306  
   307  type EventApiDestinationArrayOutput struct{ *pulumi.OutputState }
   308  
   309  func (EventApiDestinationArrayOutput) ElementType() reflect.Type {
   310  	return reflect.TypeOf((*[]*EventApiDestination)(nil)).Elem()
   311  }
   312  
   313  func (o EventApiDestinationArrayOutput) ToEventApiDestinationArrayOutput() EventApiDestinationArrayOutput {
   314  	return o
   315  }
   316  
   317  func (o EventApiDestinationArrayOutput) ToEventApiDestinationArrayOutputWithContext(ctx context.Context) EventApiDestinationArrayOutput {
   318  	return o
   319  }
   320  
   321  func (o EventApiDestinationArrayOutput) Index(i pulumi.IntInput) EventApiDestinationOutput {
   322  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EventApiDestination {
   323  		return vs[0].([]*EventApiDestination)[vs[1].(int)]
   324  	}).(EventApiDestinationOutput)
   325  }
   326  
   327  type EventApiDestinationMapOutput struct{ *pulumi.OutputState }
   328  
   329  func (EventApiDestinationMapOutput) ElementType() reflect.Type {
   330  	return reflect.TypeOf((*map[string]*EventApiDestination)(nil)).Elem()
   331  }
   332  
   333  func (o EventApiDestinationMapOutput) ToEventApiDestinationMapOutput() EventApiDestinationMapOutput {
   334  	return o
   335  }
   336  
   337  func (o EventApiDestinationMapOutput) ToEventApiDestinationMapOutputWithContext(ctx context.Context) EventApiDestinationMapOutput {
   338  	return o
   339  }
   340  
   341  func (o EventApiDestinationMapOutput) MapIndex(k pulumi.StringInput) EventApiDestinationOutput {
   342  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EventApiDestination {
   343  		return vs[0].(map[string]*EventApiDestination)[vs[1].(string)]
   344  	}).(EventApiDestinationOutput)
   345  }
   346  
   347  func init() {
   348  	pulumi.RegisterInputType(reflect.TypeOf((*EventApiDestinationInput)(nil)).Elem(), &EventApiDestination{})
   349  	pulumi.RegisterInputType(reflect.TypeOf((*EventApiDestinationArrayInput)(nil)).Elem(), EventApiDestinationArray{})
   350  	pulumi.RegisterInputType(reflect.TypeOf((*EventApiDestinationMapInput)(nil)).Elem(), EventApiDestinationMap{})
   351  	pulumi.RegisterOutputType(EventApiDestinationOutput{})
   352  	pulumi.RegisterOutputType(EventApiDestinationArrayOutput{})
   353  	pulumi.RegisterOutputType(EventApiDestinationMapOutput{})
   354  }