github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/opensearch/vpcEndpoint.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 opensearch
     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  // Manages an [AWS Opensearch VPC Endpoint](https://docs.aws.amazon.com/opensearch-service/latest/APIReference/API_CreateVpcEndpoint.html). Creates an Amazon OpenSearch Service-managed VPC endpoint.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/opensearch"
    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 := opensearch.NewVpcEndpoint(ctx, "foo", &opensearch.VpcEndpointArgs{
    35  //				DomainArn: pulumi.Any(domain1.Arn),
    36  //				VpcOptions: &opensearch.VpcEndpointVpcOptionsArgs{
    37  //					SecurityGroupIds: pulumi.StringArray{
    38  //						test.Id,
    39  //						test2.Id,
    40  //					},
    41  //					SubnetIds: pulumi.StringArray{
    42  //						testAwsSubnet.Id,
    43  //						test2AwsSubnet.Id,
    44  //					},
    45  //				},
    46  //			})
    47  //			if err != nil {
    48  //				return err
    49  //			}
    50  //			return nil
    51  //		})
    52  //	}
    53  //
    54  // ```
    55  // <!--End PulumiCodeChooser -->
    56  //
    57  // ## Import
    58  //
    59  // Using `pulumi import`, import OpenSearch VPC endpoint connections using the `id`. For example:
    60  //
    61  // ```sh
    62  // $ pulumi import aws:opensearch/vpcEndpoint:VpcEndpoint example endpoint-id
    63  // ```
    64  type VpcEndpoint struct {
    65  	pulumi.CustomResourceState
    66  
    67  	// Specifies the Amazon Resource Name (ARN) of the domain to create the endpoint for
    68  	DomainArn pulumi.StringOutput `pulumi:"domainArn"`
    69  	// The connection endpoint ID for connecting to the domain.
    70  	Endpoint pulumi.StringOutput `pulumi:"endpoint"`
    71  	// Options to specify the subnets and security groups for the endpoint.
    72  	VpcOptions VpcEndpointVpcOptionsOutput `pulumi:"vpcOptions"`
    73  }
    74  
    75  // NewVpcEndpoint registers a new resource with the given unique name, arguments, and options.
    76  func NewVpcEndpoint(ctx *pulumi.Context,
    77  	name string, args *VpcEndpointArgs, opts ...pulumi.ResourceOption) (*VpcEndpoint, error) {
    78  	if args == nil {
    79  		return nil, errors.New("missing one or more required arguments")
    80  	}
    81  
    82  	if args.DomainArn == nil {
    83  		return nil, errors.New("invalid value for required argument 'DomainArn'")
    84  	}
    85  	if args.VpcOptions == nil {
    86  		return nil, errors.New("invalid value for required argument 'VpcOptions'")
    87  	}
    88  	opts = internal.PkgResourceDefaultOpts(opts)
    89  	var resource VpcEndpoint
    90  	err := ctx.RegisterResource("aws:opensearch/vpcEndpoint:VpcEndpoint", name, args, &resource, opts...)
    91  	if err != nil {
    92  		return nil, err
    93  	}
    94  	return &resource, nil
    95  }
    96  
    97  // GetVpcEndpoint gets an existing VpcEndpoint resource's state with the given name, ID, and optional
    98  // state properties that are used to uniquely qualify the lookup (nil if not required).
    99  func GetVpcEndpoint(ctx *pulumi.Context,
   100  	name string, id pulumi.IDInput, state *VpcEndpointState, opts ...pulumi.ResourceOption) (*VpcEndpoint, error) {
   101  	var resource VpcEndpoint
   102  	err := ctx.ReadResource("aws:opensearch/vpcEndpoint:VpcEndpoint", name, id, state, &resource, opts...)
   103  	if err != nil {
   104  		return nil, err
   105  	}
   106  	return &resource, nil
   107  }
   108  
   109  // Input properties used for looking up and filtering VpcEndpoint resources.
   110  type vpcEndpointState struct {
   111  	// Specifies the Amazon Resource Name (ARN) of the domain to create the endpoint for
   112  	DomainArn *string `pulumi:"domainArn"`
   113  	// The connection endpoint ID for connecting to the domain.
   114  	Endpoint *string `pulumi:"endpoint"`
   115  	// Options to specify the subnets and security groups for the endpoint.
   116  	VpcOptions *VpcEndpointVpcOptions `pulumi:"vpcOptions"`
   117  }
   118  
   119  type VpcEndpointState struct {
   120  	// Specifies the Amazon Resource Name (ARN) of the domain to create the endpoint for
   121  	DomainArn pulumi.StringPtrInput
   122  	// The connection endpoint ID for connecting to the domain.
   123  	Endpoint pulumi.StringPtrInput
   124  	// Options to specify the subnets and security groups for the endpoint.
   125  	VpcOptions VpcEndpointVpcOptionsPtrInput
   126  }
   127  
   128  func (VpcEndpointState) ElementType() reflect.Type {
   129  	return reflect.TypeOf((*vpcEndpointState)(nil)).Elem()
   130  }
   131  
   132  type vpcEndpointArgs struct {
   133  	// Specifies the Amazon Resource Name (ARN) of the domain to create the endpoint for
   134  	DomainArn string `pulumi:"domainArn"`
   135  	// Options to specify the subnets and security groups for the endpoint.
   136  	VpcOptions VpcEndpointVpcOptions `pulumi:"vpcOptions"`
   137  }
   138  
   139  // The set of arguments for constructing a VpcEndpoint resource.
   140  type VpcEndpointArgs struct {
   141  	// Specifies the Amazon Resource Name (ARN) of the domain to create the endpoint for
   142  	DomainArn pulumi.StringInput
   143  	// Options to specify the subnets and security groups for the endpoint.
   144  	VpcOptions VpcEndpointVpcOptionsInput
   145  }
   146  
   147  func (VpcEndpointArgs) ElementType() reflect.Type {
   148  	return reflect.TypeOf((*vpcEndpointArgs)(nil)).Elem()
   149  }
   150  
   151  type VpcEndpointInput interface {
   152  	pulumi.Input
   153  
   154  	ToVpcEndpointOutput() VpcEndpointOutput
   155  	ToVpcEndpointOutputWithContext(ctx context.Context) VpcEndpointOutput
   156  }
   157  
   158  func (*VpcEndpoint) ElementType() reflect.Type {
   159  	return reflect.TypeOf((**VpcEndpoint)(nil)).Elem()
   160  }
   161  
   162  func (i *VpcEndpoint) ToVpcEndpointOutput() VpcEndpointOutput {
   163  	return i.ToVpcEndpointOutputWithContext(context.Background())
   164  }
   165  
   166  func (i *VpcEndpoint) ToVpcEndpointOutputWithContext(ctx context.Context) VpcEndpointOutput {
   167  	return pulumi.ToOutputWithContext(ctx, i).(VpcEndpointOutput)
   168  }
   169  
   170  // VpcEndpointArrayInput is an input type that accepts VpcEndpointArray and VpcEndpointArrayOutput values.
   171  // You can construct a concrete instance of `VpcEndpointArrayInput` via:
   172  //
   173  //	VpcEndpointArray{ VpcEndpointArgs{...} }
   174  type VpcEndpointArrayInput interface {
   175  	pulumi.Input
   176  
   177  	ToVpcEndpointArrayOutput() VpcEndpointArrayOutput
   178  	ToVpcEndpointArrayOutputWithContext(context.Context) VpcEndpointArrayOutput
   179  }
   180  
   181  type VpcEndpointArray []VpcEndpointInput
   182  
   183  func (VpcEndpointArray) ElementType() reflect.Type {
   184  	return reflect.TypeOf((*[]*VpcEndpoint)(nil)).Elem()
   185  }
   186  
   187  func (i VpcEndpointArray) ToVpcEndpointArrayOutput() VpcEndpointArrayOutput {
   188  	return i.ToVpcEndpointArrayOutputWithContext(context.Background())
   189  }
   190  
   191  func (i VpcEndpointArray) ToVpcEndpointArrayOutputWithContext(ctx context.Context) VpcEndpointArrayOutput {
   192  	return pulumi.ToOutputWithContext(ctx, i).(VpcEndpointArrayOutput)
   193  }
   194  
   195  // VpcEndpointMapInput is an input type that accepts VpcEndpointMap and VpcEndpointMapOutput values.
   196  // You can construct a concrete instance of `VpcEndpointMapInput` via:
   197  //
   198  //	VpcEndpointMap{ "key": VpcEndpointArgs{...} }
   199  type VpcEndpointMapInput interface {
   200  	pulumi.Input
   201  
   202  	ToVpcEndpointMapOutput() VpcEndpointMapOutput
   203  	ToVpcEndpointMapOutputWithContext(context.Context) VpcEndpointMapOutput
   204  }
   205  
   206  type VpcEndpointMap map[string]VpcEndpointInput
   207  
   208  func (VpcEndpointMap) ElementType() reflect.Type {
   209  	return reflect.TypeOf((*map[string]*VpcEndpoint)(nil)).Elem()
   210  }
   211  
   212  func (i VpcEndpointMap) ToVpcEndpointMapOutput() VpcEndpointMapOutput {
   213  	return i.ToVpcEndpointMapOutputWithContext(context.Background())
   214  }
   215  
   216  func (i VpcEndpointMap) ToVpcEndpointMapOutputWithContext(ctx context.Context) VpcEndpointMapOutput {
   217  	return pulumi.ToOutputWithContext(ctx, i).(VpcEndpointMapOutput)
   218  }
   219  
   220  type VpcEndpointOutput struct{ *pulumi.OutputState }
   221  
   222  func (VpcEndpointOutput) ElementType() reflect.Type {
   223  	return reflect.TypeOf((**VpcEndpoint)(nil)).Elem()
   224  }
   225  
   226  func (o VpcEndpointOutput) ToVpcEndpointOutput() VpcEndpointOutput {
   227  	return o
   228  }
   229  
   230  func (o VpcEndpointOutput) ToVpcEndpointOutputWithContext(ctx context.Context) VpcEndpointOutput {
   231  	return o
   232  }
   233  
   234  // Specifies the Amazon Resource Name (ARN) of the domain to create the endpoint for
   235  func (o VpcEndpointOutput) DomainArn() pulumi.StringOutput {
   236  	return o.ApplyT(func(v *VpcEndpoint) pulumi.StringOutput { return v.DomainArn }).(pulumi.StringOutput)
   237  }
   238  
   239  // The connection endpoint ID for connecting to the domain.
   240  func (o VpcEndpointOutput) Endpoint() pulumi.StringOutput {
   241  	return o.ApplyT(func(v *VpcEndpoint) pulumi.StringOutput { return v.Endpoint }).(pulumi.StringOutput)
   242  }
   243  
   244  // Options to specify the subnets and security groups for the endpoint.
   245  func (o VpcEndpointOutput) VpcOptions() VpcEndpointVpcOptionsOutput {
   246  	return o.ApplyT(func(v *VpcEndpoint) VpcEndpointVpcOptionsOutput { return v.VpcOptions }).(VpcEndpointVpcOptionsOutput)
   247  }
   248  
   249  type VpcEndpointArrayOutput struct{ *pulumi.OutputState }
   250  
   251  func (VpcEndpointArrayOutput) ElementType() reflect.Type {
   252  	return reflect.TypeOf((*[]*VpcEndpoint)(nil)).Elem()
   253  }
   254  
   255  func (o VpcEndpointArrayOutput) ToVpcEndpointArrayOutput() VpcEndpointArrayOutput {
   256  	return o
   257  }
   258  
   259  func (o VpcEndpointArrayOutput) ToVpcEndpointArrayOutputWithContext(ctx context.Context) VpcEndpointArrayOutput {
   260  	return o
   261  }
   262  
   263  func (o VpcEndpointArrayOutput) Index(i pulumi.IntInput) VpcEndpointOutput {
   264  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VpcEndpoint {
   265  		return vs[0].([]*VpcEndpoint)[vs[1].(int)]
   266  	}).(VpcEndpointOutput)
   267  }
   268  
   269  type VpcEndpointMapOutput struct{ *pulumi.OutputState }
   270  
   271  func (VpcEndpointMapOutput) ElementType() reflect.Type {
   272  	return reflect.TypeOf((*map[string]*VpcEndpoint)(nil)).Elem()
   273  }
   274  
   275  func (o VpcEndpointMapOutput) ToVpcEndpointMapOutput() VpcEndpointMapOutput {
   276  	return o
   277  }
   278  
   279  func (o VpcEndpointMapOutput) ToVpcEndpointMapOutputWithContext(ctx context.Context) VpcEndpointMapOutput {
   280  	return o
   281  }
   282  
   283  func (o VpcEndpointMapOutput) MapIndex(k pulumi.StringInput) VpcEndpointOutput {
   284  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VpcEndpoint {
   285  		return vs[0].(map[string]*VpcEndpoint)[vs[1].(string)]
   286  	}).(VpcEndpointOutput)
   287  }
   288  
   289  func init() {
   290  	pulumi.RegisterInputType(reflect.TypeOf((*VpcEndpointInput)(nil)).Elem(), &VpcEndpoint{})
   291  	pulumi.RegisterInputType(reflect.TypeOf((*VpcEndpointArrayInput)(nil)).Elem(), VpcEndpointArray{})
   292  	pulumi.RegisterInputType(reflect.TypeOf((*VpcEndpointMapInput)(nil)).Elem(), VpcEndpointMap{})
   293  	pulumi.RegisterOutputType(VpcEndpointOutput{})
   294  	pulumi.RegisterOutputType(VpcEndpointArrayOutput{})
   295  	pulumi.RegisterOutputType(VpcEndpointMapOutput{})
   296  }