github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/vpcEndpointConnectionNotification.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 ec2
     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 VPC Endpoint connection notification resource.
    16  // Connection notifications notify subscribers of VPC Endpoint events.
    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/ec2"
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns"
    29  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    30  //
    31  // )
    32  //
    33  //	func main() {
    34  //		pulumi.Run(func(ctx *pulumi.Context) error {
    35  //			topic, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    36  //				Statements: []iam.GetPolicyDocumentStatement{
    37  //					{
    38  //						Effect: pulumi.StringRef("Allow"),
    39  //						Principals: []iam.GetPolicyDocumentStatementPrincipal{
    40  //							{
    41  //								Type: "Service",
    42  //								Identifiers: []string{
    43  //									"vpce.amazonaws.com",
    44  //								},
    45  //							},
    46  //						},
    47  //						Actions: []string{
    48  //							"SNS:Publish",
    49  //						},
    50  //						Resources: []string{
    51  //							"arn:aws:sns:*:*:vpce-notification-topic",
    52  //						},
    53  //					},
    54  //				},
    55  //			}, nil)
    56  //			if err != nil {
    57  //				return err
    58  //			}
    59  //			topicTopic, err := sns.NewTopic(ctx, "topic", &sns.TopicArgs{
    60  //				Name:   pulumi.String("vpce-notification-topic"),
    61  //				Policy: pulumi.String(topic.Json),
    62  //			})
    63  //			if err != nil {
    64  //				return err
    65  //			}
    66  //			foo, err := ec2.NewVpcEndpointService(ctx, "foo", &ec2.VpcEndpointServiceArgs{
    67  //				AcceptanceRequired: pulumi.Bool(false),
    68  //				NetworkLoadBalancerArns: pulumi.StringArray{
    69  //					test.Arn,
    70  //				},
    71  //			})
    72  //			if err != nil {
    73  //				return err
    74  //			}
    75  //			_, err = ec2.NewVpcEndpointConnectionNotification(ctx, "foo", &ec2.VpcEndpointConnectionNotificationArgs{
    76  //				VpcEndpointServiceId:      foo.ID(),
    77  //				ConnectionNotificationArn: topicTopic.Arn,
    78  //				ConnectionEvents: pulumi.StringArray{
    79  //					pulumi.String("Accept"),
    80  //					pulumi.String("Reject"),
    81  //				},
    82  //			})
    83  //			if err != nil {
    84  //				return err
    85  //			}
    86  //			return nil
    87  //		})
    88  //	}
    89  //
    90  // ```
    91  // <!--End PulumiCodeChooser -->
    92  //
    93  // ## Import
    94  //
    95  // Using `pulumi import`, import VPC Endpoint connection notifications using the VPC endpoint connection notification `id`. For example:
    96  //
    97  // ```sh
    98  // $ pulumi import aws:ec2/vpcEndpointConnectionNotification:VpcEndpointConnectionNotification foo vpce-nfn-09e6ed3b4efba2263
    99  // ```
   100  type VpcEndpointConnectionNotification struct {
   101  	pulumi.CustomResourceState
   102  
   103  	// One or more endpoint [events](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVpcEndpointConnectionNotification.html#API_CreateVpcEndpointConnectionNotification_RequestParameters) for which to receive notifications.
   104  	//
   105  	// > **NOTE:** One of `vpcEndpointServiceId` or `vpcEndpointId` must be specified.
   106  	ConnectionEvents pulumi.StringArrayOutput `pulumi:"connectionEvents"`
   107  	// The ARN of the SNS topic for the notifications.
   108  	ConnectionNotificationArn pulumi.StringOutput `pulumi:"connectionNotificationArn"`
   109  	// The type of notification.
   110  	NotificationType pulumi.StringOutput `pulumi:"notificationType"`
   111  	// The state of the notification.
   112  	State pulumi.StringOutput `pulumi:"state"`
   113  	// The ID of the VPC Endpoint to receive notifications for.
   114  	VpcEndpointId pulumi.StringPtrOutput `pulumi:"vpcEndpointId"`
   115  	// The ID of the VPC Endpoint Service to receive notifications for.
   116  	VpcEndpointServiceId pulumi.StringPtrOutput `pulumi:"vpcEndpointServiceId"`
   117  }
   118  
   119  // NewVpcEndpointConnectionNotification registers a new resource with the given unique name, arguments, and options.
   120  func NewVpcEndpointConnectionNotification(ctx *pulumi.Context,
   121  	name string, args *VpcEndpointConnectionNotificationArgs, opts ...pulumi.ResourceOption) (*VpcEndpointConnectionNotification, error) {
   122  	if args == nil {
   123  		return nil, errors.New("missing one or more required arguments")
   124  	}
   125  
   126  	if args.ConnectionEvents == nil {
   127  		return nil, errors.New("invalid value for required argument 'ConnectionEvents'")
   128  	}
   129  	if args.ConnectionNotificationArn == nil {
   130  		return nil, errors.New("invalid value for required argument 'ConnectionNotificationArn'")
   131  	}
   132  	opts = internal.PkgResourceDefaultOpts(opts)
   133  	var resource VpcEndpointConnectionNotification
   134  	err := ctx.RegisterResource("aws:ec2/vpcEndpointConnectionNotification:VpcEndpointConnectionNotification", name, args, &resource, opts...)
   135  	if err != nil {
   136  		return nil, err
   137  	}
   138  	return &resource, nil
   139  }
   140  
   141  // GetVpcEndpointConnectionNotification gets an existing VpcEndpointConnectionNotification resource's state with the given name, ID, and optional
   142  // state properties that are used to uniquely qualify the lookup (nil if not required).
   143  func GetVpcEndpointConnectionNotification(ctx *pulumi.Context,
   144  	name string, id pulumi.IDInput, state *VpcEndpointConnectionNotificationState, opts ...pulumi.ResourceOption) (*VpcEndpointConnectionNotification, error) {
   145  	var resource VpcEndpointConnectionNotification
   146  	err := ctx.ReadResource("aws:ec2/vpcEndpointConnectionNotification:VpcEndpointConnectionNotification", name, id, state, &resource, opts...)
   147  	if err != nil {
   148  		return nil, err
   149  	}
   150  	return &resource, nil
   151  }
   152  
   153  // Input properties used for looking up and filtering VpcEndpointConnectionNotification resources.
   154  type vpcEndpointConnectionNotificationState struct {
   155  	// One or more endpoint [events](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVpcEndpointConnectionNotification.html#API_CreateVpcEndpointConnectionNotification_RequestParameters) for which to receive notifications.
   156  	//
   157  	// > **NOTE:** One of `vpcEndpointServiceId` or `vpcEndpointId` must be specified.
   158  	ConnectionEvents []string `pulumi:"connectionEvents"`
   159  	// The ARN of the SNS topic for the notifications.
   160  	ConnectionNotificationArn *string `pulumi:"connectionNotificationArn"`
   161  	// The type of notification.
   162  	NotificationType *string `pulumi:"notificationType"`
   163  	// The state of the notification.
   164  	State *string `pulumi:"state"`
   165  	// The ID of the VPC Endpoint to receive notifications for.
   166  	VpcEndpointId *string `pulumi:"vpcEndpointId"`
   167  	// The ID of the VPC Endpoint Service to receive notifications for.
   168  	VpcEndpointServiceId *string `pulumi:"vpcEndpointServiceId"`
   169  }
   170  
   171  type VpcEndpointConnectionNotificationState struct {
   172  	// One or more endpoint [events](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVpcEndpointConnectionNotification.html#API_CreateVpcEndpointConnectionNotification_RequestParameters) for which to receive notifications.
   173  	//
   174  	// > **NOTE:** One of `vpcEndpointServiceId` or `vpcEndpointId` must be specified.
   175  	ConnectionEvents pulumi.StringArrayInput
   176  	// The ARN of the SNS topic for the notifications.
   177  	ConnectionNotificationArn pulumi.StringPtrInput
   178  	// The type of notification.
   179  	NotificationType pulumi.StringPtrInput
   180  	// The state of the notification.
   181  	State pulumi.StringPtrInput
   182  	// The ID of the VPC Endpoint to receive notifications for.
   183  	VpcEndpointId pulumi.StringPtrInput
   184  	// The ID of the VPC Endpoint Service to receive notifications for.
   185  	VpcEndpointServiceId pulumi.StringPtrInput
   186  }
   187  
   188  func (VpcEndpointConnectionNotificationState) ElementType() reflect.Type {
   189  	return reflect.TypeOf((*vpcEndpointConnectionNotificationState)(nil)).Elem()
   190  }
   191  
   192  type vpcEndpointConnectionNotificationArgs struct {
   193  	// One or more endpoint [events](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVpcEndpointConnectionNotification.html#API_CreateVpcEndpointConnectionNotification_RequestParameters) for which to receive notifications.
   194  	//
   195  	// > **NOTE:** One of `vpcEndpointServiceId` or `vpcEndpointId` must be specified.
   196  	ConnectionEvents []string `pulumi:"connectionEvents"`
   197  	// The ARN of the SNS topic for the notifications.
   198  	ConnectionNotificationArn string `pulumi:"connectionNotificationArn"`
   199  	// The ID of the VPC Endpoint to receive notifications for.
   200  	VpcEndpointId *string `pulumi:"vpcEndpointId"`
   201  	// The ID of the VPC Endpoint Service to receive notifications for.
   202  	VpcEndpointServiceId *string `pulumi:"vpcEndpointServiceId"`
   203  }
   204  
   205  // The set of arguments for constructing a VpcEndpointConnectionNotification resource.
   206  type VpcEndpointConnectionNotificationArgs struct {
   207  	// One or more endpoint [events](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVpcEndpointConnectionNotification.html#API_CreateVpcEndpointConnectionNotification_RequestParameters) for which to receive notifications.
   208  	//
   209  	// > **NOTE:** One of `vpcEndpointServiceId` or `vpcEndpointId` must be specified.
   210  	ConnectionEvents pulumi.StringArrayInput
   211  	// The ARN of the SNS topic for the notifications.
   212  	ConnectionNotificationArn pulumi.StringInput
   213  	// The ID of the VPC Endpoint to receive notifications for.
   214  	VpcEndpointId pulumi.StringPtrInput
   215  	// The ID of the VPC Endpoint Service to receive notifications for.
   216  	VpcEndpointServiceId pulumi.StringPtrInput
   217  }
   218  
   219  func (VpcEndpointConnectionNotificationArgs) ElementType() reflect.Type {
   220  	return reflect.TypeOf((*vpcEndpointConnectionNotificationArgs)(nil)).Elem()
   221  }
   222  
   223  type VpcEndpointConnectionNotificationInput interface {
   224  	pulumi.Input
   225  
   226  	ToVpcEndpointConnectionNotificationOutput() VpcEndpointConnectionNotificationOutput
   227  	ToVpcEndpointConnectionNotificationOutputWithContext(ctx context.Context) VpcEndpointConnectionNotificationOutput
   228  }
   229  
   230  func (*VpcEndpointConnectionNotification) ElementType() reflect.Type {
   231  	return reflect.TypeOf((**VpcEndpointConnectionNotification)(nil)).Elem()
   232  }
   233  
   234  func (i *VpcEndpointConnectionNotification) ToVpcEndpointConnectionNotificationOutput() VpcEndpointConnectionNotificationOutput {
   235  	return i.ToVpcEndpointConnectionNotificationOutputWithContext(context.Background())
   236  }
   237  
   238  func (i *VpcEndpointConnectionNotification) ToVpcEndpointConnectionNotificationOutputWithContext(ctx context.Context) VpcEndpointConnectionNotificationOutput {
   239  	return pulumi.ToOutputWithContext(ctx, i).(VpcEndpointConnectionNotificationOutput)
   240  }
   241  
   242  // VpcEndpointConnectionNotificationArrayInput is an input type that accepts VpcEndpointConnectionNotificationArray and VpcEndpointConnectionNotificationArrayOutput values.
   243  // You can construct a concrete instance of `VpcEndpointConnectionNotificationArrayInput` via:
   244  //
   245  //	VpcEndpointConnectionNotificationArray{ VpcEndpointConnectionNotificationArgs{...} }
   246  type VpcEndpointConnectionNotificationArrayInput interface {
   247  	pulumi.Input
   248  
   249  	ToVpcEndpointConnectionNotificationArrayOutput() VpcEndpointConnectionNotificationArrayOutput
   250  	ToVpcEndpointConnectionNotificationArrayOutputWithContext(context.Context) VpcEndpointConnectionNotificationArrayOutput
   251  }
   252  
   253  type VpcEndpointConnectionNotificationArray []VpcEndpointConnectionNotificationInput
   254  
   255  func (VpcEndpointConnectionNotificationArray) ElementType() reflect.Type {
   256  	return reflect.TypeOf((*[]*VpcEndpointConnectionNotification)(nil)).Elem()
   257  }
   258  
   259  func (i VpcEndpointConnectionNotificationArray) ToVpcEndpointConnectionNotificationArrayOutput() VpcEndpointConnectionNotificationArrayOutput {
   260  	return i.ToVpcEndpointConnectionNotificationArrayOutputWithContext(context.Background())
   261  }
   262  
   263  func (i VpcEndpointConnectionNotificationArray) ToVpcEndpointConnectionNotificationArrayOutputWithContext(ctx context.Context) VpcEndpointConnectionNotificationArrayOutput {
   264  	return pulumi.ToOutputWithContext(ctx, i).(VpcEndpointConnectionNotificationArrayOutput)
   265  }
   266  
   267  // VpcEndpointConnectionNotificationMapInput is an input type that accepts VpcEndpointConnectionNotificationMap and VpcEndpointConnectionNotificationMapOutput values.
   268  // You can construct a concrete instance of `VpcEndpointConnectionNotificationMapInput` via:
   269  //
   270  //	VpcEndpointConnectionNotificationMap{ "key": VpcEndpointConnectionNotificationArgs{...} }
   271  type VpcEndpointConnectionNotificationMapInput interface {
   272  	pulumi.Input
   273  
   274  	ToVpcEndpointConnectionNotificationMapOutput() VpcEndpointConnectionNotificationMapOutput
   275  	ToVpcEndpointConnectionNotificationMapOutputWithContext(context.Context) VpcEndpointConnectionNotificationMapOutput
   276  }
   277  
   278  type VpcEndpointConnectionNotificationMap map[string]VpcEndpointConnectionNotificationInput
   279  
   280  func (VpcEndpointConnectionNotificationMap) ElementType() reflect.Type {
   281  	return reflect.TypeOf((*map[string]*VpcEndpointConnectionNotification)(nil)).Elem()
   282  }
   283  
   284  func (i VpcEndpointConnectionNotificationMap) ToVpcEndpointConnectionNotificationMapOutput() VpcEndpointConnectionNotificationMapOutput {
   285  	return i.ToVpcEndpointConnectionNotificationMapOutputWithContext(context.Background())
   286  }
   287  
   288  func (i VpcEndpointConnectionNotificationMap) ToVpcEndpointConnectionNotificationMapOutputWithContext(ctx context.Context) VpcEndpointConnectionNotificationMapOutput {
   289  	return pulumi.ToOutputWithContext(ctx, i).(VpcEndpointConnectionNotificationMapOutput)
   290  }
   291  
   292  type VpcEndpointConnectionNotificationOutput struct{ *pulumi.OutputState }
   293  
   294  func (VpcEndpointConnectionNotificationOutput) ElementType() reflect.Type {
   295  	return reflect.TypeOf((**VpcEndpointConnectionNotification)(nil)).Elem()
   296  }
   297  
   298  func (o VpcEndpointConnectionNotificationOutput) ToVpcEndpointConnectionNotificationOutput() VpcEndpointConnectionNotificationOutput {
   299  	return o
   300  }
   301  
   302  func (o VpcEndpointConnectionNotificationOutput) ToVpcEndpointConnectionNotificationOutputWithContext(ctx context.Context) VpcEndpointConnectionNotificationOutput {
   303  	return o
   304  }
   305  
   306  // One or more endpoint [events](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVpcEndpointConnectionNotification.html#API_CreateVpcEndpointConnectionNotification_RequestParameters) for which to receive notifications.
   307  //
   308  // > **NOTE:** One of `vpcEndpointServiceId` or `vpcEndpointId` must be specified.
   309  func (o VpcEndpointConnectionNotificationOutput) ConnectionEvents() pulumi.StringArrayOutput {
   310  	return o.ApplyT(func(v *VpcEndpointConnectionNotification) pulumi.StringArrayOutput { return v.ConnectionEvents }).(pulumi.StringArrayOutput)
   311  }
   312  
   313  // The ARN of the SNS topic for the notifications.
   314  func (o VpcEndpointConnectionNotificationOutput) ConnectionNotificationArn() pulumi.StringOutput {
   315  	return o.ApplyT(func(v *VpcEndpointConnectionNotification) pulumi.StringOutput { return v.ConnectionNotificationArn }).(pulumi.StringOutput)
   316  }
   317  
   318  // The type of notification.
   319  func (o VpcEndpointConnectionNotificationOutput) NotificationType() pulumi.StringOutput {
   320  	return o.ApplyT(func(v *VpcEndpointConnectionNotification) pulumi.StringOutput { return v.NotificationType }).(pulumi.StringOutput)
   321  }
   322  
   323  // The state of the notification.
   324  func (o VpcEndpointConnectionNotificationOutput) State() pulumi.StringOutput {
   325  	return o.ApplyT(func(v *VpcEndpointConnectionNotification) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)
   326  }
   327  
   328  // The ID of the VPC Endpoint to receive notifications for.
   329  func (o VpcEndpointConnectionNotificationOutput) VpcEndpointId() pulumi.StringPtrOutput {
   330  	return o.ApplyT(func(v *VpcEndpointConnectionNotification) pulumi.StringPtrOutput { return v.VpcEndpointId }).(pulumi.StringPtrOutput)
   331  }
   332  
   333  // The ID of the VPC Endpoint Service to receive notifications for.
   334  func (o VpcEndpointConnectionNotificationOutput) VpcEndpointServiceId() pulumi.StringPtrOutput {
   335  	return o.ApplyT(func(v *VpcEndpointConnectionNotification) pulumi.StringPtrOutput { return v.VpcEndpointServiceId }).(pulumi.StringPtrOutput)
   336  }
   337  
   338  type VpcEndpointConnectionNotificationArrayOutput struct{ *pulumi.OutputState }
   339  
   340  func (VpcEndpointConnectionNotificationArrayOutput) ElementType() reflect.Type {
   341  	return reflect.TypeOf((*[]*VpcEndpointConnectionNotification)(nil)).Elem()
   342  }
   343  
   344  func (o VpcEndpointConnectionNotificationArrayOutput) ToVpcEndpointConnectionNotificationArrayOutput() VpcEndpointConnectionNotificationArrayOutput {
   345  	return o
   346  }
   347  
   348  func (o VpcEndpointConnectionNotificationArrayOutput) ToVpcEndpointConnectionNotificationArrayOutputWithContext(ctx context.Context) VpcEndpointConnectionNotificationArrayOutput {
   349  	return o
   350  }
   351  
   352  func (o VpcEndpointConnectionNotificationArrayOutput) Index(i pulumi.IntInput) VpcEndpointConnectionNotificationOutput {
   353  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VpcEndpointConnectionNotification {
   354  		return vs[0].([]*VpcEndpointConnectionNotification)[vs[1].(int)]
   355  	}).(VpcEndpointConnectionNotificationOutput)
   356  }
   357  
   358  type VpcEndpointConnectionNotificationMapOutput struct{ *pulumi.OutputState }
   359  
   360  func (VpcEndpointConnectionNotificationMapOutput) ElementType() reflect.Type {
   361  	return reflect.TypeOf((*map[string]*VpcEndpointConnectionNotification)(nil)).Elem()
   362  }
   363  
   364  func (o VpcEndpointConnectionNotificationMapOutput) ToVpcEndpointConnectionNotificationMapOutput() VpcEndpointConnectionNotificationMapOutput {
   365  	return o
   366  }
   367  
   368  func (o VpcEndpointConnectionNotificationMapOutput) ToVpcEndpointConnectionNotificationMapOutputWithContext(ctx context.Context) VpcEndpointConnectionNotificationMapOutput {
   369  	return o
   370  }
   371  
   372  func (o VpcEndpointConnectionNotificationMapOutput) MapIndex(k pulumi.StringInput) VpcEndpointConnectionNotificationOutput {
   373  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VpcEndpointConnectionNotification {
   374  		return vs[0].(map[string]*VpcEndpointConnectionNotification)[vs[1].(string)]
   375  	}).(VpcEndpointConnectionNotificationOutput)
   376  }
   377  
   378  func init() {
   379  	pulumi.RegisterInputType(reflect.TypeOf((*VpcEndpointConnectionNotificationInput)(nil)).Elem(), &VpcEndpointConnectionNotification{})
   380  	pulumi.RegisterInputType(reflect.TypeOf((*VpcEndpointConnectionNotificationArrayInput)(nil)).Elem(), VpcEndpointConnectionNotificationArray{})
   381  	pulumi.RegisterInputType(reflect.TypeOf((*VpcEndpointConnectionNotificationMapInput)(nil)).Elem(), VpcEndpointConnectionNotificationMap{})
   382  	pulumi.RegisterOutputType(VpcEndpointConnectionNotificationOutput{})
   383  	pulumi.RegisterOutputType(VpcEndpointConnectionNotificationArrayOutput{})
   384  	pulumi.RegisterOutputType(VpcEndpointConnectionNotificationMapOutput{})
   385  }