generated from pulumi/pulumi-component-provider-ts-boilerplate
/
website.go
208 lines (166 loc) · 6.38 KB
/
website.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
// Code generated by Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package googlecloudstaticwebsite
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type Website struct {
pulumi.ResourceState
// The CDN URL of the website.
CdnURL pulumi.StringPtrOutput `pulumi:"cdnURL"`
// The custom-domain URL of the website.
CustomDomainURL pulumi.StringPtrOutput `pulumi:"customDomainURL"`
// The direct URL of the website.
OriginURL pulumi.StringOutput `pulumi:"originURL"`
}
// NewWebsite registers a new resource with the given unique name, arguments, and options.
func NewWebsite(ctx *pulumi.Context,
name string, args *WebsiteArgs, opts ...pulumi.ResourceOption) (*Website, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.SitePath == nil {
return nil, errors.New("invalid value for required argument 'SitePath'")
}
var resource Website
err := ctx.RegisterRemoteComponentResource("google-cloud-static-website:index:Website", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
type websiteArgs struct {
// The domain of the website.
Domain *string `pulumi:"domain"`
// The default error page for the website. Defaults to error.html.
ErrorDocument *string `pulumi:"errorDocument"`
// The default document for the site. Defaults to index.html.
IndexDocument *string `pulumi:"indexDocument"`
// The root directory containing contents of the built website contents.
SitePath string `pulumi:"sitePath"`
// The subdomain of the website.
Subdomain *string `pulumi:"subdomain"`
// Whether to provision a Google Cloud CDN to serve website content.
WithCDN *bool `pulumi:"withCDN"`
}
// The set of arguments for constructing a Website resource.
type WebsiteArgs struct {
// The domain of the website.
Domain pulumi.StringPtrInput
// The default error page for the website. Defaults to error.html.
ErrorDocument pulumi.StringPtrInput
// The default document for the site. Defaults to index.html.
IndexDocument pulumi.StringPtrInput
// The root directory containing contents of the built website contents.
SitePath pulumi.StringInput
// The subdomain of the website.
Subdomain pulumi.StringPtrInput
// Whether to provision a Google Cloud CDN to serve website content.
WithCDN pulumi.BoolPtrInput
}
func (WebsiteArgs) ElementType() reflect.Type {
return reflect.TypeOf((*websiteArgs)(nil)).Elem()
}
type WebsiteInput interface {
pulumi.Input
ToWebsiteOutput() WebsiteOutput
ToWebsiteOutputWithContext(ctx context.Context) WebsiteOutput
}
func (*Website) ElementType() reflect.Type {
return reflect.TypeOf((**Website)(nil)).Elem()
}
func (i *Website) ToWebsiteOutput() WebsiteOutput {
return i.ToWebsiteOutputWithContext(context.Background())
}
func (i *Website) ToWebsiteOutputWithContext(ctx context.Context) WebsiteOutput {
return pulumi.ToOutputWithContext(ctx, i).(WebsiteOutput)
}
// WebsiteArrayInput is an input type that accepts WebsiteArray and WebsiteArrayOutput values.
// You can construct a concrete instance of `WebsiteArrayInput` via:
//
// WebsiteArray{ WebsiteArgs{...} }
type WebsiteArrayInput interface {
pulumi.Input
ToWebsiteArrayOutput() WebsiteArrayOutput
ToWebsiteArrayOutputWithContext(context.Context) WebsiteArrayOutput
}
type WebsiteArray []WebsiteInput
func (WebsiteArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Website)(nil)).Elem()
}
func (i WebsiteArray) ToWebsiteArrayOutput() WebsiteArrayOutput {
return i.ToWebsiteArrayOutputWithContext(context.Background())
}
func (i WebsiteArray) ToWebsiteArrayOutputWithContext(ctx context.Context) WebsiteArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(WebsiteArrayOutput)
}
// WebsiteMapInput is an input type that accepts WebsiteMap and WebsiteMapOutput values.
// You can construct a concrete instance of `WebsiteMapInput` via:
//
// WebsiteMap{ "key": WebsiteArgs{...} }
type WebsiteMapInput interface {
pulumi.Input
ToWebsiteMapOutput() WebsiteMapOutput
ToWebsiteMapOutputWithContext(context.Context) WebsiteMapOutput
}
type WebsiteMap map[string]WebsiteInput
func (WebsiteMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Website)(nil)).Elem()
}
func (i WebsiteMap) ToWebsiteMapOutput() WebsiteMapOutput {
return i.ToWebsiteMapOutputWithContext(context.Background())
}
func (i WebsiteMap) ToWebsiteMapOutputWithContext(ctx context.Context) WebsiteMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(WebsiteMapOutput)
}
type WebsiteOutput struct{ *pulumi.OutputState }
func (WebsiteOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Website)(nil)).Elem()
}
func (o WebsiteOutput) ToWebsiteOutput() WebsiteOutput {
return o
}
func (o WebsiteOutput) ToWebsiteOutputWithContext(ctx context.Context) WebsiteOutput {
return o
}
type WebsiteArrayOutput struct{ *pulumi.OutputState }
func (WebsiteArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Website)(nil)).Elem()
}
func (o WebsiteArrayOutput) ToWebsiteArrayOutput() WebsiteArrayOutput {
return o
}
func (o WebsiteArrayOutput) ToWebsiteArrayOutputWithContext(ctx context.Context) WebsiteArrayOutput {
return o
}
func (o WebsiteArrayOutput) Index(i pulumi.IntInput) WebsiteOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Website {
return vs[0].([]*Website)[vs[1].(int)]
}).(WebsiteOutput)
}
type WebsiteMapOutput struct{ *pulumi.OutputState }
func (WebsiteMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Website)(nil)).Elem()
}
func (o WebsiteMapOutput) ToWebsiteMapOutput() WebsiteMapOutput {
return o
}
func (o WebsiteMapOutput) ToWebsiteMapOutputWithContext(ctx context.Context) WebsiteMapOutput {
return o
}
func (o WebsiteMapOutput) MapIndex(k pulumi.StringInput) WebsiteOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Website {
return vs[0].(map[string]*Website)[vs[1].(string)]
}).(WebsiteOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*WebsiteInput)(nil)).Elem(), &Website{})
pulumi.RegisterInputType(reflect.TypeOf((*WebsiteArrayInput)(nil)).Elem(), WebsiteArray{})
pulumi.RegisterInputType(reflect.TypeOf((*WebsiteMapInput)(nil)).Elem(), WebsiteMap{})
pulumi.RegisterOutputType(WebsiteOutput{})
pulumi.RegisterOutputType(WebsiteArrayOutput{})
pulumi.RegisterOutputType(WebsiteMapOutput{})
}