All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.ec2.model.ModifySnapshotAttributeRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon EC2 module holds the client classes that are used for communicating with Amazon EC2 Service

There is a newer version: 1.9.19
Show newest version
/*
 * Copyright 2010-2016 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 java.io.Serializable;
import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.Request;
import com.amazonaws.services.ec2.model.transform.ModifySnapshotAttributeRequestMarshaller;

/**
 * 

* Contains the parameters for ModifySnapshotAttribute. *

*/ public class ModifySnapshotAttributeRequest extends AmazonWebServiceRequest implements Serializable, Cloneable, DryRunSupportedRequest { /** *

* The ID of the snapshot. *

*/ private String snapshotId; /** *

* The snapshot attribute to modify. *

* *

* Only volume creation permissions may be modified at the customer level. *

*
*/ private String attribute; /** *

* The type of operation to perform to the attribute. *

*/ private String operationType; /** *

* The account ID to modify for the snapshot. *

*/ private com.amazonaws.internal.SdkInternalList userIds; /** *

* The group to modify for the snapshot. *

*/ private com.amazonaws.internal.SdkInternalList groupNames; /** *

* A JSON representation of the snapshot attribute modification. *

*/ private CreateVolumePermissionModifications createVolumePermission; /** * Default constructor for ModifySnapshotAttributeRequest object. Callers * should use the setter or fluent setter (with...) methods to initialize * the 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 snapshot. * @param attribute * The snapshot attribute to modify.

*

* Only volume creation permissions may be modified at the customer * level. *

* @param operationType * The type of operation to perform to the attribute. */ public ModifySnapshotAttributeRequest(String snapshotId, String attribute, String 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. * * @param snapshotId * The ID of the snapshot. * @param attribute * The snapshot attribute to modify.

*

* Only volume creation permissions may be modified at the customer * level. *

* @param operationType * The type of operation to perform to the attribute. */ public ModifySnapshotAttributeRequest(String snapshotId, SnapshotAttributeName attribute, OperationType operationType) { setSnapshotId(snapshotId); setAttribute(attribute.toString()); setOperationType(operationType.toString()); } /** *

* The ID of the snapshot. *

* * @param snapshotId * The ID of the snapshot. */ public void setSnapshotId(String snapshotId) { this.snapshotId = snapshotId; } /** *

* The ID of the snapshot. *

* * @return The ID of the snapshot. */ public String getSnapshotId() { return this.snapshotId; } /** *

* The ID of the snapshot. *

* * @param snapshotId * The ID of the snapshot. * @return Returns a reference to this object so that method calls can be * chained together. */ public ModifySnapshotAttributeRequest withSnapshotId(String snapshotId) { setSnapshotId(snapshotId); return this; } /** *

* The snapshot attribute to modify. *

* *

* Only volume creation permissions may be modified at the customer level. *

*
* * @param attribute * The snapshot attribute to modify.

*

* Only volume creation permissions may be modified at the customer * level. *

* @see SnapshotAttributeName */ public void setAttribute(String attribute) { this.attribute = attribute; } /** *

* The snapshot attribute to modify. *

* *

* Only volume creation permissions may be modified at the customer level. *

*
* * @return The snapshot attribute to modify.

*

* Only volume creation permissions may be modified at the customer * level. *

* @see SnapshotAttributeName */ public String getAttribute() { return this.attribute; } /** *

* The snapshot attribute to modify. *

* *

* Only volume creation permissions may be modified at the customer level. *

*
* * @param attribute * The snapshot attribute to modify.

*

* Only volume creation permissions may be modified at the customer * level. *

* @return Returns a reference to this object so that method calls can be * chained together. * @see SnapshotAttributeName */ public ModifySnapshotAttributeRequest withAttribute(String attribute) { setAttribute(attribute); return this; } /** *

* The snapshot attribute to modify. *

* *

* Only volume creation permissions may be modified at the customer level. *

*
* * @param attribute * The snapshot attribute to modify.

*

* Only volume creation permissions may be modified at the customer * level. *

* @see SnapshotAttributeName */ public void setAttribute(SnapshotAttributeName attribute) { this.attribute = attribute.toString(); } /** *

* The snapshot attribute to modify. *

* *

* Only volume creation permissions may be modified at the customer level. *

*
* * @param attribute * The snapshot attribute to modify.

*

* Only volume creation permissions may be modified at the customer * level. *

* @return Returns a reference to this object so that method calls can be * chained together. * @see SnapshotAttributeName */ public ModifySnapshotAttributeRequest withAttribute( SnapshotAttributeName attribute) { setAttribute(attribute); return this; } /** *

* The type of operation to perform to the attribute. *

* * @param operationType * The type of operation to perform to the attribute. * @see OperationType */ public void setOperationType(String operationType) { this.operationType = operationType; } /** *

* The type of operation to perform to the attribute. *

* * @return The type of operation to perform to the attribute. * @see OperationType */ public String getOperationType() { return this.operationType; } /** *

* The type of operation to perform to the attribute. *

* * @param operationType * The type of operation to perform to the attribute. * @return Returns a reference to this object so that method calls can be * chained together. * @see OperationType */ public ModifySnapshotAttributeRequest withOperationType(String operationType) { setOperationType(operationType); return this; } /** *

* The type of operation to perform to the attribute. *

* * @param operationType * The type of operation to perform to the attribute. * @see OperationType */ public void setOperationType(OperationType operationType) { this.operationType = operationType.toString(); } /** *

* The type of operation to perform to the attribute. *

* * @param operationType * The type of operation to perform to the attribute. * @return Returns a reference to this object so that method calls can be * chained together. * @see OperationType */ public ModifySnapshotAttributeRequest withOperationType( OperationType operationType) { setOperationType(operationType); return this; } /** *

* The account ID to modify for the snapshot. *

* * @return The account ID to modify for the snapshot. */ public java.util.List getUserIds() { if (userIds == null) { userIds = new com.amazonaws.internal.SdkInternalList(); } return userIds; } /** *

* The account ID to modify for the snapshot. *

* * @param userIds * The account ID to modify for the snapshot. */ public void setUserIds(java.util.Collection userIds) { if (userIds == null) { this.userIds = null; return; } this.userIds = new com.amazonaws.internal.SdkInternalList( userIds); } /** *

* The account ID to modify for the snapshot. *

*

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

* * @param userIds * The account ID to modify for the snapshot. * @return Returns a reference to this object so that method calls can be * chained together. */ public ModifySnapshotAttributeRequest withUserIds(String... userIds) { if (this.userIds == null) { setUserIds(new com.amazonaws.internal.SdkInternalList( userIds.length)); } for (String ele : userIds) { this.userIds.add(ele); } return this; } /** *

* The account ID to modify for the snapshot. *

* * @param userIds * The account ID to modify for the snapshot. * @return Returns a reference to this object so that method calls can be * chained together. */ public ModifySnapshotAttributeRequest withUserIds( java.util.Collection userIds) { setUserIds(userIds); return this; } /** *

* The group to modify for the snapshot. *

* * @return The group to modify for the snapshot. */ public java.util.List getGroupNames() { if (groupNames == null) { groupNames = new com.amazonaws.internal.SdkInternalList(); } return groupNames; } /** *

* The group to modify for the snapshot. *

* * @param groupNames * The group to modify for the snapshot. */ public void setGroupNames(java.util.Collection groupNames) { if (groupNames == null) { this.groupNames = null; return; } this.groupNames = new com.amazonaws.internal.SdkInternalList( groupNames); } /** *

* The group to modify for the snapshot. *

*

* NOTE: This method appends the values to the existing list (if * any). Use {@link #setGroupNames(java.util.Collection)} or * {@link #withGroupNames(java.util.Collection)} if you want to override the * existing values. *

* * @param groupNames * The group to modify for the snapshot. * @return Returns a reference to this object so that method calls can be * chained together. */ public ModifySnapshotAttributeRequest withGroupNames(String... groupNames) { if (this.groupNames == null) { setGroupNames(new com.amazonaws.internal.SdkInternalList( groupNames.length)); } for (String ele : groupNames) { this.groupNames.add(ele); } return this; } /** *

* The group to modify for the snapshot. *

* * @param groupNames * The group to modify for the snapshot. * @return Returns a reference to this object so that method calls can be * chained together. */ public ModifySnapshotAttributeRequest withGroupNames( java.util.Collection groupNames) { setGroupNames(groupNames); return this; } /** *

* A JSON representation of the snapshot attribute modification. *

* * @param createVolumePermission * A JSON representation of the snapshot attribute modification. */ public void setCreateVolumePermission( CreateVolumePermissionModifications createVolumePermission) { this.createVolumePermission = createVolumePermission; } /** *

* A JSON representation of the snapshot attribute modification. *

* * @return A JSON representation of the snapshot attribute modification. */ public CreateVolumePermissionModifications getCreateVolumePermission() { return this.createVolumePermission; } /** *

* A JSON representation of the snapshot attribute modification. *

* * @param createVolumePermission * A JSON representation of the snapshot attribute modification. * @return Returns a reference to this object so that method calls can be * chained together. */ public ModifySnapshotAttributeRequest withCreateVolumePermission( CreateVolumePermissionModifications createVolumePermission) { setCreateVolumePermission(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 public Request getDryRunRequest() { Request request = new ModifySnapshotAttributeRequestMarshaller() .marshall(this); request.addParameter("DryRun", Boolean.toString(true)); return request; } /** * 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("{"); if (getSnapshotId() != null) sb.append("SnapshotId: " + getSnapshotId() + ","); if (getAttribute() != null) sb.append("Attribute: " + getAttribute() + ","); if (getOperationType() != null) sb.append("OperationType: " + getOperationType() + ","); if (getUserIds() != null) sb.append("UserIds: " + getUserIds() + ","); if (getGroupNames() != null) sb.append("GroupNames: " + getGroupNames() + ","); if (getCreateVolumePermission() != null) sb.append("CreateVolumePermission: " + getCreateVolumePermission()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ModifySnapshotAttributeRequest == false) return false; ModifySnapshotAttributeRequest other = (ModifySnapshotAttributeRequest) obj; if (other.getSnapshotId() == null ^ this.getSnapshotId() == null) return false; if (other.getSnapshotId() != null && other.getSnapshotId().equals(this.getSnapshotId()) == false) return false; if (other.getAttribute() == null ^ this.getAttribute() == null) return false; if (other.getAttribute() != null && other.getAttribute().equals(this.getAttribute()) == false) return false; if (other.getOperationType() == null ^ this.getOperationType() == null) return false; if (other.getOperationType() != null && other.getOperationType().equals(this.getOperationType()) == false) return false; if (other.getUserIds() == null ^ this.getUserIds() == null) return false; if (other.getUserIds() != null && other.getUserIds().equals(this.getUserIds()) == false) return false; if (other.getGroupNames() == null ^ this.getGroupNames() == null) return false; if (other.getGroupNames() != null && other.getGroupNames().equals(this.getGroupNames()) == false) return false; if (other.getCreateVolumePermission() == null ^ this.getCreateVolumePermission() == null) return false; if (other.getCreateVolumePermission() != null && other.getCreateVolumePermission().equals( this.getCreateVolumePermission()) == false) return false; return true; } @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 ModifySnapshotAttributeRequest clone() { return (ModifySnapshotAttributeRequest) super.clone(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy