Skip to content

RunCommandProps

Properties for defining a RunCommand.

See https://www.alibabacloud.com/help/ros/developer-reference/aliyun-swas-runcommand

Initializer

using AlibabaCloud.SDK.ROS.CDK.Swas;
new RunCommandProps {
    object CommandContent,
    object InstanceId,
    object Name,
    object Type,
    object ContentEncoding = null,
    object EnableParameter = null,
    object Parameters = null,
    object Sync = null,
    object Timeout = null,
    object WindowsPasswordName = null,
    object WorkingDir = null,
    object WorkingUser = null
};

Properties

Name Type Description
CommandContent object Property commandContent: The content of the command.
InstanceId object Property instanceId: The ID of the SWAS instance on which to run the command.
Name object Property name: The name of the command to run.
Type object Property type: The language type of the O&M script.
ContentEncoding object Property contentEncoding: The encoding mode of command content (CommandContent).
EnableParameter object Property enableParameter: Specifies whether the command contains custom parameters.
Parameters object Property parameters: The key-value pairs of custom parameters passed in when the command contains custom parameters.
Sync object Property sync: Whether to run the command synchronously.
Timeout object Property timeout: The timeout period for command execution.
WindowsPasswordName object Property windowsPasswordName: The name of the password to use to run the command on Windows instances.
WorkingDir object Property workingDir: The execution path of the command.
WorkingUser object Property workingUser: The user with which to run the command on the instance.

CommandContentRequired

public object CommandContent { get; set; }
  • Type: object

Property commandContent: The content of the command.

Take note of the following items:

  • If you set EnableParameter to true, the custom parameter feature is enabled in the command content and you can configure custom parameters based on the following rules:
  • Define custom parameters in the {{}} format. Within {{}}, the spaces and line feeds before and after the parameter names are ignored.
  • The number of custom parameters cannot be greater than 20.
  • A custom parameter name can contain only letters, digits, underscores (_), and hyphens (-). The name is case-insensitive.
  • Each custom parameter name cannot exceed 64 bytes in length.

InstanceIdRequired

public object InstanceId { get; set; }
  • Type: object

Property instanceId: The ID of the SWAS instance on which to run the command.

The instance must be in 'Running' status.


NameRequired

public object Name { get; set; }
  • Type: object

Property name: The name of the command to run.


TypeRequired

public object Type { get; set; }
  • Type: object

Property type: The language type of the O&M script.

Valid values: RunShellScript: shell scripts for Linux instances RunBatScript: batch scripts for Windows instances RunPowerShellScript: PowerShell scripts for Windows instances


ContentEncodingOptional

public object ContentEncoding { get; set; }
  • Type: object

Property contentEncoding: The encoding mode of command content (CommandContent).

Valid values (case insensitive): PlainText: The command content is not encoded, and transmitted in plaintext. Base64: base64-encoded. Default value: PlainText. If the specified value of this parameter is invalid, PlainText is used by default.


EnableParameterOptional

public object EnableParameter { get; set; }
  • Type: object

Property enableParameter: Specifies whether the command contains custom parameters.

Default value: false


ParametersOptional

public object Parameters { get; set; }
  • Type: object

Property parameters: The key-value pairs of custom parameters passed in when the command contains custom parameters.

Number of custom parameters: 0 to 20. The key cannot be an empty string. It can be up to 64 characters in length. The value can be an empty string. After the custom parameters and the original command content are Base64 encoded, the total size cannot exceed 16 KB. The set of custom parameter names must be a subset of the parameter set that is defined when you created the command. You can use an empty string to represent the parameters that are not passed in. Default value: null, indicating that this parameter is canceled and customer parameters are disabled.


SyncOptional

public object Sync { get; set; }
  • Type: object

Property sync: Whether to run the command synchronously.


TimeoutOptional

public object Timeout { get; set; }
  • Type: object

Property timeout: The timeout period for command execution.

Unit: seconds. Valid values: 10 to 86400. Default value: 60.


WindowsPasswordNameOptional

public object WindowsPasswordName { get; set; }
  • Type: object

Property windowsPasswordName: The name of the password to use to run the command on Windows instances.

The name can be up to 255 characters in length. If you do not want to use the default System user to run the command on Windows instances, specify both WindowsPasswordName and WorkingUser. To mitigate the risk of password leaks, the password is stored in plaintext in Operation Orchestration Service (OOS) Parameter Store, and only the name of the password is passed in by using WindowsPasswordName.


WorkingDirOptional

public object WorkingDir { get; set; }
  • Type: object

Property workingDir: The execution path of the command.

Custom paths are supported. Default execution paths vary based on the operating systems of the servers.

  • For Linux servers, the default path is /root of the root user.
  • For Windows servers, the default path is C:\Windows\system32.

WorkingUserOptional

public object WorkingUser { get; set; }
  • Type: object

Property workingUser: The user with which to run the command on the instance.

Default value: 'root' for Linux instances, 'system' for Windows instances. You can specify other existing users to run the command to reduce security risks.