-
Notifications
You must be signed in to change notification settings - Fork 51
/
firewallRule.go
147 lines (134 loc) · 6.5 KB
/
firewallRule.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
// *** 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 appengine
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// A single firewall rule that is evaluated against incoming traffic
// and provides an action to take on matched requests.
//
//
// To get more information about FirewallRule, see:
//
// * [API documentation](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.firewall.ingressRules)
// * How-to Guides
// * [Official Documentation](https://cloud.google.com/appengine/docs/standard/python/creating-firewalls#creating_firewall_rules)
//
// > This content is derived from https://github.com/terraform-providers/terraform-provider-google/blob/master/website/docs/r/app_engine_firewall_rule.html.markdown.
type FirewallRule struct {
pulumi.CustomResourceState
// The action to take if this rule matches.
Action pulumi.StringOutput `pulumi:"action"`
// An optional string description of this rule.
Description pulumi.StringPtrOutput `pulumi:"description"`
// A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A
// default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action
// of this rule can be modified by the user.
Priority pulumi.IntPtrOutput `pulumi:"priority"`
// The ID of the project in which the resource belongs.
// If it is not provided, the provider project is used.
Project pulumi.StringOutput `pulumi:"project"`
// IP address or range, defined using CIDR notation, of requests that this rule applies to.
SourceRange pulumi.StringOutput `pulumi:"sourceRange"`
}
// NewFirewallRule registers a new resource with the given unique name, arguments, and options.
func NewFirewallRule(ctx *pulumi.Context,
name string, args *FirewallRuleArgs, opts ...pulumi.ResourceOption) (*FirewallRule, error) {
if args == nil || args.Action == nil {
return nil, errors.New("missing required argument 'Action'")
}
if args == nil || args.SourceRange == nil {
return nil, errors.New("missing required argument 'SourceRange'")
}
if args == nil {
args = &FirewallRuleArgs{}
}
var resource FirewallRule
err := ctx.RegisterResource("gcp:appengine/firewallRule:FirewallRule", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetFirewallRule gets an existing FirewallRule 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 GetFirewallRule(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *FirewallRuleState, opts ...pulumi.ResourceOption) (*FirewallRule, error) {
var resource FirewallRule
err := ctx.ReadResource("gcp:appengine/firewallRule:FirewallRule", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering FirewallRule resources.
type firewallRuleState struct {
// The action to take if this rule matches.
Action *string `pulumi:"action"`
// An optional string description of this rule.
Description *string `pulumi:"description"`
// A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A
// default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action
// of this rule can be modified by the user.
Priority *int `pulumi:"priority"`
// The ID of the project in which the resource belongs.
// If it is not provided, the provider project is used.
Project *string `pulumi:"project"`
// IP address or range, defined using CIDR notation, of requests that this rule applies to.
SourceRange *string `pulumi:"sourceRange"`
}
type FirewallRuleState struct {
// The action to take if this rule matches.
Action pulumi.StringPtrInput
// An optional string description of this rule.
Description pulumi.StringPtrInput
// A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A
// default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action
// of this rule can be modified by the user.
Priority pulumi.IntPtrInput
// The ID of the project in which the resource belongs.
// If it is not provided, the provider project is used.
Project pulumi.StringPtrInput
// IP address or range, defined using CIDR notation, of requests that this rule applies to.
SourceRange pulumi.StringPtrInput
}
func (FirewallRuleState) ElementType() reflect.Type {
return reflect.TypeOf((*firewallRuleState)(nil)).Elem()
}
type firewallRuleArgs struct {
// The action to take if this rule matches.
Action string `pulumi:"action"`
// An optional string description of this rule.
Description *string `pulumi:"description"`
// A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A
// default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action
// of this rule can be modified by the user.
Priority *int `pulumi:"priority"`
// The ID of the project in which the resource belongs.
// If it is not provided, the provider project is used.
Project *string `pulumi:"project"`
// IP address or range, defined using CIDR notation, of requests that this rule applies to.
SourceRange string `pulumi:"sourceRange"`
}
// The set of arguments for constructing a FirewallRule resource.
type FirewallRuleArgs struct {
// The action to take if this rule matches.
Action pulumi.StringInput
// An optional string description of this rule.
Description pulumi.StringPtrInput
// A positive integer that defines the order of rule evaluation. Rules with the lowest priority are evaluated first. A
// default rule at priority Int32.MaxValue matches all IPv4 and IPv6 traffic when no previous rule matches. Only the action
// of this rule can be modified by the user.
Priority pulumi.IntPtrInput
// The ID of the project in which the resource belongs.
// If it is not provided, the provider project is used.
Project pulumi.StringPtrInput
// IP address or range, defined using CIDR notation, of requests that this rule applies to.
SourceRange pulumi.StringInput
}
func (FirewallRuleArgs) ElementType() reflect.Type {
return reflect.TypeOf((*firewallRuleArgs)(nil)).Elem()
}