1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. ecs
  5. getCommands
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.ecs.getCommands

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

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);
Copy
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)
Copy
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
	})
}
Copy
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),
    };
});
Copy
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.applyValue(getCommandsResult -> getCommandsResult.commands()[0].id()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: alicloud:ecs:getCommands
      arguments:
        ids:
          - E2RY53-xxxx
        nameRegex: tf-testAcc
outputs:
  firstEcsCommandId: ${example.commands[0].id}
Copy

Using getCommands

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getCommands(args: GetCommandsArgs, opts?: InvokeOptions): Promise<GetCommandsResult>
function getCommandsOutput(args: GetCommandsOutputArgs, opts?: InvokeOptions): Output<GetCommandsResult>
Copy
def get_commands(command_provider: Optional[str] = None,
                 content_encoding: Optional[str] = None,
                 description: Optional[str] = None,
                 ids: Optional[Sequence[str]] = None,
                 name: Optional[str] = None,
                 name_regex: Optional[str] = None,
                 output_file: Optional[str] = None,
                 type: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetCommandsResult
def get_commands_output(command_provider: Optional[pulumi.Input[str]] = None,
                 content_encoding: Optional[pulumi.Input[str]] = None,
                 description: Optional[pulumi.Input[str]] = None,
                 ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 name_regex: Optional[pulumi.Input[str]] = None,
                 output_file: Optional[pulumi.Input[str]] = None,
                 type: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetCommandsResult]
Copy
func GetCommands(ctx *Context, args *GetCommandsArgs, opts ...InvokeOption) (*GetCommandsResult, error)
func GetCommandsOutput(ctx *Context, args *GetCommandsOutputArgs, opts ...InvokeOption) GetCommandsResultOutput
Copy

> Note: This function is named GetCommands in the Go SDK.

public static class GetCommands 
{
    public static Task<GetCommandsResult> InvokeAsync(GetCommandsArgs args, InvokeOptions? opts = null)
    public static Output<GetCommandsResult> Invoke(GetCommandsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetCommandsResult> getCommands(GetCommandsArgs args, InvokeOptions options)
public static Output<GetCommandsResult> getCommands(GetCommandsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:ecs/getCommands:getCommands
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

CommandProvider Changes to this property will trigger replacement. string
Public order provider.
ContentEncoding Changes to this property will trigger replacement. string
The Base64-encoded content of the command.
Description Changes to this property will trigger replacement. string
The description of command.
Ids Changes to this property will trigger replacement. List<string>
A list of Command IDs.
Name Changes to this property will trigger replacement. string
The name of the command.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Command name.
OutputFile string
File name where to save data source results (after running pulumi preview).
Type Changes to this property will trigger replacement. string
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
CommandProvider Changes to this property will trigger replacement. string
Public order provider.
ContentEncoding Changes to this property will trigger replacement. string
The Base64-encoded content of the command.
Description Changes to this property will trigger replacement. string
The description of command.
Ids Changes to this property will trigger replacement. []string
A list of Command IDs.
Name Changes to this property will trigger replacement. string
The name of the command.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Command name.
OutputFile string
File name where to save data source results (after running pulumi preview).
Type Changes to this property will trigger replacement. string
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
commandProvider Changes to this property will trigger replacement. String
Public order provider.
contentEncoding Changes to this property will trigger replacement. String
The Base64-encoded content of the command.
description Changes to this property will trigger replacement. String
The description of command.
ids Changes to this property will trigger replacement. List<String>
A list of Command IDs.
name Changes to this property will trigger replacement. String
The name of the command.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Command name.
outputFile String
File name where to save data source results (after running pulumi preview).
type Changes to this property will trigger replacement. String
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
commandProvider Changes to this property will trigger replacement. string
Public order provider.
contentEncoding Changes to this property will trigger replacement. string
The Base64-encoded content of the command.
description Changes to this property will trigger replacement. string
The description of command.
ids Changes to this property will trigger replacement. string[]
A list of Command IDs.
name Changes to this property will trigger replacement. string
The name of the command.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Command name.
outputFile string
File name where to save data source results (after running pulumi preview).
type Changes to this property will trigger replacement. string
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
command_provider Changes to this property will trigger replacement. str
Public order provider.
content_encoding Changes to this property will trigger replacement. str
The Base64-encoded content of the command.
description Changes to this property will trigger replacement. str
The description of command.
ids Changes to this property will trigger replacement. Sequence[str]
A list of Command IDs.
name Changes to this property will trigger replacement. str
The name of the command.
name_regex Changes to this property will trigger replacement. str
A regex string to filter results by Command name.
output_file str
File name where to save data source results (after running pulumi preview).
type Changes to this property will trigger replacement. str
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
commandProvider Changes to this property will trigger replacement. String
Public order provider.
contentEncoding Changes to this property will trigger replacement. String
The Base64-encoded content of the command.
description Changes to this property will trigger replacement. String
The description of command.
ids Changes to this property will trigger replacement. List<String>
A list of Command IDs.
name Changes to this property will trigger replacement. String
The name of the command.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Command name.
outputFile String
File name where to save data source results (after running pulumi preview).
type Changes to this property will trigger replacement. String
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.

getCommands Result

The following output properties are available:

Commands List<Pulumi.AliCloud.Ecs.Outputs.GetCommandsCommand>
Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
Names List<string>
CommandProvider string
ContentEncoding string
Description string
Name string
NameRegex string
OutputFile string
Type string
Commands []GetCommandsCommand
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
Names []string
CommandProvider string
ContentEncoding string
Description string
Name string
NameRegex string
OutputFile string
Type string
commands List<GetCommandsCommand>
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
commandProvider String
contentEncoding String
description String
name String
nameRegex String
outputFile String
type String
commands GetCommandsCommand[]
id string
The provider-assigned unique ID for this managed resource.
ids string[]
names string[]
commandProvider string
contentEncoding string
description string
name string
nameRegex string
outputFile string
type string
commands Sequence[GetCommandsCommand]
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
names Sequence[str]
command_provider str
content_encoding str
description str
name str
name_regex str
output_file str
type str
commands List<Property Map>
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
commandProvider String
contentEncoding String
description String
name String
nameRegex String
outputFile String
type String

Supporting Types

GetCommandsCommand

CommandContent This property is required. string
The Base64-encoded content of the command.
CommandId This property is required. string
The ID of the Command.
Description This property is required. string
The description of command.
EnableParameter This property is required. bool
Specifies whether to use custom parameters in the command to be created.
Id This property is required. string
The ID of the Command.
Name This property is required. string
The name of the command
ParameterNames This property is required. List<string>
A list of custom parameter names which are parsed from the command content specified when the command was being created.
Timeout This property is required. int
The timeout period that is specified for the command to be run on ECS instances.
Type This property is required. string
The command type.
WorkingDir This property is required. string
The execution path of the command in the ECS instance.
CommandContent This property is required. string
The Base64-encoded content of the command.
CommandId This property is required. string
The ID of the Command.
Description This property is required. string
The description of command.
EnableParameter This property is required. bool
Specifies whether to use custom parameters in the command to be created.
Id This property is required. string
The ID of the Command.
Name This property is required. string
The name of the command
ParameterNames This property is required. []string
A list of custom parameter names which are parsed from the command content specified when the command was being created.
Timeout This property is required. int
The timeout period that is specified for the command to be run on ECS instances.
Type This property is required. string
The command type.
WorkingDir This property is required. string
The execution path of the command in the ECS instance.
commandContent This property is required. String
The Base64-encoded content of the command.
commandId This property is required. String
The ID of the Command.
description This property is required. String
The description of command.
enableParameter This property is required. Boolean
Specifies whether to use custom parameters in the command to be created.
id This property is required. String
The ID of the Command.
name This property is required. String
The name of the command
parameterNames This property is required. List<String>
A list of custom parameter names which are parsed from the command content specified when the command was being created.
timeout This property is required. Integer
The timeout period that is specified for the command to be run on ECS instances.
type This property is required. String
The command type.
workingDir This property is required. String
The execution path of the command in the ECS instance.
commandContent This property is required. string
The Base64-encoded content of the command.
commandId This property is required. string
The ID of the Command.
description This property is required. string
The description of command.
enableParameter This property is required. boolean
Specifies whether to use custom parameters in the command to be created.
id This property is required. string
The ID of the Command.
name This property is required. string
The name of the command
parameterNames This property is required. string[]
A list of custom parameter names which are parsed from the command content specified when the command was being created.
timeout This property is required. number
The timeout period that is specified for the command to be run on ECS instances.
type This property is required. string
The command type.
workingDir This property is required. string
The execution path of the command in the ECS instance.
command_content This property is required. str
The Base64-encoded content of the command.
command_id This property is required. str
The ID of the Command.
description This property is required. str
The description of command.
enable_parameter This property is required. bool
Specifies whether to use custom parameters in the command to be created.
id This property is required. str
The ID of the Command.
name This property is required. str
The name of the command
parameter_names This property is required. Sequence[str]
A list of custom parameter names which are parsed from the command content specified when the command was being created.
timeout This property is required. int
The timeout period that is specified for the command to be run on ECS instances.
type This property is required. str
The command type.
working_dir This property is required. str
The execution path of the command in the ECS instance.
commandContent This property is required. String
The Base64-encoded content of the command.
commandId This property is required. String
The ID of the Command.
description This property is required. String
The description of command.
enableParameter This property is required. Boolean
Specifies whether to use custom parameters in the command to be created.
id This property is required. String
The ID of the Command.
name This property is required. String
The name of the command
parameterNames This property is required. List<String>
A list of custom parameter names which are parsed from the command content specified when the command was being created.
timeout This property is required. Number
The timeout period that is specified for the command to be run on ECS instances.
type This property is required. String
The command type.
workingDir This property is required. String
The execution path of the command in the ECS instance.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi