public static final class InvokeCommandRequest.Builder extends Object
限定符和类型 | 方法和说明 |
---|---|
InvokeCommandRequest |
build() |
InvokeCommandRequest.Builder |
clientToken(String clientToken)
The client token that is used to ensure the idempotence of the request.
|
InvokeCommandRequest.Builder |
commandId(String commandId)
The command ID.
|
InvokeCommandRequest.Builder |
containerId(String containerId)
The ID of the container.
|
InvokeCommandRequest.Builder |
containerName(String containerName)
The name of the container.
|
InvokeCommandRequest.Builder |
frequency(String frequency)
The schedule on which to run the command.
|
InvokeCommandRequest.Builder |
instanceId(List<String> instanceId)
The IDs of instances on which you want to run the command.
|
InvokeCommandRequest.Builder |
launcher(String launcher)
The launcher for script execution.
|
InvokeCommandRequest.Builder |
ownerAccount(String ownerAccount)
OwnerAccount.
|
InvokeCommandRequest.Builder |
ownerId(Long ownerId)
OwnerId.
|
InvokeCommandRequest.Builder |
parameters(Map<String,?> parameters)
The key-value pairs of custom parameters to be passed in when the custom parameter feature is enabled.
|
InvokeCommandRequest.Builder |
regionId(String regionId)
The region ID of the command.
|
InvokeCommandRequest.Builder |
repeatMode(String repeatMode)
The mode in which you want to run the command.
|
InvokeCommandRequest.Builder |
resourceGroupId(String resourceGroupId)
The ID of the resource group to which to assign the command executions.
|
InvokeCommandRequest.Builder |
resourceOwnerAccount(String resourceOwnerAccount)
ResourceOwnerAccount.
|
InvokeCommandRequest.Builder |
resourceOwnerId(Long resourceOwnerId)
ResourceOwnerId.
|
InvokeCommandRequest.Builder |
resourceTag(List<InvokeCommandRequest.ResourceTag> resourceTag)
The tags of the instance.
|
InvokeCommandRequest.Builder |
sourceRegionId(String sourceRegionId)
SourceRegionId.
|
InvokeCommandRequest.Builder |
tag(List<InvokeCommandRequest.Tag> tag)
The tags of the command.
|
InvokeCommandRequest.Builder |
terminationMode(String terminationMode)
Specifies how to stop the command task when a command execution is manually stopped or times out.
|
InvokeCommandRequest.Builder |
timed(Boolean timed)
> This parameter is no longer used and does not take effect.
|
InvokeCommandRequest.Builder |
timeout(Long timeout)
The timeout period for the command execution.
|
InvokeCommandRequest.Builder |
username(String username)
The username to use to run the command on the ECS instances.
|
InvokeCommandRequest.Builder |
windowsPasswordName(String windowsPasswordName)
The name of the password to use to run the command on a Windows instance.
|
public InvokeCommandRequest.Builder sourceRegionId(String sourceRegionId)
public InvokeCommandRequest.Builder clientToken(String clientToken)
public InvokeCommandRequest.Builder commandId(String commandId)
> Common Cloud Assistant commands can be run based on their names. For more information, see [View and run common Cloud Assistant commands](~~429635~~).
public InvokeCommandRequest.Builder containerId(String containerId)
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. * For information about how to query the version of Cloud Assistant Agent, see [Install Cloud Assistant Agent](~~64921~~). * For information about how to upgrade Cloud Assistant Agent, see [Upgrade or disable upgrades for Cloud Assistant Agent](~~134383~~). * If this parameter is specified, the `Username` parameter that is specified in a request to call this operation and the `WorkingDir` parameter that is specified in a request to call the [CreateCommand](~~64844~~) operation do not take effect. You can run the command only in the default working directory of the container by using the default user of the container. For more information, see [Use Cloud Assistant to run commands in containers](~~456641~~). * 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](~~456641~~).
public InvokeCommandRequest.Builder containerName(String containerName)
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. * For information about how to query the version of Cloud Assistant Agent, see [Install Cloud Assistant Agent](~~64921~~). * For information about how to upgrade Cloud Assistant Agent, see [Upgrade or disable upgrades for Cloud Assistant Agent](~~134383~~). * If this parameter is specified, the `Username` parameter that is specified in a request to call this operation and the `WorkingDir` parameter that is specified in a request to call the [CreateCommand](~~64844~~) operation do not take effect. You can run the command only in the default working directory of the container by using the default user of the container. For more information, see [Use Cloud Assistant to run commands in containers](~~456641~~). * 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](~~456641~~).
public InvokeCommandRequest.Builder frequency(String frequency)
* 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(
public InvokeCommandRequest.Builder instanceId(List<String> instanceId)
You can apply for a quota increase in the Quota Center console. The quota name is Maximum number of instances supported for command execution.
public InvokeCommandRequest.Builder launcher(String launcher)
public InvokeCommandRequest.Builder ownerAccount(String ownerAccount)
public InvokeCommandRequest.Builder ownerId(Long ownerId)
public InvokeCommandRequest.Builder parameters(Map<String,?> parameters)
* Keys in a Map collection can be up to 64 characters in length, and cannot be empty strings. * Values in a Map collection can be empty strings. * The size of the Base64-encoded custom parameters and original command content cannot exceed 18 KB. * The custom parameter names specified in the value of Parameters must be included in the custom parameters specified when you created the command. You can use empty strings to represent the parameters that are not passed in. If you want to disable the custom parameter feature, you can leave this parameter empty.
public InvokeCommandRequest.Builder regionId(String regionId)
public InvokeCommandRequest.Builder repeatMode(String repeatMode)
* Once: runs the command immediately. * Period: runs the command based on a schedule. If you set this parameter to `Period`, you must also configure the `Frequency` parameter. * 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 `Frequency`, the default value is `Once`. * If you specify `Frequency`, `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](~~64838~~) 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](~~64845~~) operation with `IncludeHistory` set to true to query the results of historical scheduled executions.
public InvokeCommandRequest.Builder resourceGroupId(String resourceGroupId)
* The instances specified by InstanceId.N must belong to the specified resource group. * After the command is run, you can call the [DescribeInvocations](~~64840~~) or [DescribeInvocationResults](~~64845~~) operation with ResourceGroupId set to query the execution results in the specified resource group.
public InvokeCommandRequest.Builder resourceOwnerAccount(String resourceOwnerAccount)
public InvokeCommandRequest.Builder resourceOwnerId(Long resourceOwnerId)
public InvokeCommandRequest.Builder resourceTag(List<InvokeCommandRequest.ResourceTag> resourceTag)
public InvokeCommandRequest.Builder tag(List<InvokeCommandRequest.Tag> tag)
public InvokeCommandRequest.Builder terminationMode(String terminationMode)
* 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.
public InvokeCommandRequest.Builder timed(Boolean timed)
public InvokeCommandRequest.Builder timeout(Long timeout)
* The timeout period cannot be less than 10 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 the specified timeout period ends, the command process is forcefully terminated. * If you do not specify this parameter, the timeout period that is specified when the command is created is used. * This timeout period is applicable only to this execution. The timeout period of the command is not modified.
public InvokeCommandRequest.Builder username(String username)
* 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](~~203771~~).
public InvokeCommandRequest.Builder windowsPasswordName(String windowsPasswordName)
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](~~186828~~) and [Run Cloud Assistant commands as a regular user](~~203771~~). > 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.
public InvokeCommandRequest build()
Copyright © 2024. All rights reserved.