/
appSecPenaltyBox.go
309 lines (263 loc) · 12.4 KB
/
appSecPenaltyBox.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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
// 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 akamai
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// **Scopes**: Security policy
//
// Modifies the penalty box settings for a security policy. When using automated attack groups, and when the penalty box is enabled, clients that trigger an attack group are placed in the “penalty box.” That means that, for the next 10 minutes, all requests from that client are ignored.
//
// **Related API Endpoint**: [/appsec/v1/configs/{configId}/versions/{versionNumber}/match-targets/sequence](https://developer.akamai.com/api/cloud_security/application_security/v1.html#putpenaltybox)
//
// ## Example Usage
//
// Basic usage:
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-akamai/sdk/v2/go/akamai"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// configuration, err := akamai.LookupAppSecConfiguration(ctx, &GetAppSecConfigurationArgs{
// Name: pulumi.StringRef("Documentation"),
// }, nil)
// if err != nil {
// return err
// }
// _, err = akamai.NewAppSecPenaltyBox(ctx, "penaltyBox", &akamai.AppSecPenaltyBoxArgs{
// ConfigId: pulumi.Int(configuration.ConfigId),
// SecurityPolicyId: pulumi.String("gms1_134637"),
// PenaltyBoxProtection: pulumi.Bool(true),
// PenaltyBoxAction: pulumi.String("deny"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type AppSecPenaltyBox struct {
pulumi.CustomResourceState
// . Unique identifier of the security configuration associated with the penalty box settings being modified.
ConfigId pulumi.IntOutput `pulumi:"configId"`
// . Action taken any time penalty box protection is triggered. Allowed values are:
// - **alert**. Record the event,
// - **deny**. Block the request.
// - **deny_custom_{custom_deny_id}**. Take the action specified by the custom deny.
// - **none**. Take no action.
PenaltyBoxAction pulumi.StringOutput `pulumi:"penaltyBoxAction"`
// . Set to **true** to enable penalty box protection; set to **false** to disable penalty box protection.
PenaltyBoxProtection pulumi.BoolOutput `pulumi:"penaltyBoxProtection"`
// . Unique identifier of the security policy associated with the penalty box settings being modified.
SecurityPolicyId pulumi.StringOutput `pulumi:"securityPolicyId"`
}
// NewAppSecPenaltyBox registers a new resource with the given unique name, arguments, and options.
func NewAppSecPenaltyBox(ctx *pulumi.Context,
name string, args *AppSecPenaltyBoxArgs, opts ...pulumi.ResourceOption) (*AppSecPenaltyBox, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ConfigId == nil {
return nil, errors.New("invalid value for required argument 'ConfigId'")
}
if args.PenaltyBoxAction == nil {
return nil, errors.New("invalid value for required argument 'PenaltyBoxAction'")
}
if args.PenaltyBoxProtection == nil {
return nil, errors.New("invalid value for required argument 'PenaltyBoxProtection'")
}
if args.SecurityPolicyId == nil {
return nil, errors.New("invalid value for required argument 'SecurityPolicyId'")
}
var resource AppSecPenaltyBox
err := ctx.RegisterResource("akamai:index/appSecPenaltyBox:AppSecPenaltyBox", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetAppSecPenaltyBox gets an existing AppSecPenaltyBox 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 GetAppSecPenaltyBox(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *AppSecPenaltyBoxState, opts ...pulumi.ResourceOption) (*AppSecPenaltyBox, error) {
var resource AppSecPenaltyBox
err := ctx.ReadResource("akamai:index/appSecPenaltyBox:AppSecPenaltyBox", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering AppSecPenaltyBox resources.
type appSecPenaltyBoxState struct {
// . Unique identifier of the security configuration associated with the penalty box settings being modified.
ConfigId *int `pulumi:"configId"`
// . Action taken any time penalty box protection is triggered. Allowed values are:
// - **alert**. Record the event,
// - **deny**. Block the request.
// - **deny_custom_{custom_deny_id}**. Take the action specified by the custom deny.
// - **none**. Take no action.
PenaltyBoxAction *string `pulumi:"penaltyBoxAction"`
// . Set to **true** to enable penalty box protection; set to **false** to disable penalty box protection.
PenaltyBoxProtection *bool `pulumi:"penaltyBoxProtection"`
// . Unique identifier of the security policy associated with the penalty box settings being modified.
SecurityPolicyId *string `pulumi:"securityPolicyId"`
}
type AppSecPenaltyBoxState struct {
// . Unique identifier of the security configuration associated with the penalty box settings being modified.
ConfigId pulumi.IntPtrInput
// . Action taken any time penalty box protection is triggered. Allowed values are:
// - **alert**. Record the event,
// - **deny**. Block the request.
// - **deny_custom_{custom_deny_id}**. Take the action specified by the custom deny.
// - **none**. Take no action.
PenaltyBoxAction pulumi.StringPtrInput
// . Set to **true** to enable penalty box protection; set to **false** to disable penalty box protection.
PenaltyBoxProtection pulumi.BoolPtrInput
// . Unique identifier of the security policy associated with the penalty box settings being modified.
SecurityPolicyId pulumi.StringPtrInput
}
func (AppSecPenaltyBoxState) ElementType() reflect.Type {
return reflect.TypeOf((*appSecPenaltyBoxState)(nil)).Elem()
}
type appSecPenaltyBoxArgs struct {
// . Unique identifier of the security configuration associated with the penalty box settings being modified.
ConfigId int `pulumi:"configId"`
// . Action taken any time penalty box protection is triggered. Allowed values are:
// - **alert**. Record the event,
// - **deny**. Block the request.
// - **deny_custom_{custom_deny_id}**. Take the action specified by the custom deny.
// - **none**. Take no action.
PenaltyBoxAction string `pulumi:"penaltyBoxAction"`
// . Set to **true** to enable penalty box protection; set to **false** to disable penalty box protection.
PenaltyBoxProtection bool `pulumi:"penaltyBoxProtection"`
// . Unique identifier of the security policy associated with the penalty box settings being modified.
SecurityPolicyId string `pulumi:"securityPolicyId"`
}
// The set of arguments for constructing a AppSecPenaltyBox resource.
type AppSecPenaltyBoxArgs struct {
// . Unique identifier of the security configuration associated with the penalty box settings being modified.
ConfigId pulumi.IntInput
// . Action taken any time penalty box protection is triggered. Allowed values are:
// - **alert**. Record the event,
// - **deny**. Block the request.
// - **deny_custom_{custom_deny_id}**. Take the action specified by the custom deny.
// - **none**. Take no action.
PenaltyBoxAction pulumi.StringInput
// . Set to **true** to enable penalty box protection; set to **false** to disable penalty box protection.
PenaltyBoxProtection pulumi.BoolInput
// . Unique identifier of the security policy associated with the penalty box settings being modified.
SecurityPolicyId pulumi.StringInput
}
func (AppSecPenaltyBoxArgs) ElementType() reflect.Type {
return reflect.TypeOf((*appSecPenaltyBoxArgs)(nil)).Elem()
}
type AppSecPenaltyBoxInput interface {
pulumi.Input
ToAppSecPenaltyBoxOutput() AppSecPenaltyBoxOutput
ToAppSecPenaltyBoxOutputWithContext(ctx context.Context) AppSecPenaltyBoxOutput
}
func (*AppSecPenaltyBox) ElementType() reflect.Type {
return reflect.TypeOf((**AppSecPenaltyBox)(nil)).Elem()
}
func (i *AppSecPenaltyBox) ToAppSecPenaltyBoxOutput() AppSecPenaltyBoxOutput {
return i.ToAppSecPenaltyBoxOutputWithContext(context.Background())
}
func (i *AppSecPenaltyBox) ToAppSecPenaltyBoxOutputWithContext(ctx context.Context) AppSecPenaltyBoxOutput {
return pulumi.ToOutputWithContext(ctx, i).(AppSecPenaltyBoxOutput)
}
// AppSecPenaltyBoxArrayInput is an input type that accepts AppSecPenaltyBoxArray and AppSecPenaltyBoxArrayOutput values.
// You can construct a concrete instance of `AppSecPenaltyBoxArrayInput` via:
//
// AppSecPenaltyBoxArray{ AppSecPenaltyBoxArgs{...} }
type AppSecPenaltyBoxArrayInput interface {
pulumi.Input
ToAppSecPenaltyBoxArrayOutput() AppSecPenaltyBoxArrayOutput
ToAppSecPenaltyBoxArrayOutputWithContext(context.Context) AppSecPenaltyBoxArrayOutput
}
type AppSecPenaltyBoxArray []AppSecPenaltyBoxInput
func (AppSecPenaltyBoxArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AppSecPenaltyBox)(nil)).Elem()
}
func (i AppSecPenaltyBoxArray) ToAppSecPenaltyBoxArrayOutput() AppSecPenaltyBoxArrayOutput {
return i.ToAppSecPenaltyBoxArrayOutputWithContext(context.Background())
}
func (i AppSecPenaltyBoxArray) ToAppSecPenaltyBoxArrayOutputWithContext(ctx context.Context) AppSecPenaltyBoxArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(AppSecPenaltyBoxArrayOutput)
}
// AppSecPenaltyBoxMapInput is an input type that accepts AppSecPenaltyBoxMap and AppSecPenaltyBoxMapOutput values.
// You can construct a concrete instance of `AppSecPenaltyBoxMapInput` via:
//
// AppSecPenaltyBoxMap{ "key": AppSecPenaltyBoxArgs{...} }
type AppSecPenaltyBoxMapInput interface {
pulumi.Input
ToAppSecPenaltyBoxMapOutput() AppSecPenaltyBoxMapOutput
ToAppSecPenaltyBoxMapOutputWithContext(context.Context) AppSecPenaltyBoxMapOutput
}
type AppSecPenaltyBoxMap map[string]AppSecPenaltyBoxInput
func (AppSecPenaltyBoxMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AppSecPenaltyBox)(nil)).Elem()
}
func (i AppSecPenaltyBoxMap) ToAppSecPenaltyBoxMapOutput() AppSecPenaltyBoxMapOutput {
return i.ToAppSecPenaltyBoxMapOutputWithContext(context.Background())
}
func (i AppSecPenaltyBoxMap) ToAppSecPenaltyBoxMapOutputWithContext(ctx context.Context) AppSecPenaltyBoxMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(AppSecPenaltyBoxMapOutput)
}
type AppSecPenaltyBoxOutput struct{ *pulumi.OutputState }
func (AppSecPenaltyBoxOutput) ElementType() reflect.Type {
return reflect.TypeOf((**AppSecPenaltyBox)(nil)).Elem()
}
func (o AppSecPenaltyBoxOutput) ToAppSecPenaltyBoxOutput() AppSecPenaltyBoxOutput {
return o
}
func (o AppSecPenaltyBoxOutput) ToAppSecPenaltyBoxOutputWithContext(ctx context.Context) AppSecPenaltyBoxOutput {
return o
}
type AppSecPenaltyBoxArrayOutput struct{ *pulumi.OutputState }
func (AppSecPenaltyBoxArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AppSecPenaltyBox)(nil)).Elem()
}
func (o AppSecPenaltyBoxArrayOutput) ToAppSecPenaltyBoxArrayOutput() AppSecPenaltyBoxArrayOutput {
return o
}
func (o AppSecPenaltyBoxArrayOutput) ToAppSecPenaltyBoxArrayOutputWithContext(ctx context.Context) AppSecPenaltyBoxArrayOutput {
return o
}
func (o AppSecPenaltyBoxArrayOutput) Index(i pulumi.IntInput) AppSecPenaltyBoxOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AppSecPenaltyBox {
return vs[0].([]*AppSecPenaltyBox)[vs[1].(int)]
}).(AppSecPenaltyBoxOutput)
}
type AppSecPenaltyBoxMapOutput struct{ *pulumi.OutputState }
func (AppSecPenaltyBoxMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AppSecPenaltyBox)(nil)).Elem()
}
func (o AppSecPenaltyBoxMapOutput) ToAppSecPenaltyBoxMapOutput() AppSecPenaltyBoxMapOutput {
return o
}
func (o AppSecPenaltyBoxMapOutput) ToAppSecPenaltyBoxMapOutputWithContext(ctx context.Context) AppSecPenaltyBoxMapOutput {
return o
}
func (o AppSecPenaltyBoxMapOutput) MapIndex(k pulumi.StringInput) AppSecPenaltyBoxOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AppSecPenaltyBox {
return vs[0].(map[string]*AppSecPenaltyBox)[vs[1].(string)]
}).(AppSecPenaltyBoxOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*AppSecPenaltyBoxInput)(nil)).Elem(), &AppSecPenaltyBox{})
pulumi.RegisterInputType(reflect.TypeOf((*AppSecPenaltyBoxArrayInput)(nil)).Elem(), AppSecPenaltyBoxArray{})
pulumi.RegisterInputType(reflect.TypeOf((*AppSecPenaltyBoxMapInput)(nil)).Elem(), AppSecPenaltyBoxMap{})
pulumi.RegisterOutputType(AppSecPenaltyBoxOutput{})
pulumi.RegisterOutputType(AppSecPenaltyBoxArrayOutput{})
pulumi.RegisterOutputType(AppSecPenaltyBoxMapOutput{})
}