
com.amazonaws.services.accessanalyzer.model.EbsSnapshotConfiguration Maven / Gradle / Ivy
/*
* Copyright 2019-2024 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.accessanalyzer.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* The proposed access control configuration for an Amazon EBS volume snapshot. You can propose a configuration for a
* new Amazon EBS volume snapshot or an Amazon EBS volume snapshot that you own by specifying the user IDs, groups, and
* optional KMS encryption key. For more information, see ModifySnapshotAttribute.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class EbsSnapshotConfiguration implements Serializable, Cloneable, StructuredPojo {
/**
*
* The IDs of the Amazon Web Services accounts that have access to the Amazon EBS volume snapshot.
*
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* userIds
, then the access preview uses the existing shared userIds
for the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the userIds
, then the access
* preview considers the snapshot without any userIds
.
*
*
* -
*
* To propose deletion of existing shared accountIds
, you can specify an empty list for
* userIds
.
*
*
*
*/
private java.util.List userIds;
/**
*
* The groups that have access to the Amazon EBS volume snapshot. If the value all
is specified, then
* the Amazon EBS volume snapshot is public.
*
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the groups
* , then the access preview uses the existing shared groups
for the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the groups
, then the access
* preview considers the snapshot without any groups
.
*
*
* -
*
* To propose deletion of existing shared groups
, you can specify an empty list for groups
* .
*
*
*
*/
private java.util.List groups;
/**
*
* The KMS key identifier for an encrypted Amazon EBS volume snapshot. The KMS key identifier is the key ARN, key
* ID, alias ARN, or alias name for the KMS key.
*
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* kmsKeyId
, or you specify an empty string, then the access preview uses the existing
* kmsKeyId
of the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the kmsKeyId
, the access preview
* considers the snapshot as unencrypted.
*
*
*
*/
private String kmsKeyId;
/**
*
* The IDs of the Amazon Web Services accounts that have access to the Amazon EBS volume snapshot.
*
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* userIds
, then the access preview uses the existing shared userIds
for the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the userIds
, then the access
* preview considers the snapshot without any userIds
.
*
*
* -
*
* To propose deletion of existing shared accountIds
, you can specify an empty list for
* userIds
.
*
*
*
*
* @return The IDs of the Amazon Web Services accounts that have access to the Amazon EBS volume snapshot.
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* userIds
, then the access preview uses the existing shared userIds
for the
* snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the userIds
, then the
* access preview considers the snapshot without any userIds
.
*
*
* -
*
* To propose deletion of existing shared accountIds
, you can specify an empty list for
* userIds
.
*
*
*/
public java.util.List getUserIds() {
return userIds;
}
/**
*
* The IDs of the Amazon Web Services accounts that have access to the Amazon EBS volume snapshot.
*
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* userIds
, then the access preview uses the existing shared userIds
for the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the userIds
, then the access
* preview considers the snapshot without any userIds
.
*
*
* -
*
* To propose deletion of existing shared accountIds
, you can specify an empty list for
* userIds
.
*
*
*
*
* @param userIds
* The IDs of the Amazon Web Services accounts that have access to the Amazon EBS volume snapshot.
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* userIds
, then the access preview uses the existing shared userIds
for the
* snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the userIds
, then the
* access preview considers the snapshot without any userIds
.
*
*
* -
*
* To propose deletion of existing shared accountIds
, you can specify an empty list for
* userIds
.
*
*
*/
public void setUserIds(java.util.Collection userIds) {
if (userIds == null) {
this.userIds = null;
return;
}
this.userIds = new java.util.ArrayList(userIds);
}
/**
*
* The IDs of the Amazon Web Services accounts that have access to the Amazon EBS volume snapshot.
*
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* userIds
, then the access preview uses the existing shared userIds
for the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the userIds
, then the access
* preview considers the snapshot without any userIds
.
*
*
* -
*
* To propose deletion of existing shared accountIds
, you can specify an empty list for
* userIds
.
*
*
*
*
* 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 IDs of the Amazon Web Services accounts that have access to the Amazon EBS volume snapshot.
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* userIds
, then the access preview uses the existing shared userIds
for the
* snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the userIds
, then the
* access preview considers the snapshot without any userIds
.
*
*
* -
*
* To propose deletion of existing shared accountIds
, you can specify an empty list for
* userIds
.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EbsSnapshotConfiguration withUserIds(String... userIds) {
if (this.userIds == null) {
setUserIds(new java.util.ArrayList(userIds.length));
}
for (String ele : userIds) {
this.userIds.add(ele);
}
return this;
}
/**
*
* The IDs of the Amazon Web Services accounts that have access to the Amazon EBS volume snapshot.
*
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* userIds
, then the access preview uses the existing shared userIds
for the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the userIds
, then the access
* preview considers the snapshot without any userIds
.
*
*
* -
*
* To propose deletion of existing shared accountIds
, you can specify an empty list for
* userIds
.
*
*
*
*
* @param userIds
* The IDs of the Amazon Web Services accounts that have access to the Amazon EBS volume snapshot.
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* userIds
, then the access preview uses the existing shared userIds
for the
* snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the userIds
, then the
* access preview considers the snapshot without any userIds
.
*
*
* -
*
* To propose deletion of existing shared accountIds
, you can specify an empty list for
* userIds
.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EbsSnapshotConfiguration withUserIds(java.util.Collection userIds) {
setUserIds(userIds);
return this;
}
/**
*
* The groups that have access to the Amazon EBS volume snapshot. If the value all
is specified, then
* the Amazon EBS volume snapshot is public.
*
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the groups
* , then the access preview uses the existing shared groups
for the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the groups
, then the access
* preview considers the snapshot without any groups
.
*
*
* -
*
* To propose deletion of existing shared groups
, you can specify an empty list for groups
* .
*
*
*
*
* @return The groups that have access to the Amazon EBS volume snapshot. If the value all
is
* specified, then the Amazon EBS volume snapshot is public.
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* groups
, then the access preview uses the existing shared groups
for the
* snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the groups
, then the
* access preview considers the snapshot without any groups
.
*
*
* -
*
* To propose deletion of existing shared groups
, you can specify an empty list for
* groups
.
*
*
*/
public java.util.List getGroups() {
return groups;
}
/**
*
* The groups that have access to the Amazon EBS volume snapshot. If the value all
is specified, then
* the Amazon EBS volume snapshot is public.
*
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the groups
* , then the access preview uses the existing shared groups
for the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the groups
, then the access
* preview considers the snapshot without any groups
.
*
*
* -
*
* To propose deletion of existing shared groups
, you can specify an empty list for groups
* .
*
*
*
*
* @param groups
* The groups that have access to the Amazon EBS volume snapshot. If the value all
is specified,
* then the Amazon EBS volume snapshot is public.
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* groups
, then the access preview uses the existing shared groups
for the
* snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the groups
, then the
* access preview considers the snapshot without any groups
.
*
*
* -
*
* To propose deletion of existing shared groups
, you can specify an empty list for
* groups
.
*
*
*/
public void setGroups(java.util.Collection groups) {
if (groups == null) {
this.groups = null;
return;
}
this.groups = new java.util.ArrayList(groups);
}
/**
*
* The groups that have access to the Amazon EBS volume snapshot. If the value all
is specified, then
* the Amazon EBS volume snapshot is public.
*
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the groups
* , then the access preview uses the existing shared groups
for the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the groups
, then the access
* preview considers the snapshot without any groups
.
*
*
* -
*
* To propose deletion of existing shared groups
, you can specify an empty list for groups
* .
*
*
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setGroups(java.util.Collection)} or {@link #withGroups(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param groups
* The groups that have access to the Amazon EBS volume snapshot. If the value all
is specified,
* then the Amazon EBS volume snapshot is public.
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* groups
, then the access preview uses the existing shared groups
for the
* snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the groups
, then the
* access preview considers the snapshot without any groups
.
*
*
* -
*
* To propose deletion of existing shared groups
, you can specify an empty list for
* groups
.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EbsSnapshotConfiguration withGroups(String... groups) {
if (this.groups == null) {
setGroups(new java.util.ArrayList(groups.length));
}
for (String ele : groups) {
this.groups.add(ele);
}
return this;
}
/**
*
* The groups that have access to the Amazon EBS volume snapshot. If the value all
is specified, then
* the Amazon EBS volume snapshot is public.
*
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the groups
* , then the access preview uses the existing shared groups
for the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the groups
, then the access
* preview considers the snapshot without any groups
.
*
*
* -
*
* To propose deletion of existing shared groups
, you can specify an empty list for groups
* .
*
*
*
*
* @param groups
* The groups that have access to the Amazon EBS volume snapshot. If the value all
is specified,
* then the Amazon EBS volume snapshot is public.
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* groups
, then the access preview uses the existing shared groups
for the
* snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the groups
, then the
* access preview considers the snapshot without any groups
.
*
*
* -
*
* To propose deletion of existing shared groups
, you can specify an empty list for
* groups
.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EbsSnapshotConfiguration withGroups(java.util.Collection groups) {
setGroups(groups);
return this;
}
/**
*
* The KMS key identifier for an encrypted Amazon EBS volume snapshot. The KMS key identifier is the key ARN, key
* ID, alias ARN, or alias name for the KMS key.
*
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* kmsKeyId
, or you specify an empty string, then the access preview uses the existing
* kmsKeyId
of the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the kmsKeyId
, the access preview
* considers the snapshot as unencrypted.
*
*
*
*
* @param kmsKeyId
* The KMS key identifier for an encrypted Amazon EBS volume snapshot. The KMS key identifier is the key ARN,
* key ID, alias ARN, or alias name for the KMS key.
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* kmsKeyId
, or you specify an empty string, then the access preview uses the existing
* kmsKeyId
of the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the kmsKeyId
, the access
* preview considers the snapshot as unencrypted.
*
*
*/
public void setKmsKeyId(String kmsKeyId) {
this.kmsKeyId = kmsKeyId;
}
/**
*
* The KMS key identifier for an encrypted Amazon EBS volume snapshot. The KMS key identifier is the key ARN, key
* ID, alias ARN, or alias name for the KMS key.
*
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* kmsKeyId
, or you specify an empty string, then the access preview uses the existing
* kmsKeyId
of the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the kmsKeyId
, the access preview
* considers the snapshot as unencrypted.
*
*
*
*
* @return The KMS key identifier for an encrypted Amazon EBS volume snapshot. The KMS key identifier is the key
* ARN, key ID, alias ARN, or alias name for the KMS key.
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* kmsKeyId
, or you specify an empty string, then the access preview uses the existing
* kmsKeyId
of the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the kmsKeyId
, the access
* preview considers the snapshot as unencrypted.
*
*
*/
public String getKmsKeyId() {
return this.kmsKeyId;
}
/**
*
* The KMS key identifier for an encrypted Amazon EBS volume snapshot. The KMS key identifier is the key ARN, key
* ID, alias ARN, or alias name for the KMS key.
*
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* kmsKeyId
, or you specify an empty string, then the access preview uses the existing
* kmsKeyId
of the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the kmsKeyId
, the access preview
* considers the snapshot as unencrypted.
*
*
*
*
* @param kmsKeyId
* The KMS key identifier for an encrypted Amazon EBS volume snapshot. The KMS key identifier is the key ARN,
* key ID, alias ARN, or alias name for the KMS key.
*
* -
*
* If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the
* kmsKeyId
, or you specify an empty string, then the access preview uses the existing
* kmsKeyId
of the snapshot.
*
*
* -
*
* If the access preview is for a new resource and you do not specify the kmsKeyId
, the access
* preview considers the snapshot as unencrypted.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EbsSnapshotConfiguration withKmsKeyId(String kmsKeyId) {
setKmsKeyId(kmsKeyId);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getUserIds() != null)
sb.append("UserIds: ").append(getUserIds()).append(",");
if (getGroups() != null)
sb.append("Groups: ").append(getGroups()).append(",");
if (getKmsKeyId() != null)
sb.append("KmsKeyId: ").append(getKmsKeyId());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof EbsSnapshotConfiguration == false)
return false;
EbsSnapshotConfiguration other = (EbsSnapshotConfiguration) obj;
if (other.getUserIds() == null ^ this.getUserIds() == null)
return false;
if (other.getUserIds() != null && other.getUserIds().equals(this.getUserIds()) == false)
return false;
if (other.getGroups() == null ^ this.getGroups() == null)
return false;
if (other.getGroups() != null && other.getGroups().equals(this.getGroups()) == false)
return false;
if (other.getKmsKeyId() == null ^ this.getKmsKeyId() == null)
return false;
if (other.getKmsKeyId() != null && other.getKmsKeyId().equals(this.getKmsKeyId()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getUserIds() == null) ? 0 : getUserIds().hashCode());
hashCode = prime * hashCode + ((getGroups() == null) ? 0 : getGroups().hashCode());
hashCode = prime * hashCode + ((getKmsKeyId() == null) ? 0 : getKmsKeyId().hashCode());
return hashCode;
}
@Override
public EbsSnapshotConfiguration clone() {
try {
return (EbsSnapshotConfiguration) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.accessanalyzer.model.transform.EbsSnapshotConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}