generated from pulumi/pulumi-provider-boilerplate
/
command.go
246 lines (200 loc) · 7.82 KB
/
command.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
// *** WARNING: this file was generated by pulumigen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package local
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// A local command to be executed.
// This command can be inserted into the life cycles of other resources using the
// `dependsOn` or `parent` resource options. A command is considered to have
// failed when it finished with a non-zero exit code. This will fail the CRUD step
// of the `Command` resource.
type Command struct {
pulumi.CustomResourceState
// The command to run on create.
Create pulumi.StringPtrOutput `pulumi:"create"`
// The command to run on delete.
Delete pulumi.StringPtrOutput `pulumi:"delete"`
// The directory from which to run the command from. If `dir` does not exist, then
// `Command` will fail.
Dir pulumi.StringPtrOutput `pulumi:"dir"`
// Additional environment variables available to the command's process.
Environment pulumi.StringMapOutput `pulumi:"environment"`
// The program and arguments to run the command.
// For example: `["/bin/sh", "-c"]`
Interpreter pulumi.StringArrayOutput `pulumi:"interpreter"`
// The standard error of the command's process
Stderr pulumi.StringOutput `pulumi:"stderr"`
// The standard output of the command's process
Stdout pulumi.StringOutput `pulumi:"stdout"`
// The command to run on update.
Update pulumi.StringPtrOutput `pulumi:"update"`
}
// NewCommand registers a new resource with the given unique name, arguments, and options.
func NewCommand(ctx *pulumi.Context,
name string, args *CommandArgs, opts ...pulumi.ResourceOption) (*Command, error) {
if args == nil {
args = &CommandArgs{}
}
var resource Command
err := ctx.RegisterResource("command:local:Command", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetCommand gets an existing Command 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 GetCommand(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *CommandState, opts ...pulumi.ResourceOption) (*Command, error) {
var resource Command
err := ctx.ReadResource("command:local:Command", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Command resources.
type commandState struct {
}
type CommandState struct {
}
func (CommandState) ElementType() reflect.Type {
return reflect.TypeOf((*commandState)(nil)).Elem()
}
type commandArgs struct {
// The command to run on create.
Create *string `pulumi:"create"`
// The command to run on delete.
Delete *string `pulumi:"delete"`
// The working directory in which to run the command from.
Dir *string `pulumi:"dir"`
// Additional environment variables available to the command's process.
Environment map[string]string `pulumi:"environment"`
// The program and arguments to run the command.
// On Linux and macOS, defaults to: `["/bin/sh", "-c"]`. On Windows, defaults to: `["cmd", "/C"]`
Interpreter []string `pulumi:"interpreter"`
// The command to run on update.
Update *string `pulumi:"update"`
}
// The set of arguments for constructing a Command resource.
type CommandArgs struct {
// The command to run on create.
Create pulumi.StringPtrInput
// The command to run on delete.
Delete pulumi.StringPtrInput
// The working directory in which to run the command from.
Dir pulumi.StringPtrInput
// Additional environment variables available to the command's process.
Environment pulumi.StringMapInput
// The program and arguments to run the command.
// On Linux and macOS, defaults to: `["/bin/sh", "-c"]`. On Windows, defaults to: `["cmd", "/C"]`
Interpreter pulumi.StringArrayInput
// The command to run on update.
Update pulumi.StringPtrInput
}
func (CommandArgs) ElementType() reflect.Type {
return reflect.TypeOf((*commandArgs)(nil)).Elem()
}
type CommandInput interface {
pulumi.Input
ToCommandOutput() CommandOutput
ToCommandOutputWithContext(ctx context.Context) CommandOutput
}
func (*Command) ElementType() reflect.Type {
return reflect.TypeOf((**Command)(nil)).Elem()
}
func (i *Command) ToCommandOutput() CommandOutput {
return i.ToCommandOutputWithContext(context.Background())
}
func (i *Command) ToCommandOutputWithContext(ctx context.Context) CommandOutput {
return pulumi.ToOutputWithContext(ctx, i).(CommandOutput)
}
// CommandArrayInput is an input type that accepts CommandArray and CommandArrayOutput values.
// You can construct a concrete instance of `CommandArrayInput` via:
//
// CommandArray{ CommandArgs{...} }
type CommandArrayInput interface {
pulumi.Input
ToCommandArrayOutput() CommandArrayOutput
ToCommandArrayOutputWithContext(context.Context) CommandArrayOutput
}
type CommandArray []CommandInput
func (CommandArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Command)(nil)).Elem()
}
func (i CommandArray) ToCommandArrayOutput() CommandArrayOutput {
return i.ToCommandArrayOutputWithContext(context.Background())
}
func (i CommandArray) ToCommandArrayOutputWithContext(ctx context.Context) CommandArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(CommandArrayOutput)
}
// CommandMapInput is an input type that accepts CommandMap and CommandMapOutput values.
// You can construct a concrete instance of `CommandMapInput` via:
//
// CommandMap{ "key": CommandArgs{...} }
type CommandMapInput interface {
pulumi.Input
ToCommandMapOutput() CommandMapOutput
ToCommandMapOutputWithContext(context.Context) CommandMapOutput
}
type CommandMap map[string]CommandInput
func (CommandMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Command)(nil)).Elem()
}
func (i CommandMap) ToCommandMapOutput() CommandMapOutput {
return i.ToCommandMapOutputWithContext(context.Background())
}
func (i CommandMap) ToCommandMapOutputWithContext(ctx context.Context) CommandMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(CommandMapOutput)
}
type CommandOutput struct{ *pulumi.OutputState }
func (CommandOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Command)(nil)).Elem()
}
func (o CommandOutput) ToCommandOutput() CommandOutput {
return o
}
func (o CommandOutput) ToCommandOutputWithContext(ctx context.Context) CommandOutput {
return o
}
type CommandArrayOutput struct{ *pulumi.OutputState }
func (CommandArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Command)(nil)).Elem()
}
func (o CommandArrayOutput) ToCommandArrayOutput() CommandArrayOutput {
return o
}
func (o CommandArrayOutput) ToCommandArrayOutputWithContext(ctx context.Context) CommandArrayOutput {
return o
}
func (o CommandArrayOutput) Index(i pulumi.IntInput) CommandOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Command {
return vs[0].([]*Command)[vs[1].(int)]
}).(CommandOutput)
}
type CommandMapOutput struct{ *pulumi.OutputState }
func (CommandMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Command)(nil)).Elem()
}
func (o CommandMapOutput) ToCommandMapOutput() CommandMapOutput {
return o
}
func (o CommandMapOutput) ToCommandMapOutputWithContext(ctx context.Context) CommandMapOutput {
return o
}
func (o CommandMapOutput) MapIndex(k pulumi.StringInput) CommandOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Command {
return vs[0].(map[string]*Command)[vs[1].(string)]
}).(CommandOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*CommandInput)(nil)).Elem(), &Command{})
pulumi.RegisterInputType(reflect.TypeOf((*CommandArrayInput)(nil)).Elem(), CommandArray{})
pulumi.RegisterInputType(reflect.TypeOf((*CommandMapInput)(nil)).Elem(), CommandMap{})
pulumi.RegisterOutputType(CommandOutput{})
pulumi.RegisterOutputType(CommandArrayOutput{})
pulumi.RegisterOutputType(CommandMapOutput{})
}