Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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;
 
 
Container for the parameters to the ModifyImageAttribute operation.

Modifies the specified attribute of the specified AMI. You can specify only one attribute at a time.

NOTE: AWS Marketplace product codes cannot be modified. Images with an AWS Marketplace product code cannot be made public.

 
The ID of the AMI.
 
     private String imageId;

    
The name of the attribute to modify.
 
     private String attribute;

    
The operation type.
 
     private String operationType;

    
One or more AWS account IDs. This is only valid when modifying the launchPermission attribute.
 
One or more user groups. This is only valid when modifying the launchPermission attribute.
 
One or more product codes. After you add a product code to an AMI, it can't be removed. This is only valid when modifying the productCodes attribute.
 
The value of the attribute being modified. This is only valid when modifying the description attribute.
 
     private String value;

    
A launch permission modification.
 
A description for the AMI.
 
     private String description;

    
Default constructor for a new ModifyImageAttributeRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
 
     public ModifyImageAttributeRequest() {}
    
    
Constructs a new ModifyImageAttributeRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
imageId The ID of the AMI.
attribute The name of the attribute to modify.
    public ModifyImageAttributeRequest(String imageIdString attribute) {
        setImageId(imageId);
        setAttribute(attribute);
    }

    
The ID of the AMI.

Returns:
The ID of the AMI.
    public String getImageId() {
        return ;
    }
    
    
The ID of the AMI.

Parameters:
imageId The ID of the AMI.
    public void setImageId(String imageId) {
        this. = imageId;
    }
    
    
The ID of the AMI.

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

Parameters:
imageId The ID of the AMI.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ModifyImageAttributeRequest withImageId(String imageId) {
        this. = imageId;
        return this;
    }

    
The name of the attribute to modify.

Returns:
The name of the attribute to modify.
    public String getAttribute() {
        return ;
    }
    
    
The name of the attribute to modify.

Parameters:
attribute The name of the attribute to modify.
    public void setAttribute(String attribute) {
        this. = attribute;
    }
    
    
The name of the attribute to modify.

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

Parameters:
attribute The name of the attribute to modify.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ModifyImageAttributeRequest withAttribute(String attribute) {
        this. = attribute;
        return this;
    }

    
The operation type.

Returns:
The operation type.
    public String getOperationType() {
        return ;
    }
    
    
The operation type.

Parameters:
operationType The operation type.
    public void setOperationType(String operationType) {
        this. = operationType;
    }
    
    
The operation type.

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

Parameters:
operationType The operation type.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ModifyImageAttributeRequest withOperationType(String operationType) {
        this. = operationType;
        return this;
    }

    
One or more AWS account IDs. This is only valid when modifying the launchPermission attribute.

Returns:
One or more AWS account IDs. This is only valid when modifying the launchPermission attribute.
    public java.util.List<StringgetUserIds() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
One or more AWS account IDs. This is only valid when modifying the launchPermission attribute.

Parameters:
userIds One or more AWS account IDs. This is only valid when modifying the launchPermission attribute.
    public void setUserIds(java.util.Collection<StringuserIds) {
        if (userIds == null) {
            this. = null;
            return;
        }
        userIdsCopy.addAll(userIds);
        this. = userIdsCopy;
    }
    
    
One or more AWS account IDs. This is only valid when modifying the launchPermission attribute.

NOTE: This method appends the values to the existing list (if any). Use setUserIds(java.util.Collection) or withUserIds(java.util.Collection) if you want to override the existing values.

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

Parameters:
userIds One or more AWS account IDs. This is only valid when modifying the launchPermission attribute.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ModifyImageAttributeRequest withUserIds(String... userIds) {
        if (getUserIds() == nullsetUserIds(new java.util.ArrayList<String>(userIds.length));
        for (String value : userIds) {
            getUserIds().add(value);
        }
        return this;
    }
    
    
One or more AWS account IDs. This is only valid when modifying the launchPermission attribute.

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

Parameters:
userIds One or more AWS account IDs. This is only valid when modifying the launchPermission attribute.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (userIds == null) {
            this. = null;
        } else {
            userIdsCopy.addAll(userIds);
            this. = userIdsCopy;
        }
        return this;
    }

    
