-
Notifications
You must be signed in to change notification settings - Fork 50
/
managedCertificate.go
330 lines (274 loc) · 14.1 KB
/
managedCertificate.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
// 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 appservice
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// This certificate can be used to secure custom domains on App Services (Windows and Linux) hosted on an App Service Plan of Basic and above (free and shared tiers are not supported).
//
// > NOTE: A certificate is valid for six months, and about a month before the certificate’s expiration date, App Services renews/rotates the certificate. This is managed by Azure and doesn't require this resource to be changed or reprovisioned. It will change the `thumbprint` computed attribute the next time the resource is refreshed after rotation occurs, so keep that in mind if you have any dependencies on this attribute directly.
//
// ## Import
//
// App Service Managed Certificates can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:appservice/managedCertificate:ManagedCertificate example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.Web/certificates/customhost.contoso.com
// ```
type ManagedCertificate struct {
pulumi.CustomResourceState
// The Canonical Name of the Certificate.
CanonicalName pulumi.StringOutput `pulumi:"canonicalName"`
// The ID of the App Service Custom Hostname Binding for the Certificate. Changing this forces a new App Service Managed Certificate to be created.
CustomHostnameBindingId pulumi.StringOutput `pulumi:"customHostnameBindingId"`
// The expiration date of the Certificate.
ExpirationDate pulumi.StringOutput `pulumi:"expirationDate"`
// The friendly name of the Certificate.
FriendlyName pulumi.StringOutput `pulumi:"friendlyName"`
// The list of Host Names for the Certificate.
HostNames pulumi.StringArrayOutput `pulumi:"hostNames"`
// The Start date for the Certificate.
IssueDate pulumi.StringOutput `pulumi:"issueDate"`
// The issuer of the Certificate.
Issuer pulumi.StringOutput `pulumi:"issuer"`
// The Subject Name for the Certificate.
SubjectName pulumi.StringOutput `pulumi:"subjectName"`
// A mapping of tags which should be assigned to the App Service Managed Certificate.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// The Certificate Thumbprint.
Thumbprint pulumi.StringOutput `pulumi:"thumbprint"`
}
// NewManagedCertificate registers a new resource with the given unique name, arguments, and options.
func NewManagedCertificate(ctx *pulumi.Context,
name string, args *ManagedCertificateArgs, opts ...pulumi.ResourceOption) (*ManagedCertificate, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.CustomHostnameBindingId == nil {
return nil, errors.New("invalid value for required argument 'CustomHostnameBindingId'")
}
var resource ManagedCertificate
err := ctx.RegisterResource("azure:appservice/managedCertificate:ManagedCertificate", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetManagedCertificate gets an existing ManagedCertificate 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 GetManagedCertificate(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ManagedCertificateState, opts ...pulumi.ResourceOption) (*ManagedCertificate, error) {
var resource ManagedCertificate
err := ctx.ReadResource("azure:appservice/managedCertificate:ManagedCertificate", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ManagedCertificate resources.
type managedCertificateState struct {
// The Canonical Name of the Certificate.
CanonicalName *string `pulumi:"canonicalName"`
// The ID of the App Service Custom Hostname Binding for the Certificate. Changing this forces a new App Service Managed Certificate to be created.
CustomHostnameBindingId *string `pulumi:"customHostnameBindingId"`
// The expiration date of the Certificate.
ExpirationDate *string `pulumi:"expirationDate"`
// The friendly name of the Certificate.
FriendlyName *string `pulumi:"friendlyName"`
// The list of Host Names for the Certificate.
HostNames []string `pulumi:"hostNames"`
// The Start date for the Certificate.
IssueDate *string `pulumi:"issueDate"`
// The issuer of the Certificate.
Issuer *string `pulumi:"issuer"`
// The Subject Name for the Certificate.
SubjectName *string `pulumi:"subjectName"`
// A mapping of tags which should be assigned to the App Service Managed Certificate.
Tags map[string]string `pulumi:"tags"`
// The Certificate Thumbprint.
Thumbprint *string `pulumi:"thumbprint"`
}
type ManagedCertificateState struct {
// The Canonical Name of the Certificate.
CanonicalName pulumi.StringPtrInput
// The ID of the App Service Custom Hostname Binding for the Certificate. Changing this forces a new App Service Managed Certificate to be created.
CustomHostnameBindingId pulumi.StringPtrInput
// The expiration date of the Certificate.
ExpirationDate pulumi.StringPtrInput
// The friendly name of the Certificate.
FriendlyName pulumi.StringPtrInput
// The list of Host Names for the Certificate.
HostNames pulumi.StringArrayInput
// The Start date for the Certificate.
IssueDate pulumi.StringPtrInput
// The issuer of the Certificate.
Issuer pulumi.StringPtrInput
// The Subject Name for the Certificate.
SubjectName pulumi.StringPtrInput
// A mapping of tags which should be assigned to the App Service Managed Certificate.
Tags pulumi.StringMapInput
// The Certificate Thumbprint.
Thumbprint pulumi.StringPtrInput
}
func (ManagedCertificateState) ElementType() reflect.Type {
return reflect.TypeOf((*managedCertificateState)(nil)).Elem()
}
type managedCertificateArgs struct {
// The ID of the App Service Custom Hostname Binding for the Certificate. Changing this forces a new App Service Managed Certificate to be created.
CustomHostnameBindingId string `pulumi:"customHostnameBindingId"`
// A mapping of tags which should be assigned to the App Service Managed Certificate.
Tags map[string]string `pulumi:"tags"`
}
// The set of arguments for constructing a ManagedCertificate resource.
type ManagedCertificateArgs struct {
// The ID of the App Service Custom Hostname Binding for the Certificate. Changing this forces a new App Service Managed Certificate to be created.
CustomHostnameBindingId pulumi.StringInput
// A mapping of tags which should be assigned to the App Service Managed Certificate.
Tags pulumi.StringMapInput
}
func (ManagedCertificateArgs) ElementType() reflect.Type {
return reflect.TypeOf((*managedCertificateArgs)(nil)).Elem()
}
type ManagedCertificateInput interface {
pulumi.Input
ToManagedCertificateOutput() ManagedCertificateOutput
ToManagedCertificateOutputWithContext(ctx context.Context) ManagedCertificateOutput
}
func (*ManagedCertificate) ElementType() reflect.Type {
return reflect.TypeOf((**ManagedCertificate)(nil)).Elem()
}
func (i *ManagedCertificate) ToManagedCertificateOutput() ManagedCertificateOutput {
return i.ToManagedCertificateOutputWithContext(context.Background())
}
func (i *ManagedCertificate) ToManagedCertificateOutputWithContext(ctx context.Context) ManagedCertificateOutput {
return pulumi.ToOutputWithContext(ctx, i).(ManagedCertificateOutput)
}
// ManagedCertificateArrayInput is an input type that accepts ManagedCertificateArray and ManagedCertificateArrayOutput values.
// You can construct a concrete instance of `ManagedCertificateArrayInput` via:
//
// ManagedCertificateArray{ ManagedCertificateArgs{...} }
type ManagedCertificateArrayInput interface {
pulumi.Input
ToManagedCertificateArrayOutput() ManagedCertificateArrayOutput
ToManagedCertificateArrayOutputWithContext(context.Context) ManagedCertificateArrayOutput
}
type ManagedCertificateArray []ManagedCertificateInput
func (ManagedCertificateArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ManagedCertificate)(nil)).Elem()
}
func (i ManagedCertificateArray) ToManagedCertificateArrayOutput() ManagedCertificateArrayOutput {
return i.ToManagedCertificateArrayOutputWithContext(context.Background())
}
func (i ManagedCertificateArray) ToManagedCertificateArrayOutputWithContext(ctx context.Context) ManagedCertificateArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ManagedCertificateArrayOutput)
}
// ManagedCertificateMapInput is an input type that accepts ManagedCertificateMap and ManagedCertificateMapOutput values.
// You can construct a concrete instance of `ManagedCertificateMapInput` via:
//
// ManagedCertificateMap{ "key": ManagedCertificateArgs{...} }
type ManagedCertificateMapInput interface {
pulumi.Input
ToManagedCertificateMapOutput() ManagedCertificateMapOutput
ToManagedCertificateMapOutputWithContext(context.Context) ManagedCertificateMapOutput
}
type ManagedCertificateMap map[string]ManagedCertificateInput
func (ManagedCertificateMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ManagedCertificate)(nil)).Elem()
}
func (i ManagedCertificateMap) ToManagedCertificateMapOutput() ManagedCertificateMapOutput {
return i.ToManagedCertificateMapOutputWithContext(context.Background())
}
func (i ManagedCertificateMap) ToManagedCertificateMapOutputWithContext(ctx context.Context) ManagedCertificateMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ManagedCertificateMapOutput)
}
type ManagedCertificateOutput struct{ *pulumi.OutputState }
func (ManagedCertificateOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ManagedCertificate)(nil)).Elem()
}
func (o ManagedCertificateOutput) ToManagedCertificateOutput() ManagedCertificateOutput {
return o
}
func (o ManagedCertificateOutput) ToManagedCertificateOutputWithContext(ctx context.Context) ManagedCertificateOutput {
return o
}
// The Canonical Name of the Certificate.
func (o ManagedCertificateOutput) CanonicalName() pulumi.StringOutput {
return o.ApplyT(func(v *ManagedCertificate) pulumi.StringOutput { return v.CanonicalName }).(pulumi.StringOutput)
}
// The ID of the App Service Custom Hostname Binding for the Certificate. Changing this forces a new App Service Managed Certificate to be created.
func (o ManagedCertificateOutput) CustomHostnameBindingId() pulumi.StringOutput {
return o.ApplyT(func(v *ManagedCertificate) pulumi.StringOutput { return v.CustomHostnameBindingId }).(pulumi.StringOutput)
}
// The expiration date of the Certificate.
func (o ManagedCertificateOutput) ExpirationDate() pulumi.StringOutput {
return o.ApplyT(func(v *ManagedCertificate) pulumi.StringOutput { return v.ExpirationDate }).(pulumi.StringOutput)
}
// The friendly name of the Certificate.
func (o ManagedCertificateOutput) FriendlyName() pulumi.StringOutput {
return o.ApplyT(func(v *ManagedCertificate) pulumi.StringOutput { return v.FriendlyName }).(pulumi.StringOutput)
}
// The list of Host Names for the Certificate.
func (o ManagedCertificateOutput) HostNames() pulumi.StringArrayOutput {
return o.ApplyT(func(v *ManagedCertificate) pulumi.StringArrayOutput { return v.HostNames }).(pulumi.StringArrayOutput)
}
// The Start date for the Certificate.
func (o ManagedCertificateOutput) IssueDate() pulumi.StringOutput {
return o.ApplyT(func(v *ManagedCertificate) pulumi.StringOutput { return v.IssueDate }).(pulumi.StringOutput)
}
// The issuer of the Certificate.
func (o ManagedCertificateOutput) Issuer() pulumi.StringOutput {
return o.ApplyT(func(v *ManagedCertificate) pulumi.StringOutput { return v.Issuer }).(pulumi.StringOutput)
}
// The Subject Name for the Certificate.
func (o ManagedCertificateOutput) SubjectName() pulumi.StringOutput {
return o.ApplyT(func(v *ManagedCertificate) pulumi.StringOutput { return v.SubjectName }).(pulumi.StringOutput)
}
// A mapping of tags which should be assigned to the App Service Managed Certificate.
func (o ManagedCertificateOutput) Tags() pulumi.StringMapOutput {
return o.ApplyT(func(v *ManagedCertificate) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
}
// The Certificate Thumbprint.
func (o ManagedCertificateOutput) Thumbprint() pulumi.StringOutput {
return o.ApplyT(func(v *ManagedCertificate) pulumi.StringOutput { return v.Thumbprint }).(pulumi.StringOutput)
}
type ManagedCertificateArrayOutput struct{ *pulumi.OutputState }
func (ManagedCertificateArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ManagedCertificate)(nil)).Elem()
}
func (o ManagedCertificateArrayOutput) ToManagedCertificateArrayOutput() ManagedCertificateArrayOutput {
return o
}
func (o ManagedCertificateArrayOutput) ToManagedCertificateArrayOutputWithContext(ctx context.Context) ManagedCertificateArrayOutput {
return o
}
func (o ManagedCertificateArrayOutput) Index(i pulumi.IntInput) ManagedCertificateOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ManagedCertificate {
return vs[0].([]*ManagedCertificate)[vs[1].(int)]
}).(ManagedCertificateOutput)
}
type ManagedCertificateMapOutput struct{ *pulumi.OutputState }
func (ManagedCertificateMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ManagedCertificate)(nil)).Elem()
}
func (o ManagedCertificateMapOutput) ToManagedCertificateMapOutput() ManagedCertificateMapOutput {
return o
}
func (o ManagedCertificateMapOutput) ToManagedCertificateMapOutputWithContext(ctx context.Context) ManagedCertificateMapOutput {
return o
}
func (o ManagedCertificateMapOutput) MapIndex(k pulumi.StringInput) ManagedCertificateOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ManagedCertificate {
return vs[0].(map[string]*ManagedCertificate)[vs[1].(string)]
}).(ManagedCertificateOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ManagedCertificateInput)(nil)).Elem(), &ManagedCertificate{})
pulumi.RegisterInputType(reflect.TypeOf((*ManagedCertificateArrayInput)(nil)).Elem(), ManagedCertificateArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ManagedCertificateMapInput)(nil)).Elem(), ManagedCertificateMap{})
pulumi.RegisterOutputType(ManagedCertificateOutput{})
pulumi.RegisterOutputType(ManagedCertificateArrayOutput{})
pulumi.RegisterOutputType(ManagedCertificateMapOutput{})
}