github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/opensearch/outboundConnection.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 Outbound Connection.
    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"
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/opensearch"
    29  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    30  //
    31  // )
    32  //
    33  //	func main() {
    34  //		pulumi.Run(func(ctx *pulumi.Context) error {
    35  //			current, err := aws.GetCallerIdentity(ctx, nil, nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			currentGetRegion, err := aws.GetRegion(ctx, nil, nil)
    40  //			if err != nil {
    41  //				return err
    42  //			}
    43  //			_, err = opensearch.NewOutboundConnection(ctx, "foo", &opensearch.OutboundConnectionArgs{
    44  //				ConnectionAlias: pulumi.String("outbound_connection"),
    45  //				ConnectionMode:  pulumi.String("DIRECT"),
    46  //				LocalDomainInfo: &opensearch.OutboundConnectionLocalDomainInfoArgs{
    47  //					OwnerId:    pulumi.String(current.AccountId),
    48  //					Region:     pulumi.String(currentGetRegion.Name),
    49  //					DomainName: pulumi.Any(localDomain.DomainName),
    50  //				},
    51  //				RemoteDomainInfo: &opensearch.OutboundConnectionRemoteDomainInfoArgs{
    52  //					OwnerId:    pulumi.String(current.AccountId),
    53  //					Region:     pulumi.String(currentGetRegion.Name),
    54  //					DomainName: pulumi.Any(remoteDomain.DomainName),
    55  //				},
    56  //			})
    57  //			if err != nil {
    58  //				return err
    59  //			}
    60  //			return nil
    61  //		})
    62  //	}
    63  //
    64  // ```
    65  // <!--End PulumiCodeChooser -->
    66  //
    67  // ## Import
    68  //
    69  // Using `pulumi import`, import AWS Opensearch Outbound Connections using the Outbound Connection ID. For example:
    70  //
    71  // ```sh
    72  // $ pulumi import aws:opensearch/outboundConnection:OutboundConnection foo connection-id
    73  // ```
    74  type OutboundConnection struct {
    75  	pulumi.CustomResourceState
    76  
    77  	// Accepts the connection.
    78  	AcceptConnection pulumi.BoolPtrOutput `pulumi:"acceptConnection"`
    79  	// Specifies the connection alias that will be used by the customer for this connection.
    80  	ConnectionAlias pulumi.StringOutput `pulumi:"connectionAlias"`
    81  	// Specifies the connection mode. Accepted values are `DIRECT` or `VPC_ENDPOINT`.
    82  	ConnectionMode pulumi.StringPtrOutput `pulumi:"connectionMode"`
    83  	// Configuration block for the outbound connection.
    84  	ConnectionProperties OutboundConnectionConnectionPropertiesOutput `pulumi:"connectionProperties"`
    85  	// Status of the connection request.
    86  	ConnectionStatus pulumi.StringOutput `pulumi:"connectionStatus"`
    87  	// Configuration block for the local Opensearch domain.
    88  	LocalDomainInfo OutboundConnectionLocalDomainInfoOutput `pulumi:"localDomainInfo"`
    89  	// Configuration block for the remote Opensearch domain.
    90  	RemoteDomainInfo OutboundConnectionRemoteDomainInfoOutput `pulumi:"remoteDomainInfo"`
    91  }
    92  
    93  // NewOutboundConnection registers a new resource with the given unique name, arguments, and options.
    94  func NewOutboundConnection(ctx *pulumi.Context,
    95  	name string, args *OutboundConnectionArgs, opts ...pulumi.ResourceOption) (*OutboundConnection, error) {
    96  	if args == nil {
    97  		return nil, errors.New("missing one or more required arguments")
    98  	}
    99  
   100  	if args.ConnectionAlias == nil {
   101  		return nil, errors.New("invalid value for required argument 'ConnectionAlias'")
   102  	}
   103  	if args.LocalDomainInfo == nil {
   104  		return nil, errors.New("invalid value for required argument 'LocalDomainInfo'")
   105  	}
   106  	if args.RemoteDomainInfo == nil {
   107  		return nil, errors.New("invalid value for required argument 'RemoteDomainInfo'")
   108  	}
   109  	opts = internal.PkgResourceDefaultOpts(opts)
   110  	var resource OutboundConnection
   111  	err := ctx.RegisterResource("aws:opensearch/outboundConnection:OutboundConnection", name, args, &resource, opts...)
   112  	if err != nil {
   113  		return nil, err
   114  	}
   115  	return &resource, nil
   116  }
   117  
   118  // GetOutboundConnection gets an existing OutboundConnection resource's state with the given name, ID, and optional
   119  // state properties that are used to uniquely qualify the lookup (nil if not required).
   120  func GetOutboundConnection(ctx *pulumi.Context,
   121  	name string, id pulumi.IDInput, state *OutboundConnectionState, opts ...pulumi.ResourceOption) (*OutboundConnection, error) {
   122  	var resource OutboundConnection
   123  	err := ctx.ReadResource("aws:opensearch/outboundConnection:OutboundConnection", name, id, state, &resource, opts...)
   124  	if err != nil {
   125  		return nil, err
   126  	}
   127  	return &resource, nil
   128  }
   129  
   130  // Input properties used for looking up and filtering OutboundConnection resources.
   131  type outboundConnectionState struct {
   132  	// Accepts the connection.
   133  	AcceptConnection *bool `pulumi:"acceptConnection"`
   134  	// Specifies the connection alias that will be used by the customer for this connection.
   135  	ConnectionAlias *string `pulumi:"connectionAlias"`
   136  	// Specifies the connection mode. Accepted values are `DIRECT` or `VPC_ENDPOINT`.
   137  	ConnectionMode *string `pulumi:"connectionMode"`
   138  	// Configuration block for the outbound connection.
   139  	ConnectionProperties *OutboundConnectionConnectionProperties `pulumi:"connectionProperties"`
   140  	// Status of the connection request.
   141  	ConnectionStatus *string `pulumi:"connectionStatus"`
   142  	// Configuration block for the local Opensearch domain.
   143  	LocalDomainInfo *OutboundConnectionLocalDomainInfo `pulumi:"localDomainInfo"`
   144  	// Configuration block for the remote Opensearch domain.
   145  	RemoteDomainInfo *OutboundConnectionRemoteDomainInfo `pulumi:"remoteDomainInfo"`
   146  }
   147  
   148  type OutboundConnectionState struct {
   149  	// Accepts the connection.
   150  	AcceptConnection pulumi.BoolPtrInput
   151  	// Specifies the connection alias that will be used by the customer for this connection.
   152  	ConnectionAlias pulumi.StringPtrInput
   153  	// Specifies the connection mode. Accepted values are `DIRECT` or `VPC_ENDPOINT`.
   154  	ConnectionMode pulumi.StringPtrInput
   155  	// Configuration block for the outbound connection.
   156  	ConnectionProperties OutboundConnectionConnectionPropertiesPtrInput
   157  	// Status of the connection request.
   158  	ConnectionStatus pulumi.StringPtrInput
   159  	// Configuration block for the local Opensearch domain.
   160  	LocalDomainInfo OutboundConnectionLocalDomainInfoPtrInput
   161  	// Configuration block for the remote Opensearch domain.
   162  	RemoteDomainInfo OutboundConnectionRemoteDomainInfoPtrInput
   163  }
   164  
   165  func (OutboundConnectionState) ElementType() reflect.Type {
   166  	return reflect.TypeOf((*outboundConnectionState)(nil)).Elem()
   167  }
   168  
   169  type outboundConnectionArgs struct {
   170  	// Accepts the connection.
   171  	AcceptConnection *bool `pulumi:"acceptConnection"`
   172  	// Specifies the connection alias that will be used by the customer for this connection.
   173  	ConnectionAlias string `pulumi:"connectionAlias"`
   174  	// Specifies the connection mode. Accepted values are `DIRECT` or `VPC_ENDPOINT`.
   175  	ConnectionMode *string `pulumi:"connectionMode"`
   176  	// Configuration block for the outbound connection.
   177  	ConnectionProperties *OutboundConnectionConnectionProperties `pulumi:"connectionProperties"`
   178  	// Configuration block for the local Opensearch domain.
   179  	LocalDomainInfo OutboundConnectionLocalDomainInfo `pulumi:"localDomainInfo"`
   180  	// Configuration block for the remote Opensearch domain.
   181  	RemoteDomainInfo OutboundConnectionRemoteDomainInfo `pulumi:"remoteDomainInfo"`
   182  }
   183  
   184  // The set of arguments for constructing a OutboundConnection resource.
   185  type OutboundConnectionArgs struct {
   186  	// Accepts the connection.
   187  	AcceptConnection pulumi.BoolPtrInput
   188  	// Specifies the connection alias that will be used by the customer for this connection.
   189  	ConnectionAlias pulumi.StringInput
   190  	// Specifies the connection mode. Accepted values are `DIRECT` or `VPC_ENDPOINT`.
   191  	ConnectionMode pulumi.StringPtrInput
   192  	// Configuration block for the outbound connection.
   193  	ConnectionProperties OutboundConnectionConnectionPropertiesPtrInput
   194  	// Configuration block for the local Opensearch domain.
   195  	LocalDomainInfo OutboundConnectionLocalDomainInfoInput
   196  	// Configuration block for the remote Opensearch domain.
   197  	RemoteDomainInfo OutboundConnectionRemoteDomainInfoInput
   198  }
   199  
   200  func (OutboundConnectionArgs) ElementType() reflect.Type {
   201  	return reflect.TypeOf((*outboundConnectionArgs)(nil)).Elem()
   202  }
   203  
   204  type OutboundConnectionInput interface {
   205  	pulumi.Input
   206  
   207  	ToOutboundConnectionOutput() OutboundConnectionOutput
   208  	ToOutboundConnectionOutputWithContext(ctx context.Context) OutboundConnectionOutput
   209  }
   210  
   211  func (*OutboundConnection) ElementType() reflect.Type {
   212  	return reflect.TypeOf((**OutboundConnection)(nil)).Elem()
   213  }
   214  
   215  func (i *OutboundConnection) ToOutboundConnectionOutput() OutboundConnectionOutput {
   216  	return i.ToOutboundConnectionOutputWithContext(context.Background())
   217  }
   218  
   219  func (i *OutboundConnection) ToOutboundConnectionOutputWithContext(ctx context.Context) OutboundConnectionOutput {
   220  	return pulumi.ToOutputWithContext(ctx, i).(OutboundConnectionOutput)
   221  }
   222  
   223  // OutboundConnectionArrayInput is an input type that accepts OutboundConnectionArray and OutboundConnectionArrayOutput values.
   224  // You can construct a concrete instance of `OutboundConnectionArrayInput` via:
   225  //
   226  //	OutboundConnectionArray{ OutboundConnectionArgs{...} }
   227  type OutboundConnectionArrayInput interface {
   228  	pulumi.Input
   229  
   230  	ToOutboundConnectionArrayOutput() OutboundConnectionArrayOutput
   231  	ToOutboundConnectionArrayOutputWithContext(context.Context) OutboundConnectionArrayOutput
   232  }
   233  
   234  type OutboundConnectionArray []OutboundConnectionInput
   235  
   236  func (OutboundConnectionArray) ElementType() reflect.Type {
   237  	return reflect.TypeOf((*[]*OutboundConnection)(nil)).Elem()
   238  }
   239  
   240  func (i OutboundConnectionArray) ToOutboundConnectionArrayOutput() OutboundConnectionArrayOutput {
   241  	return i.ToOutboundConnectionArrayOutputWithContext(context.Background())
   242  }
   243  
   244  func (i OutboundConnectionArray) ToOutboundConnectionArrayOutputWithContext(ctx context.Context) OutboundConnectionArrayOutput {
   245  	return pulumi.ToOutputWithContext(ctx, i).(OutboundConnectionArrayOutput)
   246  }
   247  
   248  // OutboundConnectionMapInput is an input type that accepts OutboundConnectionMap and OutboundConnectionMapOutput values.
   249  // You can construct a concrete instance of `OutboundConnectionMapInput` via:
   250  //
   251  //	OutboundConnectionMap{ "key": OutboundConnectionArgs{...} }
   252  type OutboundConnectionMapInput interface {
   253  	pulumi.Input
   254  
   255  	ToOutboundConnectionMapOutput() OutboundConnectionMapOutput
   256  	ToOutboundConnectionMapOutputWithContext(context.Context) OutboundConnectionMapOutput
   257  }
   258  
   259  type OutboundConnectionMap map[string]OutboundConnectionInput
   260  
   261  func (OutboundConnectionMap) ElementType() reflect.Type {
   262  	return reflect.TypeOf((*map[string]*OutboundConnection)(nil)).Elem()
   263  }
   264  
   265  func (i OutboundConnectionMap) ToOutboundConnectionMapOutput() OutboundConnectionMapOutput {
   266  	return i.ToOutboundConnectionMapOutputWithContext(context.Background())
   267  }
   268  
   269  func (i OutboundConnectionMap) ToOutboundConnectionMapOutputWithContext(ctx context.Context) OutboundConnectionMapOutput {
   270  	return pulumi.ToOutputWithContext(ctx, i).(OutboundConnectionMapOutput)
   271  }
   272  
   273  type OutboundConnectionOutput struct{ *pulumi.OutputState }
   274  
   275  func (OutboundConnectionOutput) ElementType() reflect.Type {
   276  	return reflect.TypeOf((**OutboundConnection)(nil)).Elem()
   277  }
   278  
   279  func (o OutboundConnectionOutput) ToOutboundConnectionOutput() OutboundConnectionOutput {
   280  	return o
   281  }
   282  
   283  func (o OutboundConnectionOutput) ToOutboundConnectionOutputWithContext(ctx context.Context) OutboundConnectionOutput {
   284  	return o
   285  }
   286  
   287  // Accepts the connection.
   288  func (o OutboundConnectionOutput) AcceptConnection() pulumi.BoolPtrOutput {
   289  	return o.ApplyT(func(v *OutboundConnection) pulumi.BoolPtrOutput { return v.AcceptConnection }).(pulumi.BoolPtrOutput)
   290  }
   291  
   292  // Specifies the connection alias that will be used by the customer for this connection.
   293  func (o OutboundConnectionOutput) ConnectionAlias() pulumi.StringOutput {
   294  	return o.ApplyT(func(v *OutboundConnection) pulumi.StringOutput { return v.ConnectionAlias }).(pulumi.StringOutput)
   295  }
   296  
   297  // Specifies the connection mode. Accepted values are `DIRECT` or `VPC_ENDPOINT`.
   298  func (o OutboundConnectionOutput) ConnectionMode() pulumi.StringPtrOutput {
   299  	return o.ApplyT(func(v *OutboundConnection) pulumi.StringPtrOutput { return v.ConnectionMode }).(pulumi.StringPtrOutput)
   300  }
   301  
   302  // Configuration block for the outbound connection.
   303  func (o OutboundConnectionOutput) ConnectionProperties() OutboundConnectionConnectionPropertiesOutput {
   304  	return o.ApplyT(func(v *OutboundConnection) OutboundConnectionConnectionPropertiesOutput {
   305  		return v.ConnectionProperties
   306  	}).(OutboundConnectionConnectionPropertiesOutput)
   307  }
   308  
   309  // Status of the connection request.
   310  func (o OutboundConnectionOutput) ConnectionStatus() pulumi.StringOutput {
   311  	return o.ApplyT(func(v *OutboundConnection) pulumi.StringOutput { return v.ConnectionStatus }).(pulumi.StringOutput)
   312  }
   313  
   314  // Configuration block for the local Opensearch domain.
   315  func (o OutboundConnectionOutput) LocalDomainInfo() OutboundConnectionLocalDomainInfoOutput {
   316  	return o.ApplyT(func(v *OutboundConnection) OutboundConnectionLocalDomainInfoOutput { return v.LocalDomainInfo }).(OutboundConnectionLocalDomainInfoOutput)
   317  }
   318  
   319  // Configuration block for the remote Opensearch domain.
   320  func (o OutboundConnectionOutput) RemoteDomainInfo() OutboundConnectionRemoteDomainInfoOutput {
   321  	return o.ApplyT(func(v *OutboundConnection) OutboundConnectionRemoteDomainInfoOutput { return v.RemoteDomainInfo }).(OutboundConnectionRemoteDomainInfoOutput)
   322  }
   323  
   324  type OutboundConnectionArrayOutput struct{ *pulumi.OutputState }
   325  
   326  func (OutboundConnectionArrayOutput) ElementType() reflect.Type {
   327  	return reflect.TypeOf((*[]*OutboundConnection)(nil)).Elem()
   328  }
   329  
   330  func (o OutboundConnectionArrayOutput) ToOutboundConnectionArrayOutput() OutboundConnectionArrayOutput {
   331  	return o
   332  }
   333  
   334  func (o OutboundConnectionArrayOutput) ToOutboundConnectionArrayOutputWithContext(ctx context.Context) OutboundConnectionArrayOutput {
   335  	return o
   336  }
   337  
   338  func (o OutboundConnectionArrayOutput) Index(i pulumi.IntInput) OutboundConnectionOutput {
   339  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *OutboundConnection {
   340  		return vs[0].([]*OutboundConnection)[vs[1].(int)]
   341  	}).(OutboundConnectionOutput)
   342  }
   343  
   344  type OutboundConnectionMapOutput struct{ *pulumi.OutputState }
   345  
   346  func (OutboundConnectionMapOutput) ElementType() reflect.Type {
   347  	return reflect.TypeOf((*map[string]*OutboundConnection)(nil)).Elem()
   348  }
   349  
   350  func (o OutboundConnectionMapOutput) ToOutboundConnectionMapOutput() OutboundConnectionMapOutput {
   351  	return o
   352  }
   353  
   354  func (o OutboundConnectionMapOutput) ToOutboundConnectionMapOutputWithContext(ctx context.Context) OutboundConnectionMapOutput {
   355  	return o
   356  }
   357  
   358  func (o OutboundConnectionMapOutput) MapIndex(k pulumi.StringInput) OutboundConnectionOutput {
   359  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *OutboundConnection {
   360  		return vs[0].(map[string]*OutboundConnection)[vs[1].(string)]
   361  	}).(OutboundConnectionOutput)
   362  }
   363  
   364  func init() {
   365  	pulumi.RegisterInputType(reflect.TypeOf((*OutboundConnectionInput)(nil)).Elem(), &OutboundConnection{})
   366  	pulumi.RegisterInputType(reflect.TypeOf((*OutboundConnectionArrayInput)(nil)).Elem(), OutboundConnectionArray{})
   367  	pulumi.RegisterInputType(reflect.TypeOf((*OutboundConnectionMapInput)(nil)).Elem(), OutboundConnectionMap{})
   368  	pulumi.RegisterOutputType(OutboundConnectionOutput{})
   369  	pulumi.RegisterOutputType(OutboundConnectionArrayOutput{})
   370  	pulumi.RegisterOutputType(OutboundConnectionMapOutput{})
   371  }