public class RunCommandShrinkRequest
extends com.aliyun.tea.TeaModel
限定符和类型 | 类和说明 |
---|---|
static class |
RunCommandShrinkRequest.RunCommandShrinkRequestResourceTag |
static class |
RunCommandShrinkRequest.RunCommandShrinkRequestTag |
限定符和类型 | 字段和说明 |
---|---|
String |
clientToken
The client token that is used to ensure the idempotence of the request.
|
String |
commandContent
The content of the command.
|
String |
containerId
The ID of the container.
|
String |
containerName
The name of the container.
|
String |
contentEncoding
The encoding mode of command content (
CommandContent ). |
String |
description
The description of the command.
|
Boolean |
enableParameter
Specifies whether to include custom parameters in the command.
|
String |
frequency
The schedule on which to run the command.
|
List<String> |
instanceId
The IDs of instances on which to run the command.
|
Boolean |
keepCommand
Specifies whether to retain the command after the command is run.
|
String |
launcher
The launcher for script execution.
|
String |
name
The name of the command.
|
String |
ownerAccount |
Long |
ownerId |
String |
parametersShrink
The key-value pairs of the custom parameters that are passed in when the command that can include custom parameters is run.
|
String |
regionId
The region ID of the command.
|
String |
repeatMode
Specifies how to run the command.
|
String |
resourceGroupId
The ID of the resource group to which to assign the command executions.
|
String |
resourceOwnerAccount |
Long |
resourceOwnerId |
List<RunCommandShrinkRequest.RunCommandShrinkRequestResourceTag> |
resourceTag
The tags of the instance.
|
List<RunCommandShrinkRequest.RunCommandShrinkRequestTag> |
tag
The description of the command.
|
String |
terminationMode
Specifies how to stop the command task when a command execution is manually stopped or times out.
|
Boolean |
timed
This parameter is no longer used and does not take effect.
|
Long |
timeout
The timeout period for the command execution.
|
String |
type
The language type of the command.
|
String |
username
The username to use to run the command on the ECS instances.
|
String |
windowsPasswordName
The name of the password to use to run the command on a Windows instance.
|
String |
workingDir
The working directory of the command on the instance.
|
构造器和说明 |
---|
RunCommandShrinkRequest() |
@NameInMap(value="ClientToken") public String clientToken
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
@NameInMap(value="CommandContent") public String commandContent
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:
{{}}
format. Within {{}}
, the spaces and line feeds before and after the parameter names are ignored.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:
{{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:
{{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:
{{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:
This parameter is required.
example:ZWNobyAxMjM=
@NameInMap(value="ContainerId") public String containerId
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:
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.#!/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.ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****
@NameInMap(value="ContainerName") public String containerName
The name of the container.
Take note of the following items:
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.#!/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.test-container
@NameInMap(value="ContentEncoding") public String contentEncoding
The encoding mode of command content (CommandContent
). The valid values are case-insensitive. Valid values:
Default value: PlainText. If the specified value of this parameter is invalid, PlainText is used by default.
example:Base64
@NameInMap(value="Description") public String description
The description of the command. The description supports all character sets and can be up to 512 characters in length.
example:testDescription
@NameInMap(value="EnableParameter") public Boolean enableParameter
Specifies whether to include custom parameters in the command.
Default value: false.
example:false
@NameInMap(value="Frequency") public String frequency
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:
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:
Asia/Shanghai
and America/Los_Angeles
.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.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:
Asia/Shanghai
and America/Los_Angeles
.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.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.
@NameInMap(value="InstanceId") public List<String> instanceId
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****
@NameInMap(value="KeepCommand") public Boolean keepCommand
Specifies whether to retain the command after the command is run. Valid values:
Default value: false.
example:false
@NameInMap(value="Launcher") public String launcher
The launcher for script execution. The value cannot exceed 1 KB in length.
example:python3 -u {{ACS::ScriptFileName|Ext(".py")}}
@NameInMap(value="Name") public String name
The name of the command. The name supports all character sets and can be up to 128 characters in length.
example:testName
@NameInMap(value="OwnerAccount") public String ownerAccount
@NameInMap(value="OwnerId") public Long ownerId
@NameInMap(value="Parameters") public String parametersShrink
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:
KeepCommand
to specify whether to retain the command.This parameter is empty by default. You can leave this parameter empty to disable the custom parameter feature.
example:{"name":"Jack", "accessKey":"LTAIdyvdIqaRY****"}
@NameInMap(value="RegionId") public String regionId
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
@NameInMap(value="RepeatMode") public String repeatMode
Specifies how to run the command. Valid values:
Period
, you must specify Frequency
.Default values:
Frequency
parameter, the default value is Once
.Frequency
parameter, Period
is used as the value of RepeatMode regardless of whether RepeatMode is set to Period.Take note of the following items:
Period
or EveryReboot
, you can call the DescribeInvocationResults operation with IncludeHistory
set to true to query the results of historical scheduled executions.Once
@NameInMap(value="ResourceGroupId") public String resourceGroupId
The ID of the resource group to which to assign the command executions. When you set this parameter, take note of the following items:
rg-bp67acfmxazb4p****
@NameInMap(value="ResourceOwnerAccount") public String resourceOwnerAccount
@NameInMap(value="ResourceOwnerId") public Long resourceOwnerId
@NameInMap(value="ResourceTag") public List<RunCommandShrinkRequest.RunCommandShrinkRequestResourceTag> resourceTag
The tags of the instance. If you do not specify InstanceId.N, the command is run on the instances that have the specified tags.
@NameInMap(value="Tag") public List<RunCommandShrinkRequest.RunCommandShrinkRequestTag> tag
The description of the command. The description supports all character sets and can be up to 512 characters in length.
@NameInMap(value="TerminationMode") public String terminationMode
Specifies how to stop the command task when a command execution is manually stopped or times out. Valid values:
ProcessTree
@NameInMap(value="Timed") public Boolean timed
example:This parameter is no longer used and does not take effect.
true
@NameInMap(value="Timeout") public Long timeout
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
@NameInMap(value="Type") public String type
The language type of the command. Valid values:
This parameter is required.
example:RunShellScript
@NameInMap(value="Username") public String username
The username to use to run the command on the ECS instances. The username cannot exceed 255 characters in length.
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
@NameInMap(value="WindowsPasswordName") public String windowsPasswordName
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.
example: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.
axtSecretPassword
@NameInMap(value="WorkingDir") public String workingDir
The working directory of the command on the instance. The value can be up to 200 characters in length.
Default values:
/root
, which is the home directory of the administrator (the root user).C:\\Windows\\System32
./home/user
public static RunCommandShrinkRequest build(Map<String,?> map) throws Exception
Exception
public RunCommandShrinkRequest setClientToken(String clientToken)
public String getClientToken()
public RunCommandShrinkRequest setCommandContent(String commandContent)
public String getCommandContent()
public RunCommandShrinkRequest setContainerId(String containerId)
public String getContainerId()
public RunCommandShrinkRequest setContainerName(String containerName)
public String getContainerName()
public RunCommandShrinkRequest setContentEncoding(String contentEncoding)
public String getContentEncoding()
public RunCommandShrinkRequest setDescription(String description)
public String getDescription()
public RunCommandShrinkRequest setEnableParameter(Boolean enableParameter)
public Boolean getEnableParameter()
public RunCommandShrinkRequest setFrequency(String frequency)
public String getFrequency()
public RunCommandShrinkRequest setInstanceId(List<String> instanceId)
public RunCommandShrinkRequest setKeepCommand(Boolean keepCommand)
public Boolean getKeepCommand()
public RunCommandShrinkRequest setLauncher(String launcher)
public String getLauncher()
public RunCommandShrinkRequest setName(String name)
public String getName()
public RunCommandShrinkRequest setOwnerAccount(String ownerAccount)
public String getOwnerAccount()
public RunCommandShrinkRequest setOwnerId(Long ownerId)
public Long getOwnerId()
public RunCommandShrinkRequest setParametersShrink(String parametersShrink)
public String getParametersShrink()
public RunCommandShrinkRequest setRegionId(String regionId)
public String getRegionId()
public RunCommandShrinkRequest setRepeatMode(String repeatMode)
public String getRepeatMode()
public RunCommandShrinkRequest setResourceGroupId(String resourceGroupId)
public String getResourceGroupId()
public RunCommandShrinkRequest setResourceOwnerAccount(String resourceOwnerAccount)
public String getResourceOwnerAccount()
public RunCommandShrinkRequest setResourceOwnerId(Long resourceOwnerId)
public Long getResourceOwnerId()
public RunCommandShrinkRequest setResourceTag(List<RunCommandShrinkRequest.RunCommandShrinkRequestResourceTag> resourceTag)
public List<RunCommandShrinkRequest.RunCommandShrinkRequestResourceTag> getResourceTag()
public RunCommandShrinkRequest setTag(List<RunCommandShrinkRequest.RunCommandShrinkRequestTag> tag)
public List<RunCommandShrinkRequest.RunCommandShrinkRequestTag> getTag()
public RunCommandShrinkRequest setTerminationMode(String terminationMode)
public String getTerminationMode()
public RunCommandShrinkRequest setTimed(Boolean timed)
public Boolean getTimed()
public RunCommandShrinkRequest setTimeout(Long timeout)
public Long getTimeout()
public RunCommandShrinkRequest setType(String type)
public String getType()
public RunCommandShrinkRequest setUsername(String username)
public String getUsername()
public RunCommandShrinkRequest setWindowsPasswordName(String windowsPasswordName)
public String getWindowsPasswordName()
public RunCommandShrinkRequest setWorkingDir(String workingDir)
public String getWorkingDir()
Copyright © 2024. All rights reserved.