/
baiduChannel.go
324 lines (274 loc) · 10.5 KB
/
baiduChannel.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
// 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 pinpoint
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a Pinpoint Baidu Channel resource.
//
// > **Note:** All arguments including the Api Key and Secret Key will be stored in the raw state as plain-text.
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/pinpoint"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// app, err := pinpoint.NewApp(ctx, "app", nil)
// if err != nil {
// return err
// }
// _, err = pinpoint.NewBaiduChannel(ctx, "channel", &pinpoint.BaiduChannelArgs{
// ApplicationId: app.ApplicationId,
// ApiKey: pulumi.String(""),
// SecretKey: pulumi.String(""),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Using `pulumi import`, import Pinpoint Baidu Channel using the `application-id`. For example:
//
// ```sh
// $ pulumi import aws:pinpoint/baiduChannel:BaiduChannel channel application-id
// ```
type BaiduChannel struct {
pulumi.CustomResourceState
// Platform credential API key from Baidu.
ApiKey pulumi.StringOutput `pulumi:"apiKey"`
// The application ID.
ApplicationId pulumi.StringOutput `pulumi:"applicationId"`
// Specifies whether to enable the channel. Defaults to `true`.
Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
// Platform credential Secret key from Baidu.
SecretKey pulumi.StringOutput `pulumi:"secretKey"`
}
// NewBaiduChannel registers a new resource with the given unique name, arguments, and options.
func NewBaiduChannel(ctx *pulumi.Context,
name string, args *BaiduChannelArgs, opts ...pulumi.ResourceOption) (*BaiduChannel, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ApiKey == nil {
return nil, errors.New("invalid value for required argument 'ApiKey'")
}
if args.ApplicationId == nil {
return nil, errors.New("invalid value for required argument 'ApplicationId'")
}
if args.SecretKey == nil {
return nil, errors.New("invalid value for required argument 'SecretKey'")
}
if args.ApiKey != nil {
args.ApiKey = pulumi.ToSecret(args.ApiKey).(pulumi.StringInput)
}
if args.SecretKey != nil {
args.SecretKey = pulumi.ToSecret(args.SecretKey).(pulumi.StringInput)
}
secrets := pulumi.AdditionalSecretOutputs([]string{
"apiKey",
"secretKey",
})
opts = append(opts, secrets)
opts = internal.PkgResourceDefaultOpts(opts)
var resource BaiduChannel
err := ctx.RegisterResource("aws:pinpoint/baiduChannel:BaiduChannel", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetBaiduChannel gets an existing BaiduChannel 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 GetBaiduChannel(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *BaiduChannelState, opts ...pulumi.ResourceOption) (*BaiduChannel, error) {
var resource BaiduChannel
err := ctx.ReadResource("aws:pinpoint/baiduChannel:BaiduChannel", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering BaiduChannel resources.
type baiduChannelState struct {
// Platform credential API key from Baidu.
ApiKey *string `pulumi:"apiKey"`
// The application ID.
ApplicationId *string `pulumi:"applicationId"`
// Specifies whether to enable the channel. Defaults to `true`.
Enabled *bool `pulumi:"enabled"`
// Platform credential Secret key from Baidu.
SecretKey *string `pulumi:"secretKey"`
}
type BaiduChannelState struct {
// Platform credential API key from Baidu.
ApiKey pulumi.StringPtrInput
// The application ID.
ApplicationId pulumi.StringPtrInput
// Specifies whether to enable the channel. Defaults to `true`.
Enabled pulumi.BoolPtrInput
// Platform credential Secret key from Baidu.
SecretKey pulumi.StringPtrInput
}
func (BaiduChannelState) ElementType() reflect.Type {
return reflect.TypeOf((*baiduChannelState)(nil)).Elem()
}
type baiduChannelArgs struct {
// Platform credential API key from Baidu.
ApiKey string `pulumi:"apiKey"`
// The application ID.
ApplicationId string `pulumi:"applicationId"`
// Specifies whether to enable the channel. Defaults to `true`.
Enabled *bool `pulumi:"enabled"`
// Platform credential Secret key from Baidu.
SecretKey string `pulumi:"secretKey"`
}
// The set of arguments for constructing a BaiduChannel resource.
type BaiduChannelArgs struct {
// Platform credential API key from Baidu.
ApiKey pulumi.StringInput
// The application ID.
ApplicationId pulumi.StringInput
// Specifies whether to enable the channel. Defaults to `true`.
Enabled pulumi.BoolPtrInput
// Platform credential Secret key from Baidu.
SecretKey pulumi.StringInput
}
func (BaiduChannelArgs) ElementType() reflect.Type {
return reflect.TypeOf((*baiduChannelArgs)(nil)).Elem()
}
type BaiduChannelInput interface {
pulumi.Input
ToBaiduChannelOutput() BaiduChannelOutput
ToBaiduChannelOutputWithContext(ctx context.Context) BaiduChannelOutput
}
func (*BaiduChannel) ElementType() reflect.Type {
return reflect.TypeOf((**BaiduChannel)(nil)).Elem()
}
func (i *BaiduChannel) ToBaiduChannelOutput() BaiduChannelOutput {
return i.ToBaiduChannelOutputWithContext(context.Background())
}
func (i *BaiduChannel) ToBaiduChannelOutputWithContext(ctx context.Context) BaiduChannelOutput {
return pulumi.ToOutputWithContext(ctx, i).(BaiduChannelOutput)
}
// BaiduChannelArrayInput is an input type that accepts BaiduChannelArray and BaiduChannelArrayOutput values.
// You can construct a concrete instance of `BaiduChannelArrayInput` via:
//
// BaiduChannelArray{ BaiduChannelArgs{...} }
type BaiduChannelArrayInput interface {
pulumi.Input
ToBaiduChannelArrayOutput() BaiduChannelArrayOutput
ToBaiduChannelArrayOutputWithContext(context.Context) BaiduChannelArrayOutput
}
type BaiduChannelArray []BaiduChannelInput
func (BaiduChannelArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*BaiduChannel)(nil)).Elem()
}
func (i BaiduChannelArray) ToBaiduChannelArrayOutput() BaiduChannelArrayOutput {
return i.ToBaiduChannelArrayOutputWithContext(context.Background())
}
func (i BaiduChannelArray) ToBaiduChannelArrayOutputWithContext(ctx context.Context) BaiduChannelArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(BaiduChannelArrayOutput)
}
// BaiduChannelMapInput is an input type that accepts BaiduChannelMap and BaiduChannelMapOutput values.
// You can construct a concrete instance of `BaiduChannelMapInput` via:
//
// BaiduChannelMap{ "key": BaiduChannelArgs{...} }
type BaiduChannelMapInput interface {
pulumi.Input
ToBaiduChannelMapOutput() BaiduChannelMapOutput
ToBaiduChannelMapOutputWithContext(context.Context) BaiduChannelMapOutput
}
type BaiduChannelMap map[string]BaiduChannelInput
func (BaiduChannelMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*BaiduChannel)(nil)).Elem()
}
func (i BaiduChannelMap) ToBaiduChannelMapOutput() BaiduChannelMapOutput {
return i.ToBaiduChannelMapOutputWithContext(context.Background())
}
func (i BaiduChannelMap) ToBaiduChannelMapOutputWithContext(ctx context.Context) BaiduChannelMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(BaiduChannelMapOutput)
}
type BaiduChannelOutput struct{ *pulumi.OutputState }
func (BaiduChannelOutput) ElementType() reflect.Type {
return reflect.TypeOf((**BaiduChannel)(nil)).Elem()
}
func (o BaiduChannelOutput) ToBaiduChannelOutput() BaiduChannelOutput {
return o
}
func (o BaiduChannelOutput) ToBaiduChannelOutputWithContext(ctx context.Context) BaiduChannelOutput {
return o
}
// Platform credential API key from Baidu.
func (o BaiduChannelOutput) ApiKey() pulumi.StringOutput {
return o.ApplyT(func(v *BaiduChannel) pulumi.StringOutput { return v.ApiKey }).(pulumi.StringOutput)
}
// The application ID.
func (o BaiduChannelOutput) ApplicationId() pulumi.StringOutput {
return o.ApplyT(func(v *BaiduChannel) pulumi.StringOutput { return v.ApplicationId }).(pulumi.StringOutput)
}
// Specifies whether to enable the channel. Defaults to `true`.
func (o BaiduChannelOutput) Enabled() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *BaiduChannel) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput)
}
// Platform credential Secret key from Baidu.
func (o BaiduChannelOutput) SecretKey() pulumi.StringOutput {
return o.ApplyT(func(v *BaiduChannel) pulumi.StringOutput { return v.SecretKey }).(pulumi.StringOutput)
}
type BaiduChannelArrayOutput struct{ *pulumi.OutputState }
func (BaiduChannelArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*BaiduChannel)(nil)).Elem()
}
func (o BaiduChannelArrayOutput) ToBaiduChannelArrayOutput() BaiduChannelArrayOutput {
return o
}
func (o BaiduChannelArrayOutput) ToBaiduChannelArrayOutputWithContext(ctx context.Context) BaiduChannelArrayOutput {
return o
}
func (o BaiduChannelArrayOutput) Index(i pulumi.IntInput) BaiduChannelOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *BaiduChannel {
return vs[0].([]*BaiduChannel)[vs[1].(int)]
}).(BaiduChannelOutput)
}
type BaiduChannelMapOutput struct{ *pulumi.OutputState }
func (BaiduChannelMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*BaiduChannel)(nil)).Elem()
}
func (o BaiduChannelMapOutput) ToBaiduChannelMapOutput() BaiduChannelMapOutput {
return o
}
func (o BaiduChannelMapOutput) ToBaiduChannelMapOutputWithContext(ctx context.Context) BaiduChannelMapOutput {
return o
}
func (o BaiduChannelMapOutput) MapIndex(k pulumi.StringInput) BaiduChannelOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *BaiduChannel {
return vs[0].(map[string]*BaiduChannel)[vs[1].(string)]
}).(BaiduChannelOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*BaiduChannelInput)(nil)).Elem(), &BaiduChannel{})
pulumi.RegisterInputType(reflect.TypeOf((*BaiduChannelArrayInput)(nil)).Elem(), BaiduChannelArray{})
pulumi.RegisterInputType(reflect.TypeOf((*BaiduChannelMapInput)(nil)).Elem(), BaiduChannelMap{})
pulumi.RegisterOutputType(BaiduChannelOutput{})
pulumi.RegisterOutputType(BaiduChannelArrayOutput{})
pulumi.RegisterOutputType(BaiduChannelMapOutput{})
}