Invocation
This class encapsulates and extends the ROS resource type ALIYUN::ECS::Invocation
, which is used to run a Cloud Assistant command on Elastic Compute Service (ECS) instances.
Initializers
import com.aliyun.ros.cdk.ecs.Invocation;
Invocation.Builder.create(Construct scope, java.lang.String id, java.lang.Boolean enableResourcePropertyConstraint)
.instanceIds(java.util.List<java.lang.Object>)
.instanceIds(IResolvable)
// .commandId(java.lang.String)
// .commandId(IResolvable)
// .commandName(java.lang.String)
// .commandName(IResolvable)
// .containerId(java.lang.String)
// .containerId(IResolvable)
// .containerName(java.lang.String)
// .containerName(IResolvable)
// .frequency(java.lang.String)
// .frequency(IResolvable)
// .parameters(IResolvable)
// .parameters(java.util.Map<java.lang.String, java.lang.Object>)
// .repeatMode(java.lang.String)
// .repeatMode(IResolvable)
// .resourceGroupId(java.lang.String)
// .resourceGroupId(IResolvable)
// .sync(java.lang.Boolean)
// .sync(IResolvable)
// .tags(java.util.List<TagsProperty>)
// .timeout(java.lang.Number)
// .timeout(IResolvable)
// .username(java.lang.String)
// .username(IResolvable)
// .windowsPasswordName(java.lang.String)
// .windowsPasswordName(IResolvable)
.build();
Name | Type | Description |
---|---|---|
scope |
com.aliyun.ros.cdk.core.Construct |
No description. |
id |
java.lang.String |
No description. |
enableResourcePropertyConstraint |
java.lang.Boolean |
No description. |
instanceIds |
java.util.List |
Property instanceIds: The instance id list. |
commandId |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property commandId: The id of command. |
commandName |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property commandName: The name of command. |
containerId |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property containerId: The ID of the container. |
containerName |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property containerName: The name of the container. |
frequency |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property frequency: The frequency of timing execution (the shortest frequency is performed every 1 minute). |
parameters |
com.aliyun.ros.cdk.core.IResolvable OR java.util.Map |
Property parameters: The key-value pairs of custom parameters passed in when the script contains custom parameters. |
repeatMode |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property repeatMode: Specifies how to run the command. |
resourceGroupId |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property resourceGroupId: The ID of the resource group to which to assign the command executions. |
sync |
java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable |
Property sync: Whether to invoke synchronously. |
tags |
java.util.List<TagsProperty> |
Property tags: Tags to attach to invocation. |
timeout |
java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable |
Property timeout: The timeout period for the command execution. |
username |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property username: The username to use to run the command on instances. |
windowsPasswordName |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property windowsPasswordName: The name of the password to use to run the command on Windows instances. |
scope
Required
- Type: com.aliyun.ros.cdk.core.Construct
id
Required
- Type: java.lang.String
enableResourcePropertyConstraint
Optional
- Type: java.lang.Boolean
instanceIds
Required
- Type: java.util.List
OR com.aliyun.ros.cdk.core.IResolvable
Property instanceIds: The instance id list.
Instances status must be running.
commandId
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property commandId: The id of command.
commandName
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property commandName: The name of command.
Only system commands whose provide is AlibabaCloud are supported
containerId
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property containerId: The ID of the container.
Only 64-bit hexadecimal strings are supported. You can use container IDs that are prefixed with docker://, containerd://, or cri-o:// to specify container runtimes. Take note of the following items:
- If you specify this parameter, Cloud Assistant runs scripts in the specified container of the instance.
- If you specify this parameter, make sure that the version of Cloud Assistant Agent installed on Linux instances is 2.2.3.344 or later.- If you specify this parameter, Username that is specified in a request to call this operation and WorkingDir that is specified in a request to call the CreateCommand 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.
- If you specify this parameter, 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.
containerName
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property containerName: The name of the container.
Take note of the following items:
- If you specify this parameter, Cloud Assistant runs scripts in the specified container of the instance.
- If you specify this parameter, make sure that the version of Cloud Assistant Agent installed on Linux instances is 2.2.3.344 or later.
- If you specify this parameter, Username that is specified in a request to call this operation and WorkingDir that is specified in a request to call the CreateCommand 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.
- If you specify this parameter, 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.
frequency
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property frequency: The frequency of timing execution (the shortest frequency is performed every 1 minute).
It iss mandatory when Timing is True.The value rule follows the rules of the cron expression.
parameters
Optional
- Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.Map
Property parameters: The key-value pairs of custom parameters passed in when the script contains custom parameters.
Number of custom parameters: 0 to 10. 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 script 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 script. 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.
repeatMode
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property repeatMode: 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 value:
- 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.
resourceGroupId
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property resourceGroupId: The ID of the resource group to which to assign the command executions.
The instances specified by InstanceIds must belong to the specified resource group.
sync
Optional
- Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable
Property sync: Whether to invoke synchronously.
tags
Optional
- Type: java.util.List<TagsProperty>
Property tags: Tags to attach to invocation.
Max support 20 tags to add during create invocation. Each tag with two properties Key and Value, and Key is required.
timeout
Optional
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
Property timeout: The timeout period for the command execution.
Unit: seconds.
- 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.
username
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property username: The username to use to run the command on instances.
The username can be up to 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.
windowsPasswordName
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
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 Username. 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.
Methods
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
synthesize |
Allows this construct to emit artifacts into the cloud assembly during synthesis. |
addCondition |
No description. |
addCount |
No description. |
addDependency |
No description. |
addResourceDesc |
No description. |
applyRemovalPolicy |
No description. |
getAtt |
No description. |
setMetadata |
No description. |
toString
public java.lang.String toString()
Returns a string representation of this construct.
synthesize
public void synthesize(ISynthesisSession session)
Allows this construct to emit artifacts into the cloud assembly during synthesis.
This method is usually implemented by framework-level constructs such as Stack
and Asset
as they participate in synthesizing the cloud assembly.
- Type: com.aliyun.ros.cdk.core.ISynthesisSession
The synthesis session.
addCondition
public void addCondition(RosCondition condition)
- Type: com.aliyun.ros.cdk.core.RosCondition
addCount
public void addCount(java.lang.Number OR IResolvable count)
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
addDependency
public void addDependency(Resource resource)
- Type: com.aliyun.ros.cdk.core.Resource
addResourceDesc
public void addResourceDesc(java.lang.String desc)
- Type: java.lang.String
applyRemovalPolicy
public void applyRemovalPolicy(RemovalPolicy policy)
- Type: com.aliyun.ros.cdk.core.RemovalPolicy
getAtt
public IResolvable getAtt(java.lang.String name)
- Type: java.lang.String
setMetadata
public void setMetadata(java.lang.String key, java.lang.Object value)
- Type: java.lang.String
- Type: java.lang.Object
Static Functions
Name | Description |
---|---|
isConstruct |
Return whether the given object is a Construct. |
isConstruct
import com.aliyun.ros.cdk.ecs.Invocation;
Invocation.isConstruct(java.lang.Object x)
Return whether the given object is a Construct.
- Type: java.lang.Object
Properties
Name | Type | Description |
---|---|---|
node |
com.aliyun.ros.cdk.core.ConstructNode |
The construct tree node associated with this construct. |
ref |
java.lang.String |
No description. |
stack |
com.aliyun.ros.cdk.core.Stack |
The stack in which this resource is defined. |
resource |
com.aliyun.ros.cdk.core.RosResource |
No description. |
attrInvokeId |
com.aliyun.ros.cdk.core.IResolvable |
Attribute InvokeId: The id of command execution. |
attrInvokeInstances |
com.aliyun.ros.cdk.core.IResolvable |
Attribute InvokeInstances: The InvokeInstances of command. |
attrInvokeResults |
com.aliyun.ros.cdk.core.IResolvable |
Attribute InvokeResults: The results of invoke command. |
node
Required
public ConstructNode getNode();
- Type: com.aliyun.ros.cdk.core.ConstructNode
The construct tree node associated with this construct.
ref
Required
public java.lang.String getRef();
- Type: java.lang.String
stack
Required
public Stack getStack();
- Type: com.aliyun.ros.cdk.core.Stack
The stack in which this resource is defined.
resource
Optional
public RosResource getResource();
- Type: com.aliyun.ros.cdk.core.RosResource
attrInvokeId
Required
public IResolvable getAttrInvokeId();
- Type: com.aliyun.ros.cdk.core.IResolvable
Attribute InvokeId: The id of command execution.
attrInvokeInstances
Required
public IResolvable getAttrInvokeInstances();
- Type: com.aliyun.ros.cdk.core.IResolvable
Attribute InvokeInstances: The InvokeInstances of command.
attrInvokeResults
Required
public IResolvable getAttrInvokeResults();
- Type: com.aliyun.ros.cdk.core.IResolvable
Attribute InvokeResults: The results of invoke command.