/
shovel.go
209 lines (186 loc) · 5.5 KB
/
shovel.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
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package rabbitmq
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// The ``Shovel`` resource creates and manages a shovel.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-rabbitmq/sdk/v2/go/rabbitmq"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// testVHost, err := rabbitmq.NewVHost(ctx, "testVHost", nil)
// if err != nil {
// return err
// }
// testExchange, err := rabbitmq.NewExchange(ctx, "testExchange", &rabbitmq.ExchangeArgs{
// Settings: &rabbitmq.ExchangeSettingsArgs{
// AutoDelete: pulumi.Bool(true),
// Durable: pulumi.Bool(false),
// Type: pulumi.String("fanout"),
// },
// Vhost: testVHost.Name,
// })
// if err != nil {
// return err
// }
// testQueue, err := rabbitmq.NewQueue(ctx, "testQueue", &rabbitmq.QueueArgs{
// Settings: &rabbitmq.QueueSettingsArgs{
// AutoDelete: pulumi.Bool(true),
// Durable: pulumi.Bool(false),
// },
// Vhost: testVHost.Name,
// })
// if err != nil {
// return err
// }
// _, err = rabbitmq.NewShovel(ctx, "shovelTest", &rabbitmq.ShovelArgs{
// Info: &rabbitmq.ShovelInfoArgs{
// DestinationQueue: testQueue.Name,
// DestinationUri: pulumi.String("amqp:///test"),
// SourceExchange: testExchange.Name,
// SourceExchangeKey: pulumi.String("test"),
// SourceUri: pulumi.String("amqp:///test"),
// },
// Vhost: testVHost.Name,
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Shovels can be imported using the `name` and `vhost` E.g.
//
// ```sh
// $ pulumi import rabbitmq:index/shovel:Shovel test shovelTest@test
// ```
type Shovel struct {
pulumi.CustomResourceState
// The settings of the shovel. The structure is
// described below.
Info ShovelInfoOutput `pulumi:"info"`
// The shovel name.
Name pulumi.StringOutput `pulumi:"name"`
// The vhost to create the resource in.
Vhost pulumi.StringOutput `pulumi:"vhost"`
}
// NewShovel registers a new resource with the given unique name, arguments, and options.
func NewShovel(ctx *pulumi.Context,
name string, args *ShovelArgs, opts ...pulumi.ResourceOption) (*Shovel, error) {
if args == nil || args.Info == nil {
return nil, errors.New("missing required argument 'Info'")
}
if args == nil || args.Vhost == nil {
return nil, errors.New("missing required argument 'Vhost'")
}
if args == nil {
args = &ShovelArgs{}
}
var resource Shovel
err := ctx.RegisterResource("rabbitmq:index/shovel:Shovel", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetShovel gets an existing Shovel 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 GetShovel(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ShovelState, opts ...pulumi.ResourceOption) (*Shovel, error) {
var resource Shovel
err := ctx.ReadResource("rabbitmq:index/shovel:Shovel", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Shovel resources.
type shovelState struct {
// The settings of the shovel. The structure is
// described below.
Info *ShovelInfo `pulumi:"info"`
// The shovel name.
Name *string `pulumi:"name"`
// The vhost to create the resource in.
Vhost *string `pulumi:"vhost"`
}
type ShovelState struct {
// The settings of the shovel. The structure is
// described below.
Info ShovelInfoPtrInput
// The shovel name.
Name pulumi.StringPtrInput
// The vhost to create the resource in.
Vhost pulumi.StringPtrInput
}
func (ShovelState) ElementType() reflect.Type {
return reflect.TypeOf((*shovelState)(nil)).Elem()
}
type shovelArgs struct {
// The settings of the shovel. The structure is
// described below.
Info ShovelInfo `pulumi:"info"`
// The shovel name.
Name *string `pulumi:"name"`
// The vhost to create the resource in.
Vhost string `pulumi:"vhost"`
}
// The set of arguments for constructing a Shovel resource.
type ShovelArgs struct {
// The settings of the shovel. The structure is
// described below.
Info ShovelInfoInput
// The shovel name.
Name pulumi.StringPtrInput
// The vhost to create the resource in.
Vhost pulumi.StringInput
}
func (ShovelArgs) ElementType() reflect.Type {
return reflect.TypeOf((*shovelArgs)(nil)).Elem()
}
type ShovelInput interface {
pulumi.Input
ToShovelOutput() ShovelOutput
ToShovelOutputWithContext(ctx context.Context) ShovelOutput
}
func (Shovel) ElementType() reflect.Type {
return reflect.TypeOf((*Shovel)(nil)).Elem()
}
func (i Shovel) ToShovelOutput() ShovelOutput {
return i.ToShovelOutputWithContext(context.Background())
}
func (i Shovel) ToShovelOutputWithContext(ctx context.Context) ShovelOutput {
return pulumi.ToOutputWithContext(ctx, i).(ShovelOutput)
}
type ShovelOutput struct {
*pulumi.OutputState
}
func (ShovelOutput) ElementType() reflect.Type {
return reflect.TypeOf((*ShovelOutput)(nil)).Elem()
}
func (o ShovelOutput) ToShovelOutput() ShovelOutput {
return o
}
func (o ShovelOutput) ToShovelOutputWithContext(ctx context.Context) ShovelOutput {
return o
}
func init() {
pulumi.RegisterOutputType(ShovelOutput{})
}