/
getGateway.go
168 lines (146 loc) · 5.57 KB
/
getGateway.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package metal
import (
"context"
"reflect"
"github.com/equinix/pulumi-equinix/sdk/go/equinix/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this datasource to retrieve Metal Gateway resources in Equinix Metal.
//
// > VRF features are not generally available. The interfaces related to VRF resources may change ahead of general availability.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/equinix/pulumi-equinix/sdk/go/equinix/metal"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// // Create Metal Gateway for a VLAN with a private IPv4 block with 8 IP addresses
// _, err := metal.NewVlan(ctx, "testVlan", &metal.VlanArgs{
// Description: pulumi.String("test VLAN in SV"),
// Metro: pulumi.String("sv"),
// ProjectId: pulumi.Any(local.Project_id),
// })
// if err != nil {
// return err
// }
// _, err = metal.LookupGateway(ctx, &metal.LookupGatewayArgs{
// GatewayId: local.Gateway_id,
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
func LookupGateway(ctx *pulumi.Context, args *LookupGatewayArgs, opts ...pulumi.InvokeOption) (*LookupGatewayResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv LookupGatewayResult
err := ctx.Invoke("equinix:metal/getGateway:getGateway", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getGateway.
type LookupGatewayArgs struct {
// UUID of the metal gateway resource to retrieve.
GatewayId string `pulumi:"gatewayId"`
}
// A collection of values returned by getGateway.
type LookupGatewayResult struct {
GatewayId string `pulumi:"gatewayId"`
Id string `pulumi:"id"`
// UUID of IP reservation block bound to the gateway.
IpReservationId string `pulumi:"ipReservationId"`
// Size of the private IPv4 subnet bound to this metal gateway. One of
// `8`, `16`, `32`, `64`, `128`.
PrivateIpv4SubnetSize int `pulumi:"privateIpv4SubnetSize"`
// UUID of the project where the gateway is scoped to.
ProjectId string `pulumi:"projectId"`
// Status of the gateway resource.
State string `pulumi:"state"`
// UUID of the VLAN where the gateway is scoped to.
VlanId string `pulumi:"vlanId"`
// UUID of the VRF associated with the IP Reservation.
VrfId string `pulumi:"vrfId"`
}
func LookupGatewayOutput(ctx *pulumi.Context, args LookupGatewayOutputArgs, opts ...pulumi.InvokeOption) LookupGatewayResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupGatewayResult, error) {
args := v.(LookupGatewayArgs)
r, err := LookupGateway(ctx, &args, opts...)
var s LookupGatewayResult
if r != nil {
s = *r
}
return s, err
}).(LookupGatewayResultOutput)
}
// A collection of arguments for invoking getGateway.
type LookupGatewayOutputArgs struct {
// UUID of the metal gateway resource to retrieve.
GatewayId pulumi.StringInput `pulumi:"gatewayId"`
}
func (LookupGatewayOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupGatewayArgs)(nil)).Elem()
}
// A collection of values returned by getGateway.
type LookupGatewayResultOutput struct{ *pulumi.OutputState }
func (LookupGatewayResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupGatewayResult)(nil)).Elem()
}
func (o LookupGatewayResultOutput) ToLookupGatewayResultOutput() LookupGatewayResultOutput {
return o
}
func (o LookupGatewayResultOutput) ToLookupGatewayResultOutputWithContext(ctx context.Context) LookupGatewayResultOutput {
return o
}
func (o LookupGatewayResultOutput) GatewayId() pulumi.StringOutput {
return o.ApplyT(func(v LookupGatewayResult) string { return v.GatewayId }).(pulumi.StringOutput)
}
func (o LookupGatewayResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupGatewayResult) string { return v.Id }).(pulumi.StringOutput)
}
// UUID of IP reservation block bound to the gateway.
func (o LookupGatewayResultOutput) IpReservationId() pulumi.StringOutput {
return o.ApplyT(func(v LookupGatewayResult) string { return v.IpReservationId }).(pulumi.StringOutput)
}
// Size of the private IPv4 subnet bound to this metal gateway. One of
// `8`, `16`, `32`, `64`, `128`.
func (o LookupGatewayResultOutput) PrivateIpv4SubnetSize() pulumi.IntOutput {
return o.ApplyT(func(v LookupGatewayResult) int { return v.PrivateIpv4SubnetSize }).(pulumi.IntOutput)
}
// UUID of the project where the gateway is scoped to.
func (o LookupGatewayResultOutput) ProjectId() pulumi.StringOutput {
return o.ApplyT(func(v LookupGatewayResult) string { return v.ProjectId }).(pulumi.StringOutput)
}
// Status of the gateway resource.
func (o LookupGatewayResultOutput) State() pulumi.StringOutput {
return o.ApplyT(func(v LookupGatewayResult) string { return v.State }).(pulumi.StringOutput)
}
// UUID of the VLAN where the gateway is scoped to.
func (o LookupGatewayResultOutput) VlanId() pulumi.StringOutput {
return o.ApplyT(func(v LookupGatewayResult) string { return v.VlanId }).(pulumi.StringOutput)
}
// UUID of the VRF associated with the IP Reservation.
func (o LookupGatewayResultOutput) VrfId() pulumi.StringOutput {
return o.ApplyT(func(v LookupGatewayResult) string { return v.VrfId }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(LookupGatewayResultOutput{})
}