1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. ecs
  5. Command
Alibaba Cloud v3.56.0 published on Friday, May 31, 2024 by Pulumi

alicloud.ecs.Command

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.56.0 published on Friday, May 31, 2024 by Pulumi

    Provides a ECS Command resource.

    For information about ECS Command and how to use it, see What is Command.

    NOTE: Available in v1.116.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const example = new alicloud.ecs.Command("example", {
        name: "tf-testAcc",
        commandContent: "bHMK",
        description: "For Terraform Test",
        type: "RunShellScript",
        workingDir: "/root",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    example = alicloud.ecs.Command("example",
        name="tf-testAcc",
        command_content="bHMK",
        description="For Terraform Test",
        type="RunShellScript",
        working_dir="/root")
    
    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 {
    		_, err := ecs.NewCommand(ctx, "example", &ecs.CommandArgs{
    			Name:           pulumi.String("tf-testAcc"),
    			CommandContent: pulumi.String("bHMK"),
    			Description:    pulumi.String("For Terraform Test"),
    			Type:           pulumi.String("RunShellScript"),
    			WorkingDir:     pulumi.String("/root"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new AliCloud.Ecs.Command("example", new()
        {
            Name = "tf-testAcc",
            CommandContent = "bHMK",
            Description = "For Terraform Test",
            Type = "RunShellScript",
            WorkingDir = "/root",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.Command;
    import com.pulumi.alicloud.ecs.CommandArgs;
    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) {
            var example = new Command("example", CommandArgs.builder()
                .name("tf-testAcc")
                .commandContent("bHMK")
                .description("For Terraform Test")
                .type("RunShellScript")
                .workingDir("/root")
                .build());
    
        }
    }
    
    resources:
      example:
        type: alicloud:ecs:Command
        properties:
          name: tf-testAcc
          commandContent: bHMK
          description: For Terraform Test
          type: RunShellScript
          workingDir: /root
    

    Create Command Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Command(name: string, args: CommandArgs, opts?: CustomResourceOptions);
    @overload
    def Command(resource_name: str,
                args: CommandArgs,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Command(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                command_content: Optional[str] = None,
                type: Optional[str] = None,
                description: Optional[str] = None,
                enable_parameter: Optional[bool] = None,
                name: Optional[str] = None,
                timeout: Optional[int] = None,
                working_dir: Optional[str] = None)
    func NewCommand(ctx *Context, name string, args CommandArgs, opts ...ResourceOption) (*Command, error)
    public Command(string name, CommandArgs args, CustomResourceOptions? opts = null)
    public Command(String name, CommandArgs args)
    public Command(String name, CommandArgs args, CustomResourceOptions options)
    
    type: alicloud:ecs:Command
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args CommandArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args CommandArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args CommandArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CommandArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CommandArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var commandResource = new AliCloud.Ecs.Command("commandResource", new()
    {
        CommandContent = "string",
        Type = "string",
        Description = "string",
        EnableParameter = false,
        Name = "string",
        Timeout = 0,
        WorkingDir = "string",
    });
    
    example, err := ecs.NewCommand(ctx, "commandResource", &ecs.CommandArgs{
    	CommandContent:  pulumi.String("string"),
    	Type:            pulumi.String("string"),
    	Description:     pulumi.String("string"),
    	EnableParameter: pulumi.Bool(false),
    	Name:            pulumi.String("string"),
    	Timeout:         pulumi.Int(0),
    	WorkingDir:      pulumi.String("string"),
    })
    
    var commandResource = new Command("commandResource", CommandArgs.builder()
        .commandContent("string")
        .type("string")
        .description("string")
        .enableParameter(false)
        .name("string")
        .timeout(0)
        .workingDir("string")
        .build());
    
    command_resource = alicloud.ecs.Command("commandResource",
        command_content="string",
        type="string",
        description="string",
        enable_parameter=False,
        name="string",
        timeout=0,
        working_dir="string")
    
    const commandResource = new alicloud.ecs.Command("commandResource", {
        commandContent: "string",
        type: "string",
        description: "string",
        enableParameter: false,
        name: "string",
        timeout: 0,
        workingDir: "string",
    });
    
    type: alicloud:ecs:Command
    properties:
        commandContent: string
        description: string
        enableParameter: false
        name: string
        timeout: 0
        type: string
        workingDir: string
    

    Command Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Command resource accepts the following input properties:

    CommandContent string
    The Base64-encoded content of the command.
    Type string
    The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
    Description string
    The description of command.
    EnableParameter bool
    Specifies whether to use custom parameters in the command to be created. Default to: false.
    Name string
    The name of the command, which supports all character sets. It can be up to 128 characters in length.
    Timeout int
    The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
    WorkingDir string
    The execution path of the command in the ECS instance.
    CommandContent string
    The Base64-encoded content of the command.
    Type string
    The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
    Description string
    The description of command.
    EnableParameter bool
    Specifies whether to use custom parameters in the command to be created. Default to: false.
    Name string
    The name of the command, which supports all character sets. It can be up to 128 characters in length.
    Timeout int
    The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
    WorkingDir string
    The execution path of the command in the ECS instance.
    commandContent String
    The Base64-encoded content of the command.
    type String
    The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
    description String
    The description of command.
    enableParameter Boolean
    Specifies whether to use custom parameters in the command to be created. Default to: false.
    name String
    The name of the command, which supports all character sets. It can be up to 128 characters in length.
    timeout Integer
    The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
    workingDir String
    The execution path of the command in the ECS instance.
    commandContent string
    The Base64-encoded content of the command.
    type string
    The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
    description string
    The description of command.
    enableParameter boolean
    Specifies whether to use custom parameters in the command to be created. Default to: false.
    name string
    The name of the command, which supports all character sets. It can be up to 128 characters in length.
    timeout number
    The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
    workingDir string
    The execution path of the command in the ECS instance.
    command_content str
    The Base64-encoded content of the command.
    type str
    The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
    description str
    The description of command.
    enable_parameter bool
    Specifies whether to use custom parameters in the command to be created. Default to: false.
    name str
    The name of the command, which supports all character sets. It can be up to 128 characters in length.
    timeout int
    The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
    working_dir str
    The execution path of the command in the ECS instance.
    commandContent String
    The Base64-encoded content of the command.
    type String
    The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
    description String
    The description of command.
    enableParameter Boolean
    Specifies whether to use custom parameters in the command to be created. Default to: false.
    name String
    The name of the command, which supports all character sets. It can be up to 128 characters in length.
    timeout Number
    The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
    workingDir String
    The execution path of the command in the ECS instance.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Command resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Command Resource

    Get an existing Command resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: CommandState, opts?: CustomResourceOptions): Command
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            command_content: Optional[str] = None,
            description: Optional[str] = None,
            enable_parameter: Optional[bool] = None,
            name: Optional[str] = None,
            timeout: Optional[int] = None,
            type: Optional[str] = None,
            working_dir: Optional[str] = None) -> Command
    func GetCommand(ctx *Context, name string, id IDInput, state *CommandState, opts ...ResourceOption) (*Command, error)
    public static Command Get(string name, Input<string> id, CommandState? state, CustomResourceOptions? opts = null)
    public static Command get(String name, Output<String> id, CommandState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CommandContent string
    The Base64-encoded content of the command.
    Description string
    The description of command.
    EnableParameter bool
    Specifies whether to use custom parameters in the command to be created. Default to: false.
    Name string
    The name of the command, which supports all character sets. It can be up to 128 characters in length.
    Timeout int
    The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
    Type string
    The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
    WorkingDir string
    The execution path of the command in the ECS instance.
    CommandContent string
    The Base64-encoded content of the command.
    Description string
    The description of command.
    EnableParameter bool
    Specifies whether to use custom parameters in the command to be created. Default to: false.
    Name string
    The name of the command, which supports all character sets. It can be up to 128 characters in length.
    Timeout int
    The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
    Type string
    The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
    WorkingDir string
    The execution path of the command in the ECS instance.
    commandContent String
    The Base64-encoded content of the command.
    description String
    The description of command.
    enableParameter Boolean
    Specifies whether to use custom parameters in the command to be created. Default to: false.
    name String
    The name of the command, which supports all character sets. It can be up to 128 characters in length.
    timeout Integer
    The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
    type String
    The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
    workingDir String
    The execution path of the command in the ECS instance.
    commandContent string
    The Base64-encoded content of the command.
    description string
    The description of command.
    enableParameter boolean
    Specifies whether to use custom parameters in the command to be created. Default to: false.
    name string
    The name of the command, which supports all character sets. It can be up to 128 characters in length.
    timeout number
    The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
    type string
    The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
    workingDir string
    The execution path of the command in the ECS instance.
    command_content str
    The Base64-encoded content of the command.
    description str
    The description of command.
    enable_parameter bool
    Specifies whether to use custom parameters in the command to be created. Default to: false.
    name str
    The name of the command, which supports all character sets. It can be up to 128 characters in length.
    timeout int
    The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
    type str
    The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
    working_dir str
    The execution path of the command in the ECS instance.
    commandContent String
    The Base64-encoded content of the command.
    description String
    The description of command.
    enableParameter Boolean
    Specifies whether to use custom parameters in the command to be created. Default to: false.
    name String
    The name of the command, which supports all character sets. It can be up to 128 characters in length.
    timeout Number
    The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
    type String
    The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
    workingDir String
    The execution path of the command in the ECS instance.

    Import

    ECS Command can be imported using the id, e.g.

    $ pulumi import alicloud:ecs/command:Command example <id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.56.0 published on Friday, May 31, 2024 by Pulumi