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 ModifySnapshotAttribute operation.

Adds or removes permission settings for the specified snapshot. You may add or remove specified AWS account IDs from a snapshot's list of create volume permissions, but you cannot do both in a single API call. If you need to both add and remove account IDs for a snapshot, you must use multiple API calls.

For more information on modifying snapshot permissions, see Sharing Snapshots in the Amazon Elastic Compute Cloud User Guide for Linux .

NOTE: Snapshots with AWS Marketplace product codes cannot be made public.

 
The ID of the snapshot.
 
     private String snapshotId;

    
The snapshot attribute to modify.

Constraints:
Allowed Values: productCodes, createVolumePermission

 
     private String attribute;

    
The type of operation to perform to the attribute.
 
     private String operationType;

    
The account ID to modify for the snapshot.
 
The group to modify for the snapshot.
 
A JSON representation of the snapshot attribute modification.
 
Default constructor for a new ModifySnapshotAttributeRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
 
     public ModifySnapshotAttributeRequest() {}
    
    
Constructs a new ModifySnapshotAttributeRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
snapshotId The ID of the snapshot.
attribute The snapshot attribute to modify.
operationType The type of operation to perform to the attribute.
 
     public ModifySnapshotAttributeRequest(String snapshotIdString attributeString operationType) {
         setSnapshotId(snapshotId);
         setAttribute(attribute);
         setOperationType(operationType);
     }

    
Constructs a new ModifySnapshotAttributeRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
snapshotId The ID of the snapshot.
attribute The snapshot attribute to modify.
operationType The type of operation to perform to the attribute.
    public ModifySnapshotAttributeRequest(String snapshotIdSnapshotAttributeName attributeString operationType) {
        this. = snapshotId;
        this. = attribute.toString();
        this. = operationType;
    }

    
The ID of the snapshot.

Returns:
The ID of the snapshot.
    public String getSnapshotId() {
        return ;
    }
    
    
The ID of the snapshot.

Parameters:
snapshotId The ID of the snapshot.
    public void setSnapshotId(String snapshotId) {
        this. = snapshotId;
    }
    
    
The ID of the snapshot.

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

Parameters:
snapshotId The ID of the snapshot.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = snapshotId;
        return this;
    }

    
The snapshot attribute to modify.

Constraints:
Allowed Values: productCodes, createVolumePermission

Returns:
The snapshot attribute to modify.
See also:
SnapshotAttributeName
    public String getAttribute() {
        return ;
    }
    
    
The snapshot attribute to modify.

Constraints:
Allowed Values: productCodes, createVolumePermission

Parameters:
attribute The snapshot attribute to modify.
See also:
SnapshotAttributeName
    public void setAttribute(String attribute) {
        this. = attribute;
    }
    
    
The snapshot attribute to modify.

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

Constraints:
Allowed Values: productCodes, createVolumePermission

Parameters:
attribute The snapshot attribute to modify.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
SnapshotAttributeName
        this. = attribute;
        return this;
    }

    
The snapshot attribute to modify.

Constraints:
Allowed Values: productCodes, createVolumePermission

Parameters:
attribute The snapshot attribute to modify.
See also:
SnapshotAttributeName
    public void setAttribute(SnapshotAttributeName attribute) {
        this. = attribute.toString();
    }
    
    
The snapshot attribute to modify.

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

Constraints:
Allowed Values: productCodes, createVolumePermission

Parameters:
attribute The snapshot attribute to modify.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
SnapshotAttributeName
        this. = attribute.toString();
        return this;
    }

    
The type of operation to perform to the attribute.

Returns:
The type of operation to perform to the attribute.
    public String getOperationType() {
        return ;
    }
    
    
The type of operation to perform to the attribute.

Parameters:
operationType The type of operation to perform to the attribute.
    public void setOperationType(String operationType) {
        this. = operationType;
    }
    
    
The type of operation to perform to the attribute.

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

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

    
The account ID to modify for the snapshot.

Returns:
The account ID to modify for the snapshot.
    public java.util.List<StringgetUserIds() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The account ID to modify for the snapshot.

