github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/msk/vpcConnection.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 msk
     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  // Resource for managing an AWS Managed Streaming for Kafka VPC Connection.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/msk"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  // func main() {
    30  // pulumi.Run(func(ctx *pulumi.Context) error {
    31  // var splat0 []interface{}
    32  // for _, val0 := range testAwsSubnet {
    33  // splat0 = append(splat0, val0.Id)
    34  // }
    35  // _, err := msk.NewVpcConnection(ctx, "test", &msk.VpcConnectionArgs{
    36  // Authentication: pulumi.String("SASL_IAM"),
    37  // TargetClusterArn: pulumi.String("aws_msk_cluster.arn"),
    38  // VpcId: pulumi.Any(testAwsVpc.Id),
    39  // ClientSubnets: toPulumiArray(splat0),
    40  // SecurityGroups: pulumi.StringArray{
    41  // testAwsSecurityGroup.Id,
    42  // },
    43  // })
    44  // if err != nil {
    45  // return err
    46  // }
    47  // return nil
    48  // })
    49  // }
    50  // func toPulumiArray(arr []) pulumi.Array {
    51  // var pulumiArr pulumi.Array
    52  // for _, v := range arr {
    53  // pulumiArr = append(pulumiArr, pulumi.(v))
    54  // }
    55  // return pulumiArr
    56  // }
    57  // ```
    58  // <!--End PulumiCodeChooser -->
    59  //
    60  // ## Import
    61  //
    62  // Using `pulumi import`, import MSK configurations using the configuration ARN. For example:
    63  //
    64  // ```sh
    65  // $ pulumi import aws:msk/vpcConnection:VpcConnection example arn:aws:kafka:eu-west-2:123456789012:vpc-connection/123456789012/example/38173259-79cd-4ee8-87f3-682ea6023f48-2
    66  // ```
    67  type VpcConnection struct {
    68  	pulumi.CustomResourceState
    69  
    70  	// Amazon Resource Name (ARN) of the VPC connection.
    71  	Arn pulumi.StringOutput `pulumi:"arn"`
    72  	// The authentication type for the client VPC connection. Specify one of these auth type strings: SASL_IAM, SASL_SCRAM, or TLS.
    73  	Authentication pulumi.StringOutput `pulumi:"authentication"`
    74  	// The list of subnets in the client VPC to connect to.
    75  	ClientSubnets pulumi.StringArrayOutput `pulumi:"clientSubnets"`
    76  	// The security groups to attach to the ENIs for the broker nodes.
    77  	SecurityGroups pulumi.StringArrayOutput `pulumi:"securityGroups"`
    78  	// 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.
    79  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    80  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    81  	//
    82  	// Deprecated: Please use `tags` instead.
    83  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    84  	// The Amazon Resource Name (ARN) of the cluster.
    85  	TargetClusterArn pulumi.StringOutput `pulumi:"targetClusterArn"`
    86  	// The VPC ID of the remote client.
    87  	VpcId pulumi.StringOutput `pulumi:"vpcId"`
    88  }
    89  
    90  // NewVpcConnection registers a new resource with the given unique name, arguments, and options.
    91  func NewVpcConnection(ctx *pulumi.Context,
    92  	name string, args *VpcConnectionArgs, opts ...pulumi.ResourceOption) (*VpcConnection, error) {
    93  	if args == nil {
    94  		return nil, errors.New("missing one or more required arguments")
    95  	}
    96  
    97  	if args.Authentication == nil {
    98  		return nil, errors.New("invalid value for required argument 'Authentication'")
    99  	}
   100  	if args.ClientSubnets == nil {
   101  		return nil, errors.New("invalid value for required argument 'ClientSubnets'")
   102  	}
   103  	if args.SecurityGroups == nil {
   104  		return nil, errors.New("invalid value for required argument 'SecurityGroups'")
   105  	}
   106  	if args.TargetClusterArn == nil {
   107  		return nil, errors.New("invalid value for required argument 'TargetClusterArn'")
   108  	}
   109  	if args.VpcId == nil {
   110  		return nil, errors.New("invalid value for required argument 'VpcId'")
   111  	}
   112  	opts = internal.PkgResourceDefaultOpts(opts)
   113  	var resource VpcConnection
   114  	err := ctx.RegisterResource("aws:msk/vpcConnection:VpcConnection", name, args, &resource, opts...)
   115  	if err != nil {
   116  		return nil, err
   117  	}
   118  	return &resource, nil
   119  }
   120  
   121  // GetVpcConnection gets an existing VpcConnection resource's state with the given name, ID, and optional
   122  // state properties that are used to uniquely qualify the lookup (nil if not required).
   123  func GetVpcConnection(ctx *pulumi.Context,
   124  	name string, id pulumi.IDInput, state *VpcConnectionState, opts ...pulumi.ResourceOption) (*VpcConnection, error) {
   125  	var resource VpcConnection
   126  	err := ctx.ReadResource("aws:msk/vpcConnection:VpcConnection", name, id, state, &resource, opts...)
   127  	if err != nil {
   128  		return nil, err
   129  	}
   130  	return &resource, nil
   131  }
   132  
   133  // Input properties used for looking up and filtering VpcConnection resources.
   134  type vpcConnectionState struct {
   135  	// Amazon Resource Name (ARN) of the VPC connection.
   136  	Arn *string `pulumi:"arn"`
   137  	// The authentication type for the client VPC connection. Specify one of these auth type strings: SASL_IAM, SASL_SCRAM, or TLS.
   138  	Authentication *string `pulumi:"authentication"`
   139  	// The list of subnets in the client VPC to connect to.
   140  	ClientSubnets []string `pulumi:"clientSubnets"`
   141  	// The security groups to attach to the ENIs for the broker nodes.
   142  	SecurityGroups []string `pulumi:"securityGroups"`
   143  	// 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.
   144  	Tags map[string]string `pulumi:"tags"`
   145  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   146  	//
   147  	// Deprecated: Please use `tags` instead.
   148  	TagsAll map[string]string `pulumi:"tagsAll"`
   149  	// The Amazon Resource Name (ARN) of the cluster.
   150  	TargetClusterArn *string `pulumi:"targetClusterArn"`
   151  	// The VPC ID of the remote client.
   152  	VpcId *string `pulumi:"vpcId"`
   153  }
   154  
   155  type VpcConnectionState struct {
   156  	// Amazon Resource Name (ARN) of the VPC connection.
   157  	Arn pulumi.StringPtrInput
   158  	// The authentication type for the client VPC connection. Specify one of these auth type strings: SASL_IAM, SASL_SCRAM, or TLS.
   159  	Authentication pulumi.StringPtrInput
   160  	// The list of subnets in the client VPC to connect to.
   161  	ClientSubnets pulumi.StringArrayInput
   162  	// The security groups to attach to the ENIs for the broker nodes.
   163  	SecurityGroups pulumi.StringArrayInput
   164  	// 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.
   165  	Tags pulumi.StringMapInput
   166  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   167  	//
   168  	// Deprecated: Please use `tags` instead.
   169  	TagsAll pulumi.StringMapInput
   170  	// The Amazon Resource Name (ARN) of the cluster.
   171  	TargetClusterArn pulumi.StringPtrInput
   172  	// The VPC ID of the remote client.
   173  	VpcId pulumi.StringPtrInput
   174  }
   175  
   176  func (VpcConnectionState) ElementType() reflect.Type {
   177  	return reflect.TypeOf((*vpcConnectionState)(nil)).Elem()
   178  }
   179  
   180  type vpcConnectionArgs struct {
   181  	// The authentication type for the client VPC connection. Specify one of these auth type strings: SASL_IAM, SASL_SCRAM, or TLS.
   182  	Authentication string `pulumi:"authentication"`
   183  	// The list of subnets in the client VPC to connect to.
   184  	ClientSubnets []string `pulumi:"clientSubnets"`
   185  	// The security groups to attach to the ENIs for the broker nodes.
   186  	SecurityGroups []string `pulumi:"securityGroups"`
   187  	// 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.
   188  	Tags map[string]string `pulumi:"tags"`
   189  	// The Amazon Resource Name (ARN) of the cluster.
   190  	TargetClusterArn string `pulumi:"targetClusterArn"`
   191  	// The VPC ID of the remote client.
   192  	VpcId string `pulumi:"vpcId"`
   193  }
   194  
   195  // The set of arguments for constructing a VpcConnection resource.
   196  type VpcConnectionArgs struct {
   197  	// The authentication type for the client VPC connection. Specify one of these auth type strings: SASL_IAM, SASL_SCRAM, or TLS.
   198  	Authentication pulumi.StringInput
   199  	// The list of subnets in the client VPC to connect to.
   200  	ClientSubnets pulumi.StringArrayInput
   201  	// The security groups to attach to the ENIs for the broker nodes.
   202  	SecurityGroups pulumi.StringArrayInput
   203  	// 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.
   204  	Tags pulumi.StringMapInput
   205  	// The Amazon Resource Name (ARN) of the cluster.
   206  	TargetClusterArn pulumi.StringInput
   207  	// The VPC ID of the remote client.
   208  	VpcId pulumi.StringInput
   209  }
   210  
   211  func (VpcConnectionArgs) ElementType() reflect.Type {
   212  	return reflect.TypeOf((*vpcConnectionArgs)(nil)).Elem()
   213  }
   214  
   215  type VpcConnectionInput interface {
   216  	pulumi.Input
   217  
   218  	ToVpcConnectionOutput() VpcConnectionOutput
   219  	ToVpcConnectionOutputWithContext(ctx context.Context) VpcConnectionOutput
   220  }
   221  
   222  func (*VpcConnection) ElementType() reflect.Type {
   223  	return reflect.TypeOf((**VpcConnection)(nil)).Elem()
   224  }
   225  
   226  func (i *VpcConnection) ToVpcConnectionOutput() VpcConnectionOutput {
   227  	return i.ToVpcConnectionOutputWithContext(context.Background())
   228  }
   229  
   230  func (i *VpcConnection) ToVpcConnectionOutputWithContext(ctx context.Context) VpcConnectionOutput {
   231  	return pulumi.ToOutputWithContext(ctx, i).(VpcConnectionOutput)
   232  }
   233  
   234  // VpcConnectionArrayInput is an input type that accepts VpcConnectionArray and VpcConnectionArrayOutput values.
   235  // You can construct a concrete instance of `VpcConnectionArrayInput` via:
   236  //
   237  //	VpcConnectionArray{ VpcConnectionArgs{...} }
   238  type VpcConnectionArrayInput interface {
   239  	pulumi.Input
   240  
   241  	ToVpcConnectionArrayOutput() VpcConnectionArrayOutput
   242  	ToVpcConnectionArrayOutputWithContext(context.Context) VpcConnectionArrayOutput
   243  }
   244  
   245  type VpcConnectionArray []VpcConnectionInput
   246  
   247  func (VpcConnectionArray) ElementType() reflect.Type {
   248  	return reflect.TypeOf((*[]*VpcConnection)(nil)).Elem()
   249  }
   250  
   251  func (i VpcConnectionArray) ToVpcConnectionArrayOutput() VpcConnectionArrayOutput {
   252  	return i.ToVpcConnectionArrayOutputWithContext(context.Background())
   253  }
   254  
   255  func (i VpcConnectionArray) ToVpcConnectionArrayOutputWithContext(ctx context.Context) VpcConnectionArrayOutput {
   256  	return pulumi.ToOutputWithContext(ctx, i).(VpcConnectionArrayOutput)
   257  }
   258  
   259  // VpcConnectionMapInput is an input type that accepts VpcConnectionMap and VpcConnectionMapOutput values.
   260  // You can construct a concrete instance of `VpcConnectionMapInput` via:
   261  //
   262  //	VpcConnectionMap{ "key": VpcConnectionArgs{...} }
   263  type VpcConnectionMapInput interface {
   264  	pulumi.Input
   265  
   266  	ToVpcConnectionMapOutput() VpcConnectionMapOutput
   267  	ToVpcConnectionMapOutputWithContext(context.Context) VpcConnectionMapOutput
   268  }
   269  
   270  type VpcConnectionMap map[string]VpcConnectionInput
   271  
   272  func (VpcConnectionMap) ElementType() reflect.Type {
   273  	return reflect.TypeOf((*map[string]*VpcConnection)(nil)).Elem()
   274  }
   275  
   276  func (i VpcConnectionMap) ToVpcConnectionMapOutput() VpcConnectionMapOutput {
   277  	return i.ToVpcConnectionMapOutputWithContext(context.Background())
   278  }
   279  
   280  func (i VpcConnectionMap) ToVpcConnectionMapOutputWithContext(ctx context.Context) VpcConnectionMapOutput {
   281  	return pulumi.ToOutputWithContext(ctx, i).(VpcConnectionMapOutput)
   282  }
   283  
   284  type VpcConnectionOutput struct{ *pulumi.OutputState }
   285  
   286  func (VpcConnectionOutput) ElementType() reflect.Type {
   287  	return reflect.TypeOf((**VpcConnection)(nil)).Elem()
   288  }
   289  
   290  func (o VpcConnectionOutput) ToVpcConnectionOutput() VpcConnectionOutput {
   291  	return o
   292  }
   293  
   294  func (o VpcConnectionOutput) ToVpcConnectionOutputWithContext(ctx context.Context) VpcConnectionOutput {
   295  	return o
   296  }
   297  
   298  // Amazon Resource Name (ARN) of the VPC connection.
   299  func (o VpcConnectionOutput) Arn() pulumi.StringOutput {
   300  	return o.ApplyT(func(v *VpcConnection) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   301  }
   302  
   303  // The authentication type for the client VPC connection. Specify one of these auth type strings: SASL_IAM, SASL_SCRAM, or TLS.
   304  func (o VpcConnectionOutput) Authentication() pulumi.StringOutput {
   305  	return o.ApplyT(func(v *VpcConnection) pulumi.StringOutput { return v.Authentication }).(pulumi.StringOutput)
   306  }
   307  
   308  // The list of subnets in the client VPC to connect to.
   309  func (o VpcConnectionOutput) ClientSubnets() pulumi.StringArrayOutput {
   310  	return o.ApplyT(func(v *VpcConnection) pulumi.StringArrayOutput { return v.ClientSubnets }).(pulumi.StringArrayOutput)
   311  }
   312  
   313  // The security groups to attach to the ENIs for the broker nodes.
   314  func (o VpcConnectionOutput) SecurityGroups() pulumi.StringArrayOutput {
   315  	return o.ApplyT(func(v *VpcConnection) pulumi.StringArrayOutput { return v.SecurityGroups }).(pulumi.StringArrayOutput)
   316  }
   317  
   318  // 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.
   319  func (o VpcConnectionOutput) Tags() pulumi.StringMapOutput {
   320  	return o.ApplyT(func(v *VpcConnection) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   321  }
   322  
   323  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   324  //
   325  // Deprecated: Please use `tags` instead.
   326  func (o VpcConnectionOutput) TagsAll() pulumi.StringMapOutput {
   327  	return o.ApplyT(func(v *VpcConnection) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   328  }
   329  
   330  // The Amazon Resource Name (ARN) of the cluster.
   331  func (o VpcConnectionOutput) TargetClusterArn() pulumi.StringOutput {
   332  	return o.ApplyT(func(v *VpcConnection) pulumi.StringOutput { return v.TargetClusterArn }).(pulumi.StringOutput)
   333  }
   334  
   335  // The VPC ID of the remote client.
   336  func (o VpcConnectionOutput) VpcId() pulumi.StringOutput {
   337  	return o.ApplyT(func(v *VpcConnection) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput)
   338  }
   339  
   340  type VpcConnectionArrayOutput struct{ *pulumi.OutputState }
   341  
   342  func (VpcConnectionArrayOutput) ElementType() reflect.Type {
   343  	return reflect.TypeOf((*[]*VpcConnection)(nil)).Elem()
   344  }
   345  
   346  func (o VpcConnectionArrayOutput) ToVpcConnectionArrayOutput() VpcConnectionArrayOutput {
   347  	return o
   348  }
   349  
   350  func (o VpcConnectionArrayOutput) ToVpcConnectionArrayOutputWithContext(ctx context.Context) VpcConnectionArrayOutput {
   351  	return o
   352  }
   353  
   354  func (o VpcConnectionArrayOutput) Index(i pulumi.IntInput) VpcConnectionOutput {
   355  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VpcConnection {
   356  		return vs[0].([]*VpcConnection)[vs[1].(int)]
   357  	}).(VpcConnectionOutput)
   358  }
   359  
   360  type VpcConnectionMapOutput struct{ *pulumi.OutputState }
   361  
   362  func (VpcConnectionMapOutput) ElementType() reflect.Type {
   363  	return reflect.TypeOf((*map[string]*VpcConnection)(nil)).Elem()
   364  }
   365  
   366  func (o VpcConnectionMapOutput) ToVpcConnectionMapOutput() VpcConnectionMapOutput {
   367  	return o
   368  }
   369  
   370  func (o VpcConnectionMapOutput) ToVpcConnectionMapOutputWithContext(ctx context.Context) VpcConnectionMapOutput {
   371  	return o
   372  }
   373  
   374  func (o VpcConnectionMapOutput) MapIndex(k pulumi.StringInput) VpcConnectionOutput {
   375  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VpcConnection {
   376  		return vs[0].(map[string]*VpcConnection)[vs[1].(string)]
   377  	}).(VpcConnectionOutput)
   378  }
   379  
   380  func init() {
   381  	pulumi.RegisterInputType(reflect.TypeOf((*VpcConnectionInput)(nil)).Elem(), &VpcConnection{})
   382  	pulumi.RegisterInputType(reflect.TypeOf((*VpcConnectionArrayInput)(nil)).Elem(), VpcConnectionArray{})
   383  	pulumi.RegisterInputType(reflect.TypeOf((*VpcConnectionMapInput)(nil)).Elem(), VpcConnectionMap{})
   384  	pulumi.RegisterOutputType(VpcConnectionOutput{})
   385  	pulumi.RegisterOutputType(VpcConnectionArrayOutput{})
   386  	pulumi.RegisterOutputType(VpcConnectionMapOutput{})
   387  }