/* * Copyright 2018-2023 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.simplesystemsmanagement.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** * * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ModifyDocumentPermissionRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** *

* The name of the document that you want to share. *

*/ private String name; /** *

* The permission type for the document. The permission type can be Share. *

*/ private String permissionType; /** *

* The Amazon Web Services users that should have access to the document. The account IDs can either be a group of * account IDs or All. *

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

* The Amazon Web Services users that should no longer have access to the document. The Amazon Web Services user can * either be a group of account IDs or All. This action has a higher priority than AccountIdsToAdd. If * you specify an ID to add and the same ID to remove, the system removes access to the document. *

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

* (Optional) The version of the document to share. If it isn't specified, the system choose the * Default version to share. *

*/ private String sharedDocumentVersion; /** *

* The name of the document that you want to share. *

* * @param name * The name of the document that you want to share. */ public void setName(String name) { this.name = name; } /** *

* The name of the document that you want to share. *

* * @return The name of the document that you want to share. */ public String getName() { return this.name; } /** *

* The name of the document that you want to share. *

* * @param name * The name of the document that you want to share. * @return Returns a reference to this object so that method calls can be chained together. */ public ModifyDocumentPermissionRequest withName(String name) { setName(name); return this; } /** *

* The permission type for the document. The permission type can be Share. *

* * @param permissionType * The permission type for the document. The permission type can be Share. * @see DocumentPermissionType */ public void setPermissionType(String permissionType) { this.permissionType = permissionType; } /** *

* The permission type for the document. The permission type can be Share. *

* * @return The permission type for the document. The permission type can be Share. * @see DocumentPermissionType */ public String getPermissionType() { return this.permissionType; } /** *

* The permission type for the document. The permission type can be Share. *

* * @param permissionType * The permission type for the document. The permission type can be Share. * @return Returns a reference to this object so that method calls can be chained together. * @see DocumentPermissionType */ public ModifyDocumentPermissionRequest withPermissionType(String permissionType) { setPermissionType(permissionType); return this; } /** *

* The permission type for the document. The permission type can be Share. *

* * @param permissionType * The permission type for the document. The permission type can be Share. * @see DocumentPermissionType */ public void setPermissionType(DocumentPermissionType permissionType) { withPermissionType(permissionType); } /** *

* The permission type for the document. The permission type can be Share. *

* * @param permissionType * The permission type for the document. The permission type can be Share. * @return Returns a reference to this object so that method calls can be chained together. * @see DocumentPermissionType */ public ModifyDocumentPermissionRequest withPermissionType(DocumentPermissionType permissionType) { this.permissionType = permissionType.toString(); return this; } /** *

* The Amazon Web Services users that should have access to the document. The account IDs can either be a group of * account IDs or All. *

* * @return The Amazon Web Services users that should have access to the document. The account IDs can either be a * group of account IDs or All. */ public java.util.List getAccountIdsToAdd() { if (accountIdsToAdd == null) { accountIdsToAdd = new com.amazonaws.internal.SdkInternalList(); } return accountIdsToAdd; } /** *

* The Amazon Web Services users that should have access to the document. The account IDs can either be a group of * account IDs or All. *

* * @param accountIdsToAdd * The Amazon Web Services users that should have access to the document. The account IDs can either be a * group of account IDs or All. */ public void setAccountIdsToAdd(java.util.Collection accountIdsToAdd) { if (accountIdsToAdd == null) { this.accountIdsToAdd = null; return; } this.accountIdsToAdd = new com.amazonaws.internal.SdkInternalList(accountIdsToAdd); } /** *

* The Amazon Web Services users that should have access to the document. The account IDs can either be a group of * account IDs or All. *

*

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

* * @param accountIdsToAdd * The Amazon Web Services users that should have access to the document. The account IDs can either be a * group of account IDs or All. * @return Returns a reference to this object so that method calls can be chained together. */ public ModifyDocumentPermissionRequest withAccountIdsToAdd(String... accountIdsToAdd) { if (this.accountIdsToAdd == null) { setAccountIdsToAdd(new com.amazonaws.internal.SdkInternalList(accountIdsToAdd.length)); } for (String ele : accountIdsToAdd) { this.accountIdsToAdd.add(ele); } return this; } /** *

* The Amazon Web Services users that should have access to the document. The account IDs can either be a group of * account IDs or All. *

* * @param accountIdsToAdd * The Amazon Web Services users that should have access to the document. The account IDs can either be a * group of account IDs or All. * @return Returns a reference to this object so that method calls can be chained together. */ public ModifyDocumentPermissionRequest withAccountIdsToAdd(java.util.Collection accountIdsToAdd) { setAccountIdsToAdd(accountIdsToAdd); return this; } /** *

* The Amazon Web Services users that should no longer have access to the document. The Amazon Web Services user can * either be a group of account IDs or All. This action has a higher priority than AccountIdsToAdd. If * you specify an ID to add and the same ID to remove, the system removes access to the document. *

* * @return The Amazon Web Services users that should no longer have access to the document. The Amazon Web Services * user can either be a group of account IDs or All. This action has a higher priority than * AccountIdsToAdd. If you specify an ID to add and the same ID to remove, the system removes access * to the document. */ public java.util.List getAccountIdsToRemove() { if (accountIdsToRemove == null) { accountIdsToRemove = new com.amazonaws.internal.SdkInternalList(); } return accountIdsToRemove; } /** *

* The Amazon Web Services users that should no longer have access to the document. The Amazon Web Services user can * either be a group of account IDs or All. This action has a higher priority than AccountIdsToAdd. If * you specify an ID to add and the same ID to remove, the system removes access to the document. *

* * @param accountIdsToRemove * The Amazon Web Services users that should no longer have access to the document. The Amazon Web Services * user can either be a group of account IDs or All. This action has a higher priority than * AccountIdsToAdd. If you specify an ID to add and the same ID to remove, the system removes access * to the document. */ public void setAccountIdsToRemove(java.util.Collection accountIdsToRemove) { if (accountIdsToRemove == null) { this.accountIdsToRemove = null; return; } this.accountIdsToRemove = new com.amazonaws.internal.SdkInternalList(accountIdsToRemove); } /** *

* The Amazon Web Services users that should no longer have access to the document. The Amazon Web Services user can * either be a group of account IDs or All. This action has a higher priority than AccountIdsToAdd. If * you specify an ID to add and the same ID to remove, the system removes access to the document. *

*

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

* * @param accountIdsToRemove * The Amazon Web Services users that should no longer have access to the document. The Amazon Web Services * user can either be a group of account IDs or All. This action has a higher priority than * AccountIdsToAdd. If you specify an ID to add and the same ID to remove, the system removes access * to the document. * @return Returns a reference to this object so that method calls can be chained together. */ public ModifyDocumentPermissionRequest withAccountIdsToRemove(String... accountIdsToRemove) { if (this.accountIdsToRemove == null) { setAccountIdsToRemove(new com.amazonaws.internal.SdkInternalList(accountIdsToRemove.length)); } for (String ele : accountIdsToRemove) { this.accountIdsToRemove.add(ele); } return this; } /** *

* The Amazon Web Services users that should no longer have access to the document. The Amazon Web Services user can * either be a group of account IDs or All. This action has a higher priority than AccountIdsToAdd. If * you specify an ID to add and the same ID to remove, the system removes access to the document. *

* * @param accountIdsToRemove * The Amazon Web Services users that should no longer have access to the document. The Amazon Web Services * user can either be a group of account IDs or All. This action has a higher priority than * AccountIdsToAdd. If you specify an ID to add and the same ID to remove, the system removes access * to the document. * @return Returns a reference to this object so that method calls can be chained together. */ public ModifyDocumentPermissionRequest withAccountIdsToRemove(java.util.Collection accountIdsToRemove) { setAccountIdsToRemove(accountIdsToRemove); return this; } /** *

* (Optional) The version of the document to share. If it isn't specified, the system choose the * Default version to share. *

* * @param sharedDocumentVersion * (Optional) The version of the document to share. If it isn't specified, the system choose the * Default version to share. */ public void setSharedDocumentVersion(String sharedDocumentVersion) { this.sharedDocumentVersion = sharedDocumentVersion; } /** *

* (Optional) The version of the document to share. If it isn't specified, the system choose the * Default version to share. *

* * @return (Optional) The version of the document to share. If it isn't specified, the system choose the * Default version to share. */ public String getSharedDocumentVersion() { return this.sharedDocumentVersion; } /** *

* (Optional) The version of the document to share. If it isn't specified, the system choose the * Default version to share. *

* * @param sharedDocumentVersion * (Optional) The version of the document to share. If it isn't specified, the system choose the * Default version to share. * @return Returns a reference to this object so that method calls can be chained together. */ public ModifyDocumentPermissionRequest withSharedDocumentVersion(String sharedDocumentVersion) { setSharedDocumentVersion(sharedDocumentVersion); 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 (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getPermissionType() != null) sb.append("PermissionType: ").append(getPermissionType()).append(","); if (getAccountIdsToAdd() != null) sb.append("AccountIdsToAdd: ").append(getAccountIdsToAdd()).append(","); if (getAccountIdsToRemove() != null) sb.append("AccountIdsToRemove: ").append(getAccountIdsToRemove()).append(","); if (getSharedDocumentVersion() != null) sb.append("SharedDocumentVersion: ").append(getSharedDocumentVersion()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ModifyDocumentPermissionRequest == false) return false; ModifyDocumentPermissionRequest other = (ModifyDocumentPermissionRequest) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getPermissionType() == null ^ this.getPermissionType() == null) return false; if (other.getPermissionType() != null && other.getPermissionType().equals(this.getPermissionType()) == false) return false; if (other.getAccountIdsToAdd() == null ^ this.getAccountIdsToAdd() == null) return false; if (other.getAccountIdsToAdd() != null && other.getAccountIdsToAdd().equals(this.getAccountIdsToAdd()) == false) return false; if (other.getAccountIdsToRemove() == null ^ this.getAccountIdsToRemove() == null) return false; if (other.getAccountIdsToRemove() != null && other.getAccountIdsToRemove().equals(this.getAccountIdsToRemove()) == false) return false; if (other.getSharedDocumentVersion() == null ^ this.getSharedDocumentVersion() == null) return false; if (other.getSharedDocumentVersion() != null && other.getSharedDocumentVersion().equals(this.getSharedDocumentVersion()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getPermissionType() == null) ? 0 : getPermissionType().hashCode()); hashCode = prime * hashCode + ((getAccountIdsToAdd() == null) ? 0 : getAccountIdsToAdd().hashCode()); hashCode = prime * hashCode + ((getAccountIdsToRemove() == null) ? 0 : getAccountIdsToRemove().hashCode()); hashCode = prime * hashCode + ((getSharedDocumentVersion() == null) ? 0 : getSharedDocumentVersion().hashCode()); return hashCode; } @Override public ModifyDocumentPermissionRequest clone() { return (ModifyDocumentPermissionRequest) super.clone(); } }