One or more user groups. This is only valid when modifying the launchPermission attribute.

Returns:
One or more user groups. This is only valid when modifying the launchPermission attribute.
    public java.util.List<StringgetUserGroups() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
One or more user groups. This is only valid when modifying the launchPermission attribute.

Parameters:
userGroups One or more user groups. This is only valid when modifying the launchPermission attribute.
    public void setUserGroups(java.util.Collection<StringuserGroups) {
        if (userGroups == null) {
            this. = null;
            return;
        }
        userGroupsCopy.addAll(userGroups);
        this. = userGroupsCopy;
    }
    
    
One or more user groups. This is only valid when modifying the launchPermission attribute.

NOTE: This method appends the values to the existing list (if any). Use setUserGroups(java.util.Collection) or withUserGroups(java.util.Collection) if you want to override the existing values.

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

Parameters:
userGroups One or more user groups. This is only valid when modifying the launchPermission attribute.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ModifyImageAttributeRequest withUserGroups(String... userGroups) {
        if (getUserGroups() == nullsetUserGroups(new java.util.ArrayList<String>(userGroups.length));
        for (String value : userGroups) {
            getUserGroups().add(value);
        }
        return this;
    }
    
    
One or more user groups. This is only valid when modifying the launchPermission attribute.

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

Parameters:
userGroups One or more user groups. This is only valid when modifying the launchPermission attribute.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (userGroups == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringuserGroupsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(userGroups.size());
            userGroupsCopy.addAll(userGroups);
            this. = userGroupsCopy;
        }
        return this;
    }

    
One or more product codes. After you add a product code to an AMI, it can't be removed. This is only valid when modifying the productCodes attribute.

Returns:
One or more product codes. After you add a product code to an AMI, it can't be removed. This is only valid when modifying the productCodes attribute.
    public java.util.List<StringgetProductCodes() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
One or more product codes. After you add a product code to an AMI, it can't be removed. This is only valid when modifying the productCodes attribute.

Parameters:
productCodes One or more product codes. After you add a product code to an AMI, it can't be removed. This is only valid when modifying the productCodes attribute.
    public void setProductCodes(java.util.Collection<StringproductCodes) {
        if (productCodes == null) {
            this. = null;
            return;
        }
        productCodesCopy.addAll(productCodes);
        this. = productCodesCopy;
    }
    
    
One or more product codes. After you add a product code to an AMI, it can't be removed. This is only valid when modifying the productCodes attribute.

NOTE: This method appends the values to the existing list (if any). Use setProductCodes(java.util.Collection) or withProductCodes(java.util.Collection) if you want to override the existing values.

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

Parameters:
productCodes One or more product codes. After you add a product code to an AMI, it can't be removed. This is only valid when modifying the productCodes attribute.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ModifyImageAttributeRequest withProductCodes(String... productCodes) {
        if (getProductCodes() == nullsetProductCodes(new java.util.ArrayList<String>(productCodes.length));
        for (String value : productCodes) {
            getProductCodes().add(value);
        }
        return this;
    }
    
    
One or more product codes. After you add a product code to an AMI, it can't be removed. This is only valid when modifying the productCodes attribute.

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

Parameters:
productCodes One or more product codes. After you add a product code to an AMI, it can't be removed. This is only valid when modifying the productCodes attribute.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (productCodes == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringproductCodesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(productCodes.size());
            productCodesCopy.addAll(productCodes);
            this. = productCodesCopy;
        }
        return this;
    }

    
The value of the attribute being modified. This is only valid when modifying the description attribute.

Returns:
The value of the attribute being modified. This is only valid when modifying the description attribute.
    public String getValue() {
        return ;
    }
    
    
The value of the attribute being modified. This is only valid when modifying the description attribute.

Parameters:
value The value of the attribute being modified. This is only valid when modifying the description attribute.
    public void setValue(String value) {
        this. = value;
    }
    
    
The value of the attribute being modified. This is only valid when modifying the description attribute.

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

Parameters:
value The value of the attribute being modified. This is only valid when modifying the description attribute.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ModifyImageAttributeRequest withValue(String value) {
        this. = value;
        return this;
    }

    
