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

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

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

import com.aliyun.core.annotation.*;
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 { @Host @NameInMap("SourceRegionId") private String sourceRegionId; @Query @NameInMap("ClientToken") private String clientToken; @Query @NameInMap("CommandContent") @Validation(required = true) private String commandContent; @Query @NameInMap("ContainerId") private String containerId; @Query @NameInMap("ContainerName") private String containerName; @Query @NameInMap("ContentEncoding") private String contentEncoding; @Query @NameInMap("Description") private String description; @Query @NameInMap("EnableParameter") private Boolean enableParameter; @Query @NameInMap("Frequency") private String frequency; @Query @NameInMap("InstanceId") @Validation(required = true) private java.util.List < String > instanceId; @Query @NameInMap("KeepCommand") private Boolean keepCommand; @Query @NameInMap("Name") private String name; @Query @NameInMap("OwnerAccount") private String ownerAccount; @Query @NameInMap("OwnerId") private Long ownerId; @Query @NameInMap("Parameters") private java.util.Map < String, ? > parameters; @Query @NameInMap("RegionId") @Validation(required = true) private String regionId; @Query @NameInMap("RepeatMode") private String repeatMode; @Query @NameInMap("ResourceGroupId") private String resourceGroupId; @Query @NameInMap("ResourceOwnerAccount") private String resourceOwnerAccount; @Query @NameInMap("ResourceOwnerId") private Long resourceOwnerId; @Query @NameInMap("Tag") private java.util.List < Tag> tag; @Query @NameInMap("Timed") private Boolean timed; @Query @NameInMap("Timeout") private Long timeout; @Query @NameInMap("Type") @Validation(required = true) private String type; @Query @NameInMap("Username") private String username; @Query @NameInMap("WindowsPasswordName") private String windowsPasswordName; @Query @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.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.tag = builder.tag; 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 < String > getInstanceId() { return this.instanceId; } /** * @return keepCommand */ public Boolean getKeepCommand() { return this.keepCommand; } /** * @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 < String, ? > 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 tag */ public java.util.List < Tag> getTag() { return this.tag; } /** * @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 < String > instanceId; private Boolean keepCommand; private String name; private String ownerAccount; private Long ownerId; private java.util.Map < String, ? > parameters; private String regionId; private String repeatMode; private String resourceGroupId; private String resourceOwnerAccount; private Long resourceOwnerId; private java.util.List < Tag> tag; 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.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.tag = request.tag; 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 value that is unique among different requests. The `ClientToken` value can only contain ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](~~25693~~). */ public Builder clientToken(String clientToken) { this.putQueryParameter("ClientToken", clientToken); this.clientToken = clientToken; return this; } /** * Specifies whether to retain the command after it is run. Valid values: *

* * * true: The command is retained. You can call the InvokeCommand operation to run the command again. The retained command counts against the quota of Cloud Assistant commands. * * false: The command is not retained. The command is automatically deleted after it is run and does not count against the quota of Cloud Assistant commands. * * Default value: false */ public Builder commandContent(String commandContent) { this.putQueryParameter("CommandContent", commandContent); this.commandContent = commandContent; return this; } /** * The value of tag N of the command. You can specify 1 to 20 tag keys for the command. The tag value can be an empty string. *

* * It can be up to 128 characters in length and cannot contain `http://` or `https://`. */ public Builder containerId(String containerId) { this.putQueryParameter("ContainerId", containerId); this.containerId = containerId; return this; } /** * Runs a shell, PowerShell, or batch command on one or more Elastic Compute Service (ECS) instances. */ public Builder containerName(String containerName) { this.putQueryParameter("ContainerName", containerName); this.containerName = containerName; return this; } /** * Specifies whether to run the command on a schedule. Valid values: *

* * * true: runs the command on the schedule specified by `Frequency`. The results of each execution of a command do not affect the subsequent executions of the command. * * false: runs the command only once. * * Default value: false. */ public Builder contentEncoding(String contentEncoding) { this.putQueryParameter("ContentEncoding", contentEncoding); this.contentEncoding = contentEncoding; 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 `KeepCommand` to specify whether to retain the command. * * * If the command content is Base64-encoded, set `ContentEncoding` to Base64. * * * When `EnableParameter` is set to true, the custom parameter feature is enabled 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 exceed 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. * * * You can specify built-in environment parameters as custom parameters. Then, when you run the command, the parameters are automatically specified by Cloud Assistant. You can specify the following built-in environment parameters: * * * `{{ACS::RegionId}}`: the ID of the region. * * * `{{ACS::AccountId}}`: the UID of the Alibaba Cloud account. * * * `{{ACS::InstanceId}}`: the ID of the instance. If you want to run the command on multiple instances and specify `{{ACS::InstanceId}}` as a built-in environment parameter, make sure that your Cloud Assistant is of the following versions or later: * * * Linux: 2.2.3.309 * * Windows: 2.1.3.309 * * * `{{ACS::InstanceName}}`: the name of the instance. If you want to run the command on multiple instances and specify `{{ACS::InstanceName}}` as a built-in environment parameter, make sure that your Cloud Assistant is of the following versions or later: * * * Linux: 2.2.3.344 * * Windows: 2.1.3.344 * * * `{{ACS::InvokeId}}`: the ID of the command task. If you want to specify `{{ACS::InvokeId}}` as a built-in environment variable, make sure that your Cloud Assistant is of the following versions or later: * * * 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 your Cloud Assistant is of the following versions or later: * * * Linux: 2.2.3.309 * * Windows: 2.1.3.309 */ public Builder description(String description) { this.putQueryParameter("Description", description); this.description = description; return this; } /** * The ID of the resource group to which you want to assign the command executions. When you set this parameter, take note of the following items: *

* * * The instances specified by the InstanceId.N parameter must belong to the specified resource group. * * You can set this parameter to call the [DescribeInvocations](~~64840~~) or [DescribeInvocationResults](~~64845~~) operation to query execution results in the specified resource group. */ public Builder enableParameter(Boolean enableParameter) { this.putQueryParameter("EnableParameter", enableParameter); this.enableParameter = enableParameter; return this; } /** * The name of the command. The name supports all character sets and can be up to 128 characters in length. */ public Builder frequency(String frequency) { this.putQueryParameter("Frequency", frequency); this.frequency = frequency; return this; } /** * The name of the password to use to run the command on Windows instances. *

* * If you do not want to use the default System user to run the command on Windows instances, you must specify both the WindowsPasswordName and `Username` parameters. The password is hosted in the parameter repository of Operation Orchestration Service (OOS) by using an encryption parameter to mitigate the risk of password leaks. Only the name of the encryption parameter that corresponds to the password is passed in by using the WindowsPasswordName parameter. For more information, see [Encrypt parameters](~~186828~~) and [Configure a regular user to run Cloud Assistant commands](~~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 the WindowsPasswordName parameter. */ public Builder instanceId(java.util.List < String > instanceId) { this.putQueryParameter("InstanceId", instanceId); this.instanceId = instanceId; return this; } /** * The ID of instance N on which to run the command. Valid values of N: 1 to 50. *

* * 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. */ public Builder keepCommand(Boolean keepCommand) { this.putQueryParameter("KeepCommand", keepCommand); this.keepCommand = keepCommand; return this; } /** * The ID of the command. */ 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 working directory of the command on the instance. *

* * 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 client process resides. Example: `C:\Windows\System32`. */ public Builder parameters(java.util.Map < String, ? > parameters) { String parametersShrink = shrink(parameters, "Parameters", "json"); this.putQueryParameter("Parameters", parametersShrink); this.parameters = parameters; 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 */ public Builder regionId(String regionId) { this.putQueryParameter("RegionId", regionId); this.regionId = regionId; return this; } /** * root */ public Builder repeatMode(String repeatMode) { this.putQueryParameter("RepeatMode", repeatMode); this.repeatMode = repeatMode; return this; } /** * The tags to add to the command. */ 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 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> tag) { this.putQueryParameter("Tag", tag); this.tag = tag; return this; } /** * The key-value pairs of custom parameters to pass in when the command includes custom parameters. For example, assume that the command content is `echo {{name}}`. You can use the `Parameter` parameter 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 actually run. *

* * Number of custom parameters: 0 to 10. 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 size of the Base64-encoded command content (including custom parameters and original command content) does not exceed 18 KB. If you do not want to retain the command, make sure that the size of the Base64-encoded command content does not exceed 24 KB. You can set `KeepCommand` to specify whether to retain the command. * * The custom parameter names specified in the value of Parameters must all be included in the custom parameter names 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. */ 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 occurs when a command cannot be completed because the process gets stuck, the modules are missing, or the Cloud Assistant client is not installed on the instance. When an execution times out, the command process is forcefully terminated. * * Default value: 60. */ public Builder timeout(Long timeout) { this.putQueryParameter("Timeout", timeout); this.timeout = timeout; return this; } /** * The region ID of the command. You can call the [DescribeRegions](~~25609~~) operation to query the most recent region list. */ public Builder type(String type) { this.putQueryParameter("Type", type); this.type = type; return this; } /** * Specifies whether to enable the the custom parameter feature. *

* * Default value: false */ public Builder username(String username) { this.putQueryParameter("Username", username); this.username = username; return this; } /** * The ID of instance N on which to run the command. Valid values of N: 1 to 50. *

* * 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. */ public Builder windowsPasswordName(String windowsPasswordName) { this.putQueryParameter("WindowsPasswordName", windowsPasswordName); this.windowsPasswordName = windowsPasswordName; return this; } /** * The ID of the command task. */ public Builder workingDir(String workingDir) { this.putQueryParameter("WorkingDir", workingDir); this.workingDir = workingDir; return this; } @Override public RunCommandRequest build() { return new RunCommandRequest(this); } } public static class Tag extends TeaModel { @NameInMap("Key") private String key; @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 of the command. You can specify 1 to 20 tag keys for the command. The tag key cannot be an empty string. *

* * If a single tag is specified to query resources, up to 1,000 resources that have the specified tag are displayed in the response. If multiple tags are specified to query resources, up to 1,000 resources that have all specified tags are displayed in the response. To query more than 1,000 resources that have the specified tags, call the [ListTagResources](~~110425~~) operation. * * The tag key can be up to 64 characters in length and cannot start with `acs:` or `aliyun`. It cannot contain `http://` or `https://`. */ public Builder key(String key) { this.key = key; return this; } /** * The tags to add to the command. */ public Builder value(String value) { this.value = value; return this; } public Tag build() { return new Tag(this); } } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy