/
customHostname.go
346 lines (286 loc) · 12.1 KB
/
customHostname.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
346
// *** 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 cloudflare
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a Cloudflare custom hostname (also known as SSL for SaaS) resource.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-cloudflare/sdk/v3/go/cloudflare"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := cloudflare.NewCustomHostname(ctx, "exampleHostname", &cloudflare.CustomHostnameArgs{
// Hostname: pulumi.String("hostname.example.com"),
// Ssls: cloudflare.CustomHostnameSslArray{
// &cloudflare.CustomHostnameSslArgs{
// Method: pulumi.String("txt"),
// },
// },
// ZoneId: pulumi.String("d41d8cd98f00b204e9800998ecf8427e"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Custom hostname certificates can be imported using a composite ID formed of the zone ID and [hostname ID](https://api.cloudflare.com/#custom-hostname-for-a-zone-properties), separated by a "/" e.g.
//
// ```sh
// $ pulumi import cloudflare:index/customHostname:CustomHostname example d41d8cd98f00b204e9800998ecf8427e/0d89c70d-ad9f-4843-b99f-6cc0252067e9
// ```
type CustomHostname struct {
pulumi.CustomResourceState
// The custom origin server used for certificates.
CustomOriginServer pulumi.StringPtrOutput `pulumi:"customOriginServer"`
// Hostname you intend to request a certificate for.
Hostname pulumi.StringOutput `pulumi:"hostname"`
OwnershipVerification CustomHostnameOwnershipVerificationOutput `pulumi:"ownershipVerification"`
OwnershipVerificationHttp CustomHostnameOwnershipVerificationHttpOutput `pulumi:"ownershipVerificationHttp"`
// SSL configuration of the certificate. See further notes below.
Ssls CustomHostnameSslArrayOutput `pulumi:"ssls"`
Status pulumi.StringOutput `pulumi:"status"`
// The DNS zone ID where the custom hostname should be assigned.
ZoneId pulumi.StringOutput `pulumi:"zoneId"`
}
// NewCustomHostname registers a new resource with the given unique name, arguments, and options.
func NewCustomHostname(ctx *pulumi.Context,
name string, args *CustomHostnameArgs, opts ...pulumi.ResourceOption) (*CustomHostname, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Hostname == nil {
return nil, errors.New("invalid value for required argument 'Hostname'")
}
if args.ZoneId == nil {
return nil, errors.New("invalid value for required argument 'ZoneId'")
}
var resource CustomHostname
err := ctx.RegisterResource("cloudflare:index/customHostname:CustomHostname", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetCustomHostname gets an existing CustomHostname 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 GetCustomHostname(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *CustomHostnameState, opts ...pulumi.ResourceOption) (*CustomHostname, error) {
var resource CustomHostname
err := ctx.ReadResource("cloudflare:index/customHostname:CustomHostname", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering CustomHostname resources.
type customHostnameState struct {
// The custom origin server used for certificates.
CustomOriginServer *string `pulumi:"customOriginServer"`
// Hostname you intend to request a certificate for.
Hostname *string `pulumi:"hostname"`
OwnershipVerification *CustomHostnameOwnershipVerification `pulumi:"ownershipVerification"`
OwnershipVerificationHttp *CustomHostnameOwnershipVerificationHttp `pulumi:"ownershipVerificationHttp"`
// SSL configuration of the certificate. See further notes below.
Ssls []CustomHostnameSsl `pulumi:"ssls"`
Status *string `pulumi:"status"`
// The DNS zone ID where the custom hostname should be assigned.
ZoneId *string `pulumi:"zoneId"`
}
type CustomHostnameState struct {
// The custom origin server used for certificates.
CustomOriginServer pulumi.StringPtrInput
// Hostname you intend to request a certificate for.
Hostname pulumi.StringPtrInput
OwnershipVerification CustomHostnameOwnershipVerificationPtrInput
OwnershipVerificationHttp CustomHostnameOwnershipVerificationHttpPtrInput
// SSL configuration of the certificate. See further notes below.
Ssls CustomHostnameSslArrayInput
Status pulumi.StringPtrInput
// The DNS zone ID where the custom hostname should be assigned.
ZoneId pulumi.StringPtrInput
}
func (CustomHostnameState) ElementType() reflect.Type {
return reflect.TypeOf((*customHostnameState)(nil)).Elem()
}
type customHostnameArgs struct {
// The custom origin server used for certificates.
CustomOriginServer *string `pulumi:"customOriginServer"`
// Hostname you intend to request a certificate for.
Hostname string `pulumi:"hostname"`
// SSL configuration of the certificate. See further notes below.
Ssls []CustomHostnameSsl `pulumi:"ssls"`
// The DNS zone ID where the custom hostname should be assigned.
ZoneId string `pulumi:"zoneId"`
}
// The set of arguments for constructing a CustomHostname resource.
type CustomHostnameArgs struct {
// The custom origin server used for certificates.
CustomOriginServer pulumi.StringPtrInput
// Hostname you intend to request a certificate for.
Hostname pulumi.StringInput
// SSL configuration of the certificate. See further notes below.
Ssls CustomHostnameSslArrayInput
// The DNS zone ID where the custom hostname should be assigned.
ZoneId pulumi.StringInput
}
func (CustomHostnameArgs) ElementType() reflect.Type {
return reflect.TypeOf((*customHostnameArgs)(nil)).Elem()
}
type CustomHostnameInput interface {
pulumi.Input
ToCustomHostnameOutput() CustomHostnameOutput
ToCustomHostnameOutputWithContext(ctx context.Context) CustomHostnameOutput
}
func (*CustomHostname) ElementType() reflect.Type {
return reflect.TypeOf((*CustomHostname)(nil))
}
func (i *CustomHostname) ToCustomHostnameOutput() CustomHostnameOutput {
return i.ToCustomHostnameOutputWithContext(context.Background())
}
func (i *CustomHostname) ToCustomHostnameOutputWithContext(ctx context.Context) CustomHostnameOutput {
return pulumi.ToOutputWithContext(ctx, i).(CustomHostnameOutput)
}
func (i *CustomHostname) ToCustomHostnamePtrOutput() CustomHostnamePtrOutput {
return i.ToCustomHostnamePtrOutputWithContext(context.Background())
}
func (i *CustomHostname) ToCustomHostnamePtrOutputWithContext(ctx context.Context) CustomHostnamePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(CustomHostnamePtrOutput)
}
type CustomHostnamePtrInput interface {
pulumi.Input
ToCustomHostnamePtrOutput() CustomHostnamePtrOutput
ToCustomHostnamePtrOutputWithContext(ctx context.Context) CustomHostnamePtrOutput
}
type customHostnamePtrType CustomHostnameArgs
func (*customHostnamePtrType) ElementType() reflect.Type {
return reflect.TypeOf((**CustomHostname)(nil))
}
func (i *customHostnamePtrType) ToCustomHostnamePtrOutput() CustomHostnamePtrOutput {
return i.ToCustomHostnamePtrOutputWithContext(context.Background())
}
func (i *customHostnamePtrType) ToCustomHostnamePtrOutputWithContext(ctx context.Context) CustomHostnamePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(CustomHostnamePtrOutput)
}
// CustomHostnameArrayInput is an input type that accepts CustomHostnameArray and CustomHostnameArrayOutput values.
// You can construct a concrete instance of `CustomHostnameArrayInput` via:
//
// CustomHostnameArray{ CustomHostnameArgs{...} }
type CustomHostnameArrayInput interface {
pulumi.Input
ToCustomHostnameArrayOutput() CustomHostnameArrayOutput
ToCustomHostnameArrayOutputWithContext(context.Context) CustomHostnameArrayOutput
}
type CustomHostnameArray []CustomHostnameInput
func (CustomHostnameArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*CustomHostname)(nil))
}
func (i CustomHostnameArray) ToCustomHostnameArrayOutput() CustomHostnameArrayOutput {
return i.ToCustomHostnameArrayOutputWithContext(context.Background())
}
func (i CustomHostnameArray) ToCustomHostnameArrayOutputWithContext(ctx context.Context) CustomHostnameArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(CustomHostnameArrayOutput)
}
// CustomHostnameMapInput is an input type that accepts CustomHostnameMap and CustomHostnameMapOutput values.
// You can construct a concrete instance of `CustomHostnameMapInput` via:
//
// CustomHostnameMap{ "key": CustomHostnameArgs{...} }
type CustomHostnameMapInput interface {
pulumi.Input
ToCustomHostnameMapOutput() CustomHostnameMapOutput
ToCustomHostnameMapOutputWithContext(context.Context) CustomHostnameMapOutput
}
type CustomHostnameMap map[string]CustomHostnameInput
func (CustomHostnameMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*CustomHostname)(nil))
}
func (i CustomHostnameMap) ToCustomHostnameMapOutput() CustomHostnameMapOutput {
return i.ToCustomHostnameMapOutputWithContext(context.Background())
}
func (i CustomHostnameMap) ToCustomHostnameMapOutputWithContext(ctx context.Context) CustomHostnameMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(CustomHostnameMapOutput)
}
type CustomHostnameOutput struct {
*pulumi.OutputState
}
func (CustomHostnameOutput) ElementType() reflect.Type {
return reflect.TypeOf((*CustomHostname)(nil))
}
func (o CustomHostnameOutput) ToCustomHostnameOutput() CustomHostnameOutput {
return o
}
func (o CustomHostnameOutput) ToCustomHostnameOutputWithContext(ctx context.Context) CustomHostnameOutput {
return o
}
func (o CustomHostnameOutput) ToCustomHostnamePtrOutput() CustomHostnamePtrOutput {
return o.ToCustomHostnamePtrOutputWithContext(context.Background())
}
func (o CustomHostnameOutput) ToCustomHostnamePtrOutputWithContext(ctx context.Context) CustomHostnamePtrOutput {
return o.ApplyT(func(v CustomHostname) *CustomHostname {
return &v
}).(CustomHostnamePtrOutput)
}
type CustomHostnamePtrOutput struct {
*pulumi.OutputState
}
func (CustomHostnamePtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**CustomHostname)(nil))
}
func (o CustomHostnamePtrOutput) ToCustomHostnamePtrOutput() CustomHostnamePtrOutput {
return o
}
func (o CustomHostnamePtrOutput) ToCustomHostnamePtrOutputWithContext(ctx context.Context) CustomHostnamePtrOutput {
return o
}
type CustomHostnameArrayOutput struct{ *pulumi.OutputState }
func (CustomHostnameArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]CustomHostname)(nil))
}
func (o CustomHostnameArrayOutput) ToCustomHostnameArrayOutput() CustomHostnameArrayOutput {
return o
}
func (o CustomHostnameArrayOutput) ToCustomHostnameArrayOutputWithContext(ctx context.Context) CustomHostnameArrayOutput {
return o
}
func (o CustomHostnameArrayOutput) Index(i pulumi.IntInput) CustomHostnameOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) CustomHostname {
return vs[0].([]CustomHostname)[vs[1].(int)]
}).(CustomHostnameOutput)
}
type CustomHostnameMapOutput struct{ *pulumi.OutputState }
func (CustomHostnameMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]CustomHostname)(nil))
}
func (o CustomHostnameMapOutput) ToCustomHostnameMapOutput() CustomHostnameMapOutput {
return o
}
func (o CustomHostnameMapOutput) ToCustomHostnameMapOutputWithContext(ctx context.Context) CustomHostnameMapOutput {
return o
}
func (o CustomHostnameMapOutput) MapIndex(k pulumi.StringInput) CustomHostnameOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) CustomHostname {
return vs[0].(map[string]CustomHostname)[vs[1].(string)]
}).(CustomHostnameOutput)
}
func init() {
pulumi.RegisterOutputType(CustomHostnameOutput{})
pulumi.RegisterOutputType(CustomHostnamePtrOutput{})
pulumi.RegisterOutputType(CustomHostnameArrayOutput{})
pulumi.RegisterOutputType(CustomHostnameMapOutput{})
}