/* * 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.acmpca.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 CreatePermissionRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** *

* The Amazon Resource Name (ARN) of the CA that grants the permissions. You can find the ARN by calling the * ListCertificateAuthorities action. This must have the following form: *

*

* arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 * . *

*/ private String certificateAuthorityArn; /** *

* The Amazon Web Services service or identity that receives the permission. At this time, the only valid principal * is acm.amazonaws.com. *

*/ private String principal; /** *

* The ID of the calling account. *

*/ private String sourceAccount; /** *

* The actions that the specified Amazon Web Services service principal can use. These include * IssueCertificate, GetCertificate, and ListPermissions. *

*/ private java.util.List actions; /** *

* The Amazon Resource Name (ARN) of the CA that grants the permissions. You can find the ARN by calling the * ListCertificateAuthorities action. This must have the following form: *

*

* arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 * . *

* * @param certificateAuthorityArn * The Amazon Resource Name (ARN) of the CA that grants the permissions. You can find the ARN by calling the * * ListCertificateAuthorities action. This must have the following form:

*

* arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 . */ public void setCertificateAuthorityArn(String certificateAuthorityArn) { this.certificateAuthorityArn = certificateAuthorityArn; } /** *

* The Amazon Resource Name (ARN) of the CA that grants the permissions. You can find the ARN by calling the * ListCertificateAuthorities action. This must have the following form: *

*

* arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 * . *

* * @return The Amazon Resource Name (ARN) of the CA that grants the permissions. You can find the ARN by calling the * * ListCertificateAuthorities action. This must have the following form:

*

* arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 . */ public String getCertificateAuthorityArn() { return this.certificateAuthorityArn; } /** *

* The Amazon Resource Name (ARN) of the CA that grants the permissions. You can find the ARN by calling the * ListCertificateAuthorities action. This must have the following form: *

*

* arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 * . *

* * @param certificateAuthorityArn * The Amazon Resource Name (ARN) of the CA that grants the permissions. You can find the ARN by calling the * * ListCertificateAuthorities action. This must have the following form:

*

* arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 . * @return Returns a reference to this object so that method calls can be chained together. */ public CreatePermissionRequest withCertificateAuthorityArn(String certificateAuthorityArn) { setCertificateAuthorityArn(certificateAuthorityArn); return this; } /** *

* The Amazon Web Services service or identity that receives the permission. At this time, the only valid principal * is acm.amazonaws.com. *

* * @param principal * The Amazon Web Services service or identity that receives the permission. At this time, the only valid * principal is acm.amazonaws.com. */ public void setPrincipal(String principal) { this.principal = principal; } /** *

* The Amazon Web Services service or identity that receives the permission. At this time, the only valid principal * is acm.amazonaws.com. *

* * @return The Amazon Web Services service or identity that receives the permission. At this time, the only valid * principal is acm.amazonaws.com. */ public String getPrincipal() { return this.principal; } /** *

* The Amazon Web Services service or identity that receives the permission. At this time, the only valid principal * is acm.amazonaws.com. *

* * @param principal * The Amazon Web Services service or identity that receives the permission. At this time, the only valid * principal is acm.amazonaws.com. * @return Returns a reference to this object so that method calls can be chained together. */ public CreatePermissionRequest withPrincipal(String principal) { setPrincipal(principal); return this; } /** *

* The ID of the calling account. *

* * @param sourceAccount * The ID of the calling account. */ public void setSourceAccount(String sourceAccount) { this.sourceAccount = sourceAccount; } /** *

* The ID of the calling account. *

* * @return The ID of the calling account. */ public String getSourceAccount() { return this.sourceAccount; } /** *

* The ID of the calling account. *

* * @param sourceAccount * The ID of the calling account. * @return Returns a reference to this object so that method calls can be chained together. */ public CreatePermissionRequest withSourceAccount(String sourceAccount) { setSourceAccount(sourceAccount); return this; } /** *

* The actions that the specified Amazon Web Services service principal can use. These include * IssueCertificate, GetCertificate, and ListPermissions. *

* * @return The actions that the specified Amazon Web Services service principal can use. These include * IssueCertificate, GetCertificate, and ListPermissions. * @see ActionType */ public java.util.List getActions() { return actions; } /** *

* The actions that the specified Amazon Web Services service principal can use. These include * IssueCertificate, GetCertificate, and ListPermissions. *

* * @param actions * The actions that the specified Amazon Web Services service principal can use. These include * IssueCertificate, GetCertificate, and ListPermissions. * @see ActionType */ public void setActions(java.util.Collection actions) { if (actions == null) { this.actions = null; return; } this.actions = new java.util.ArrayList(actions); } /** *

* The actions that the specified Amazon Web Services service principal can use. These include * IssueCertificate, GetCertificate, and ListPermissions. *

*

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

* * @param actions * The actions that the specified Amazon Web Services service principal can use. These include * IssueCertificate, GetCertificate, and ListPermissions. * @return Returns a reference to this object so that method calls can be chained together. * @see ActionType */ public CreatePermissionRequest withActions(String... actions) { if (this.actions == null) { setActions(new java.util.ArrayList(actions.length)); } for (String ele : actions) { this.actions.add(ele); } return this; } /** *

* The actions that the specified Amazon Web Services service principal can use. These include * IssueCertificate, GetCertificate, and ListPermissions. *

* * @param actions * The actions that the specified Amazon Web Services service principal can use. These include * IssueCertificate, GetCertificate, and ListPermissions. * @return Returns a reference to this object so that method calls can be chained together. * @see ActionType */ public CreatePermissionRequest withActions(java.util.Collection actions) { setActions(actions); return this; } /** *

* The actions that the specified Amazon Web Services service principal can use. These include * IssueCertificate, GetCertificate, and ListPermissions. *

* * @param actions * The actions that the specified Amazon Web Services service principal can use. These include * IssueCertificate, GetCertificate, and ListPermissions. * @return Returns a reference to this object so that method calls can be chained together. * @see ActionType */ public CreatePermissionRequest withActions(ActionType... actions) { java.util.ArrayList actionsCopy = new java.util.ArrayList(actions.length); for (ActionType value : actions) { actionsCopy.add(value.toString()); } if (getActions() == null) { setActions(actionsCopy); } else { getActions().addAll(actionsCopy); } 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 (getCertificateAuthorityArn() != null) sb.append("CertificateAuthorityArn: ").append(getCertificateAuthorityArn()).append(","); if (getPrincipal() != null) sb.append("Principal: ").append(getPrincipal()).append(","); if (getSourceAccount() != null) sb.append("SourceAccount: ").append(getSourceAccount()).append(","); if (getActions() != null) sb.append("Actions: ").append(getActions()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreatePermissionRequest == false) return false; CreatePermissionRequest other = (CreatePermissionRequest) obj; if (other.getCertificateAuthorityArn() == null ^ this.getCertificateAuthorityArn() == null) return false; if (other.getCertificateAuthorityArn() != null && other.getCertificateAuthorityArn().equals(this.getCertificateAuthorityArn()) == false) return false; if (other.getPrincipal() == null ^ this.getPrincipal() == null) return false; if (other.getPrincipal() != null && other.getPrincipal().equals(this.getPrincipal()) == false) return false; if (other.getSourceAccount() == null ^ this.getSourceAccount() == null) return false; if (other.getSourceAccount() != null && other.getSourceAccount().equals(this.getSourceAccount()) == false) return false; if (other.getActions() == null ^ this.getActions() == null) return false; if (other.getActions() != null && other.getActions().equals(this.getActions()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getCertificateAuthorityArn() == null) ? 0 : getCertificateAuthorityArn().hashCode()); hashCode = prime * hashCode + ((getPrincipal() == null) ? 0 : getPrincipal().hashCode()); hashCode = prime * hashCode + ((getSourceAccount() == null) ? 0 : getSourceAccount().hashCode()); hashCode = prime * hashCode + ((getActions() == null) ? 0 : getActions().hashCode()); return hashCode; } @Override public CreatePermissionRequest clone() { return (CreatePermissionRequest) super.clone(); } }