/
plugin.go
310 lines (257 loc) · 9.63 KB
/
plugin.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
// 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"
)
// ## Import
//
// `cloudamqp_plugin` can be imported using the name argument of the resource together with CloudAMQP instance identifier. The name and identifier are CSV separated, see example below.
//
// ```sh
// $ pulumi import cloudamqp:index/plugin:Plugin rabbitmq_management rabbitmq_management,<instance_id>`
// ```
type Plugin struct {
pulumi.CustomResourceState
// The description of the plugin.
Description pulumi.StringOutput `pulumi:"description"`
// If the plugin is enabled
Enabled pulumi.BoolOutput `pulumi:"enabled"`
// Instance identifier
InstanceId pulumi.IntOutput `pulumi:"instanceId"`
// The name of the plugin
Name pulumi.StringOutput `pulumi:"name"`
// Configurable sleep time in seconds between retries for plugins
Sleep pulumi.IntPtrOutput `pulumi:"sleep"`
// Configurable timeout time in seconds for plugins
Timeout pulumi.IntPtrOutput `pulumi:"timeout"`
// The version of the plugin.
Version pulumi.StringOutput `pulumi:"version"`
}
// NewPlugin registers a new resource with the given unique name, arguments, and options.
func NewPlugin(ctx *pulumi.Context,
name string, args *PluginArgs, opts ...pulumi.ResourceOption) (*Plugin, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Enabled == nil {
return nil, errors.New("invalid value for required argument 'Enabled'")
}
if args.InstanceId == nil {
return nil, errors.New("invalid value for required argument 'InstanceId'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Plugin
err := ctx.RegisterResource("cloudamqp:index/plugin:Plugin", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetPlugin gets an existing Plugin 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 GetPlugin(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *PluginState, opts ...pulumi.ResourceOption) (*Plugin, error) {
var resource Plugin
err := ctx.ReadResource("cloudamqp:index/plugin:Plugin", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Plugin resources.
type pluginState struct {
// The description of the plugin.
Description *string `pulumi:"description"`
// If the plugin is enabled
Enabled *bool `pulumi:"enabled"`
// Instance identifier
InstanceId *int `pulumi:"instanceId"`
// The name of the plugin
Name *string `pulumi:"name"`
// Configurable sleep time in seconds between retries for plugins
Sleep *int `pulumi:"sleep"`
// Configurable timeout time in seconds for plugins
Timeout *int `pulumi:"timeout"`
// The version of the plugin.
Version *string `pulumi:"version"`
}
type PluginState struct {
// The description of the plugin.
Description pulumi.StringPtrInput
// If the plugin is enabled
Enabled pulumi.BoolPtrInput
// Instance identifier
InstanceId pulumi.IntPtrInput
// The name of the plugin
Name pulumi.StringPtrInput
// Configurable sleep time in seconds between retries for plugins
Sleep pulumi.IntPtrInput
// Configurable timeout time in seconds for plugins
Timeout pulumi.IntPtrInput
// The version of the plugin.
Version pulumi.StringPtrInput
}
func (PluginState) ElementType() reflect.Type {
return reflect.TypeOf((*pluginState)(nil)).Elem()
}
type pluginArgs struct {
// If the plugin is enabled
Enabled bool `pulumi:"enabled"`
// Instance identifier
InstanceId int `pulumi:"instanceId"`
// The name of the plugin
Name *string `pulumi:"name"`
// Configurable sleep time in seconds between retries for plugins
Sleep *int `pulumi:"sleep"`
// Configurable timeout time in seconds for plugins
Timeout *int `pulumi:"timeout"`
}
// The set of arguments for constructing a Plugin resource.
type PluginArgs struct {
// If the plugin is enabled
Enabled pulumi.BoolInput
// Instance identifier
InstanceId pulumi.IntInput
// The name of the plugin
Name pulumi.StringPtrInput
// Configurable sleep time in seconds between retries for plugins
Sleep pulumi.IntPtrInput
// Configurable timeout time in seconds for plugins
Timeout pulumi.IntPtrInput
}
func (PluginArgs) ElementType() reflect.Type {
return reflect.TypeOf((*pluginArgs)(nil)).Elem()
}
type PluginInput interface {
pulumi.Input
ToPluginOutput() PluginOutput
ToPluginOutputWithContext(ctx context.Context) PluginOutput
}
func (*Plugin) ElementType() reflect.Type {
return reflect.TypeOf((**Plugin)(nil)).Elem()
}
func (i *Plugin) ToPluginOutput() PluginOutput {
return i.ToPluginOutputWithContext(context.Background())
}
func (i *Plugin) ToPluginOutputWithContext(ctx context.Context) PluginOutput {
return pulumi.ToOutputWithContext(ctx, i).(PluginOutput)
}
// PluginArrayInput is an input type that accepts PluginArray and PluginArrayOutput values.
// You can construct a concrete instance of `PluginArrayInput` via:
//
// PluginArray{ PluginArgs{...} }
type PluginArrayInput interface {
pulumi.Input
ToPluginArrayOutput() PluginArrayOutput
ToPluginArrayOutputWithContext(context.Context) PluginArrayOutput
}
type PluginArray []PluginInput
func (PluginArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Plugin)(nil)).Elem()
}
func (i PluginArray) ToPluginArrayOutput() PluginArrayOutput {
return i.ToPluginArrayOutputWithContext(context.Background())
}
func (i PluginArray) ToPluginArrayOutputWithContext(ctx context.Context) PluginArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(PluginArrayOutput)
}
// PluginMapInput is an input type that accepts PluginMap and PluginMapOutput values.
// You can construct a concrete instance of `PluginMapInput` via:
//
// PluginMap{ "key": PluginArgs{...} }
type PluginMapInput interface {
pulumi.Input
ToPluginMapOutput() PluginMapOutput
ToPluginMapOutputWithContext(context.Context) PluginMapOutput
}
type PluginMap map[string]PluginInput
func (PluginMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Plugin)(nil)).Elem()
}
func (i PluginMap) ToPluginMapOutput() PluginMapOutput {
return i.ToPluginMapOutputWithContext(context.Background())
}
func (i PluginMap) ToPluginMapOutputWithContext(ctx context.Context) PluginMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(PluginMapOutput)
}
type PluginOutput struct{ *pulumi.OutputState }
func (PluginOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Plugin)(nil)).Elem()
}
func (o PluginOutput) ToPluginOutput() PluginOutput {
return o
}
func (o PluginOutput) ToPluginOutputWithContext(ctx context.Context) PluginOutput {
return o
}
// The description of the plugin.
func (o PluginOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v *Plugin) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
}
// If the plugin is enabled
func (o PluginOutput) Enabled() pulumi.BoolOutput {
return o.ApplyT(func(v *Plugin) pulumi.BoolOutput { return v.Enabled }).(pulumi.BoolOutput)
}
// Instance identifier
func (o PluginOutput) InstanceId() pulumi.IntOutput {
return o.ApplyT(func(v *Plugin) pulumi.IntOutput { return v.InstanceId }).(pulumi.IntOutput)
}
// The name of the plugin
func (o PluginOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Plugin) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Configurable sleep time in seconds between retries for plugins
func (o PluginOutput) Sleep() pulumi.IntPtrOutput {
return o.ApplyT(func(v *Plugin) pulumi.IntPtrOutput { return v.Sleep }).(pulumi.IntPtrOutput)
}
// Configurable timeout time in seconds for plugins
func (o PluginOutput) Timeout() pulumi.IntPtrOutput {
return o.ApplyT(func(v *Plugin) pulumi.IntPtrOutput { return v.Timeout }).(pulumi.IntPtrOutput)
}
// The version of the plugin.
func (o PluginOutput) Version() pulumi.StringOutput {
return o.ApplyT(func(v *Plugin) pulumi.StringOutput { return v.Version }).(pulumi.StringOutput)
}
type PluginArrayOutput struct{ *pulumi.OutputState }
func (PluginArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Plugin)(nil)).Elem()
}
func (o PluginArrayOutput) ToPluginArrayOutput() PluginArrayOutput {
return o
}
func (o PluginArrayOutput) ToPluginArrayOutputWithContext(ctx context.Context) PluginArrayOutput {
return o
}
func (o PluginArrayOutput) Index(i pulumi.IntInput) PluginOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Plugin {
return vs[0].([]*Plugin)[vs[1].(int)]
}).(PluginOutput)
}
type PluginMapOutput struct{ *pulumi.OutputState }
func (PluginMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Plugin)(nil)).Elem()
}
func (o PluginMapOutput) ToPluginMapOutput() PluginMapOutput {
return o
}
func (o PluginMapOutput) ToPluginMapOutputWithContext(ctx context.Context) PluginMapOutput {
return o
}
func (o PluginMapOutput) MapIndex(k pulumi.StringInput) PluginOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Plugin {
return vs[0].(map[string]*Plugin)[vs[1].(string)]
}).(PluginOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*PluginInput)(nil)).Elem(), &Plugin{})
pulumi.RegisterInputType(reflect.TypeOf((*PluginArrayInput)(nil)).Elem(), PluginArray{})
pulumi.RegisterInputType(reflect.TypeOf((*PluginMapInput)(nil)).Elem(), PluginMap{})
pulumi.RegisterOutputType(PluginOutput{})
pulumi.RegisterOutputType(PluginArrayOutput{})
pulumi.RegisterOutputType(PluginMapOutput{})
}