/
getFirewall.go
196 lines (172 loc) · 7.25 KB
/
getFirewall.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
// 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 digitalocean
import (
"context"
"reflect"
"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Get information on a DigitalOcean Firewall.
//
// ## Example Usage
//
// Get the firewall:
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := digitalocean.LookupFirewall(ctx, &digitalocean.LookupFirewallArgs{
// FirewallId: "1df48973-6eef-4214-854f-fa7726e7e583",
// }, nil)
// if err != nil {
// return err
// }
// ctx.Export("exampleFirewallName", example.Name)
// return nil
// })
// }
//
// ```
func LookupFirewall(ctx *pulumi.Context, args *LookupFirewallArgs, opts ...pulumi.InvokeOption) (*LookupFirewallResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv LookupFirewallResult
err := ctx.Invoke("digitalocean:index/getFirewall:getFirewall", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getFirewall.
type LookupFirewallArgs struct {
// The list of the IDs of the Droplets assigned to
// the Firewall.
DropletIds []int `pulumi:"dropletIds"`
// The ID of the firewall to retrieve information
// about.
FirewallId string `pulumi:"firewallId"`
InboundRules []GetFirewallInboundRule `pulumi:"inboundRules"`
OutboundRules []GetFirewallOutboundRule `pulumi:"outboundRules"`
// The names of the Tags assigned to the Firewall.
Tags []string `pulumi:"tags"`
}
// A collection of values returned by getFirewall.
type LookupFirewallResult struct {
// A time value given in ISO8601 combined date and time format
// that represents when the Firewall was created.
CreatedAt string `pulumi:"createdAt"`
// The list of the IDs of the Droplets assigned to
// the Firewall.
DropletIds []int `pulumi:"dropletIds"`
FirewallId string `pulumi:"firewallId"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
InboundRules []GetFirewallInboundRule `pulumi:"inboundRules"`
// The name of the Firewall.
Name string `pulumi:"name"`
OutboundRules []GetFirewallOutboundRule `pulumi:"outboundRules"`
// A set of object containing the fields, `dropletId`,
// `removing`, and `status`. It is provided to detail exactly which Droplets
// are having their security policies updated. When empty, all changes
// have been successfully applied.
PendingChanges []GetFirewallPendingChange `pulumi:"pendingChanges"`
// A status string indicating the current state of the Firewall.
// This can be "waiting", "succeeded", or "failed".
Status string `pulumi:"status"`
// The names of the Tags assigned to the Firewall.
Tags []string `pulumi:"tags"`
}
func LookupFirewallOutput(ctx *pulumi.Context, args LookupFirewallOutputArgs, opts ...pulumi.InvokeOption) LookupFirewallResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupFirewallResult, error) {
args := v.(LookupFirewallArgs)
r, err := LookupFirewall(ctx, &args, opts...)
var s LookupFirewallResult
if r != nil {
s = *r
}
return s, err
}).(LookupFirewallResultOutput)
}
// A collection of arguments for invoking getFirewall.
type LookupFirewallOutputArgs struct {
// The list of the IDs of the Droplets assigned to
// the Firewall.
DropletIds pulumi.IntArrayInput `pulumi:"dropletIds"`
// The ID of the firewall to retrieve information
// about.
FirewallId pulumi.StringInput `pulumi:"firewallId"`
InboundRules GetFirewallInboundRuleArrayInput `pulumi:"inboundRules"`
OutboundRules GetFirewallOutboundRuleArrayInput `pulumi:"outboundRules"`
// The names of the Tags assigned to the Firewall.
Tags pulumi.StringArrayInput `pulumi:"tags"`
}
func (LookupFirewallOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupFirewallArgs)(nil)).Elem()
}
// A collection of values returned by getFirewall.
type LookupFirewallResultOutput struct{ *pulumi.OutputState }
func (LookupFirewallResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupFirewallResult)(nil)).Elem()
}
func (o LookupFirewallResultOutput) ToLookupFirewallResultOutput() LookupFirewallResultOutput {
return o
}
func (o LookupFirewallResultOutput) ToLookupFirewallResultOutputWithContext(ctx context.Context) LookupFirewallResultOutput {
return o
}
// A time value given in ISO8601 combined date and time format
// that represents when the Firewall was created.
func (o LookupFirewallResultOutput) CreatedAt() pulumi.StringOutput {
return o.ApplyT(func(v LookupFirewallResult) string { return v.CreatedAt }).(pulumi.StringOutput)
}
// The list of the IDs of the Droplets assigned to
// the Firewall.
func (o LookupFirewallResultOutput) DropletIds() pulumi.IntArrayOutput {
return o.ApplyT(func(v LookupFirewallResult) []int { return v.DropletIds }).(pulumi.IntArrayOutput)
}
func (o LookupFirewallResultOutput) FirewallId() pulumi.StringOutput {
return o.ApplyT(func(v LookupFirewallResult) string { return v.FirewallId }).(pulumi.StringOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o LookupFirewallResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupFirewallResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o LookupFirewallResultOutput) InboundRules() GetFirewallInboundRuleArrayOutput {
return o.ApplyT(func(v LookupFirewallResult) []GetFirewallInboundRule { return v.InboundRules }).(GetFirewallInboundRuleArrayOutput)
}
// The name of the Firewall.
func (o LookupFirewallResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupFirewallResult) string { return v.Name }).(pulumi.StringOutput)
}
func (o LookupFirewallResultOutput) OutboundRules() GetFirewallOutboundRuleArrayOutput {
return o.ApplyT(func(v LookupFirewallResult) []GetFirewallOutboundRule { return v.OutboundRules }).(GetFirewallOutboundRuleArrayOutput)
}
// A set of object containing the fields, `dropletId`,
// `removing`, and `status`. It is provided to detail exactly which Droplets
// are having their security policies updated. When empty, all changes
// have been successfully applied.
func (o LookupFirewallResultOutput) PendingChanges() GetFirewallPendingChangeArrayOutput {
return o.ApplyT(func(v LookupFirewallResult) []GetFirewallPendingChange { return v.PendingChanges }).(GetFirewallPendingChangeArrayOutput)
}
// A status string indicating the current state of the Firewall.
// This can be "waiting", "succeeded", or "failed".
func (o LookupFirewallResultOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v LookupFirewallResult) string { return v.Status }).(pulumi.StringOutput)
}
// The names of the Tags assigned to the Firewall.
func (o LookupFirewallResultOutput) Tags() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupFirewallResult) []string { return v.Tags }).(pulumi.StringArrayOutput)
}
func init() {
pulumi.RegisterOutputType(LookupFirewallResultOutput{})
}