Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   * 
   *  http://aws.amazon.com/apache2.0
   * 
  * or in the "license" file accompanying this file. This file is distributed
  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.ec2.model;
 
 
 import  com.amazonaws.services.ec2.model.transform.CreateImageRequestMarshaller;

Container for the parameters to the CreateImage operation.

Creates an Amazon EBS-backed AMI from an Amazon EBS-backed instance that is either running or stopped.

If you customized your instance with instance store volumes or EBS volumes in addition to the root device volume, the new AMI contains block device mapping information for those volumes. When you launch an instance from this new AMI, the instance automatically launches with those additional volumes.

For more information, see Creating Amazon EBS-Backed Linux AMIs in the Amazon Elastic Compute Cloud User Guide .

See also:
com.amazonaws.services.ec2.AmazonEC2.createImage(CreateImageRequest)
 
 public class CreateImageRequest extends AmazonWebServiceRequest implements Serializable, DryRunSupportedRequest<CreateImageRequest> {

    
The ID of the instance.
 
     private String instanceId;

    
A name for the new image.

Constraints: 3-128 alphanumeric characters, parenthesis (()), periods (.), slashes (/), dashes (-), or underscores(_)

 
     private String name;

    
A description for the new image.
 
     private String description;

    
By default, this parameter is set to false, which means Amazon EC2 attempts to shut down the instance cleanly before image creation and then reboots the instance. When the parameter is set to true, Amazon EC2 doesn't shut down the instance before creating the image. When this option is used, file system integrity on the created image can't be guaranteed.
 
     private Boolean noReboot;

    
Information about one or more block device mappings.
 
Default constructor for a new CreateImageRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
 
     public CreateImageRequest() {}
    
    
Constructs a new CreateImageRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
instanceId The ID of the instance.
name A name for the new image.

Constraints: 3-128 alphanumeric characters, parenthesis (()), periods (.), slashes (/), dashes (-), or underscores(_)

 
     public CreateImageRequest(String instanceIdString name) {
         setInstanceId(instanceId);
         setName(name);
     }

    
The ID of the instance.

Returns:
The ID of the instance.
    public String getInstanceId() {
        return ;
    }
    
    
The ID of the instance.

Parameters:
instanceId The ID of the instance.
    public void setInstanceId(String instanceId) {
        this. = instanceId;
    }
    
    
The ID of the instance.

Returns a reference to this object so that method calls can be chained together.

Parameters:
instanceId The ID of the instance.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateImageRequest withInstanceId(String instanceId) {
        this. = instanceId;
        return this;
    }

    
A name for the new image.

Constraints: 3-128 alphanumeric characters, parenthesis (()), periods (.), slashes (/), dashes (-), or underscores(_)

Returns:
A name for the new image.

Constraints: 3-128 alphanumeric characters, parenthesis (()), periods (.), slashes (/), dashes (-), or underscores(_)

    public String getName() {
        return ;
    }
    
    
A name for the new image.

Constraints: 3-128 alphanumeric characters, parenthesis (()), periods (.), slashes (/), dashes (-), or underscores(_)

Parameters:
name A name for the new image.

Constraints: 3-128 alphanumeric characters, parenthesis (()), periods (.), slashes (/), dashes (-), or underscores(_)

    public void setName(String name) {
        this. = name;
    }
    
    
A name for the new image.

Constraints: 3-128 alphanumeric characters, parenthesis (()), periods (.), slashes (/), dashes (-), or underscores(_)

Returns a reference to this object so that method calls can be chained together.

Parameters:
name A name for the new image.

Constraints: 3-128 alphanumeric characters, parenthesis (()), periods (.), slashes (/), dashes (-), or underscores(_)

Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateImageRequest withName(String name) {
        this. = name;
        return this;
    }

    
A description for the new image.

Returns:
A description for the new image.
    public String getDescription() {
        return ;
    }
    
    
A description for the new image.

Parameters:
description A description for the new image.
    public void setDescription(String description) {
        this. = description;
    }
    
    
A description for the new image.

Returns a reference to this object so that method calls can be chained together.

Parameters:
description A description for the new image.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateImageRequest withDescription(String description) {
        this. = description;
        return this;
    }

    
By default, this parameter is set to false, which means Amazon EC2 attempts to shut down the instance cleanly before image creation and then reboots the instance. When the parameter is set to true, Amazon EC2 doesn't shut down the instance before creating the image. When this option is used, file system integrity on the created image can't be guaranteed.

Returns:
By default, this parameter is set to false, which means Amazon EC2 attempts to shut down the instance cleanly before image creation and then reboots the instance. When the parameter is set to true, Amazon EC2 doesn't shut down the instance before creating the image. When this option is used, file system integrity on the created image can't be guaranteed.
    public Boolean isNoReboot() {
        return ;
    }
    
    
By default, this parameter is set to false, which means Amazon EC2 attempts to shut down the instance cleanly before image creation and then reboots the instance. When the parameter is set to true, Amazon EC2 doesn't shut down the instance before creating the image. When this option is used, file system integrity on the created image can't be guaranteed.

Parameters:
noReboot By default, this parameter is set to false, which means Amazon EC2 attempts to shut down the instance cleanly before image creation and then reboots the instance. When the parameter is set to true, Amazon EC2 doesn't shut down the instance before creating the image. When this option is used, file system integrity on the created image can't be guaranteed.
    public void setNoReboot(Boolean noReboot) {
        this. = noReboot;
    }
    
    
By default, this parameter is set to false, which means Amazon EC2 attempts to shut down the instance cleanly before image creation and then reboots the instance. When the parameter is set to true, Amazon EC2 doesn't shut down the instance before creating the image. When this option is used, file system integrity on the created image can't be guaranteed.

Returns a reference to this object so that method calls can be chained together.

Parameters:
noReboot By default, this parameter is set to false, which means Amazon EC2 attempts to shut down the instance cleanly before image creation and then reboots the instance. When the parameter is set to true, Amazon EC2 doesn't shut down the instance before creating the image. When this option is used, file system integrity on the created image can't be guaranteed.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateImageRequest withNoReboot(Boolean noReboot) {
        this. = noReboot;
        return this;
    }

    
By default, this parameter is set to false, which means Amazon EC2 attempts to shut down the instance cleanly before image creation and then reboots the instance. When the parameter is set to true, Amazon EC2 doesn't shut down the instance before creating the image. When this option is used, file system integrity on the created image can't be guaranteed.

Returns:
By default, this parameter is set to false, which means Amazon EC2 attempts to shut down the instance cleanly before image creation and then reboots the instance. When the parameter is set to true, Amazon EC2 doesn't shut down the instance before creating the image. When this option is used, file system integrity on the created image can't be guaranteed.
    public Boolean getNoReboot() {
        return ;
    }

    
Information about one or more block device mappings.

Returns:
Information about one or more block device mappings.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
Information about one or more block device mappings.

Parameters:
blockDeviceMappings Information about one or more block device mappings.
    public void setBlockDeviceMappings(java.util.Collection<BlockDeviceMappingblockDeviceMappings) {
        if (blockDeviceMappings == null) {
            this. = null;
            return;
        }
        blockDeviceMappingsCopy.addAll(blockDeviceMappings);
        this. = blockDeviceMappingsCopy;
    }
    
    
Information about one or more block device mappings.

Returns a reference to this object so that method calls can be chained together.

Parameters:
blockDeviceMappings Information about one or more block device mappings.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateImageRequest withBlockDeviceMappings(BlockDeviceMapping... blockDeviceMappings) {
        if (getBlockDeviceMappings() == nullsetBlockDeviceMappings(new java.util.ArrayList<BlockDeviceMapping>(blockDeviceMappings.length));
        for (BlockDeviceMapping value : blockDeviceMappings) {
            getBlockDeviceMappings().add(value);
        }
        return this;
    }
    
    
Information about one or more block device mappings.

Returns a reference to this object so that method calls can be chained together.

Parameters:
blockDeviceMappings Information about one or more block device mappings.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (blockDeviceMappings == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<BlockDeviceMappingblockDeviceMappingsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<BlockDeviceMapping>(blockDeviceMappings.size());
            blockDeviceMappingsCopy.addAll(blockDeviceMappings);
            this. = blockDeviceMappingsCopy;
        }
        return this;
    }

    
This method is intended for internal use only. Returns the marshaled request configured with additional parameters to enable operation dry-run.
    @Override
        Request<CreateImageRequestrequest = new CreateImageRequestMarshaller().marshall(this);
        request.addParameter("DryRun", Boolean.toString(true));
        return request;
    }
    
    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getInstanceId() != nullsb.append("InstanceId: " + getInstanceId() + ",");
        if (getName() != nullsb.append("Name: " + getName() + ",");
        if (getDescription() != nullsb.append("Description: " + getDescription() + ",");
        if (isNoReboot() != nullsb.append("NoReboot: " + isNoReboot() + ",");
        if (getBlockDeviceMappings() != nullsb.append("BlockDeviceMappings: " + getBlockDeviceMappings() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getInstanceId() == null) ? 0 : getInstanceId().hashCode()); 
        hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); 
        hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); 
        hashCode = prime * hashCode + ((isNoReboot() == null) ? 0 : isNoReboot().hashCode()); 
        hashCode = prime * hashCode + ((getBlockDeviceMappings() == null) ? 0 : getBlockDeviceMappings().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof CreateImageRequest == falsereturn false;
        CreateImageRequest other = (CreateImageRequest)obj;
        
        if (other.getInstanceId() == null ^ this.getInstanceId() == nullreturn false;
        if (other.getInstanceId() != null && other.getInstanceId().equals(this.getInstanceId()) == falsereturn false
        if (other.getName() == null ^ this.getName() == nullreturn false;
        if (other.getName() != null && other.getName().equals(this.getName()) == falsereturn false
        if (other.getDescription() == null ^ this.getDescription() == nullreturn false;
        if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == falsereturn false
        if (other.isNoReboot() == null ^ this.isNoReboot() == nullreturn false;
        if (other.isNoReboot() != null && other.isNoReboot().equals(this.isNoReboot()) == falsereturn false
        if (other.getBlockDeviceMappings() == null ^ this.getBlockDeviceMappings() == nullreturn false;
        if (other.getBlockDeviceMappings() != null && other.getBlockDeviceMappings().equals(this.getBlockDeviceMappings()) == falsereturn false
        return true;
    }
    
}
    
New to GrepCode? Check out our FAQ X