/
accessRule.go
115 lines (101 loc) · 4.86 KB
/
accessRule.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
// *** 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 cloudflare
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Provides a Cloudflare IP Firewall Access Rule resource. Access control can be applied on basis of IP addresses, IP ranges, AS numbers or countries.
//
// > This content is derived from https://github.com/terraform-providers/terraform-provider-cloudflare/blob/master/website/docs/r/access_rule.html.markdown.
type AccessRule struct {
pulumi.CustomResourceState
// Rule configuration to apply to a matched request. It's a complex value. See description below.
Configuration AccessRuleConfigurationOutput `pulumi:"configuration"`
// The action to apply to a matched request. Allowed values: "block", "challenge", "whitelist", "jsChallenge"
Mode pulumi.StringOutput `pulumi:"mode"`
// A personal note about the rule. Typically used as a reminder or explanation for the rule.
Notes pulumi.StringPtrOutput `pulumi:"notes"`
// The DNS zone to which the access rule should be added.
ZoneId pulumi.StringOutput `pulumi:"zoneId"`
}
// NewAccessRule registers a new resource with the given unique name, arguments, and options.
func NewAccessRule(ctx *pulumi.Context,
name string, args *AccessRuleArgs, opts ...pulumi.ResourceOption) (*AccessRule, error) {
if args == nil || args.Configuration == nil {
return nil, errors.New("missing required argument 'Configuration'")
}
if args == nil || args.Mode == nil {
return nil, errors.New("missing required argument 'Mode'")
}
if args == nil {
args = &AccessRuleArgs{}
}
var resource AccessRule
err := ctx.RegisterResource("cloudflare:index/accessRule:AccessRule", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetAccessRule gets an existing AccessRule 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 GetAccessRule(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *AccessRuleState, opts ...pulumi.ResourceOption) (*AccessRule, error) {
var resource AccessRule
err := ctx.ReadResource("cloudflare:index/accessRule:AccessRule", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering AccessRule resources.
type accessRuleState struct {
// Rule configuration to apply to a matched request. It's a complex value. See description below.
Configuration *AccessRuleConfiguration `pulumi:"configuration"`
// The action to apply to a matched request. Allowed values: "block", "challenge", "whitelist", "jsChallenge"
Mode *string `pulumi:"mode"`
// A personal note about the rule. Typically used as a reminder or explanation for the rule.
Notes *string `pulumi:"notes"`
// The DNS zone to which the access rule should be added.
ZoneId *string `pulumi:"zoneId"`
}
type AccessRuleState struct {
// Rule configuration to apply to a matched request. It's a complex value. See description below.
Configuration AccessRuleConfigurationPtrInput
// The action to apply to a matched request. Allowed values: "block", "challenge", "whitelist", "jsChallenge"
Mode pulumi.StringPtrInput
// A personal note about the rule. Typically used as a reminder or explanation for the rule.
Notes pulumi.StringPtrInput
// The DNS zone to which the access rule should be added.
ZoneId pulumi.StringPtrInput
}
func (AccessRuleState) ElementType() reflect.Type {
return reflect.TypeOf((*accessRuleState)(nil)).Elem()
}
type accessRuleArgs struct {
// Rule configuration to apply to a matched request. It's a complex value. See description below.
Configuration AccessRuleConfiguration `pulumi:"configuration"`
// The action to apply to a matched request. Allowed values: "block", "challenge", "whitelist", "jsChallenge"
Mode string `pulumi:"mode"`
// A personal note about the rule. Typically used as a reminder or explanation for the rule.
Notes *string `pulumi:"notes"`
// The DNS zone to which the access rule should be added.
ZoneId *string `pulumi:"zoneId"`
}
// The set of arguments for constructing a AccessRule resource.
type AccessRuleArgs struct {
// Rule configuration to apply to a matched request. It's a complex value. See description below.
Configuration AccessRuleConfigurationInput
// The action to apply to a matched request. Allowed values: "block", "challenge", "whitelist", "jsChallenge"
Mode pulumi.StringInput
// A personal note about the rule. Typically used as a reminder or explanation for the rule.
Notes pulumi.StringPtrInput
// The DNS zone to which the access rule should be added.
ZoneId pulumi.StringPtrInput
}
func (AccessRuleArgs) ElementType() reflect.Type {
return reflect.TypeOf((*accessRuleArgs)(nil)).Elem()
}