/
customDomain.go
288 lines (240 loc) · 9.26 KB
/
customDomain.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
// 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 cloudamqp
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-cloudamqp/sdk/v3/go/cloudamqp/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// This resource allows you to configure and manage your custom domain for the CloudAMQP instance.
//
// Adding a custom domain to your instance will generate a TLS certificate from [Let's Encrypt], for the given hostname, and install it on all servers in your cluster. The certificate will be automatically renewed going forward.
//
// > **WARNING:** Please note that when creating, changing or deleting the custom domain, the listeners on your servers will be restarted in order to apply the changes. This will close your current connections.
//
// Your custom domain name needs to point to your CloudAMQP hostname, preferably using a CNAME DNS record.
//
// Only available for dedicated subscription plans.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-cloudamqp/sdk/v3/go/cloudamqp"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := cloudamqp.NewCustomDomain(ctx, "settings", &cloudamqp.CustomDomainArgs{
// InstanceId: pulumi.Any(cloudamqp_instance.Instance.Id),
// Hostname: pulumi.String("myname.mydomain"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Depedency
//
// This resource depends on CloudAMQP instance identifier, `cloudamqp_instance.instance.id`.
//
// ## Import
//
// `cloudamqp_custom_domain` can be imported using CloudAMQP instance identifier.
//
// ```sh
// $ pulumi import cloudamqp:index/customDomain:CustomDomain settings <instance_id>`
// ```
//
// [Let's Encrypt]: https://letsencrypt.org/
type CustomDomain struct {
pulumi.CustomResourceState
// Your custom domain name.
Hostname pulumi.StringOutput `pulumi:"hostname"`
// The CloudAMQP instance ID.
InstanceId pulumi.IntOutput `pulumi:"instanceId"`
}
// NewCustomDomain registers a new resource with the given unique name, arguments, and options.
func NewCustomDomain(ctx *pulumi.Context,
name string, args *CustomDomainArgs, opts ...pulumi.ResourceOption) (*CustomDomain, 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.InstanceId == nil {
return nil, errors.New("invalid value for required argument 'InstanceId'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource CustomDomain
err := ctx.RegisterResource("cloudamqp:index/customDomain:CustomDomain", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetCustomDomain gets an existing CustomDomain 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 GetCustomDomain(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *CustomDomainState, opts ...pulumi.ResourceOption) (*CustomDomain, error) {
var resource CustomDomain
err := ctx.ReadResource("cloudamqp:index/customDomain:CustomDomain", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering CustomDomain resources.
type customDomainState struct {
// Your custom domain name.
Hostname *string `pulumi:"hostname"`
// The CloudAMQP instance ID.
InstanceId *int `pulumi:"instanceId"`
}
type CustomDomainState struct {
// Your custom domain name.
Hostname pulumi.StringPtrInput
// The CloudAMQP instance ID.
InstanceId pulumi.IntPtrInput
}
func (CustomDomainState) ElementType() reflect.Type {
return reflect.TypeOf((*customDomainState)(nil)).Elem()
}
type customDomainArgs struct {
// Your custom domain name.
Hostname string `pulumi:"hostname"`
// The CloudAMQP instance ID.
InstanceId int `pulumi:"instanceId"`
}
// The set of arguments for constructing a CustomDomain resource.
type CustomDomainArgs struct {
// Your custom domain name.
Hostname pulumi.StringInput
// The CloudAMQP instance ID.
InstanceId pulumi.IntInput
}
func (CustomDomainArgs) ElementType() reflect.Type {
return reflect.TypeOf((*customDomainArgs)(nil)).Elem()
}
type CustomDomainInput interface {
pulumi.Input
ToCustomDomainOutput() CustomDomainOutput
ToCustomDomainOutputWithContext(ctx context.Context) CustomDomainOutput
}
func (*CustomDomain) ElementType() reflect.Type {
return reflect.TypeOf((**CustomDomain)(nil)).Elem()
}
func (i *CustomDomain) ToCustomDomainOutput() CustomDomainOutput {
return i.ToCustomDomainOutputWithContext(context.Background())
}
func (i *CustomDomain) ToCustomDomainOutputWithContext(ctx context.Context) CustomDomainOutput {
return pulumi.ToOutputWithContext(ctx, i).(CustomDomainOutput)
}
// CustomDomainArrayInput is an input type that accepts CustomDomainArray and CustomDomainArrayOutput values.
// You can construct a concrete instance of `CustomDomainArrayInput` via:
//
// CustomDomainArray{ CustomDomainArgs{...} }
type CustomDomainArrayInput interface {
pulumi.Input
ToCustomDomainArrayOutput() CustomDomainArrayOutput
ToCustomDomainArrayOutputWithContext(context.Context) CustomDomainArrayOutput
}
type CustomDomainArray []CustomDomainInput
func (CustomDomainArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*CustomDomain)(nil)).Elem()
}
func (i CustomDomainArray) ToCustomDomainArrayOutput() CustomDomainArrayOutput {
return i.ToCustomDomainArrayOutputWithContext(context.Background())
}
func (i CustomDomainArray) ToCustomDomainArrayOutputWithContext(ctx context.Context) CustomDomainArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(CustomDomainArrayOutput)
}
// CustomDomainMapInput is an input type that accepts CustomDomainMap and CustomDomainMapOutput values.
// You can construct a concrete instance of `CustomDomainMapInput` via:
//
// CustomDomainMap{ "key": CustomDomainArgs{...} }
type CustomDomainMapInput interface {
pulumi.Input
ToCustomDomainMapOutput() CustomDomainMapOutput
ToCustomDomainMapOutputWithContext(context.Context) CustomDomainMapOutput
}
type CustomDomainMap map[string]CustomDomainInput
func (CustomDomainMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*CustomDomain)(nil)).Elem()
}
func (i CustomDomainMap) ToCustomDomainMapOutput() CustomDomainMapOutput {
return i.ToCustomDomainMapOutputWithContext(context.Background())
}
func (i CustomDomainMap) ToCustomDomainMapOutputWithContext(ctx context.Context) CustomDomainMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(CustomDomainMapOutput)
}
type CustomDomainOutput struct{ *pulumi.OutputState }
func (CustomDomainOutput) ElementType() reflect.Type {
return reflect.TypeOf((**CustomDomain)(nil)).Elem()
}
func (o CustomDomainOutput) ToCustomDomainOutput() CustomDomainOutput {
return o
}
func (o CustomDomainOutput) ToCustomDomainOutputWithContext(ctx context.Context) CustomDomainOutput {
return o
}
// Your custom domain name.
func (o CustomDomainOutput) Hostname() pulumi.StringOutput {
return o.ApplyT(func(v *CustomDomain) pulumi.StringOutput { return v.Hostname }).(pulumi.StringOutput)
}
// The CloudAMQP instance ID.
func (o CustomDomainOutput) InstanceId() pulumi.IntOutput {
return o.ApplyT(func(v *CustomDomain) pulumi.IntOutput { return v.InstanceId }).(pulumi.IntOutput)
}
type CustomDomainArrayOutput struct{ *pulumi.OutputState }
func (CustomDomainArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*CustomDomain)(nil)).Elem()
}
func (o CustomDomainArrayOutput) ToCustomDomainArrayOutput() CustomDomainArrayOutput {
return o
}
func (o CustomDomainArrayOutput) ToCustomDomainArrayOutputWithContext(ctx context.Context) CustomDomainArrayOutput {
return o
}
func (o CustomDomainArrayOutput) Index(i pulumi.IntInput) CustomDomainOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CustomDomain {
return vs[0].([]*CustomDomain)[vs[1].(int)]
}).(CustomDomainOutput)
}
type CustomDomainMapOutput struct{ *pulumi.OutputState }
func (CustomDomainMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*CustomDomain)(nil)).Elem()
}
func (o CustomDomainMapOutput) ToCustomDomainMapOutput() CustomDomainMapOutput {
return o
}
func (o CustomDomainMapOutput) ToCustomDomainMapOutputWithContext(ctx context.Context) CustomDomainMapOutput {
return o
}
func (o CustomDomainMapOutput) MapIndex(k pulumi.StringInput) CustomDomainOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CustomDomain {
return vs[0].(map[string]*CustomDomain)[vs[1].(string)]
}).(CustomDomainOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*CustomDomainInput)(nil)).Elem(), &CustomDomain{})
pulumi.RegisterInputType(reflect.TypeOf((*CustomDomainArrayInput)(nil)).Elem(), CustomDomainArray{})
pulumi.RegisterInputType(reflect.TypeOf((*CustomDomainMapInput)(nil)).Elem(), CustomDomainMap{})
pulumi.RegisterOutputType(CustomDomainOutput{})
pulumi.RegisterOutputType(CustomDomainArrayOutput{})
pulumi.RegisterOutputType(CustomDomainMapOutput{})
}