get Commands
This data source provides the Ecs Commands of the current Alibaba Cloud user.
NOTE: Available in v1.116.0+.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const example = alicloud.ecs.getCommands({
ids: ["E2RY53-xxxx"],
nameRegex: "tf-testAcc",
});
export const firstEcsCommandId = example.then(example => example.commands?.[0]?.id);
Content copied to clipboard
import pulumi
import pulumi_alicloud as alicloud
example = alicloud.ecs.get_commands(ids=["E2RY53-xxxx"],
name_regex="tf-testAcc")
pulumi.export("firstEcsCommandId", example.commands[0].id)
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var example = AliCloud.Ecs.GetCommands.Invoke(new()
{
Ids = new[]
{
"E2RY53-xxxx",
},
NameRegex = "tf-testAcc",
});
return new Dictionary<string, object?>
{
["firstEcsCommandId"] = example.Apply(getCommandsResult => getCommandsResult.Commands[0]?.Id),
};
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := ecs.GetCommands(ctx, &ecs.GetCommandsArgs{
Ids: []string{
"E2RY53-xxxx",
},
NameRegex: pulumi.StringRef("tf-testAcc"),
}, nil)
if err != nil {
return err
}
ctx.Export("firstEcsCommandId", example.Commands[0].Id)
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetCommandsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = EcsFunctions.getCommands(GetCommandsArgs.builder()
.ids("E2RY53-xxxx")
.nameRegex("tf-testAcc")
.build());
ctx.export("firstEcsCommandId", example.commands()[0].id());
}
}
Content copied to clipboard
variables:
example:
fn::invoke:
function: alicloud:ecs:getCommands
arguments:
ids:
- E2RY53-xxxx
nameRegex: tf-testAcc
outputs:
firstEcsCommandId: ${example.commands[0].id}
Content copied to clipboard
Return
A collection of values returned by getCommands.
Parameters
argument
A collection of arguments for invoking getCommands.
suspend fun getCommands(commandProvider: String? = null, contentEncoding: String? = null, description: String? = null, ids: List<String>? = null, name: String? = null, nameRegex: String? = null, outputFile: String? = null, type: String? = null): GetCommandsResult
Return
A collection of values returned by getCommands.
Parameters
command Provider
Public order provider.
content Encoding
The Base64-encoded content of the command.
description
The description of command.
ids
A list of Command IDs.
name
The name of the command.
name Regex
A regex string to filter results by Command name.
output File
File name where to save data source results (after running pulumi preview
).
type
The command type. Valid Values: RunBatScript
, RunPowerShellScript
and RunShellScript
.
See also
suspend fun getCommands(argument: suspend GetCommandsPlainArgsBuilder.() -> Unit): GetCommandsResult
Return
A collection of values returned by getCommands.
Parameters
argument
Builder for com.pulumi.alicloud.ecs.kotlin.inputs.GetCommandsPlainArgs.