/
appSecAttackGroup.go
331 lines (285 loc) · 14.7 KB
/
appSecAttackGroup.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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
// 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**: Attack group
//
// Modify an attack group's action, conditions, and exceptions. Attack groups are collections of Kona Rule Set rules used to streamline the management of website protections.
//
// **Related API Endpoints**: [/appsec/v1/configs/{configId}/versions/{versionNumber}/security-policies/{policyId}/attack-groups/{attackGroupId}](https://developer.akamai.com/api/cloud_security/application_security/v1.html#putattackgroup) *and* [/appsec/v1/configs/{configId}/versions/{versionNumber}/security-policies/{policyId}/attack-groups/{attackGroupId}/condition-exception](https://developer.akamai.com/api/cloud_security/application_security/v1.html#putattackgroupconditionexception)
//
// ## Example Usage
//
// Basic usage:
//
// ```go
// package main
//
// import (
// "fmt"
// "io/ioutil"
//
// "github.com/pulumi/pulumi-akamai/sdk/v2/go/akamai"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func readFileOrPanic(path string) pulumi.StringPtrInput {
// data, err := ioutil.ReadFile(path)
// if err != nil {
// panic(err.Error())
// }
// return pulumi.String(string(data))
// }
//
// 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.NewAppSecAttackGroup(ctx, "attackGroup", &akamai.AppSecAttackGroupArgs{
// ConfigId: pulumi.Int(configuration.ConfigId),
// SecurityPolicyId: pulumi.String("gms1_134637"),
// AttackGroup: pulumi.String("SQL"),
// AttackGroupAction: pulumi.String("deny"),
// ConditionException: readFileOrPanic(fmt.Sprintf("%v%v", path.Module, "/condition_exception.json")),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type AppSecAttackGroup struct {
pulumi.CustomResourceState
// . Unique name of the attack group being modified.
AttackGroup pulumi.StringOutput `pulumi:"attackGroup"`
// . Action taken any time the attack group is triggered. Allowed values are:
// - **alert**. Record information about the request.
// - **deny**. Block the request,
// - **deny_custom_{custom_deny_id}**. Take the action specified by the custom deny.
// - **none**. Take no action.
AttackGroupAction pulumi.StringOutput `pulumi:"attackGroupAction"`
// . Path to a JSON file containing the conditions and exceptions to be assigned to the attack group. You can view a sample JSON file in the [Modify the exceptions of an attack group](https://developer.akamai.com/api/cloud_security/application_security/v1.html#putattackgroupconditionexception) section of the Application Security API documentation.
ConditionException pulumi.StringPtrOutput `pulumi:"conditionException"`
// . Unique identifier of the security configuration associated with the attack group being modified.
ConfigId pulumi.IntOutput `pulumi:"configId"`
// . Unique identifier of the security policy associated with the attack group being modified.
SecurityPolicyId pulumi.StringOutput `pulumi:"securityPolicyId"`
}
// NewAppSecAttackGroup registers a new resource with the given unique name, arguments, and options.
func NewAppSecAttackGroup(ctx *pulumi.Context,
name string, args *AppSecAttackGroupArgs, opts ...pulumi.ResourceOption) (*AppSecAttackGroup, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AttackGroup == nil {
return nil, errors.New("invalid value for required argument 'AttackGroup'")
}
if args.AttackGroupAction == nil {
return nil, errors.New("invalid value for required argument 'AttackGroupAction'")
}
if args.ConfigId == nil {
return nil, errors.New("invalid value for required argument 'ConfigId'")
}
if args.SecurityPolicyId == nil {
return nil, errors.New("invalid value for required argument 'SecurityPolicyId'")
}
var resource AppSecAttackGroup
err := ctx.RegisterResource("akamai:index/appSecAttackGroup:AppSecAttackGroup", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetAppSecAttackGroup gets an existing AppSecAttackGroup 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 GetAppSecAttackGroup(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *AppSecAttackGroupState, opts ...pulumi.ResourceOption) (*AppSecAttackGroup, error) {
var resource AppSecAttackGroup
err := ctx.ReadResource("akamai:index/appSecAttackGroup:AppSecAttackGroup", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering AppSecAttackGroup resources.
type appSecAttackGroupState struct {
// . Unique name of the attack group being modified.
AttackGroup *string `pulumi:"attackGroup"`
// . Action taken any time the attack group is triggered. Allowed values are:
// - **alert**. Record information about the request.
// - **deny**. Block the request,
// - **deny_custom_{custom_deny_id}**. Take the action specified by the custom deny.
// - **none**. Take no action.
AttackGroupAction *string `pulumi:"attackGroupAction"`
// . Path to a JSON file containing the conditions and exceptions to be assigned to the attack group. You can view a sample JSON file in the [Modify the exceptions of an attack group](https://developer.akamai.com/api/cloud_security/application_security/v1.html#putattackgroupconditionexception) section of the Application Security API documentation.
ConditionException *string `pulumi:"conditionException"`
// . Unique identifier of the security configuration associated with the attack group being modified.
ConfigId *int `pulumi:"configId"`
// . Unique identifier of the security policy associated with the attack group being modified.
SecurityPolicyId *string `pulumi:"securityPolicyId"`
}
type AppSecAttackGroupState struct {
// . Unique name of the attack group being modified.
AttackGroup pulumi.StringPtrInput
// . Action taken any time the attack group is triggered. Allowed values are:
// - **alert**. Record information about the request.
// - **deny**. Block the request,
// - **deny_custom_{custom_deny_id}**. Take the action specified by the custom deny.
// - **none**. Take no action.
AttackGroupAction pulumi.StringPtrInput
// . Path to a JSON file containing the conditions and exceptions to be assigned to the attack group. You can view a sample JSON file in the [Modify the exceptions of an attack group](https://developer.akamai.com/api/cloud_security/application_security/v1.html#putattackgroupconditionexception) section of the Application Security API documentation.
ConditionException pulumi.StringPtrInput
// . Unique identifier of the security configuration associated with the attack group being modified.
ConfigId pulumi.IntPtrInput
// . Unique identifier of the security policy associated with the attack group being modified.
SecurityPolicyId pulumi.StringPtrInput
}
func (AppSecAttackGroupState) ElementType() reflect.Type {
return reflect.TypeOf((*appSecAttackGroupState)(nil)).Elem()
}
type appSecAttackGroupArgs struct {
// . Unique name of the attack group being modified.
AttackGroup string `pulumi:"attackGroup"`
// . Action taken any time the attack group is triggered. Allowed values are:
// - **alert**. Record information about the request.
// - **deny**. Block the request,
// - **deny_custom_{custom_deny_id}**. Take the action specified by the custom deny.
// - **none**. Take no action.
AttackGroupAction string `pulumi:"attackGroupAction"`
// . Path to a JSON file containing the conditions and exceptions to be assigned to the attack group. You can view a sample JSON file in the [Modify the exceptions of an attack group](https://developer.akamai.com/api/cloud_security/application_security/v1.html#putattackgroupconditionexception) section of the Application Security API documentation.
ConditionException *string `pulumi:"conditionException"`
// . Unique identifier of the security configuration associated with the attack group being modified.
ConfigId int `pulumi:"configId"`
// . Unique identifier of the security policy associated with the attack group being modified.
SecurityPolicyId string `pulumi:"securityPolicyId"`
}
// The set of arguments for constructing a AppSecAttackGroup resource.
type AppSecAttackGroupArgs struct {
// . Unique name of the attack group being modified.
AttackGroup pulumi.StringInput
// . Action taken any time the attack group is triggered. Allowed values are:
// - **alert**. Record information about the request.
// - **deny**. Block the request,
// - **deny_custom_{custom_deny_id}**. Take the action specified by the custom deny.
// - **none**. Take no action.
AttackGroupAction pulumi.StringInput
// . Path to a JSON file containing the conditions and exceptions to be assigned to the attack group. You can view a sample JSON file in the [Modify the exceptions of an attack group](https://developer.akamai.com/api/cloud_security/application_security/v1.html#putattackgroupconditionexception) section of the Application Security API documentation.
ConditionException pulumi.StringPtrInput
// . Unique identifier of the security configuration associated with the attack group being modified.
ConfigId pulumi.IntInput
// . Unique identifier of the security policy associated with the attack group being modified.
SecurityPolicyId pulumi.StringInput
}
func (AppSecAttackGroupArgs) ElementType() reflect.Type {
return reflect.TypeOf((*appSecAttackGroupArgs)(nil)).Elem()
}
type AppSecAttackGroupInput interface {
pulumi.Input
ToAppSecAttackGroupOutput() AppSecAttackGroupOutput
ToAppSecAttackGroupOutputWithContext(ctx context.Context) AppSecAttackGroupOutput
}
func (*AppSecAttackGroup) ElementType() reflect.Type {
return reflect.TypeOf((**AppSecAttackGroup)(nil)).Elem()
}
func (i *AppSecAttackGroup) ToAppSecAttackGroupOutput() AppSecAttackGroupOutput {
return i.ToAppSecAttackGroupOutputWithContext(context.Background())
}
func (i *AppSecAttackGroup) ToAppSecAttackGroupOutputWithContext(ctx context.Context) AppSecAttackGroupOutput {
return pulumi.ToOutputWithContext(ctx, i).(AppSecAttackGroupOutput)
}
// AppSecAttackGroupArrayInput is an input type that accepts AppSecAttackGroupArray and AppSecAttackGroupArrayOutput values.
// You can construct a concrete instance of `AppSecAttackGroupArrayInput` via:
//
// AppSecAttackGroupArray{ AppSecAttackGroupArgs{...} }
type AppSecAttackGroupArrayInput interface {
pulumi.Input
ToAppSecAttackGroupArrayOutput() AppSecAttackGroupArrayOutput
ToAppSecAttackGroupArrayOutputWithContext(context.Context) AppSecAttackGroupArrayOutput
}
type AppSecAttackGroupArray []AppSecAttackGroupInput
func (AppSecAttackGroupArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AppSecAttackGroup)(nil)).Elem()
}
func (i AppSecAttackGroupArray) ToAppSecAttackGroupArrayOutput() AppSecAttackGroupArrayOutput {
return i.ToAppSecAttackGroupArrayOutputWithContext(context.Background())
}
func (i AppSecAttackGroupArray) ToAppSecAttackGroupArrayOutputWithContext(ctx context.Context) AppSecAttackGroupArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(AppSecAttackGroupArrayOutput)
}
// AppSecAttackGroupMapInput is an input type that accepts AppSecAttackGroupMap and AppSecAttackGroupMapOutput values.
// You can construct a concrete instance of `AppSecAttackGroupMapInput` via:
//
// AppSecAttackGroupMap{ "key": AppSecAttackGroupArgs{...} }
type AppSecAttackGroupMapInput interface {
pulumi.Input
ToAppSecAttackGroupMapOutput() AppSecAttackGroupMapOutput
ToAppSecAttackGroupMapOutputWithContext(context.Context) AppSecAttackGroupMapOutput
}
type AppSecAttackGroupMap map[string]AppSecAttackGroupInput
func (AppSecAttackGroupMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AppSecAttackGroup)(nil)).Elem()
}
func (i AppSecAttackGroupMap) ToAppSecAttackGroupMapOutput() AppSecAttackGroupMapOutput {
return i.ToAppSecAttackGroupMapOutputWithContext(context.Background())
}
func (i AppSecAttackGroupMap) ToAppSecAttackGroupMapOutputWithContext(ctx context.Context) AppSecAttackGroupMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(AppSecAttackGroupMapOutput)
}
type AppSecAttackGroupOutput struct{ *pulumi.OutputState }
func (AppSecAttackGroupOutput) ElementType() reflect.Type {
return reflect.TypeOf((**AppSecAttackGroup)(nil)).Elem()
}
func (o AppSecAttackGroupOutput) ToAppSecAttackGroupOutput() AppSecAttackGroupOutput {
return o
}
func (o AppSecAttackGroupOutput) ToAppSecAttackGroupOutputWithContext(ctx context.Context) AppSecAttackGroupOutput {
return o
}
type AppSecAttackGroupArrayOutput struct{ *pulumi.OutputState }
func (AppSecAttackGroupArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AppSecAttackGroup)(nil)).Elem()
}
func (o AppSecAttackGroupArrayOutput) ToAppSecAttackGroupArrayOutput() AppSecAttackGroupArrayOutput {
return o
}
func (o AppSecAttackGroupArrayOutput) ToAppSecAttackGroupArrayOutputWithContext(ctx context.Context) AppSecAttackGroupArrayOutput {
return o
}
func (o AppSecAttackGroupArrayOutput) Index(i pulumi.IntInput) AppSecAttackGroupOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AppSecAttackGroup {
return vs[0].([]*AppSecAttackGroup)[vs[1].(int)]
}).(AppSecAttackGroupOutput)
}
type AppSecAttackGroupMapOutput struct{ *pulumi.OutputState }
func (AppSecAttackGroupMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AppSecAttackGroup)(nil)).Elem()
}
func (o AppSecAttackGroupMapOutput) ToAppSecAttackGroupMapOutput() AppSecAttackGroupMapOutput {
return o
}
func (o AppSecAttackGroupMapOutput) ToAppSecAttackGroupMapOutputWithContext(ctx context.Context) AppSecAttackGroupMapOutput {
return o
}
func (o AppSecAttackGroupMapOutput) MapIndex(k pulumi.StringInput) AppSecAttackGroupOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AppSecAttackGroup {
return vs[0].(map[string]*AppSecAttackGroup)[vs[1].(string)]
}).(AppSecAttackGroupOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*AppSecAttackGroupInput)(nil)).Elem(), &AppSecAttackGroup{})
pulumi.RegisterInputType(reflect.TypeOf((*AppSecAttackGroupArrayInput)(nil)).Elem(), AppSecAttackGroupArray{})
pulumi.RegisterInputType(reflect.TypeOf((*AppSecAttackGroupMapInput)(nil)).Elem(), AppSecAttackGroupMap{})
pulumi.RegisterOutputType(AppSecAttackGroupOutput{})
pulumi.RegisterOutputType(AppSecAttackGroupArrayOutput{})
pulumi.RegisterOutputType(AppSecAttackGroupMapOutput{})
}