/
apiPolicy.go
321 lines (261 loc) · 11.2 KB
/
apiPolicy.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
// *** 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! ***
package apimanagement
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Manages an API Management API Policy
//
// ## Import
//
// API Management API Policy can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:apimanagement/apiPolicy:ApiPolicy example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/apis/exampleId/policies/policy
// ```
type ApiPolicy struct {
pulumi.CustomResourceState
// The name of the API Management Service. Changing this forces a new resource to be created.
ApiManagementName pulumi.StringOutput `pulumi:"apiManagementName"`
// The ID of the API Management API within the API Management Service. Changing this forces a new resource to be created.
ApiName pulumi.StringOutput `pulumi:"apiName"`
// The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringOutput `pulumi:"resourceGroupName"`
// The XML Content for this Policy as a string.
XmlContent pulumi.StringOutput `pulumi:"xmlContent"`
// A link to a Policy XML Document, which must be publicly available.
XmlLink pulumi.StringPtrOutput `pulumi:"xmlLink"`
}
// NewApiPolicy registers a new resource with the given unique name, arguments, and options.
func NewApiPolicy(ctx *pulumi.Context,
name string, args *ApiPolicyArgs, opts ...pulumi.ResourceOption) (*ApiPolicy, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ApiManagementName == nil {
return nil, errors.New("invalid value for required argument 'ApiManagementName'")
}
if args.ApiName == nil {
return nil, errors.New("invalid value for required argument 'ApiName'")
}
if args.ResourceGroupName == nil {
return nil, errors.New("invalid value for required argument 'ResourceGroupName'")
}
var resource ApiPolicy
err := ctx.RegisterResource("azure:apimanagement/apiPolicy:ApiPolicy", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetApiPolicy gets an existing ApiPolicy 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 GetApiPolicy(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ApiPolicyState, opts ...pulumi.ResourceOption) (*ApiPolicy, error) {
var resource ApiPolicy
err := ctx.ReadResource("azure:apimanagement/apiPolicy:ApiPolicy", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ApiPolicy resources.
type apiPolicyState struct {
// The name of the API Management Service. Changing this forces a new resource to be created.
ApiManagementName *string `pulumi:"apiManagementName"`
// The ID of the API Management API within the API Management Service. Changing this forces a new resource to be created.
ApiName *string `pulumi:"apiName"`
// The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
ResourceGroupName *string `pulumi:"resourceGroupName"`
// The XML Content for this Policy as a string.
XmlContent *string `pulumi:"xmlContent"`
// A link to a Policy XML Document, which must be publicly available.
XmlLink *string `pulumi:"xmlLink"`
}
type ApiPolicyState struct {
// The name of the API Management Service. Changing this forces a new resource to be created.
ApiManagementName pulumi.StringPtrInput
// The ID of the API Management API within the API Management Service. Changing this forces a new resource to be created.
ApiName pulumi.StringPtrInput
// The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringPtrInput
// The XML Content for this Policy as a string.
XmlContent pulumi.StringPtrInput
// A link to a Policy XML Document, which must be publicly available.
XmlLink pulumi.StringPtrInput
}
func (ApiPolicyState) ElementType() reflect.Type {
return reflect.TypeOf((*apiPolicyState)(nil)).Elem()
}
type apiPolicyArgs struct {
// The name of the API Management Service. Changing this forces a new resource to be created.
ApiManagementName string `pulumi:"apiManagementName"`
// The ID of the API Management API within the API Management Service. Changing this forces a new resource to be created.
ApiName string `pulumi:"apiName"`
// The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
ResourceGroupName string `pulumi:"resourceGroupName"`
// The XML Content for this Policy as a string.
XmlContent *string `pulumi:"xmlContent"`
// A link to a Policy XML Document, which must be publicly available.
XmlLink *string `pulumi:"xmlLink"`
}
// The set of arguments for constructing a ApiPolicy resource.
type ApiPolicyArgs struct {
// The name of the API Management Service. Changing this forces a new resource to be created.
ApiManagementName pulumi.StringInput
// The ID of the API Management API within the API Management Service. Changing this forces a new resource to be created.
ApiName pulumi.StringInput
// The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringInput
// The XML Content for this Policy as a string.
XmlContent pulumi.StringPtrInput
// A link to a Policy XML Document, which must be publicly available.
XmlLink pulumi.StringPtrInput
}
func (ApiPolicyArgs) ElementType() reflect.Type {
return reflect.TypeOf((*apiPolicyArgs)(nil)).Elem()
}
type ApiPolicyInput interface {
pulumi.Input
ToApiPolicyOutput() ApiPolicyOutput
ToApiPolicyOutputWithContext(ctx context.Context) ApiPolicyOutput
}
func (*ApiPolicy) ElementType() reflect.Type {
return reflect.TypeOf((*ApiPolicy)(nil))
}
func (i *ApiPolicy) ToApiPolicyOutput() ApiPolicyOutput {
return i.ToApiPolicyOutputWithContext(context.Background())
}
func (i *ApiPolicy) ToApiPolicyOutputWithContext(ctx context.Context) ApiPolicyOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApiPolicyOutput)
}
func (i *ApiPolicy) ToApiPolicyPtrOutput() ApiPolicyPtrOutput {
return i.ToApiPolicyPtrOutputWithContext(context.Background())
}
func (i *ApiPolicy) ToApiPolicyPtrOutputWithContext(ctx context.Context) ApiPolicyPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApiPolicyPtrOutput)
}
type ApiPolicyPtrInput interface {
pulumi.Input
ToApiPolicyPtrOutput() ApiPolicyPtrOutput
ToApiPolicyPtrOutputWithContext(ctx context.Context) ApiPolicyPtrOutput
}
type apiPolicyPtrType ApiPolicyArgs
func (*apiPolicyPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**ApiPolicy)(nil))
}
func (i *apiPolicyPtrType) ToApiPolicyPtrOutput() ApiPolicyPtrOutput {
return i.ToApiPolicyPtrOutputWithContext(context.Background())
}
func (i *apiPolicyPtrType) ToApiPolicyPtrOutputWithContext(ctx context.Context) ApiPolicyPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApiPolicyPtrOutput)
}
// ApiPolicyArrayInput is an input type that accepts ApiPolicyArray and ApiPolicyArrayOutput values.
// You can construct a concrete instance of `ApiPolicyArrayInput` via:
//
// ApiPolicyArray{ ApiPolicyArgs{...} }
type ApiPolicyArrayInput interface {
pulumi.Input
ToApiPolicyArrayOutput() ApiPolicyArrayOutput
ToApiPolicyArrayOutputWithContext(context.Context) ApiPolicyArrayOutput
}
type ApiPolicyArray []ApiPolicyInput
func (ApiPolicyArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*ApiPolicy)(nil))
}
func (i ApiPolicyArray) ToApiPolicyArrayOutput() ApiPolicyArrayOutput {
return i.ToApiPolicyArrayOutputWithContext(context.Background())
}
func (i ApiPolicyArray) ToApiPolicyArrayOutputWithContext(ctx context.Context) ApiPolicyArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApiPolicyArrayOutput)
}
// ApiPolicyMapInput is an input type that accepts ApiPolicyMap and ApiPolicyMapOutput values.
// You can construct a concrete instance of `ApiPolicyMapInput` via:
//
// ApiPolicyMap{ "key": ApiPolicyArgs{...} }
type ApiPolicyMapInput interface {
pulumi.Input
ToApiPolicyMapOutput() ApiPolicyMapOutput
ToApiPolicyMapOutputWithContext(context.Context) ApiPolicyMapOutput
}
type ApiPolicyMap map[string]ApiPolicyInput
func (ApiPolicyMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*ApiPolicy)(nil))
}
func (i ApiPolicyMap) ToApiPolicyMapOutput() ApiPolicyMapOutput {
return i.ToApiPolicyMapOutputWithContext(context.Background())
}
func (i ApiPolicyMap) ToApiPolicyMapOutputWithContext(ctx context.Context) ApiPolicyMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApiPolicyMapOutput)
}
type ApiPolicyOutput struct {
*pulumi.OutputState
}
func (ApiPolicyOutput) ElementType() reflect.Type {
return reflect.TypeOf((*ApiPolicy)(nil))
}
func (o ApiPolicyOutput) ToApiPolicyOutput() ApiPolicyOutput {
return o
}
func (o ApiPolicyOutput) ToApiPolicyOutputWithContext(ctx context.Context) ApiPolicyOutput {
return o
}
func (o ApiPolicyOutput) ToApiPolicyPtrOutput() ApiPolicyPtrOutput {
return o.ToApiPolicyPtrOutputWithContext(context.Background())
}
func (o ApiPolicyOutput) ToApiPolicyPtrOutputWithContext(ctx context.Context) ApiPolicyPtrOutput {
return o.ApplyT(func(v ApiPolicy) *ApiPolicy {
return &v
}).(ApiPolicyPtrOutput)
}
type ApiPolicyPtrOutput struct {
*pulumi.OutputState
}
func (ApiPolicyPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ApiPolicy)(nil))
}
func (o ApiPolicyPtrOutput) ToApiPolicyPtrOutput() ApiPolicyPtrOutput {
return o
}
func (o ApiPolicyPtrOutput) ToApiPolicyPtrOutputWithContext(ctx context.Context) ApiPolicyPtrOutput {
return o
}
type ApiPolicyArrayOutput struct{ *pulumi.OutputState }
func (ApiPolicyArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]ApiPolicy)(nil))
}
func (o ApiPolicyArrayOutput) ToApiPolicyArrayOutput() ApiPolicyArrayOutput {
return o
}
func (o ApiPolicyArrayOutput) ToApiPolicyArrayOutputWithContext(ctx context.Context) ApiPolicyArrayOutput {
return o
}
func (o ApiPolicyArrayOutput) Index(i pulumi.IntInput) ApiPolicyOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) ApiPolicy {
return vs[0].([]ApiPolicy)[vs[1].(int)]
}).(ApiPolicyOutput)
}
type ApiPolicyMapOutput struct{ *pulumi.OutputState }
func (ApiPolicyMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]ApiPolicy)(nil))
}
func (o ApiPolicyMapOutput) ToApiPolicyMapOutput() ApiPolicyMapOutput {
return o
}
func (o ApiPolicyMapOutput) ToApiPolicyMapOutputWithContext(ctx context.Context) ApiPolicyMapOutput {
return o
}
func (o ApiPolicyMapOutput) MapIndex(k pulumi.StringInput) ApiPolicyOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) ApiPolicy {
return vs[0].(map[string]ApiPolicy)[vs[1].(string)]
}).(ApiPolicyOutput)
}
func init() {
pulumi.RegisterOutputType(ApiPolicyOutput{})
pulumi.RegisterOutputType(ApiPolicyPtrOutput{})
pulumi.RegisterOutputType(ApiPolicyArrayOutput{})
pulumi.RegisterOutputType(ApiPolicyMapOutput{})
}