A launch permission modification.

Returns:
A launch permission modification.
        return ;
    }
    
    
A launch permission modification.

Parameters:
launchPermission A launch permission modification.
    public void setLaunchPermission(LaunchPermissionModifications launchPermission) {
        this. = launchPermission;
    }
    
    
A launch permission modification.

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

Parameters:
launchPermission A launch permission modification.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = launchPermission;
        return this;
    }

    
A description for the AMI.

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

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

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

Parameters:
description A description for the AMI.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ModifyImageAttributeRequest withDescription(String description) {
        this. = description;
        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.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 (getImageId() != nullsb.append("ImageId: " + getImageId() + ",");
        if (getAttribute() != nullsb.append("Attribute: " + getAttribute() + ",");
        if (getOperationType() != nullsb.append("OperationType: " + getOperationType() + ",");
        if (getUserIds() != nullsb.append("UserIds: " + getUserIds() + ",");
        if (getUserGroups() != nullsb.append("UserGroups: " + getUserGroups() + ",");
        if (getProductCodes() != nullsb.append("ProductCodes: " + getProductCodes() + ",");
        if (getValue() != nullsb.append("Value: " + getValue() + ",");
        if (getLaunchPermission() != nullsb.append("LaunchPermission: " + getLaunchPermission() + ",");
        if (getDescription() != nullsb.append("Description: " + getDescription() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getImageId() == null) ? 0 : getImageId().hashCode()); 
        hashCode = prime * hashCode + ((getAttribute() == null) ? 0 : getAttribute().hashCode()); 
        hashCode = prime * hashCode + ((getOperationType() == null) ? 0 : getOperationType().hashCode()); 
        hashCode = prime * hashCode + ((getUserIds() == null) ? 0 : getUserIds().hashCode()); 
        hashCode = prime * hashCode + ((getUserGroups() == null) ? 0 : getUserGroups().hashCode()); 
        hashCode = prime * hashCode + ((getProductCodes() == null) ? 0 : getProductCodes().hashCode()); 
        hashCode = prime * hashCode + ((getValue() == null) ? 0 : getValue().hashCode()); 
        hashCode = prime * hashCode + ((getLaunchPermission() == null) ? 0 : getLaunchPermission().hashCode()); 
        hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof ModifyImageAttributeRequest == falsereturn false;
        
        if (other.getImageId() == null ^ this.getImageId() == nullreturn false;
        if (other.getImageId() != null && other.getImageId().equals(this.getImageId()) == falsereturn false
        if (other.getAttribute() == null ^ this.getAttribute() == nullreturn false;
        if (other.getAttribute() != null && other.getAttribute().equals(this.getAttribute()) == falsereturn false
        if (other.getOperationType() == null ^ this.getOperationType() == nullreturn false;
        if (other.getOperationType() != null && other.getOperationType().equals(this.getOperationType()) == falsereturn false
        if (other.getUserIds() == null ^ this.getUserIds() == nullreturn false;
        if (other.getUserIds() != null && other.getUserIds().equals(this.getUserIds()) == falsereturn false
        if (other.getUserGroups() == null ^ this.getUserGroups() == nullreturn false;
        if (other.getUserGroups() != null && other.getUserGroups().equals(this.getUserGroups()) == falsereturn false
        if (other.getProductCodes() == null ^ this.getProductCodes() == nullreturn false;
        if (other.getProductCodes() != null && other.getProductCodes().equals(this.getProductCodes()) == falsereturn false
        if (other.getValue() == null ^ this.getValue() == nullreturn false;
        if (other.getValue() != null && other.getValue().equals(this.getValue()) == falsereturn false
        if (other.getLaunchPermission() == null ^ this.getLaunchPermission() == nullreturn false;
        if (other.getLaunchPermission() != null && other.getLaunchPermission().equals(this.getLaunchPermission()) == falsereturn false
        if (other.getDescription() == null ^ this.getDescription() == nullreturn false;
        if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == falsereturn false
        return true;
    }
    
    @Override
        
            return (ModifyImageAttributeRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X