@pulumi/command 0.0.1-alpha.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +400 -0
- package/index.d.ts +7 -0
- package/index.js +26 -0
- package/index.js.map +1 -0
- package/local/command.d.ts +404 -0
- package/local/command.js +164 -0
- package/local/command.js.map +1 -0
- package/local/index.d.ts +7 -0
- package/local/index.js +41 -0
- package/local/index.js.map +1 -0
- package/local/run.d.ts +391 -0
- package/local/run.js +46 -0
- package/local/run.js.map +1 -0
- package/package.json +29 -0
- package/package.json.dev +28 -0
- package/provider.d.ts +21 -0
- package/provider.js +38 -0
- package/provider.js.map +1 -0
- package/remote/command.d.ts +206 -0
- package/remote/command.js +141 -0
- package/remote/command.js.map +1 -0
- package/remote/copyFile.d.ts +70 -0
- package/remote/copyFile.js +79 -0
- package/remote/copyFile.js.map +1 -0
- package/remote/copyToRemote.d.ts +125 -0
- package/remote/copyToRemote.js +134 -0
- package/remote/copyToRemote.js.map +1 -0
- package/remote/index.d.ts +10 -0
- package/remote/index.js +46 -0
- package/remote/index.js.map +1 -0
- package/scripts/install-pulumi-plugin.js +21 -0
- package/types/enums/index.d.ts +3 -0
- package/types/enums/index.js +11 -0
- package/types/enums/index.js.map +1 -0
- package/types/enums/local/index.d.ts +19 -0
- package/types/enums/local/index.js +24 -0
- package/types/enums/local/index.js.map +1 -0
- package/types/enums/remote/index.d.ts +19 -0
- package/types/enums/remote/index.js +24 -0
- package/types/enums/remote/index.js.map +1 -0
- package/types/index.d.ts +4 -0
- package/types/index.js +13 -0
- package/types/index.js.map +1 -0
- package/types/input.d.ts +98 -0
- package/types/input.js +27 -0
- package/types/input.js.map +1 -0
- package/types/output.d.ts +97 -0
- package/types/output.js +26 -0
- package/types/output.js.map +1 -0
- package/utilities.d.ts +8 -0
- package/utilities.js +101 -0
- package/utilities.js.map +1 -0
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
2
|
+
import * as enums from "../types/enums";
|
|
3
|
+
/**
|
|
4
|
+
* A local command to be executed.
|
|
5
|
+
*
|
|
6
|
+
* 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.
|
|
7
|
+
*
|
|
8
|
+
* ## Example Usage
|
|
9
|
+
*
|
|
10
|
+
* ### Basic Example
|
|
11
|
+
*
|
|
12
|
+
* This example shows the simplest use case, simply running a command on `create` in the Pulumi lifecycle.
|
|
13
|
+
*
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { local } from "@pulumi/command";
|
|
16
|
+
*
|
|
17
|
+
* const random = new local.Command("random", {
|
|
18
|
+
* create: "openssl rand -hex 16",
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* export const output = random.stdout;
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* ### Invoking a Lambda during Pulumi Deployment
|
|
25
|
+
*
|
|
26
|
+
* This example show using a local command to invoke an AWS Lambda once it's deployed. The Lambda invocation could also depend on other resources.
|
|
27
|
+
*
|
|
28
|
+
* ```typescript
|
|
29
|
+
* import * as aws from "@pulumi/aws";
|
|
30
|
+
* import { local } from "@pulumi/command";
|
|
31
|
+
* import { getStack } from "@pulumi/pulumi";
|
|
32
|
+
*
|
|
33
|
+
* const f = new aws.lambda.CallbackFunction("f", {
|
|
34
|
+
* publish: true,
|
|
35
|
+
* callback: async (ev: any) => {
|
|
36
|
+
* return `Stack ${ev.stackName} is deployed!`;
|
|
37
|
+
* }
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* const invoke = new local.Command("execf", {
|
|
41
|
+
* create: `aws lambda invoke --function-name "$FN" --payload '{"stackName": "${getStack()}"}' --cli-binary-format raw-in-base64-out out.txt >/dev/null && cat out.txt | tr -d '"' && rm out.txt`,
|
|
42
|
+
* environment: {
|
|
43
|
+
* FN: f.qualifiedArn,
|
|
44
|
+
* AWS_REGION: aws.config.region!,
|
|
45
|
+
* AWS_PAGER: "",
|
|
46
|
+
* },
|
|
47
|
+
* }, { dependsOn: f })
|
|
48
|
+
*
|
|
49
|
+
* export const output = invoke.stdout;
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* ### Using Triggers
|
|
53
|
+
*
|
|
54
|
+
* This example defines several trigger values of various kinds. Changes to any of them will cause `cmd` to be re-run.
|
|
55
|
+
*
|
|
56
|
+
* ```typescript
|
|
57
|
+
* import * as pulumi from "@pulumi/pulumi";
|
|
58
|
+
* import * as command from "@pulumi/command";
|
|
59
|
+
* import * as random from "@pulumi/random";
|
|
60
|
+
*
|
|
61
|
+
* const str = "foo";
|
|
62
|
+
* const fileAsset = new pulumi.asset.FileAsset("Pulumi.yaml");
|
|
63
|
+
* const rand = new random.RandomString("rand", {length: 5});
|
|
64
|
+
* const localFile = new command.local.Command("localFile", {
|
|
65
|
+
* create: "touch foo.txt",
|
|
66
|
+
* archivePaths: ["*.txt"],
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* const cmd = new command.local.Command("cmd", {
|
|
70
|
+
* create: "echo create > op.txt",
|
|
71
|
+
* delete: "echo delete >> op.txt",
|
|
72
|
+
* triggers: [
|
|
73
|
+
* str,
|
|
74
|
+
* rand.result,
|
|
75
|
+
* fileAsset,
|
|
76
|
+
* localFile.archive,
|
|
77
|
+
* ],
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export declare class Command extends pulumi.CustomResource {
|
|
82
|
+
/**
|
|
83
|
+
* Get an existing Command resource's state with the given name, ID, and optional extra
|
|
84
|
+
* properties used to qualify the lookup.
|
|
85
|
+
*
|
|
86
|
+
* @param name The _unique_ name of the resulting resource.
|
|
87
|
+
* @param id The _unique_ provider ID of the resource to lookup.
|
|
88
|
+
* @param opts Optional settings to control the behavior of the CustomResource.
|
|
89
|
+
*/
|
|
90
|
+
static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): Command;
|
|
91
|
+
/**
|
|
92
|
+
* Returns true if the given object is an instance of Command. This is designed to work even
|
|
93
|
+
* when multiple copies of the Pulumi SDK have been loaded into the same process.
|
|
94
|
+
*/
|
|
95
|
+
static isInstance(obj: any): obj is Command;
|
|
96
|
+
/**
|
|
97
|
+
* If the previous command's stdout and stderr (as generated by the prior create/update) is
|
|
98
|
+
* injected into the environment of the next run as PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR.
|
|
99
|
+
* Defaults to true.
|
|
100
|
+
*/
|
|
101
|
+
readonly addPreviousOutputInEnv: pulumi.Output<boolean | undefined>;
|
|
102
|
+
/**
|
|
103
|
+
* An archive asset containing files found after running the command.
|
|
104
|
+
*/
|
|
105
|
+
readonly archive: pulumi.Output<pulumi.asset.Archive | undefined>;
|
|
106
|
+
/**
|
|
107
|
+
* A list of path globs to return as a single archive asset after the command completes.
|
|
108
|
+
*
|
|
109
|
+
* When specifying glob patterns the following rules apply:
|
|
110
|
+
* - We only include files not directories for assets and archives.
|
|
111
|
+
* - Path separators are `/` on all platforms - including Windows.
|
|
112
|
+
* - Patterns starting with `!` are 'exclude' rules.
|
|
113
|
+
* - Rules are evaluated in order, so exclude rules should be after inclusion rules.
|
|
114
|
+
* - `*` matches anything except `/`
|
|
115
|
+
* - `**` matches anything, _including_ `/`
|
|
116
|
+
* - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
|
|
117
|
+
* - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
|
|
118
|
+
*
|
|
119
|
+
* #### Example
|
|
120
|
+
*
|
|
121
|
+
* Given the rules:
|
|
122
|
+
* ```yaml
|
|
123
|
+
* - "assets/**"
|
|
124
|
+
* - "src/**.js"
|
|
125
|
+
* - "!**secret.*"
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* When evaluating against this folder:
|
|
129
|
+
*
|
|
130
|
+
* ```yaml
|
|
131
|
+
* - assets/
|
|
132
|
+
* - logos/
|
|
133
|
+
* - logo.svg
|
|
134
|
+
* - src/
|
|
135
|
+
* - index.js
|
|
136
|
+
* - secret.js
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* The following paths will be returned:
|
|
140
|
+
*
|
|
141
|
+
* ```yaml
|
|
142
|
+
* - assets/logos/logo.svg
|
|
143
|
+
* - src/index.js
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
readonly archivePaths: pulumi.Output<string[] | undefined>;
|
|
147
|
+
/**
|
|
148
|
+
* A list of path globs to read after the command completes.
|
|
149
|
+
*
|
|
150
|
+
* When specifying glob patterns the following rules apply:
|
|
151
|
+
* - We only include files not directories for assets and archives.
|
|
152
|
+
* - Path separators are `/` on all platforms - including Windows.
|
|
153
|
+
* - Patterns starting with `!` are 'exclude' rules.
|
|
154
|
+
* - Rules are evaluated in order, so exclude rules should be after inclusion rules.
|
|
155
|
+
* - `*` matches anything except `/`
|
|
156
|
+
* - `**` matches anything, _including_ `/`
|
|
157
|
+
* - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
|
|
158
|
+
* - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
|
|
159
|
+
*
|
|
160
|
+
* #### Example
|
|
161
|
+
*
|
|
162
|
+
* Given the rules:
|
|
163
|
+
* ```yaml
|
|
164
|
+
* - "assets/**"
|
|
165
|
+
* - "src/**.js"
|
|
166
|
+
* - "!**secret.*"
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* When evaluating against this folder:
|
|
170
|
+
*
|
|
171
|
+
* ```yaml
|
|
172
|
+
* - assets/
|
|
173
|
+
* - logos/
|
|
174
|
+
* - logo.svg
|
|
175
|
+
* - src/
|
|
176
|
+
* - index.js
|
|
177
|
+
* - secret.js
|
|
178
|
+
* ```
|
|
179
|
+
*
|
|
180
|
+
* The following paths will be returned:
|
|
181
|
+
*
|
|
182
|
+
* ```yaml
|
|
183
|
+
* - assets/logos/logo.svg
|
|
184
|
+
* - src/index.js
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
readonly assetPaths: pulumi.Output<string[] | undefined>;
|
|
188
|
+
/**
|
|
189
|
+
* A map of assets found after running the command.
|
|
190
|
+
* The key is the relative path from the command dir
|
|
191
|
+
*/
|
|
192
|
+
readonly assets: pulumi.Output<{
|
|
193
|
+
[key: string]: pulumi.asset.Asset | pulumi.asset.Archive;
|
|
194
|
+
} | undefined>;
|
|
195
|
+
/**
|
|
196
|
+
* The command to run on create.
|
|
197
|
+
*/
|
|
198
|
+
readonly create: pulumi.Output<string | undefined>;
|
|
199
|
+
/**
|
|
200
|
+
* The command to run on delete. The environment variables PULUMI_COMMAND_STDOUT
|
|
201
|
+
* and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the
|
|
202
|
+
* Command resource from previous create or update steps.
|
|
203
|
+
*/
|
|
204
|
+
readonly delete: pulumi.Output<string | undefined>;
|
|
205
|
+
/**
|
|
206
|
+
* The directory from which to run the command from. If `dir` does not exist, then
|
|
207
|
+
* `Command` will fail.
|
|
208
|
+
*/
|
|
209
|
+
readonly dir: pulumi.Output<string | undefined>;
|
|
210
|
+
/**
|
|
211
|
+
* Additional environment variables available to the command's process.
|
|
212
|
+
*/
|
|
213
|
+
readonly environment: pulumi.Output<{
|
|
214
|
+
[key: string]: string;
|
|
215
|
+
} | undefined>;
|
|
216
|
+
/**
|
|
217
|
+
* The program and arguments to run the command.
|
|
218
|
+
* On Linux and macOS, defaults to: `["/bin/sh", "-c"]`. On Windows, defaults to: `["cmd", "/C"]`
|
|
219
|
+
*/
|
|
220
|
+
readonly interpreter: pulumi.Output<string[] | undefined>;
|
|
221
|
+
/**
|
|
222
|
+
* If the command's stdout and stderr should be logged. This doesn't affect the capturing of
|
|
223
|
+
* stdout and stderr as outputs. If there might be secrets in the output, you can disable logging here and mark the
|
|
224
|
+
* outputs as secret via 'additionalSecretOutputs'. Defaults to logging both stdout and stderr.
|
|
225
|
+
*/
|
|
226
|
+
readonly logging: pulumi.Output<enums.local.Logging | undefined>;
|
|
227
|
+
/**
|
|
228
|
+
* The standard error of the command's process
|
|
229
|
+
*/
|
|
230
|
+
readonly stderr: pulumi.Output<string>;
|
|
231
|
+
/**
|
|
232
|
+
* Pass a string to the command's process as standard in
|
|
233
|
+
*/
|
|
234
|
+
readonly stdin: pulumi.Output<string | undefined>;
|
|
235
|
+
/**
|
|
236
|
+
* The standard output of the command's process
|
|
237
|
+
*/
|
|
238
|
+
readonly stdout: pulumi.Output<string>;
|
|
239
|
+
/**
|
|
240
|
+
* Trigger a resource replacement on changes to any of these values. The
|
|
241
|
+
* trigger values can be of any type. If a value is different in the current update compared to the
|
|
242
|
+
* previous update, the resource will be replaced, i.e., the "create" command will be re-run.
|
|
243
|
+
* Please see the resource documentation for examples.
|
|
244
|
+
*/
|
|
245
|
+
readonly triggers: pulumi.Output<any[] | undefined>;
|
|
246
|
+
/**
|
|
247
|
+
* The command to run on update, if empty, create will
|
|
248
|
+
* run again. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR
|
|
249
|
+
* are set to the stdout and stderr properties of the Command resource from previous
|
|
250
|
+
* create or update steps.
|
|
251
|
+
*/
|
|
252
|
+
readonly update: pulumi.Output<string | undefined>;
|
|
253
|
+
/**
|
|
254
|
+
* Create a Command resource with the given unique name, arguments, and options.
|
|
255
|
+
*
|
|
256
|
+
* @param name The _unique_ name of the resource.
|
|
257
|
+
* @param args The arguments to use to populate this resource's properties.
|
|
258
|
+
* @param opts A bag of options that control this resource's behavior.
|
|
259
|
+
*/
|
|
260
|
+
constructor(name: string, args?: CommandArgs, opts?: pulumi.CustomResourceOptions);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* The set of arguments for constructing a Command resource.
|
|
264
|
+
*/
|
|
265
|
+
export interface CommandArgs {
|
|
266
|
+
/**
|
|
267
|
+
* If the previous command's stdout and stderr (as generated by the prior create/update) is
|
|
268
|
+
* injected into the environment of the next run as PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR.
|
|
269
|
+
* Defaults to true.
|
|
270
|
+
*/
|
|
271
|
+
addPreviousOutputInEnv?: pulumi.Input<boolean>;
|
|
272
|
+
/**
|
|
273
|
+
* A list of path globs to return as a single archive asset after the command completes.
|
|
274
|
+
*
|
|
275
|
+
* When specifying glob patterns the following rules apply:
|
|
276
|
+
* - We only include files not directories for assets and archives.
|
|
277
|
+
* - Path separators are `/` on all platforms - including Windows.
|
|
278
|
+
* - Patterns starting with `!` are 'exclude' rules.
|
|
279
|
+
* - Rules are evaluated in order, so exclude rules should be after inclusion rules.
|
|
280
|
+
* - `*` matches anything except `/`
|
|
281
|
+
* - `**` matches anything, _including_ `/`
|
|
282
|
+
* - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
|
|
283
|
+
* - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
|
|
284
|
+
*
|
|
285
|
+
* #### Example
|
|
286
|
+
*
|
|
287
|
+
* Given the rules:
|
|
288
|
+
* ```yaml
|
|
289
|
+
* - "assets/**"
|
|
290
|
+
* - "src/**.js"
|
|
291
|
+
* - "!**secret.*"
|
|
292
|
+
* ```
|
|
293
|
+
*
|
|
294
|
+
* When evaluating against this folder:
|
|
295
|
+
*
|
|
296
|
+
* ```yaml
|
|
297
|
+
* - assets/
|
|
298
|
+
* - logos/
|
|
299
|
+
* - logo.svg
|
|
300
|
+
* - src/
|
|
301
|
+
* - index.js
|
|
302
|
+
* - secret.js
|
|
303
|
+
* ```
|
|
304
|
+
*
|
|
305
|
+
* The following paths will be returned:
|
|
306
|
+
*
|
|
307
|
+
* ```yaml
|
|
308
|
+
* - assets/logos/logo.svg
|
|
309
|
+
* - src/index.js
|
|
310
|
+
* ```
|
|
311
|
+
*/
|
|
312
|
+
archivePaths?: pulumi.Input<pulumi.Input<string>[]>;
|
|
313
|
+
/**
|
|
314
|
+
* A list of path globs to read after the command completes.
|
|
315
|
+
*
|
|
316
|
+
* When specifying glob patterns the following rules apply:
|
|
317
|
+
* - We only include files not directories for assets and archives.
|
|
318
|
+
* - Path separators are `/` on all platforms - including Windows.
|
|
319
|
+
* - Patterns starting with `!` are 'exclude' rules.
|
|
320
|
+
* - Rules are evaluated in order, so exclude rules should be after inclusion rules.
|
|
321
|
+
* - `*` matches anything except `/`
|
|
322
|
+
* - `**` matches anything, _including_ `/`
|
|
323
|
+
* - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
|
|
324
|
+
* - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
|
|
325
|
+
*
|
|
326
|
+
* #### Example
|
|
327
|
+
*
|
|
328
|
+
* Given the rules:
|
|
329
|
+
* ```yaml
|
|
330
|
+
* - "assets/**"
|
|
331
|
+
* - "src/**.js"
|
|
332
|
+
* - "!**secret.*"
|
|
333
|
+
* ```
|
|
334
|
+
*
|
|
335
|
+
* When evaluating against this folder:
|
|
336
|
+
*
|
|
337
|
+
* ```yaml
|
|
338
|
+
* - assets/
|
|
339
|
+
* - logos/
|
|
340
|
+
* - logo.svg
|
|
341
|
+
* - src/
|
|
342
|
+
* - index.js
|
|
343
|
+
* - secret.js
|
|
344
|
+
* ```
|
|
345
|
+
*
|
|
346
|
+
* The following paths will be returned:
|
|
347
|
+
*
|
|
348
|
+
* ```yaml
|
|
349
|
+
* - assets/logos/logo.svg
|
|
350
|
+
* - src/index.js
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
assetPaths?: pulumi.Input<pulumi.Input<string>[]>;
|
|
354
|
+
/**
|
|
355
|
+
* The command to run on create.
|
|
356
|
+
*/
|
|
357
|
+
create?: pulumi.Input<string>;
|
|
358
|
+
/**
|
|
359
|
+
* The command to run on delete. The environment variables PULUMI_COMMAND_STDOUT
|
|
360
|
+
* and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the
|
|
361
|
+
* Command resource from previous create or update steps.
|
|
362
|
+
*/
|
|
363
|
+
delete?: pulumi.Input<string>;
|
|
364
|
+
/**
|
|
365
|
+
* The directory from which to run the command from. If `dir` does not exist, then
|
|
366
|
+
* `Command` will fail.
|
|
367
|
+
*/
|
|
368
|
+
dir?: pulumi.Input<string>;
|
|
369
|
+
/**
|
|
370
|
+
* Additional environment variables available to the command's process.
|
|
371
|
+
*/
|
|
372
|
+
environment?: pulumi.Input<{
|
|
373
|
+
[key: string]: pulumi.Input<string>;
|
|
374
|
+
}>;
|
|
375
|
+
/**
|
|
376
|
+
* The program and arguments to run the command.
|
|
377
|
+
* On Linux and macOS, defaults to: `["/bin/sh", "-c"]`. On Windows, defaults to: `["cmd", "/C"]`
|
|
378
|
+
*/
|
|
379
|
+
interpreter?: pulumi.Input<pulumi.Input<string>[]>;
|
|
380
|
+
/**
|
|
381
|
+
* If the command's stdout and stderr should be logged. This doesn't affect the capturing of
|
|
382
|
+
* stdout and stderr as outputs. If there might be secrets in the output, you can disable logging here and mark the
|
|
383
|
+
* outputs as secret via 'additionalSecretOutputs'. Defaults to logging both stdout and stderr.
|
|
384
|
+
*/
|
|
385
|
+
logging?: pulumi.Input<enums.local.Logging>;
|
|
386
|
+
/**
|
|
387
|
+
* Pass a string to the command's process as standard in
|
|
388
|
+
*/
|
|
389
|
+
stdin?: pulumi.Input<string>;
|
|
390
|
+
/**
|
|
391
|
+
* Trigger a resource replacement on changes to any of these values. The
|
|
392
|
+
* trigger values can be of any type. If a value is different in the current update compared to the
|
|
393
|
+
* previous update, the resource will be replaced, i.e., the "create" command will be re-run.
|
|
394
|
+
* Please see the resource documentation for examples.
|
|
395
|
+
*/
|
|
396
|
+
triggers?: pulumi.Input<any[]>;
|
|
397
|
+
/**
|
|
398
|
+
* The command to run on update, if empty, create will
|
|
399
|
+
* run again. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR
|
|
400
|
+
* are set to the stdout and stderr properties of the Command resource from previous
|
|
401
|
+
* create or update steps.
|
|
402
|
+
*/
|
|
403
|
+
update?: pulumi.Input<string>;
|
|
404
|
+
}
|
package/local/command.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
|
|
3
|
+
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.Command = void 0;
|
|
6
|
+
const pulumi = require("@pulumi/pulumi");
|
|
7
|
+
const utilities = require("../utilities");
|
|
8
|
+
/**
|
|
9
|
+
* A local command to be executed.
|
|
10
|
+
*
|
|
11
|
+
* 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.
|
|
12
|
+
*
|
|
13
|
+
* ## Example Usage
|
|
14
|
+
*
|
|
15
|
+
* ### Basic Example
|
|
16
|
+
*
|
|
17
|
+
* This example shows the simplest use case, simply running a command on `create` in the Pulumi lifecycle.
|
|
18
|
+
*
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import { local } from "@pulumi/command";
|
|
21
|
+
*
|
|
22
|
+
* const random = new local.Command("random", {
|
|
23
|
+
* create: "openssl rand -hex 16",
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* export const output = random.stdout;
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* ### Invoking a Lambda during Pulumi Deployment
|
|
30
|
+
*
|
|
31
|
+
* This example show using a local command to invoke an AWS Lambda once it's deployed. The Lambda invocation could also depend on other resources.
|
|
32
|
+
*
|
|
33
|
+
* ```typescript
|
|
34
|
+
* import * as aws from "@pulumi/aws";
|
|
35
|
+
* import { local } from "@pulumi/command";
|
|
36
|
+
* import { getStack } from "@pulumi/pulumi";
|
|
37
|
+
*
|
|
38
|
+
* const f = new aws.lambda.CallbackFunction("f", {
|
|
39
|
+
* publish: true,
|
|
40
|
+
* callback: async (ev: any) => {
|
|
41
|
+
* return `Stack ${ev.stackName} is deployed!`;
|
|
42
|
+
* }
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* const invoke = new local.Command("execf", {
|
|
46
|
+
* create: `aws lambda invoke --function-name "$FN" --payload '{"stackName": "${getStack()}"}' --cli-binary-format raw-in-base64-out out.txt >/dev/null && cat out.txt | tr -d '"' && rm out.txt`,
|
|
47
|
+
* environment: {
|
|
48
|
+
* FN: f.qualifiedArn,
|
|
49
|
+
* AWS_REGION: aws.config.region!,
|
|
50
|
+
* AWS_PAGER: "",
|
|
51
|
+
* },
|
|
52
|
+
* }, { dependsOn: f })
|
|
53
|
+
*
|
|
54
|
+
* export const output = invoke.stdout;
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* ### Using Triggers
|
|
58
|
+
*
|
|
59
|
+
* This example defines several trigger values of various kinds. Changes to any of them will cause `cmd` to be re-run.
|
|
60
|
+
*
|
|
61
|
+
* ```typescript
|
|
62
|
+
* import * as pulumi from "@pulumi/pulumi";
|
|
63
|
+
* import * as command from "@pulumi/command";
|
|
64
|
+
* import * as random from "@pulumi/random";
|
|
65
|
+
*
|
|
66
|
+
* const str = "foo";
|
|
67
|
+
* const fileAsset = new pulumi.asset.FileAsset("Pulumi.yaml");
|
|
68
|
+
* const rand = new random.RandomString("rand", {length: 5});
|
|
69
|
+
* const localFile = new command.local.Command("localFile", {
|
|
70
|
+
* create: "touch foo.txt",
|
|
71
|
+
* archivePaths: ["*.txt"],
|
|
72
|
+
* });
|
|
73
|
+
*
|
|
74
|
+
* const cmd = new command.local.Command("cmd", {
|
|
75
|
+
* create: "echo create > op.txt",
|
|
76
|
+
* delete: "echo delete >> op.txt",
|
|
77
|
+
* triggers: [
|
|
78
|
+
* str,
|
|
79
|
+
* rand.result,
|
|
80
|
+
* fileAsset,
|
|
81
|
+
* localFile.archive,
|
|
82
|
+
* ],
|
|
83
|
+
* });
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
class Command extends pulumi.CustomResource {
|
|
87
|
+
/**
|
|
88
|
+
* Get an existing Command resource's state with the given name, ID, and optional extra
|
|
89
|
+
* properties used to qualify the lookup.
|
|
90
|
+
*
|
|
91
|
+
* @param name The _unique_ name of the resulting resource.
|
|
92
|
+
* @param id The _unique_ provider ID of the resource to lookup.
|
|
93
|
+
* @param opts Optional settings to control the behavior of the CustomResource.
|
|
94
|
+
*/
|
|
95
|
+
static get(name, id, opts) {
|
|
96
|
+
return new Command(name, undefined, Object.assign(Object.assign({}, opts), { id: id }));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Returns true if the given object is an instance of Command. This is designed to work even
|
|
100
|
+
* when multiple copies of the Pulumi SDK have been loaded into the same process.
|
|
101
|
+
*/
|
|
102
|
+
static isInstance(obj) {
|
|
103
|
+
if (obj === undefined || obj === null) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
return obj['__pulumiType'] === Command.__pulumiType;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Create a Command resource with the given unique name, arguments, and options.
|
|
110
|
+
*
|
|
111
|
+
* @param name The _unique_ name of the resource.
|
|
112
|
+
* @param args The arguments to use to populate this resource's properties.
|
|
113
|
+
* @param opts A bag of options that control this resource's behavior.
|
|
114
|
+
*/
|
|
115
|
+
constructor(name, args, opts) {
|
|
116
|
+
var _a;
|
|
117
|
+
let resourceInputs = {};
|
|
118
|
+
opts = opts || {};
|
|
119
|
+
if (!opts.id) {
|
|
120
|
+
resourceInputs["addPreviousOutputInEnv"] = (_a = (args ? args.addPreviousOutputInEnv : undefined)) !== null && _a !== void 0 ? _a : true;
|
|
121
|
+
resourceInputs["archivePaths"] = args ? args.archivePaths : undefined;
|
|
122
|
+
resourceInputs["assetPaths"] = args ? args.assetPaths : undefined;
|
|
123
|
+
resourceInputs["create"] = args ? args.create : undefined;
|
|
124
|
+
resourceInputs["delete"] = args ? args.delete : undefined;
|
|
125
|
+
resourceInputs["dir"] = args ? args.dir : undefined;
|
|
126
|
+
resourceInputs["environment"] = args ? args.environment : undefined;
|
|
127
|
+
resourceInputs["interpreter"] = args ? args.interpreter : undefined;
|
|
128
|
+
resourceInputs["logging"] = args ? args.logging : undefined;
|
|
129
|
+
resourceInputs["stdin"] = args ? args.stdin : undefined;
|
|
130
|
+
resourceInputs["triggers"] = args ? args.triggers : undefined;
|
|
131
|
+
resourceInputs["update"] = args ? args.update : undefined;
|
|
132
|
+
resourceInputs["archive"] = undefined /*out*/;
|
|
133
|
+
resourceInputs["assets"] = undefined /*out*/;
|
|
134
|
+
resourceInputs["stderr"] = undefined /*out*/;
|
|
135
|
+
resourceInputs["stdout"] = undefined /*out*/;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
resourceInputs["addPreviousOutputInEnv"] = undefined /*out*/;
|
|
139
|
+
resourceInputs["archive"] = undefined /*out*/;
|
|
140
|
+
resourceInputs["archivePaths"] = undefined /*out*/;
|
|
141
|
+
resourceInputs["assetPaths"] = undefined /*out*/;
|
|
142
|
+
resourceInputs["assets"] = undefined /*out*/;
|
|
143
|
+
resourceInputs["create"] = undefined /*out*/;
|
|
144
|
+
resourceInputs["delete"] = undefined /*out*/;
|
|
145
|
+
resourceInputs["dir"] = undefined /*out*/;
|
|
146
|
+
resourceInputs["environment"] = undefined /*out*/;
|
|
147
|
+
resourceInputs["interpreter"] = undefined /*out*/;
|
|
148
|
+
resourceInputs["logging"] = undefined /*out*/;
|
|
149
|
+
resourceInputs["stderr"] = undefined /*out*/;
|
|
150
|
+
resourceInputs["stdin"] = undefined /*out*/;
|
|
151
|
+
resourceInputs["stdout"] = undefined /*out*/;
|
|
152
|
+
resourceInputs["triggers"] = undefined /*out*/;
|
|
153
|
+
resourceInputs["update"] = undefined /*out*/;
|
|
154
|
+
}
|
|
155
|
+
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
|
|
156
|
+
const replaceOnChanges = { replaceOnChanges: ["triggers[*]"] };
|
|
157
|
+
opts = pulumi.mergeOptions(opts, replaceOnChanges);
|
|
158
|
+
super(Command.__pulumiType, name, resourceInputs, opts);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
exports.Command = Command;
|
|
162
|
+
/** @internal */
|
|
163
|
+
Command.__pulumiType = 'command:local:Command';
|
|
164
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../local/command.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,iFAAiF;;;AAEjF,yCAAyC;AAIzC,0CAA0C;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;AACH,MAAa,OAAQ,SAAQ,MAAM,CAAC,cAAc;IAC9C;;;;;;;OAOG;IACI,MAAM,CAAC,GAAG,CAAC,IAAY,EAAE,EAA2B,EAAE,IAAmC;QAC5F,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,SAAgB,kCAAO,IAAI,KAAE,EAAE,EAAE,EAAE,IAAG,CAAC;IACpE,CAAC;IAKD;;;OAGG;IACI,MAAM,CAAC,UAAU,CAAC,GAAQ;QAC7B,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,EAAE;YACnC,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,GAAG,CAAC,cAAc,CAAC,KAAK,OAAO,CAAC,YAAY,CAAC;IACxD,CAAC;IA4JD;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,IAAkB,EAAE,IAAmC;;QAC7E,IAAI,cAAc,GAAkB,EAAE,CAAC;QACvC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE;YACV,cAAc,CAAC,wBAAwB,CAAC,GAAG,MAAA,CAAC,IAAI,CAAC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C;YAC/C,cAAc,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC;SAChD;QACD,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,oBAAoB,EAAE,EAAE,IAAI,CAAC,CAAC;QACnE,MAAM,gBAAgB,GAAG,EAAE,gBAAgB,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;QAC/D,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QACnD,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;IAC5D,CAAC;;AAtOL,0BAuOC;AA1NG,gBAAgB;AACO,oBAAY,GAAG,uBAAuB,CAAC"}
|
package/local/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { CommandArgs } from "./command";
|
|
2
|
+
export type Command = import("./command").Command;
|
|
3
|
+
export declare const Command: typeof import("./command").Command;
|
|
4
|
+
export { RunArgs, RunResult, RunOutputArgs } from "./run";
|
|
5
|
+
export declare const run: typeof import("./run").run;
|
|
6
|
+
export declare const runOutput: typeof import("./run").runOutput;
|
|
7
|
+
export * from "../types/enums/local";
|
package/local/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
|
|
3
|
+
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.runOutput = exports.run = exports.Command = void 0;
|
|
20
|
+
const pulumi = require("@pulumi/pulumi");
|
|
21
|
+
const utilities = require("../utilities");
|
|
22
|
+
exports.Command = null;
|
|
23
|
+
utilities.lazyLoad(exports, ["Command"], () => require("./command"));
|
|
24
|
+
exports.run = null;
|
|
25
|
+
exports.runOutput = null;
|
|
26
|
+
utilities.lazyLoad(exports, ["run", "runOutput"], () => require("./run"));
|
|
27
|
+
// Export enums:
|
|
28
|
+
__exportStar(require("../types/enums/local"), exports);
|
|
29
|
+
const _module = {
|
|
30
|
+
version: utilities.getVersion(),
|
|
31
|
+
construct: (name, type, urn) => {
|
|
32
|
+
switch (type) {
|
|
33
|
+
case "command:local:Command":
|
|
34
|
+
return new exports.Command(name, undefined, { urn });
|
|
35
|
+
default:
|
|
36
|
+
throw new Error(`unknown resource type ${type}`);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
pulumi.runtime.registerResourceModule("command", "local", _module);
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../local/index.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,iFAAiF;;;;;;;;;;;;;;;;;AAEjF,yCAAyC;AACzC,0CAA0C;AAK7B,QAAA,OAAO,GAAuC,IAAW,CAAC;AACvE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;AAGxD,QAAA,GAAG,GAA+B,IAAW,CAAC;AAC9C,QAAA,SAAS,GAAqC,IAAW,CAAC;AACvE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAC,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AAGzE,gBAAgB;AAChB,uDAAqC;AAErC,MAAM,OAAO,GAAG;IACZ,OAAO,EAAE,SAAS,CAAC,UAAU,EAAE;IAC/B,SAAS,EAAE,CAAC,IAAY,EAAE,IAAY,EAAE,GAAW,EAAmB,EAAE;QACpE,QAAQ,IAAI,EAAE;YACV,KAAK,uBAAuB;gBACxB,OAAO,IAAI,eAAO,CAAC,IAAI,EAAO,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;YACrD;gBACI,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;SACxD;IACL,CAAC;CACJ,CAAC;AACF,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA"}
|