github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/directconnect/bgpPeer.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 directconnect
     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 Direct Connect BGP peer resource.
    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/directconnect"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := directconnect.NewBgpPeer(ctx, "peer", &directconnect.BgpPeerArgs{
    33  //				VirtualInterfaceId: pulumi.Any(foo.Id),
    34  //				AddressFamily:      pulumi.String("ipv6"),
    35  //				BgpAsn:             pulumi.Int(65351),
    36  //			})
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			return nil
    41  //		})
    42  //	}
    43  //
    44  // ```
    45  // <!--End PulumiCodeChooser -->
    46  type BgpPeer struct {
    47  	pulumi.CustomResourceState
    48  
    49  	// The address family for the BGP peer. ` ipv4  ` or `ipv6`.
    50  	AddressFamily pulumi.StringOutput `pulumi:"addressFamily"`
    51  	// The IPv4 CIDR address to use to send traffic to Amazon.
    52  	// Required for IPv4 BGP peers on public virtual interfaces.
    53  	AmazonAddress pulumi.StringOutput `pulumi:"amazonAddress"`
    54  	// The Direct Connect endpoint on which the BGP peer terminates.
    55  	AwsDevice pulumi.StringOutput `pulumi:"awsDevice"`
    56  	// The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.
    57  	BgpAsn pulumi.IntOutput `pulumi:"bgpAsn"`
    58  	// The authentication key for BGP configuration.
    59  	BgpAuthKey pulumi.StringOutput `pulumi:"bgpAuthKey"`
    60  	// The ID of the BGP peer.
    61  	BgpPeerId pulumi.StringOutput `pulumi:"bgpPeerId"`
    62  	// The Up/Down state of the BGP peer.
    63  	BgpStatus pulumi.StringOutput `pulumi:"bgpStatus"`
    64  	// The IPv4 CIDR destination address to which Amazon should send traffic.
    65  	// Required for IPv4 BGP peers on public virtual interfaces.
    66  	CustomerAddress pulumi.StringOutput `pulumi:"customerAddress"`
    67  	// The ID of the Direct Connect virtual interface on which to create the BGP peer.
    68  	VirtualInterfaceId pulumi.StringOutput `pulumi:"virtualInterfaceId"`
    69  }
    70  
    71  // NewBgpPeer registers a new resource with the given unique name, arguments, and options.
    72  func NewBgpPeer(ctx *pulumi.Context,
    73  	name string, args *BgpPeerArgs, opts ...pulumi.ResourceOption) (*BgpPeer, error) {
    74  	if args == nil {
    75  		return nil, errors.New("missing one or more required arguments")
    76  	}
    77  
    78  	if args.AddressFamily == nil {
    79  		return nil, errors.New("invalid value for required argument 'AddressFamily'")
    80  	}
    81  	if args.BgpAsn == nil {
    82  		return nil, errors.New("invalid value for required argument 'BgpAsn'")
    83  	}
    84  	if args.VirtualInterfaceId == nil {
    85  		return nil, errors.New("invalid value for required argument 'VirtualInterfaceId'")
    86  	}
    87  	opts = internal.PkgResourceDefaultOpts(opts)
    88  	var resource BgpPeer
    89  	err := ctx.RegisterResource("aws:directconnect/bgpPeer:BgpPeer", name, args, &resource, opts...)
    90  	if err != nil {
    91  		return nil, err
    92  	}
    93  	return &resource, nil
    94  }
    95  
    96  // GetBgpPeer gets an existing BgpPeer resource's state with the given name, ID, and optional
    97  // state properties that are used to uniquely qualify the lookup (nil if not required).
    98  func GetBgpPeer(ctx *pulumi.Context,
    99  	name string, id pulumi.IDInput, state *BgpPeerState, opts ...pulumi.ResourceOption) (*BgpPeer, error) {
   100  	var resource BgpPeer
   101  	err := ctx.ReadResource("aws:directconnect/bgpPeer:BgpPeer", name, id, state, &resource, opts...)
   102  	if err != nil {
   103  		return nil, err
   104  	}
   105  	return &resource, nil
   106  }
   107  
   108  // Input properties used for looking up and filtering BgpPeer resources.
   109  type bgpPeerState struct {
   110  	// The address family for the BGP peer. ` ipv4  ` or `ipv6`.
   111  	AddressFamily *string `pulumi:"addressFamily"`
   112  	// The IPv4 CIDR address to use to send traffic to Amazon.
   113  	// Required for IPv4 BGP peers on public virtual interfaces.
   114  	AmazonAddress *string `pulumi:"amazonAddress"`
   115  	// The Direct Connect endpoint on which the BGP peer terminates.
   116  	AwsDevice *string `pulumi:"awsDevice"`
   117  	// The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.
   118  	BgpAsn *int `pulumi:"bgpAsn"`
   119  	// The authentication key for BGP configuration.
   120  	BgpAuthKey *string `pulumi:"bgpAuthKey"`
   121  	// The ID of the BGP peer.
   122  	BgpPeerId *string `pulumi:"bgpPeerId"`
   123  	// The Up/Down state of the BGP peer.
   124  	BgpStatus *string `pulumi:"bgpStatus"`
   125  	// The IPv4 CIDR destination address to which Amazon should send traffic.
   126  	// Required for IPv4 BGP peers on public virtual interfaces.
   127  	CustomerAddress *string `pulumi:"customerAddress"`
   128  	// The ID of the Direct Connect virtual interface on which to create the BGP peer.
   129  	VirtualInterfaceId *string `pulumi:"virtualInterfaceId"`
   130  }
   131  
   132  type BgpPeerState struct {
   133  	// The address family for the BGP peer. ` ipv4  ` or `ipv6`.
   134  	AddressFamily pulumi.StringPtrInput
   135  	// The IPv4 CIDR address to use to send traffic to Amazon.
   136  	// Required for IPv4 BGP peers on public virtual interfaces.
   137  	AmazonAddress pulumi.StringPtrInput
   138  	// The Direct Connect endpoint on which the BGP peer terminates.
   139  	AwsDevice pulumi.StringPtrInput
   140  	// The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.
   141  	BgpAsn pulumi.IntPtrInput
   142  	// The authentication key for BGP configuration.
   143  	BgpAuthKey pulumi.StringPtrInput
   144  	// The ID of the BGP peer.
   145  	BgpPeerId pulumi.StringPtrInput
   146  	// The Up/Down state of the BGP peer.
   147  	BgpStatus pulumi.StringPtrInput
   148  	// The IPv4 CIDR destination address to which Amazon should send traffic.
   149  	// Required for IPv4 BGP peers on public virtual interfaces.
   150  	CustomerAddress pulumi.StringPtrInput
   151  	// The ID of the Direct Connect virtual interface on which to create the BGP peer.
   152  	VirtualInterfaceId pulumi.StringPtrInput
   153  }
   154  
   155  func (BgpPeerState) ElementType() reflect.Type {
   156  	return reflect.TypeOf((*bgpPeerState)(nil)).Elem()
   157  }
   158  
   159  type bgpPeerArgs struct {
   160  	// The address family for the BGP peer. ` ipv4  ` or `ipv6`.
   161  	AddressFamily string `pulumi:"addressFamily"`
   162  	// The IPv4 CIDR address to use to send traffic to Amazon.
   163  	// Required for IPv4 BGP peers on public virtual interfaces.
   164  	AmazonAddress *string `pulumi:"amazonAddress"`
   165  	// The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.
   166  	BgpAsn int `pulumi:"bgpAsn"`
   167  	// The authentication key for BGP configuration.
   168  	BgpAuthKey *string `pulumi:"bgpAuthKey"`
   169  	// The IPv4 CIDR destination address to which Amazon should send traffic.
   170  	// Required for IPv4 BGP peers on public virtual interfaces.
   171  	CustomerAddress *string `pulumi:"customerAddress"`
   172  	// The ID of the Direct Connect virtual interface on which to create the BGP peer.
   173  	VirtualInterfaceId string `pulumi:"virtualInterfaceId"`
   174  }
   175  
   176  // The set of arguments for constructing a BgpPeer resource.
   177  type BgpPeerArgs struct {
   178  	// The address family for the BGP peer. ` ipv4  ` or `ipv6`.
   179  	AddressFamily pulumi.StringInput
   180  	// The IPv4 CIDR address to use to send traffic to Amazon.
   181  	// Required for IPv4 BGP peers on public virtual interfaces.
   182  	AmazonAddress pulumi.StringPtrInput
   183  	// The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.
   184  	BgpAsn pulumi.IntInput
   185  	// The authentication key for BGP configuration.
   186  	BgpAuthKey pulumi.StringPtrInput
   187  	// The IPv4 CIDR destination address to which Amazon should send traffic.
   188  	// Required for IPv4 BGP peers on public virtual interfaces.
   189  	CustomerAddress pulumi.StringPtrInput
   190  	// The ID of the Direct Connect virtual interface on which to create the BGP peer.
   191  	VirtualInterfaceId pulumi.StringInput
   192  }
   193  
   194  func (BgpPeerArgs) ElementType() reflect.Type {
   195  	return reflect.TypeOf((*bgpPeerArgs)(nil)).Elem()
   196  }
   197  
   198  type BgpPeerInput interface {
   199  	pulumi.Input
   200  
   201  	ToBgpPeerOutput() BgpPeerOutput
   202  	ToBgpPeerOutputWithContext(ctx context.Context) BgpPeerOutput
   203  }
   204  
   205  func (*BgpPeer) ElementType() reflect.Type {
   206  	return reflect.TypeOf((**BgpPeer)(nil)).Elem()
   207  }
   208  
   209  func (i *BgpPeer) ToBgpPeerOutput() BgpPeerOutput {
   210  	return i.ToBgpPeerOutputWithContext(context.Background())
   211  }
   212  
   213  func (i *BgpPeer) ToBgpPeerOutputWithContext(ctx context.Context) BgpPeerOutput {
   214  	return pulumi.ToOutputWithContext(ctx, i).(BgpPeerOutput)
   215  }
   216  
   217  // BgpPeerArrayInput is an input type that accepts BgpPeerArray and BgpPeerArrayOutput values.
   218  // You can construct a concrete instance of `BgpPeerArrayInput` via:
   219  //
   220  //	BgpPeerArray{ BgpPeerArgs{...} }
   221  type BgpPeerArrayInput interface {
   222  	pulumi.Input
   223  
   224  	ToBgpPeerArrayOutput() BgpPeerArrayOutput
   225  	ToBgpPeerArrayOutputWithContext(context.Context) BgpPeerArrayOutput
   226  }
   227  
   228  type BgpPeerArray []BgpPeerInput
   229  
   230  func (BgpPeerArray) ElementType() reflect.Type {
   231  	return reflect.TypeOf((*[]*BgpPeer)(nil)).Elem()
   232  }
   233  
   234  func (i BgpPeerArray) ToBgpPeerArrayOutput() BgpPeerArrayOutput {
   235  	return i.ToBgpPeerArrayOutputWithContext(context.Background())
   236  }
   237  
   238  func (i BgpPeerArray) ToBgpPeerArrayOutputWithContext(ctx context.Context) BgpPeerArrayOutput {
   239  	return pulumi.ToOutputWithContext(ctx, i).(BgpPeerArrayOutput)
   240  }
   241  
   242  // BgpPeerMapInput is an input type that accepts BgpPeerMap and BgpPeerMapOutput values.
   243  // You can construct a concrete instance of `BgpPeerMapInput` via:
   244  //
   245  //	BgpPeerMap{ "key": BgpPeerArgs{...} }
   246  type BgpPeerMapInput interface {
   247  	pulumi.Input
   248  
   249  	ToBgpPeerMapOutput() BgpPeerMapOutput
   250  	ToBgpPeerMapOutputWithContext(context.Context) BgpPeerMapOutput
   251  }
   252  
   253  type BgpPeerMap map[string]BgpPeerInput
   254  
   255  func (BgpPeerMap) ElementType() reflect.Type {
   256  	return reflect.TypeOf((*map[string]*BgpPeer)(nil)).Elem()
   257  }
   258  
   259  func (i BgpPeerMap) ToBgpPeerMapOutput() BgpPeerMapOutput {
   260  	return i.ToBgpPeerMapOutputWithContext(context.Background())
   261  }
   262  
   263  func (i BgpPeerMap) ToBgpPeerMapOutputWithContext(ctx context.Context) BgpPeerMapOutput {
   264  	return pulumi.ToOutputWithContext(ctx, i).(BgpPeerMapOutput)
   265  }
   266  
   267  type BgpPeerOutput struct{ *pulumi.OutputState }
   268  
   269  func (BgpPeerOutput) ElementType() reflect.Type {
   270  	return reflect.TypeOf((**BgpPeer)(nil)).Elem()
   271  }
   272  
   273  func (o BgpPeerOutput) ToBgpPeerOutput() BgpPeerOutput {
   274  	return o
   275  }
   276  
   277  func (o BgpPeerOutput) ToBgpPeerOutputWithContext(ctx context.Context) BgpPeerOutput {
   278  	return o
   279  }
   280  
   281  // The address family for the BGP peer. ` ipv4  ` or `ipv6`.
   282  func (o BgpPeerOutput) AddressFamily() pulumi.StringOutput {
   283  	return o.ApplyT(func(v *BgpPeer) pulumi.StringOutput { return v.AddressFamily }).(pulumi.StringOutput)
   284  }
   285  
   286  // The IPv4 CIDR address to use to send traffic to Amazon.
   287  // Required for IPv4 BGP peers on public virtual interfaces.
   288  func (o BgpPeerOutput) AmazonAddress() pulumi.StringOutput {
   289  	return o.ApplyT(func(v *BgpPeer) pulumi.StringOutput { return v.AmazonAddress }).(pulumi.StringOutput)
   290  }
   291  
   292  // The Direct Connect endpoint on which the BGP peer terminates.
   293  func (o BgpPeerOutput) AwsDevice() pulumi.StringOutput {
   294  	return o.ApplyT(func(v *BgpPeer) pulumi.StringOutput { return v.AwsDevice }).(pulumi.StringOutput)
   295  }
   296  
   297  // The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.
   298  func (o BgpPeerOutput) BgpAsn() pulumi.IntOutput {
   299  	return o.ApplyT(func(v *BgpPeer) pulumi.IntOutput { return v.BgpAsn }).(pulumi.IntOutput)
   300  }
   301  
   302  // The authentication key for BGP configuration.
   303  func (o BgpPeerOutput) BgpAuthKey() pulumi.StringOutput {
   304  	return o.ApplyT(func(v *BgpPeer) pulumi.StringOutput { return v.BgpAuthKey }).(pulumi.StringOutput)
   305  }
   306  
   307  // The ID of the BGP peer.
   308  func (o BgpPeerOutput) BgpPeerId() pulumi.StringOutput {
   309  	return o.ApplyT(func(v *BgpPeer) pulumi.StringOutput { return v.BgpPeerId }).(pulumi.StringOutput)
   310  }
   311  
   312  // The Up/Down state of the BGP peer.
   313  func (o BgpPeerOutput) BgpStatus() pulumi.StringOutput {
   314  	return o.ApplyT(func(v *BgpPeer) pulumi.StringOutput { return v.BgpStatus }).(pulumi.StringOutput)
   315  }
   316  
   317  // The IPv4 CIDR destination address to which Amazon should send traffic.
   318  // Required for IPv4 BGP peers on public virtual interfaces.
   319  func (o BgpPeerOutput) CustomerAddress() pulumi.StringOutput {
   320  	return o.ApplyT(func(v *BgpPeer) pulumi.StringOutput { return v.CustomerAddress }).(pulumi.StringOutput)
   321  }
   322  
   323  // The ID of the Direct Connect virtual interface on which to create the BGP peer.
   324  func (o BgpPeerOutput) VirtualInterfaceId() pulumi.StringOutput {
   325  	return o.ApplyT(func(v *BgpPeer) pulumi.StringOutput { return v.VirtualInterfaceId }).(pulumi.StringOutput)
   326  }
   327  
   328  type BgpPeerArrayOutput struct{ *pulumi.OutputState }
   329  
   330  func (BgpPeerArrayOutput) ElementType() reflect.Type {
   331  	return reflect.TypeOf((*[]*BgpPeer)(nil)).Elem()
   332  }
   333  
   334  func (o BgpPeerArrayOutput) ToBgpPeerArrayOutput() BgpPeerArrayOutput {
   335  	return o
   336  }
   337  
   338  func (o BgpPeerArrayOutput) ToBgpPeerArrayOutputWithContext(ctx context.Context) BgpPeerArrayOutput {
   339  	return o
   340  }
   341  
   342  func (o BgpPeerArrayOutput) Index(i pulumi.IntInput) BgpPeerOutput {
   343  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *BgpPeer {
   344  		return vs[0].([]*BgpPeer)[vs[1].(int)]
   345  	}).(BgpPeerOutput)
   346  }
   347  
   348  type BgpPeerMapOutput struct{ *pulumi.OutputState }
   349  
   350  func (BgpPeerMapOutput) ElementType() reflect.Type {
   351  	return reflect.TypeOf((*map[string]*BgpPeer)(nil)).Elem()
   352  }
   353  
   354  func (o BgpPeerMapOutput) ToBgpPeerMapOutput() BgpPeerMapOutput {
   355  	return o
   356  }
   357  
   358  func (o BgpPeerMapOutput) ToBgpPeerMapOutputWithContext(ctx context.Context) BgpPeerMapOutput {
   359  	return o
   360  }
   361  
   362  func (o BgpPeerMapOutput) MapIndex(k pulumi.StringInput) BgpPeerOutput {
   363  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *BgpPeer {
   364  		return vs[0].(map[string]*BgpPeer)[vs[1].(string)]
   365  	}).(BgpPeerOutput)
   366  }
   367  
   368  func init() {
   369  	pulumi.RegisterInputType(reflect.TypeOf((*BgpPeerInput)(nil)).Elem(), &BgpPeer{})
   370  	pulumi.RegisterInputType(reflect.TypeOf((*BgpPeerArrayInput)(nil)).Elem(), BgpPeerArray{})
   371  	pulumi.RegisterInputType(reflect.TypeOf((*BgpPeerMapInput)(nil)).Elem(), BgpPeerMap{})
   372  	pulumi.RegisterOutputType(BgpPeerOutput{})
   373  	pulumi.RegisterOutputType(BgpPeerArrayOutput{})
   374  	pulumi.RegisterOutputType(BgpPeerMapOutput{})
   375  }