Parameters:
userIds The account ID to modify for the snapshot.
    public void setUserIds(java.util.Collection<StringuserIds) {
        if (userIds == null) {
            this. = null;
            return;
        }
        userIdsCopy.addAll(userIds);
        this. = userIdsCopy;
    }
    
    
The account ID to modify for the snapshot.

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 The account ID to modify for the snapshot.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ModifySnapshotAttributeRequest withUserIds(String... userIds) {
        if (getUserIds() == nullsetUserIds(new java.util.ArrayList<String>(userIds.length));
        for (String value : userIds) {
            getUserIds().add(value);
        }
        return this;
    }
    
    
The account ID to modify for the snapshot.

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

Parameters:
userIds The account ID to modify for the snapshot.
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;
    }

    
The group to modify for the snapshot.

Returns:
The group to modify for the snapshot.
    public java.util.List<StringgetGroupNames() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The group to modify for the snapshot.

Parameters:
groupNames The group to modify for the snapshot.
    public void setGroupNames(java.util.Collection<StringgroupNames) {
        if (groupNames == null) {
            this. = null;
            return;
        }
        groupNamesCopy.addAll(groupNames);
        this. = groupNamesCopy;
    }
    
    
The group to modify for the snapshot.

NOTE: This method appends the values to the existing list (if any). Use setGroupNames(java.util.Collection) or withGroupNames(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:
groupNames The group to modify for the snapshot.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ModifySnapshotAttributeRequest withGroupNames(String... groupNames) {
        if (getGroupNames() == nullsetGroupNames(new java.util.ArrayList<String>(groupNames.length));
        for (String value : groupNames) {
            getGroupNames().add(value);
        }
        return this;
    }
    
    
The group to modify for the snapshot.

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

Parameters:
groupNames The group to modify for the snapshot.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (groupNames == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringgroupNamesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(groupNames.size());
            groupNamesCopy.addAll(groupNames);
            this. = groupNamesCopy;
        }
        return this;
    }

    
A JSON representation of the snapshot attribute modification.

Returns:
A JSON representation of the snapshot attribute modification.
        return ;
    }
    
    
A JSON representation of the snapshot attribute modification.

Parameters:
createVolumePermission A JSON representation of the snapshot attribute modification.
    public void setCreateVolumePermission(CreateVolumePermissionModifications createVolumePermission) {
        this. = createVolumePermission;
    }
    
    
A JSON representation of the snapshot attribute modification.

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

Parameters:
createVolumePermission A JSON representation of the snapshot attribute modification.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = createVolumePermission;
        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 (getSnapshotId() != nullsb.append("SnapshotId: " + getSnapshotId() + ",");
        if (getAttribute() != nullsb.append("Attribute: " + getAttribute() + ",");
        if (getOperationType() != nullsb.append("OperationType: " + getOperationType() + ",");
        if (getUserIds() != nullsb.append("UserIds: " + getUserIds() + ",");
        if (getGroupNames() != nullsb.append("GroupNames: " + getGroupNames() + ",");
        if (getCreateVolumePermission() != nullsb.append("CreateVolumePermission: " + getCreateVolumePermission() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getSnapshotId() == null) ? 0 : getSnapshotId().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 + ((getGroupNames() == null) ? 0 : getGroupNames().hashCode()); 
        hashCode = prime * hashCode + ((getCreateVolumePermission() == null) ? 0 : getCreateVolumePermission().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof ModifySnapshotAttributeRequest == falsereturn false;
        
        if (other.getSnapshotId() == null ^ this.getSnapshotId() == nullreturn false;
        if (other.getSnapshotId() != null && other.getSnapshotId().equals(this.getSnapshotId()) == 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.getGroupNames() == null ^ this.getGroupNames() == nullreturn false;
        if (other.getGroupNames() != null && other.getGroupNames().equals(this.getGroupNames()) == falsereturn false
        if (other.getCreateVolumePermission() == null ^ this.getCreateVolumePermission() == nullreturn false;
        if (other.getCreateVolumePermission() != null && other.getCreateVolumePermission().equals(this.getCreateVolumePermission()) == falsereturn false
        return true;
    }
    
    @Override
        
            return (ModifySnapshotAttributeRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X