All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aliyun.sdk.service.ecs20140526.models.RunCommandRequest Maven / Gradle / Ivy

The newest version!
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.sdk.service.ecs20140526.models;

import com.aliyun.sdk.gateway.pop.*;
import darabonba.core.*;
import darabonba.core.async.*;
import darabonba.core.sync.*;
import darabonba.core.client.*;
import darabonba.core.RequestModel;
import darabonba.core.TeaModel;
import com.aliyun.sdk.gateway.pop.models.*;

/**
 * 
 * {@link RunCommandRequest} extends {@link RequestModel}
 *
 * 

RunCommandRequest

*/ public class RunCommandRequest extends Request { @com.aliyun.core.annotation.Host @com.aliyun.core.annotation.NameInMap("SourceRegionId") private String sourceRegionId; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("ClientToken") private String clientToken; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("CommandContent") @com.aliyun.core.annotation.Validation(required = true) private String commandContent; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("ContainerId") private String containerId; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("ContainerName") private String containerName; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("ContentEncoding") private String contentEncoding; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("Description") private String description; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("EnableParameter") private Boolean enableParameter; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("Frequency") private String frequency; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("InstanceId") private java.util.List instanceId; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("KeepCommand") private Boolean keepCommand; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("Launcher") private String launcher; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("Name") private String name; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("OwnerAccount") private String ownerAccount; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("OwnerId") private Long ownerId; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("Parameters") private java.util.Map parameters; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("RegionId") @com.aliyun.core.annotation.Validation(required = true) private String regionId; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("RepeatMode") private String repeatMode; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("ResourceGroupId") private String resourceGroupId; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("ResourceOwnerAccount") private String resourceOwnerAccount; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("ResourceOwnerId") private Long resourceOwnerId; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("ResourceTag") private java.util.List resourceTag; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("Tag") private java.util.List tag; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("TerminationMode") private String terminationMode; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("Timed") private Boolean timed; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("Timeout") private Long timeout; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("Type") @com.aliyun.core.annotation.Validation(required = true) private String type; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("Username") private String username; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("WindowsPasswordName") private String windowsPasswordName; @com.aliyun.core.annotation.Query @com.aliyun.core.annotation.NameInMap("WorkingDir") private String workingDir; private RunCommandRequest(Builder builder) { super(builder); this.sourceRegionId = builder.sourceRegionId; this.clientToken = builder.clientToken; this.commandContent = builder.commandContent; this.containerId = builder.containerId; this.containerName = builder.containerName; this.contentEncoding = builder.contentEncoding; this.description = builder.description; this.enableParameter = builder.enableParameter; this.frequency = builder.frequency; this.instanceId = builder.instanceId; this.keepCommand = builder.keepCommand; this.launcher = builder.launcher; this.name = builder.name; this.ownerAccount = builder.ownerAccount; this.ownerId = builder.ownerId; this.parameters = builder.parameters; this.regionId = builder.regionId; this.repeatMode = builder.repeatMode; this.resourceGroupId = builder.resourceGroupId; this.resourceOwnerAccount = builder.resourceOwnerAccount; this.resourceOwnerId = builder.resourceOwnerId; this.resourceTag = builder.resourceTag; this.tag = builder.tag; this.terminationMode = builder.terminationMode; this.timed = builder.timed; this.timeout = builder.timeout; this.type = builder.type; this.username = builder.username; this.windowsPasswordName = builder.windowsPasswordName; this.workingDir = builder.workingDir; } public static Builder builder() { return new Builder(); } public static RunCommandRequest create() { return builder().build(); } @Override public Builder toBuilder() { return new Builder(this); } /** * @return sourceRegionId */ public String getSourceRegionId() { return this.sourceRegionId; } /** * @return clientToken */ public String getClientToken() { return this.clientToken; } /** * @return commandContent */ public String getCommandContent() { return this.commandContent; } /** * @return containerId */ public String getContainerId() { return this.containerId; } /** * @return containerName */ public String getContainerName() { return this.containerName; } /** * @return contentEncoding */ public String getContentEncoding() { return this.contentEncoding; } /** * @return description */ public String getDescription() { return this.description; } /** * @return enableParameter */ public Boolean getEnableParameter() { return this.enableParameter; } /** * @return frequency */ public String getFrequency() { return this.frequency; } /** * @return instanceId */ public java.util.List getInstanceId() { return this.instanceId; } /** * @return keepCommand */ public Boolean getKeepCommand() { return this.keepCommand; } /** * @return launcher */ public String getLauncher() { return this.launcher; } /** * @return name */ public String getName() { return this.name; } /** * @return ownerAccount */ public String getOwnerAccount() { return this.ownerAccount; } /** * @return ownerId */ public Long getOwnerId() { return this.ownerId; } /** * @return parameters */ public java.util.Map getParameters() { return this.parameters; } /** * @return regionId */ public String getRegionId() { return this.regionId; } /** * @return repeatMode */ public String getRepeatMode() { return this.repeatMode; } /** * @return resourceGroupId */ public String getResourceGroupId() { return this.resourceGroupId; } /** * @return resourceOwnerAccount */ public String getResourceOwnerAccount() { return this.resourceOwnerAccount; } /** * @return resourceOwnerId */ public Long getResourceOwnerId() { return this.resourceOwnerId; } /** * @return resourceTag */ public java.util.List getResourceTag() { return this.resourceTag; } /** * @return tag */ public java.util.List getTag() { return this.tag; } /** * @return terminationMode */ public String getTerminationMode() { return this.terminationMode; } /** * @return timed */ public Boolean getTimed() { return this.timed; } /** * @return timeout */ public Long getTimeout() { return this.timeout; } /** * @return type */ public String getType() { return this.type; } /** * @return username */ public String getUsername() { return this.username; } /** * @return windowsPasswordName */ public String getWindowsPasswordName() { return this.windowsPasswordName; } /** * @return workingDir */ public String getWorkingDir() { return this.workingDir; } public static final class Builder extends Request.Builder { private String sourceRegionId; private String clientToken; private String commandContent; private String containerId; private String containerName; private String contentEncoding; private String description; private Boolean enableParameter; private String frequency; private java.util.List instanceId; private Boolean keepCommand; private String launcher; private String name; private String ownerAccount; private Long ownerId; private java.util.Map parameters; private String regionId; private String repeatMode; private String resourceGroupId; private String resourceOwnerAccount; private Long resourceOwnerId; private java.util.List resourceTag; private java.util.List tag; private String terminationMode; private Boolean timed; private Long timeout; private String type; private String username; private String windowsPasswordName; private String workingDir; private Builder() { super(); } private Builder(RunCommandRequest request) { super(request); this.sourceRegionId = request.sourceRegionId; this.clientToken = request.clientToken; this.commandContent = request.commandContent; this.containerId = request.containerId; this.containerName = request.containerName; this.contentEncoding = request.contentEncoding; this.description = request.description; this.enableParameter = request.enableParameter; this.frequency = request.frequency; this.instanceId = request.instanceId; this.keepCommand = request.keepCommand; this.launcher = request.launcher; this.name = request.name; this.ownerAccount = request.ownerAccount; this.ownerId = request.ownerId; this.parameters = request.parameters; this.regionId = request.regionId; this.repeatMode = request.repeatMode; this.resourceGroupId = request.resourceGroupId; this.resourceOwnerAccount = request.resourceOwnerAccount; this.resourceOwnerId = request.resourceOwnerId; this.resourceTag = request.resourceTag; this.tag = request.tag; this.terminationMode = request.terminationMode; this.timed = request.timed; this.timeout = request.timeout; this.type = request.type; this.username = request.username; this.windowsPasswordName = request.windowsPasswordName; this.workingDir = request.workingDir; } /** * SourceRegionId. */ public Builder sourceRegionId(String sourceRegionId) { this.putHostParameter("SourceRegionId", sourceRegionId); this.sourceRegionId = sourceRegionId; return this; } /** *

The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

* * example: *

123e4567-e89b-12d3-a456-426655440000

*/ public Builder clientToken(String clientToken) { this.putQueryParameter("ClientToken", clientToken); this.clientToken = clientToken; return this; } /** *

The content of the command. The command content can be plaintext or Base64-encoded. Take note of the following items:

*
    *
  • If you want to retain the command, make sure that the Base64-encoded command content does not exceed 18 KB in size. If you do not want to retain the command, make sure that the Base64-encoded command content does not exceed 24 KB in size. You can set the KeepCommand parameter to specify whether to retain the command.

    *
  • *
  • If the command content is encoded in Base6, set ContentEncoding to Base64.

    *
  • *
  • If you set the EnableParameter parameter to true, the custom parameter feature is enabled and you can configure custom parameters based on the following rules:

    *
      *
    • Specify custom parameters in the {{}} format. Within {{}}, the spaces and line feeds before and after the parameter names are ignored.
    • *
    • You can specify up to 20 custom parameters.
    • *
    • A custom parameter name can contain only letters, digits, underscores (_), and hyphens (-). The name is case-insensitive. The ACS:: prefix cannot be used to specify non-built-in environment parameters.
    • *
    • Each custom parameter name cannot exceed 64 bytes in length.
    • *
    *
  • *
  • You can specify built-in environment parameters as custom parameters. Then, when you run a command, the parameters are automatically specified by Cloud Assistant. You can specify the following built-in environment parameters:

    *
      *
    • {{ACS::RegionId}}: the region ID.

      *
    • *
    • {{ACS::AccountId}}: the UID of the Alibaba Cloud account.

      *
    • *
    • {{ACS::InstanceId}}: the instance ID. If you want to run the command on multiple instances and specify {{ACS::InstanceId}} as a built-in environment parameter, make sure that the Cloud Assistant Agent version is not earlier than the following ones:

      *
        *
      • Linux: 2.2.3.309
      • *
      • Windows: 2.1.3.309
      • *
      *
    • *
    • {{ACS::InstanceName}}: the instance name. If you want to run the command on multiple instances and specify {{ACS::InstanceName}} as a built-in environment parameter, make sure that the Cloud Assistant Agent version is not earlier than the following ones:

      *
        *
      • Linux: 2.2.3.344
      • *
      • Windows: 2.1.3.344
      • *
      *
    • *
    • {{ACS::InvokeId}}: the ID of the task. If you want to specify {{ACS::InvokeId}} as a built-in environment parameter, make sure that the Cloud Assistant Agent version is not earlier than the following ones:

      *
        *
      • Linux: 2.2.3.309
      • *
      • Windows: 2.1.3.309
      • *
      *
    • *
    • {{ACS::CommandId}}: the ID of the command. If you want to specify {{ACS::CommandId}} as a built-in environment parameter, make sure that the Cloud Assistant Agent version is not earlier than the following ones:

      *
        *
      • Linux: 2.2.3.309
      • *
      • Windows: 2.1.3.309
      • *
      *
    • *
    *
  • *
*

This parameter is required.

* * example: *

ZWNobyAxMjM=

*/ public Builder commandContent(String commandContent) { this.putQueryParameter("CommandContent", commandContent); this.commandContent = commandContent; return this; } /** *

The ID of the container. Only 64-bit hexadecimal strings are supported. docker://, containerd://, or cri-o:// can be used as the prefix to the container ID to specify the container runtime.

*

Take note of the following items:

*
    *
  • If this parameter is specified, Cloud Assistant runs the command in the specified container of the instance.
  • *
  • If this parameter is specified, the command can run only on Linux instances on which Cloud Assistant Agent 2.2.3.344 or later is installed.
  • *
  • If this parameter is specified, the specified Username and WorkingDir parameters do not take effect. You can run the command in the default working directory of the container only by using the default user of the container. For more information, see Use Cloud Assistant to run commands in containers.
  • *
  • If this parameter is specified, only shell scripts can be run in Linux containers. You cannot add a command in the format similar to #!/usr/bin/python at the beginning of a script to specify a script interpreter. For more information, see Use Cloud Assistant to run commands in containers.
  • *
* * example: *

ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****

*/ public Builder containerId(String containerId) { this.putQueryParameter("ContainerId", containerId); this.containerId = containerId; return this; } /** *

The name of the container.

*

Take note of the following items:

*
    *
  • If this parameter is specified, Cloud Assistant runs the command in the specified container of the instance.
  • *
  • If this parameter is specified, the command can run only on Linux instances on which Cloud Assistant Agent 2.2.3.344 or later is installed.
  • *
  • If this parameter is specified, the specified Username and WorkingDir parameters do not take effect. You can run the command in the default working directory of the container only by using the default user of the container. For more information, see Use Cloud Assistant to run commands in containers.
  • *
  • If this parameter is specified, only shell scripts can be run in Linux containers. You cannot add a command in the format similar to #!/usr/bin/python at the beginning of a script to specify a script interpreter. For more information, see Use Cloud Assistant to run commands in containers.
  • *
* * example: *

test-container

*/ public Builder containerName(String containerName) { this.putQueryParameter("ContainerName", containerName); this.containerName = containerName; return this; } /** *

The encoding mode of command content (CommandContent). The valid values are case-insensitive. Valid values:

*
    *
  • PlainText: The command content is not encoded.
  • *
  • Base64: The command content is encoded in Base64.
  • *
*

Default value: PlainText. If the specified value of this parameter is invalid, PlainText is used by default.

* * example: *

Base64

*/ public Builder contentEncoding(String contentEncoding) { this.putQueryParameter("ContentEncoding", contentEncoding); this.contentEncoding = contentEncoding; return this; } /** *

The description of the command. The description supports all character sets and can be up to 512 characters in length.

* * example: *

testDescription

*/ public Builder description(String description) { this.putQueryParameter("Description", description); this.description = description; return this; } /** *

Specifies whether to include custom parameters in the command.

*

Default value: false.

* * example: *

false

*/ public Builder enableParameter(Boolean enableParameter) { this.putQueryParameter("EnableParameter", enableParameter); this.enableParameter = enableParameter; return this; } /** *

The schedule on which to run the command. You can configure a command to run at a fixed interval based on a rate expression, run only once at a specified time, or run at designated times based on a cron expression.

*
    *
  • To run a command at a fixed interval, use a rate expression to specify the interval. You can specify the interval in seconds, minutes, hours, or days. This option is suitable for scenarios in which tasks need to be executed at a fixed interval. Specify the interval in the following format: rate(<Execution interval value> <Execution interval unit>). For example, specify rate(5m) to run the command every 5 minutes. When you specify an interval, take note of the following limits:

    *
      *
    • The interval can be anywhere from 60 seconds to 7 days, but must be longer than the timeout period of the scheduled task.
    • *
    • The interval is the amount of time that elapses between two consecutive executions. The interval is irrelevant to the amount of time that is required to run the command once. For example, assume that you set the interval to 5 minutes and that it takes 2 minutes to run the command each time. Each time the command is run, the system waits 3 minutes before the system runs the command again.
    • *
    • A task is not immediately executed after the task is created. For example, assume that you set the interval to 5 minutes for a task. The task begins to be executed 5 minutes after it is created.
    • *
    *
  • *
  • To run a command only once at a specific time, specify a point in time and a time zone. Specify the point in time in the at(yyyy-MM-dd HH:mm:ss <Time zone>) format, which indicates at(Year-Month-Day Hour:Minute:Second <Time zone>). If you do not specify a time zone, the UTC time zone is used by default. You can specify the time zone in the following forms:

    *
      *
    • The time zone name. Examples: Asia/Shanghai and America/Los_Angeles.
    • *
    • The time offset from GMT. Examples: GMT+8:00 (UTC+8) and GMT-7:00 (UTC-7). If you use the GMT format, you cannot add leading zeros to the hour value.
    • *
    • The time zone abbreviation. Only UTC is supported.
    • *
    *

    For example, to configure a command to run only once at 13:15:30 on June 6, 2022 (Shanghai time), set the time to at(2022-06-06 13:15:30 Asia/Shanghai). To configure a command to run only once at 13:15:30 on June 6, 2022 (UTC-7), set the time to at(2022-06-06 13:15:30 GMT-7:00).

    *
  • *
  • To run a command at specific times, use a cron expression to define the schedule. Specify a schedule in the <Cron expression> <Time zone> format. The cron expression is in the <seconds> <minutes> <hours> <day of the month> <month> <day of the week> <year (optional)> format. The system calculates the execution times of the command based on the specified cron expression and time zone and runs the command as scheduled. If you do not specify a time zone, the system time zone of the instance on which you want to run the command is used by default. For more information about cron expressions, see Cron expressions. You can specify the time zone in the following forms:

    *
      *
    • The time zone name. Examples: Asia/Shanghai and America/Los_Angeles.
    • *
    • The time offset from GMT. Examples: GMT+8:00 (UTC+8) and GMT-7:00 (UTC-7). If you use the GMT format, you cannot add leading zeros to the hour value.
    • *
    • The time zone abbreviation. Only UTC is supported. For example, to configure a command to run at 10:15:00 every day in 2022 (Shanghai time), set the schedule to 0 15 10 ? * * 2022 Asia/Shanghai. To configure a command to run every half an hour from 10:00:00 to 11:30:00 every day in 2022 (UTC+8), set the schedule to 0 0/30 10-11 * * ? 2022 GMT+8:00. To configure a command to run every 5 minutes from 14:00:00 to 14:55:00 every October every two years from 2022 in UTC, set the schedule to 0 0/5 14 * 10 ? 2022/2 UTC.
    • *
    *

    **

    *

    Note The minimum interval must be 10 seconds or more and cannot be shorter than the timeout period of scheduled executions.

    *
  • *
*/ public Builder frequency(String frequency) { this.putQueryParameter("Frequency", frequency); this.frequency = frequency; return this; } /** *

The IDs of instances on which to run the command. N indicates that you can specify multiple instance IDs at the same time. Valid values of N: 1 to 100.

*

If one of the specified instances does not meet the conditions for running the command, the call fails. To ensure that the call is successful, specify only the IDs of instances that meet the conditions.

*

You can apply for a quota increase in the Quota Center console. The quota name is Maximum number of instances supported for command execution.

* * example: *

i-bp185dy2o3o6neg****

*/ public Builder instanceId(java.util.List instanceId) { this.putQueryParameter("InstanceId", instanceId); this.instanceId = instanceId; return this; } /** *

Specifies whether to retain the command after the command is run. Valid values:

*
    *
  • true: retains the command. Then, you can call the InvokeCommand operation to rerun the command. The retained command counts against the quota of Cloud Assistant commands.
  • *
  • false: does not retain the command. The command is automatically deleted after it is run and does not count against the quota of Cloud Assistant commands.
  • *
*

Default value: false.

* * example: *

false

*/ public Builder keepCommand(Boolean keepCommand) { this.putQueryParameter("KeepCommand", keepCommand); this.keepCommand = keepCommand; return this; } /** *

The launcher for script execution. The value cannot exceed 1 KB in length.

* * example: *

python3 -u {{ACS::ScriptFileName|Ext(".py")}}

*/ public Builder launcher(String launcher) { this.putQueryParameter("Launcher", launcher); this.launcher = launcher; return this; } /** *

The name of the command. The name supports all character sets and can be up to 128 characters in length.

* * example: *

testName

*/ public Builder name(String name) { this.putQueryParameter("Name", name); this.name = name; return this; } /** * OwnerAccount. */ public Builder ownerAccount(String ownerAccount) { this.putQueryParameter("OwnerAccount", ownerAccount); this.ownerAccount = ownerAccount; return this; } /** * OwnerId. */ public Builder ownerId(Long ownerId) { this.putQueryParameter("OwnerId", ownerId); this.ownerId = ownerId; return this; } /** *

The key-value pairs of the custom parameters that are passed in when the command that can include custom parameters is run. For example, assume that the command content is echo {{name}}. The Parameter parameter can be used to pass in the {"name":"Jack"} key-value pair. The name key of the custom parameter is automatically replaced by the paired Jack value to generate a new command. As a result, the echo Jack command is run.

*

You can specify up to 10 custom parameters. Take note of the following items:

*
    *
  • The key cannot be an empty string. It can be up to 64 characters in length.
  • *
  • The value can be an empty string.
  • *
  • If you want to retain the command, make sure that the command after Base64 encoding, including custom parameters and original command content, does not exceed 18 KB in size. If you do not want to retain the command, make sure that the command after Base64-encoding does not exceed 24 KB in size. You can set KeepCommand to specify whether to retain the command.
  • *
  • The custom parameter names that are specified by Parameters must be included in the custom parameter names that you specified when you created the command. You can use empty strings to represent the parameters that are not passed in.
  • *
*

This parameter is empty by default. You can leave this parameter empty to disable the custom parameter feature.

* * example: *

{"name":"Jack", "accessKey":"LTAIdyvdIqaRY****"}

*/ public Builder parameters(java.util.Map parameters) { String parametersShrink = shrink(parameters, "Parameters", "json"); this.putQueryParameter("Parameters", parametersShrink); this.parameters = parameters; return this; } /** *

The region ID of the command. You can call the DescribeRegions operation to query the most recent region list.

*

This parameter is required.

* * example: *

cn-hangzhou

*/ public Builder regionId(String regionId) { this.putQueryParameter("RegionId", regionId); this.regionId = regionId; return this; } /** *

Specifies how to run the command. Valid values:

*
    *
  • Once: immediately runs the command.
  • *
  • Period: runs the command on a schedule. If you set this parameter to Period, you must specify Frequency.
  • *
  • NextRebootOnly: runs the command the next time the instance is started.
  • *
  • EveryReboot: runs the command every time the instance is started.
  • *
*

Default values:

*
    *
  • If you do not specify the Frequency parameter, the default value is Once.
  • *
  • If you specify the Frequency parameter, Period is used as the value of RepeatMode regardless of whether RepeatMode is set to Period.
  • *
*

Take note of the following items:

*
    *
  • You can call the StopInvocation operation to stop the pending or scheduled executions of the command.
  • *
  • If you set this parameter to Period or EveryReboot, you can call the DescribeInvocationResults operation with IncludeHistory set to true to query the results of historical scheduled executions.
  • *
* * example: *

Once

*/ public Builder repeatMode(String repeatMode) { this.putQueryParameter("RepeatMode", repeatMode); this.repeatMode = repeatMode; return this; } /** *

The ID of the resource group to which to assign the command executions. When you set this parameter, take note of the following items:

*
    *
  • The instances specified by InstanceId.N must belong to the specified resource group.
  • *
  • After the command is run, you can set this parameter to call the DescribeInvocations or DescribeInvocationResults operation to query the execution results in the specified resource group.
  • *
* * example: *

rg-bp67acfmxazb4p****

*/ public Builder resourceGroupId(String resourceGroupId) { this.putQueryParameter("ResourceGroupId", resourceGroupId); this.resourceGroupId = resourceGroupId; return this; } /** * ResourceOwnerAccount. */ public Builder resourceOwnerAccount(String resourceOwnerAccount) { this.putQueryParameter("ResourceOwnerAccount", resourceOwnerAccount); this.resourceOwnerAccount = resourceOwnerAccount; return this; } /** * ResourceOwnerId. */ public Builder resourceOwnerId(Long resourceOwnerId) { this.putQueryParameter("ResourceOwnerId", resourceOwnerId); this.resourceOwnerId = resourceOwnerId; return this; } /** *

The tags of the instance. If you do not specify InstanceId.N, the command is run on the instances that have the specified tags.

*/ public Builder resourceTag(java.util.List resourceTag) { this.putQueryParameter("ResourceTag", resourceTag); this.resourceTag = resourceTag; return this; } /** *

The description of the command. The description supports all character sets and can be up to 512 characters in length.

*/ public Builder tag(java.util.List tag) { this.putQueryParameter("Tag", tag); this.tag = tag; return this; } /** *

Specifies how to stop the command task when a command execution is manually stopped or times out. Valid values:

*
    *
  • Process: stops the process of the command.
  • *
  • ProcessTree: stops the process tree of the command. In this case, the process of the command and all subprocesses of the process are stopped.
  • *
* * example: *

ProcessTree

*/ public Builder terminationMode(String terminationMode) { this.putQueryParameter("TerminationMode", terminationMode); this.terminationMode = terminationMode; return this; } /** *
*

This parameter is no longer used and does not take effect.

*
* * example: *

true

*/ public Builder timed(Boolean timed) { this.putQueryParameter("Timed", timed); this.timed = timed; return this; } /** *

The timeout period for the command execution. Unit: seconds.

*

A timeout error occurs if the command cannot be run because the process slows down or because a specific module or Cloud Assistant Agent does not exist. When an execution times out, the command process is forcefully terminated.

*

Default value: 60.

* * example: *

3600

*/ public Builder timeout(Long timeout) { this.putQueryParameter("Timeout", timeout); this.timeout = timeout; return this; } /** *

The language type of the command. Valid values:

*
    *
  • RunBatScript: batch command, applicable to Windows instances.
  • *
  • RunPowerShellScript: PowerShell command, applicable to Windows instances.
  • *
  • RunShellScript: shell command, applicable to Linux instances.
  • *
*

This parameter is required.

* * example: *

RunShellScript

*/ public Builder type(String type) { this.putQueryParameter("Type", type); this.type = type; return this; } /** *

The username to use to run the command on the ECS instances. The username cannot exceed 255 characters in length.

*
    *
  • For Linux instances, the root username is used by default.
  • *
  • For Windows instances, the System username is used by default.
  • *
*

You can also specify other usernames that already exist in the instances to run the command. For security purposes, we recommend that you run Cloud Assistant commands as a regular user. For more information, see Run Cloud Assistant commands as a regular user.

* * example: *

test

*/ public Builder username(String username) { this.putQueryParameter("Username", username); this.username = username; return this; } /** *

The name of the password to use to run the command on a Windows instance. The name cannot exceed 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 Username. To mitigate the risk of password leaks, the password is stored in plaintext in CloudOps Orchestration Service (OOS) Parameter Store, and only the name of the password is passed in by using WindowsPasswordName. For more information, see Manage encryption parameters and Run Cloud Assistant commands as a regular user.

*
*

If you use the root username for Linux instances or the System username for Windows instances to run the command, you do not need to specify WindowsPasswordName.

*
* * example: *

axtSecretPassword

*/ public Builder windowsPasswordName(String windowsPasswordName) { this.putQueryParameter("WindowsPasswordName", windowsPasswordName); this.windowsPasswordName = windowsPasswordName; return this; } /** *

The working directory of the command on the instance. The value can be up to 200 characters in length.

*

Default values:

*
    *
  • For Linux instances, the default value is /root, which is the home directory of the administrator (the root user).
  • *
  • For Windows instances, the default value is the directory where the Cloud Assistant Agent process resides, such as C:\Windows\System32.
  • *
* * example: *

/home/user

*/ public Builder workingDir(String workingDir) { this.putQueryParameter("WorkingDir", workingDir); this.workingDir = workingDir; return this; } @Override public RunCommandRequest build() { return new RunCommandRequest(this); } } /** * * {@link RunCommandRequest} extends {@link TeaModel} * *

RunCommandRequest

*/ public static class ResourceTag extends TeaModel { @com.aliyun.core.annotation.NameInMap("Key") private String key; @com.aliyun.core.annotation.NameInMap("Value") private String value; private ResourceTag(Builder builder) { this.key = builder.key; this.value = builder.value; } public static Builder builder() { return new Builder(); } public static ResourceTag create() { return builder().build(); } /** * @return key */ public String getKey() { return this.key; } /** * @return value */ public String getValue() { return this.value; } public static final class Builder { private String key; private String value; /** *

The key of tag N of the instance.

*

Take note of the following items:

*
    *
  • This parameter and InstanceId.N are mutually exclusive.
  • *
  • Valid values of N: 1 to 10. The tag key cannot be an empty string.
  • *
  • The number of instances that have the specified tags cannot exceed 100. If more than 100 instances have the specified tags, we recommend that you use batch tags such as batch: b1 to group the instances into batches of up to 100 instances.
  • *
  • The tag key can be up to 64 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.
  • *
* * example: *

TestKey

*/ public Builder key(String key) { this.key = key; return this; } /** *

The value of tag N of the instance.

*

Take note of the following items:

*
    *
  • Valid values of N: 1 to 10.
  • *
  • The tag value can be an empty string.
  • *
  • The tag value can be up to 128 characters in length and cannot contain http:// or https://.
  • *
* * example: *

TestValue

*/ public Builder value(String value) { this.value = value; return this; } public ResourceTag build() { return new ResourceTag(this); } } } /** * * {@link RunCommandRequest} extends {@link TeaModel} * *

RunCommandRequest

*/ public static class Tag extends TeaModel { @com.aliyun.core.annotation.NameInMap("Key") private String key; @com.aliyun.core.annotation.NameInMap("Value") private String value; private Tag(Builder builder) { this.key = builder.key; this.value = builder.value; } public static Builder builder() { return new Builder(); } public static Tag create() { return builder().build(); } /** * @return key */ public String getKey() { return this.key; } /** * @return value */ public String getValue() { return this.value; } public static final class Builder { private String key; private String value; /** *

The key of tag N to add to the command task. Valid values of N: 1 to 20. The tag key cannot be an empty string.

*

If a single tag is specified to query resources, up to 1,000 resources that have this tag added can be displayed in the response. If multiple tags are specified to query resources, up to 1,000 resources that have all these tags added can be displayed in the response. To query more than 1,000 resources that have specified tags, call ListTagResources.

*

The tag key can be up to 64 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.

* * example: *

TestKey

*/ public Builder key(String key) { this.key = key; return this; } /** *

The value of tag N to add to the command task. Valid values of N: 1 to 20. The tag value can be an empty string.

*

The tag value can be up to 128 characters in length and cannot contain http:// or https://.

* * example: *

TestValue

*/ public Builder value(String value) { this.value = value; return this; } public Tag build() { return new Tag(this); } } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy