/
appSecConfiguration.go
345 lines (299 loc) · 14.6 KB
/
appSecConfiguration.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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
// 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**: Contract and group
//
// Creates a new WAP (Web Application Protector) or KSD (Kona Site Defender) security configuration. KSD security configurations start out empty (i.e., unconfigured), while WAP configurations are created using preset values. The contract referenced in the request body determines the type of configuration you can create.
//
// In addition to manually creating a new configuration, you can use the `createFromConfigId` argument to clone an existing configuration.
//
// **Related API Endpoint**: [/appsec/v1/configs](https://developer.akamai.com/api/cloud_security/application_security/v1.html#postconfigurations)
//
// ## 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 {
// selectableHostnames, err := akamai.GetAppSecSelectableHostnames(ctx, &GetAppSecSelectableHostnamesArgs{
// ConfigId: pulumi.IntRef("Documentation"),
// }, nil)
// if err != nil {
// return err
// }
// createConfig, err := akamai.NewAppSecConfiguration(ctx, "createConfig", &akamai.AppSecConfigurationArgs{
// Description: pulumi.String("This configuration is used as a testing environment for the documentation team."),
// ContractId: pulumi.String("5-2WA382"),
// GroupId: pulumi.Int(12198),
// HostNames: pulumi.StringArray{
// pulumi.String("documentation.akamai.com"),
// pulumi.String("training.akamai.com"),
// },
// })
// if err != nil {
// return err
// }
// ctx.Export("createConfigId", createConfig.ConfigId)
// cloneConfig, err := akamai.NewAppSecConfiguration(ctx, "cloneConfig", &akamai.AppSecConfigurationArgs{
// Description: pulumi.String("This configuration is used as a testing environment for the documentation team."),
// CreateFromConfigId: pulumi.Any(data.Akamai_appsec_configuration.Configuration.Config_id),
// CreateFromVersion: pulumi.Any(data.Akamai_appsec_configuration.Configuration.Latest_version),
// ContractId: pulumi.String("5-2WA382"),
// GroupId: pulumi.Int(12198),
// HostNames: interface{}(selectableHostnames.Hostnames),
// })
// if err != nil {
// return err
// }
// ctx.Export("cloneConfigId", cloneConfig.ConfigId)
// return nil
// })
// }
// ```
// ## Output Options
//
// The following options can be used to determine the information returned, and how that returned information is formatted:
//
// - `configId`. ID of the new security configuration.
type AppSecConfiguration struct {
pulumi.CustomResourceState
ConfigId pulumi.IntOutput `pulumi:"configId"`
// . Unique identifier of the Akamai contract t associated with the new configuration.
ContractId pulumi.StringOutput `pulumi:"contractId"`
// . Unique identifier of the existing configuration being cloned in order to create the new configuration.
CreateFromConfigId pulumi.IntPtrOutput `pulumi:"createFromConfigId"`
// . Version number of the security configuration being cloned.
CreateFromVersion pulumi.IntPtrOutput `pulumi:"createFromVersion"`
// . Brief description of the new configuration.
Description pulumi.StringOutput `pulumi:"description"`
// . Unique identifier of the contract group associated with the new configuration.
GroupId pulumi.IntOutput `pulumi:"groupId"`
// . JSON array containing the hostnames to be protected by the new configuration. You must specify at least one hostname in order to create a new configuration.
HostNames pulumi.StringArrayOutput `pulumi:"hostNames"`
// . Name of the new configuration.
Name pulumi.StringOutput `pulumi:"name"`
}
// NewAppSecConfiguration registers a new resource with the given unique name, arguments, and options.
func NewAppSecConfiguration(ctx *pulumi.Context,
name string, args *AppSecConfigurationArgs, opts ...pulumi.ResourceOption) (*AppSecConfiguration, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ContractId == nil {
return nil, errors.New("invalid value for required argument 'ContractId'")
}
if args.Description == nil {
return nil, errors.New("invalid value for required argument 'Description'")
}
if args.GroupId == nil {
return nil, errors.New("invalid value for required argument 'GroupId'")
}
if args.HostNames == nil {
return nil, errors.New("invalid value for required argument 'HostNames'")
}
var resource AppSecConfiguration
err := ctx.RegisterResource("akamai:index/appSecConfiguration:AppSecConfiguration", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetAppSecConfiguration gets an existing AppSecConfiguration 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 GetAppSecConfiguration(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *AppSecConfigurationState, opts ...pulumi.ResourceOption) (*AppSecConfiguration, error) {
var resource AppSecConfiguration
err := ctx.ReadResource("akamai:index/appSecConfiguration:AppSecConfiguration", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering AppSecConfiguration resources.
type appSecConfigurationState struct {
ConfigId *int `pulumi:"configId"`
// . Unique identifier of the Akamai contract t associated with the new configuration.
ContractId *string `pulumi:"contractId"`
// . Unique identifier of the existing configuration being cloned in order to create the new configuration.
CreateFromConfigId *int `pulumi:"createFromConfigId"`
// . Version number of the security configuration being cloned.
CreateFromVersion *int `pulumi:"createFromVersion"`
// . Brief description of the new configuration.
Description *string `pulumi:"description"`
// . Unique identifier of the contract group associated with the new configuration.
GroupId *int `pulumi:"groupId"`
// . JSON array containing the hostnames to be protected by the new configuration. You must specify at least one hostname in order to create a new configuration.
HostNames []string `pulumi:"hostNames"`
// . Name of the new configuration.
Name *string `pulumi:"name"`
}
type AppSecConfigurationState struct {
ConfigId pulumi.IntPtrInput
// . Unique identifier of the Akamai contract t associated with the new configuration.
ContractId pulumi.StringPtrInput
// . Unique identifier of the existing configuration being cloned in order to create the new configuration.
CreateFromConfigId pulumi.IntPtrInput
// . Version number of the security configuration being cloned.
CreateFromVersion pulumi.IntPtrInput
// . Brief description of the new configuration.
Description pulumi.StringPtrInput
// . Unique identifier of the contract group associated with the new configuration.
GroupId pulumi.IntPtrInput
// . JSON array containing the hostnames to be protected by the new configuration. You must specify at least one hostname in order to create a new configuration.
HostNames pulumi.StringArrayInput
// . Name of the new configuration.
Name pulumi.StringPtrInput
}
func (AppSecConfigurationState) ElementType() reflect.Type {
return reflect.TypeOf((*appSecConfigurationState)(nil)).Elem()
}
type appSecConfigurationArgs struct {
// . Unique identifier of the Akamai contract t associated with the new configuration.
ContractId string `pulumi:"contractId"`
// . Unique identifier of the existing configuration being cloned in order to create the new configuration.
CreateFromConfigId *int `pulumi:"createFromConfigId"`
// . Version number of the security configuration being cloned.
CreateFromVersion *int `pulumi:"createFromVersion"`
// . Brief description of the new configuration.
Description string `pulumi:"description"`
// . Unique identifier of the contract group associated with the new configuration.
GroupId int `pulumi:"groupId"`
// . JSON array containing the hostnames to be protected by the new configuration. You must specify at least one hostname in order to create a new configuration.
HostNames []string `pulumi:"hostNames"`
// . Name of the new configuration.
Name *string `pulumi:"name"`
}
// The set of arguments for constructing a AppSecConfiguration resource.
type AppSecConfigurationArgs struct {
// . Unique identifier of the Akamai contract t associated with the new configuration.
ContractId pulumi.StringInput
// . Unique identifier of the existing configuration being cloned in order to create the new configuration.
CreateFromConfigId pulumi.IntPtrInput
// . Version number of the security configuration being cloned.
CreateFromVersion pulumi.IntPtrInput
// . Brief description of the new configuration.
Description pulumi.StringInput
// . Unique identifier of the contract group associated with the new configuration.
GroupId pulumi.IntInput
// . JSON array containing the hostnames to be protected by the new configuration. You must specify at least one hostname in order to create a new configuration.
HostNames pulumi.StringArrayInput
// . Name of the new configuration.
Name pulumi.StringPtrInput
}
func (AppSecConfigurationArgs) ElementType() reflect.Type {
return reflect.TypeOf((*appSecConfigurationArgs)(nil)).Elem()
}
type AppSecConfigurationInput interface {
pulumi.Input
ToAppSecConfigurationOutput() AppSecConfigurationOutput
ToAppSecConfigurationOutputWithContext(ctx context.Context) AppSecConfigurationOutput
}
func (*AppSecConfiguration) ElementType() reflect.Type {
return reflect.TypeOf((**AppSecConfiguration)(nil)).Elem()
}
func (i *AppSecConfiguration) ToAppSecConfigurationOutput() AppSecConfigurationOutput {
return i.ToAppSecConfigurationOutputWithContext(context.Background())
}
func (i *AppSecConfiguration) ToAppSecConfigurationOutputWithContext(ctx context.Context) AppSecConfigurationOutput {
return pulumi.ToOutputWithContext(ctx, i).(AppSecConfigurationOutput)
}
// AppSecConfigurationArrayInput is an input type that accepts AppSecConfigurationArray and AppSecConfigurationArrayOutput values.
// You can construct a concrete instance of `AppSecConfigurationArrayInput` via:
//
// AppSecConfigurationArray{ AppSecConfigurationArgs{...} }
type AppSecConfigurationArrayInput interface {
pulumi.Input
ToAppSecConfigurationArrayOutput() AppSecConfigurationArrayOutput
ToAppSecConfigurationArrayOutputWithContext(context.Context) AppSecConfigurationArrayOutput
}
type AppSecConfigurationArray []AppSecConfigurationInput
func (AppSecConfigurationArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AppSecConfiguration)(nil)).Elem()
}
func (i AppSecConfigurationArray) ToAppSecConfigurationArrayOutput() AppSecConfigurationArrayOutput {
return i.ToAppSecConfigurationArrayOutputWithContext(context.Background())
}
func (i AppSecConfigurationArray) ToAppSecConfigurationArrayOutputWithContext(ctx context.Context) AppSecConfigurationArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(AppSecConfigurationArrayOutput)
}
// AppSecConfigurationMapInput is an input type that accepts AppSecConfigurationMap and AppSecConfigurationMapOutput values.
// You can construct a concrete instance of `AppSecConfigurationMapInput` via:
//
// AppSecConfigurationMap{ "key": AppSecConfigurationArgs{...} }
type AppSecConfigurationMapInput interface {
pulumi.Input
ToAppSecConfigurationMapOutput() AppSecConfigurationMapOutput
ToAppSecConfigurationMapOutputWithContext(context.Context) AppSecConfigurationMapOutput
}
type AppSecConfigurationMap map[string]AppSecConfigurationInput
func (AppSecConfigurationMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AppSecConfiguration)(nil)).Elem()
}
func (i AppSecConfigurationMap) ToAppSecConfigurationMapOutput() AppSecConfigurationMapOutput {
return i.ToAppSecConfigurationMapOutputWithContext(context.Background())
}
func (i AppSecConfigurationMap) ToAppSecConfigurationMapOutputWithContext(ctx context.Context) AppSecConfigurationMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(AppSecConfigurationMapOutput)
}
type AppSecConfigurationOutput struct{ *pulumi.OutputState }
func (AppSecConfigurationOutput) ElementType() reflect.Type {
return reflect.TypeOf((**AppSecConfiguration)(nil)).Elem()
}
func (o AppSecConfigurationOutput) ToAppSecConfigurationOutput() AppSecConfigurationOutput {
return o
}
func (o AppSecConfigurationOutput) ToAppSecConfigurationOutputWithContext(ctx context.Context) AppSecConfigurationOutput {
return o
}
type AppSecConfigurationArrayOutput struct{ *pulumi.OutputState }
func (AppSecConfigurationArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AppSecConfiguration)(nil)).Elem()
}
func (o AppSecConfigurationArrayOutput) ToAppSecConfigurationArrayOutput() AppSecConfigurationArrayOutput {
return o
}
func (o AppSecConfigurationArrayOutput) ToAppSecConfigurationArrayOutputWithContext(ctx context.Context) AppSecConfigurationArrayOutput {
return o
}
func (o AppSecConfigurationArrayOutput) Index(i pulumi.IntInput) AppSecConfigurationOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AppSecConfiguration {
return vs[0].([]*AppSecConfiguration)[vs[1].(int)]
}).(AppSecConfigurationOutput)
}
type AppSecConfigurationMapOutput struct{ *pulumi.OutputState }
func (AppSecConfigurationMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AppSecConfiguration)(nil)).Elem()
}
func (o AppSecConfigurationMapOutput) ToAppSecConfigurationMapOutput() AppSecConfigurationMapOutput {
return o
}
func (o AppSecConfigurationMapOutput) ToAppSecConfigurationMapOutputWithContext(ctx context.Context) AppSecConfigurationMapOutput {
return o
}
func (o AppSecConfigurationMapOutput) MapIndex(k pulumi.StringInput) AppSecConfigurationOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AppSecConfiguration {
return vs[0].(map[string]*AppSecConfiguration)[vs[1].(string)]
}).(AppSecConfigurationOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*AppSecConfigurationInput)(nil)).Elem(), &AppSecConfiguration{})
pulumi.RegisterInputType(reflect.TypeOf((*AppSecConfigurationArrayInput)(nil)).Elem(), AppSecConfigurationArray{})
pulumi.RegisterInputType(reflect.TypeOf((*AppSecConfigurationMapInput)(nil)).Elem(), AppSecConfigurationMap{})
pulumi.RegisterOutputType(AppSecConfigurationOutput{})
pulumi.RegisterOutputType(AppSecConfigurationArrayOutput{})
pulumi.RegisterOutputType(AppSecConfigurationMapOutput{})
}