public Task withCpu(String cpu) {
        setCpu(cpu);
        return this;
    }
<p>
The number of CPU units used by the task as expressed in a task definition. It can be expressed as an integer
using CPU units (for example, <code>1024</code>). It can also be expressed as a string using vCPUs (for example,
<code>1 vCPU</code> or <code>1 vcpu</code>). String values are converted to an integer that indicates the CPU
units when the task definition is registered.
</p>
<p>
If you use the EC2 launch type, this field is optional. Supported values are between <code>128</code> CPU units (
<code>0.125</code> vCPUs) and <code>10240</code> CPU units (<code>10</code> vCPUs).
</p>
<p>
If you use the Fargate launch type, this field is required. You must use one of the following values. These
values determine the range of supported values for the <code>memory</code> parameter:
</p>
<p>
The CPU units cannot be less than 1 vCPU when you use Windows containers on Fargate.
</p>
<ul>
<li>
<p>
256 (.25 vCPU) - Available <code>memory</code> values: 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB)
</p>
</li>
<li>
<p>
512 (.5 vCPU) - Available <code>memory</code> values: 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB)
</p>
</li>
<li>
<p>
1024 (1 vCPU) - Available <code>memory</code> values: 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6
GB), 7168 (7 GB), 8192 (8 GB)
</p>
</li>
<li>
<p>
2048 (2 vCPU) - Available <code>memory</code> values: 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB)
</p>
</li>
<li>
<p>
4096 (4 vCPU) - Available <code>memory</code> values: 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB)
</p>
</li>
<li>
<p>
8192 (8 vCPU) - Available <code>memory</code> values: 16 GB and 60 GB in 4 GB increments
</p>
<p>
This option requires Linux platform <code>1.4.0</code> or later.
</p>
</li>
<li>
<p>
16384 (16vCPU) - Available <code>memory</code> values: 32GB and 120 GB in 8 GB increments
</p>
<p>
This option requires Linux platform <code>1.4.0</code> or later.
</p>
</li>
</ul>

@param cpu
       The number of CPU units used by the task as expressed in a task definition. It can be expressed as an
       integer using CPU units (for example, <code>1024</code>). It can also be expressed as a string using vCPUs
       (for example, <code>1 vCPU</code> or <code>1 vcpu</code>). String values are converted to an integer that
       indicates the CPU units when the task definition is registered.</p>
       <p>
       If you use the EC2 launch type, this field is optional. Supported values are between <code>128</code> CPU
       units (<code>0.125</code> vCPUs) and <code>10240</code> CPU units (<code>10</code> vCPUs).
       </p>
       <p>
       If you use the Fargate launch type, this field is required. You must use one of the following values.
       These values determine the range of supported values for the <code>memory</code> parameter:
       </p>
       <p>
       The CPU units cannot be less than 1 vCPU when you use Windows containers on Fargate.
       </p>
       <ul>
       <li>
       <p>
       256 (.25 vCPU) - Available <code>memory</code> values: 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB)
       </p>
       </li>
       <li>
       <p>
       512 (.5 vCPU) - Available <code>memory</code> values: 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB)
       </p>
       </li>
       <li>
       <p>
       1024 (1 vCPU) - Available <code>memory</code> values: 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB),
       6144 (6 GB), 7168 (7 GB), 8192 (8 GB)
       </p>
       </li>
       <li>
       <p>
       2048 (2 vCPU) - Available <code>memory</code> values: 4096 (4 GB) and 16384 (16 GB) in increments of 1024
       (1 GB)
       </p>
       </li>
       <li>
       <p>
       4096 (4 vCPU) - Available <code>memory</code> values: 8192 (8 GB) and 30720 (30 GB) in increments of 1024
       (1 GB)
       </p>
       </li>
       <li>
       <p>
       8192 (8 vCPU) - Available <code>memory</code> values: 16 GB and 60 GB in 4 GB increments
       </p>
       <p>
       This option requires Linux platform <code>1.4.0</code> or later.
       </p>
       </li>
       <li>
       <p>
       16384 (16vCPU) - Available <code>memory</code> values: 32GB and 120 GB in 8 GB increments
       </p>
       <p>
       This option requires Linux platform <code>1.4.0</code> or later.
       </p>
       </li>
@return Returns a reference to this object so that method calls can be chained together.
aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/Task.java