
com.amazonaws.services.ec2.model.ModifySnapshotAttributeRequest Maven / Gradle / Ivy
/*
* Copyright 2010-2011 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.AmazonWebServiceRequest;
/**
* Container for the parameters to the {@link com.amazonaws.services.ec2.AmazonEC2#modifySnapshotAttribute(ModifySnapshotAttributeRequest) ModifySnapshotAttribute operation}.
*
* Adds or remove permission settings for the specified snapshot.
*
*
* @see com.amazonaws.services.ec2.AmazonEC2#modifySnapshotAttribute(ModifySnapshotAttributeRequest)
*/
public class ModifySnapshotAttributeRequest extends AmazonWebServiceRequest {
/**
* The ID of the EBS snapshot whose attributes are being modified.
*/
private String snapshotId;
/**
* The name of the attribute being modified. Available attribute
* names: createVolumePermission
*/
private String attribute;
/**
* The operation to perform on the attribute.
Available operation
* names: add, remove
*/
private String operationType;
/**
* The AWS user IDs to add to or remove from the list of users that have
* permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission attribute is being modified.
*/
private java.util.List userIds;
/**
* The AWS group names to add to or remove from the list of groups that
* have permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission
attribute is being modified.
*
*/
private java.util.List groupNames;
/**
* 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.
*
* @param snapshotId The ID of the EBS snapshot whose attributes are
* being modified.
* @param attribute The name of the attribute being modified.
* Available attribute names: createVolumePermission
* @param operationType The operation to perform on the attribute.
* Available operation names: add, remove
*/
public ModifySnapshotAttributeRequest(String snapshotId, String attribute, String operationType) {
this.snapshotId = snapshotId;
this.attribute = attribute;
this.operationType = operationType;
}
/**
* The ID of the EBS snapshot whose attributes are being modified.
*
* @return The ID of the EBS snapshot whose attributes are being modified.
*/
public String getSnapshotId() {
return snapshotId;
}
/**
* The ID of the EBS snapshot whose attributes are being modified.
*
* @param snapshotId The ID of the EBS snapshot whose attributes are being modified.
*/
public void setSnapshotId(String snapshotId) {
this.snapshotId = snapshotId;
}
/**
* The ID of the EBS snapshot whose attributes are being modified.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param snapshotId The ID of the EBS snapshot whose attributes are being modified.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public ModifySnapshotAttributeRequest withSnapshotId(String snapshotId) {
this.snapshotId = snapshotId;
return this;
}
/**
* The name of the attribute being modified.
Available attribute
* names: createVolumePermission
*
* @return The name of the attribute being modified.
Available attribute
* names: createVolumePermission
*/
public String getAttribute() {
return attribute;
}
/**
* The name of the attribute being modified.
Available attribute
* names: createVolumePermission
*
* @param attribute The name of the attribute being modified.
Available attribute
* names: createVolumePermission
*/
public void setAttribute(String attribute) {
this.attribute = attribute;
}
/**
* The name of the attribute being modified.
Available attribute
* names: createVolumePermission
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param attribute The name of the attribute being modified.
Available attribute
* names: createVolumePermission
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public ModifySnapshotAttributeRequest withAttribute(String attribute) {
this.attribute = attribute;
return this;
}
/**
* The operation to perform on the attribute.
Available operation
* names: add, remove
*
* @return The operation to perform on the attribute.
Available operation
* names: add, remove
*/
public String getOperationType() {
return operationType;
}
/**
* The operation to perform on the attribute.
Available operation
* names: add, remove
*
* @param operationType The operation to perform on the attribute.
Available operation
* names: add, remove
*/
public void setOperationType(String operationType) {
this.operationType = operationType;
}
/**
* The operation to perform on the attribute.
Available operation
* names: add, remove
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param operationType The operation to perform on the attribute.
Available operation
* names: add, remove
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public ModifySnapshotAttributeRequest withOperationType(String operationType) {
this.operationType = operationType;
return this;
}
/**
* The AWS user IDs to add to or remove from the list of users that have
* permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission attribute is being modified.
*
* @return The AWS user IDs to add to or remove from the list of users that have
* permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission attribute is being modified.
*/
public java.util.List getUserIds() {
if (userIds == null) {
userIds = new java.util.ArrayList();
}
return userIds;
}
/**
* The AWS user IDs to add to or remove from the list of users that have
* permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission attribute is being modified.
*
* @param userIds The AWS user IDs to add to or remove from the list of users that have
* permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission attribute is being modified.
*/
public void setUserIds(java.util.Collection userIds) {
java.util.List userIdsCopy = new java.util.ArrayList();
if (userIds != null) {
userIdsCopy.addAll(userIds);
}
this.userIds = userIdsCopy;
}
/**
* The AWS user IDs to add to or remove from the list of users that have
* permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission attribute is being modified.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param userIds The AWS user IDs to add to or remove from the list of users that have
* permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission attribute is being modified.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public ModifySnapshotAttributeRequest withUserIds(String... userIds) {
for (String value : userIds) {
getUserIds().add(value);
}
return this;
}
/**
* The AWS user IDs to add to or remove from the list of users that have
* permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission attribute is being modified.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param userIds The AWS user IDs to add to or remove from the list of users that have
* permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission attribute is being modified.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public ModifySnapshotAttributeRequest withUserIds(java.util.Collection userIds) {
java.util.List userIdsCopy = new java.util.ArrayList();
if (userIds != null) {
userIdsCopy.addAll(userIds);
}
this.userIds = userIdsCopy;
return this;
}
/**
* The AWS group names to add to or remove from the list of groups that
* have permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission
attribute is being modified.
*
*
* @return The AWS group names to add to or remove from the list of groups that
* have permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission
attribute is being modified.
*
*/
public java.util.List getGroupNames() {
if (groupNames == null) {
groupNames = new java.util.ArrayList();
}
return groupNames;
}
/**
* The AWS group names to add to or remove from the list of groups that
* have permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission
attribute is being modified.
*
*
* @param groupNames The AWS group names to add to or remove from the list of groups that
* have permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission
attribute is being modified.
*
*/
public void setGroupNames(java.util.Collection groupNames) {
java.util.List groupNamesCopy = new java.util.ArrayList();
if (groupNames != null) {
groupNamesCopy.addAll(groupNames);
}
this.groupNames = groupNamesCopy;
}
/**
* The AWS group names to add to or remove from the list of groups that
* have permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission
attribute is being modified.
*
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param groupNames The AWS group names to add to or remove from the list of groups that
* have permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission
attribute is being modified.
*
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public ModifySnapshotAttributeRequest withGroupNames(String... groupNames) {
for (String value : groupNames) {
getGroupNames().add(value);
}
return this;
}
/**
* The AWS group names to add to or remove from the list of groups that
* have permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission
attribute is being modified.
*
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param groupNames The AWS group names to add to or remove from the list of groups that
* have permission to create EBS volumes from the specified snapshot.
* Currently supports "all". Only valid when the
* createVolumePermission
attribute is being modified.
*
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public ModifySnapshotAttributeRequest withGroupNames(java.util.Collection groupNames) {
java.util.List groupNamesCopy = new java.util.ArrayList();
if (groupNames != null) {
groupNamesCopy.addAll(groupNames);
}
this.groupNames = groupNamesCopy;
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("SnapshotId: " + snapshotId + ", ");
sb.append("Attribute: " + attribute + ", ");
sb.append("OperationType: " + operationType + ", ");
sb.append("UserIds: " + userIds + ", ");
sb.append("GroupNames: " + groupNames + ", ");
sb.append("}");
return sb.toString();
}
}