This repository has been archived by the owner on Dec 24, 2020. It is now read-only.
/
bgpSession.go
112 lines (98 loc) · 3.85 KB
/
bgpSession.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
// nolint: lll
package packet
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Provides a resource to manage BGP sessions in Packet Host. Refer to [Packet BGP documentation](https://www.packet.com/developers/docs/network/advanced/local-and-global-bgp/) for more details.
//
// You need to have BGP config enabled in your project.
//
// BGP session must be linked to a device running [BIRD](https://bird.network.cz) or other BGP routing daemon which will control route advertisements via the session to Packet's upstream routers.
//
// > This content is derived from https://github.com/terraform-providers/terraform-provider-packet/blob/master/website/docs/r/bgp_session.html.markdown.
type BgpSession struct {
pulumi.CustomResourceState
// `ipv4` or `ipv6`
AddressFamily pulumi.StringOutput `pulumi:"addressFamily"`
// Boolean flag to set the default route policy. False by default.
DefaultRoute pulumi.BoolPtrOutput `pulumi:"defaultRoute"`
// ID of device
DeviceId pulumi.StringOutput `pulumi:"deviceId"`
Status pulumi.StringOutput `pulumi:"status"`
}
// NewBgpSession registers a new resource with the given unique name, arguments, and options.
func NewBgpSession(ctx *pulumi.Context,
name string, args *BgpSessionArgs, opts ...pulumi.ResourceOption) (*BgpSession, error) {
if args == nil || args.AddressFamily == nil {
return nil, errors.New("missing required argument 'AddressFamily'")
}
if args == nil || args.DeviceId == nil {
return nil, errors.New("missing required argument 'DeviceId'")
}
if args == nil {
args = &BgpSessionArgs{}
}
var resource BgpSession
err := ctx.RegisterResource("packet:index/bgpSession:BgpSession", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetBgpSession gets an existing BgpSession resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetBgpSession(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *BgpSessionState, opts ...pulumi.ResourceOption) (*BgpSession, error) {
var resource BgpSession
err := ctx.ReadResource("packet:index/bgpSession:BgpSession", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering BgpSession resources.
type bgpSessionState struct {
// `ipv4` or `ipv6`
AddressFamily *string `pulumi:"addressFamily"`
// Boolean flag to set the default route policy. False by default.
DefaultRoute *bool `pulumi:"defaultRoute"`
// ID of device
DeviceId *string `pulumi:"deviceId"`
Status *string `pulumi:"status"`
}
type BgpSessionState struct {
// `ipv4` or `ipv6`
AddressFamily pulumi.StringPtrInput
// Boolean flag to set the default route policy. False by default.
DefaultRoute pulumi.BoolPtrInput
// ID of device
DeviceId pulumi.StringPtrInput
Status pulumi.StringPtrInput
}
func (BgpSessionState) ElementType() reflect.Type {
return reflect.TypeOf((*bgpSessionState)(nil)).Elem()
}
type bgpSessionArgs struct {
// `ipv4` or `ipv6`
AddressFamily string `pulumi:"addressFamily"`
// Boolean flag to set the default route policy. False by default.
DefaultRoute *bool `pulumi:"defaultRoute"`
// ID of device
DeviceId string `pulumi:"deviceId"`
}
// The set of arguments for constructing a BgpSession resource.
type BgpSessionArgs struct {
// `ipv4` or `ipv6`
AddressFamily pulumi.StringInput
// Boolean flag to set the default route policy. False by default.
DefaultRoute pulumi.BoolPtrInput
// ID of device
DeviceId pulumi.StringInput
}
func (BgpSessionArgs) ElementType() reflect.Type {
return reflect.TypeOf((*bgpSessionArgs)(nil)).Elem()
}