com.amazonaws.services.acmpca.model.Permission 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.acmpca.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Permissions designate which private CA actions can be performed by an Amazon Web Services service or entity. In order
* for ACM to automatically renew private certificates, you must give the ACM service principal all available
* permissions (IssueCertificate
, GetCertificate
, and ListPermissions
).
* Permissions can be assigned with the CreatePermission
* action, removed with the DeletePermission
* action, and listed with the ListPermissions action.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Permission implements Serializable, Cloneable, StructuredPojo {
/**
*
* The Amazon Resource Number (ARN) of the private CA from which the permission was issued.
*
*/
private String certificateAuthorityArn;
/**
*
* The time at which the permission was created.
*
*/
private java.util.Date createdAt;
/**
*
* The Amazon Web Services service or entity that holds the permission. At this time, the only valid principal is
* acm.amazonaws.com
.
*
*/
private String principal;
/**
*
* The ID of the account that assigned the permission.
*
*/
private String sourceAccount;
/**
*
* The private CA actions that can be performed by the designated Amazon Web Services service.
*
*/
private java.util.List actions;
/**
*
* The name of the policy that is associated with the permission.
*
*/
private String policy;
/**
*
* The Amazon Resource Number (ARN) of the private CA from which the permission was issued.
*
*
* @param certificateAuthorityArn
* The Amazon Resource Number (ARN) of the private CA from which the permission was issued.
*/
public void setCertificateAuthorityArn(String certificateAuthorityArn) {
this.certificateAuthorityArn = certificateAuthorityArn;
}
/**
*
* The Amazon Resource Number (ARN) of the private CA from which the permission was issued.
*
*
* @return The Amazon Resource Number (ARN) of the private CA from which the permission was issued.
*/
public String getCertificateAuthorityArn() {
return this.certificateAuthorityArn;
}
/**
*
* The Amazon Resource Number (ARN) of the private CA from which the permission was issued.
*
*
* @param certificateAuthorityArn
* The Amazon Resource Number (ARN) of the private CA from which the permission was issued.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Permission withCertificateAuthorityArn(String certificateAuthorityArn) {
setCertificateAuthorityArn(certificateAuthorityArn);
return this;
}
/**
*
* The time at which the permission was created.
*
*
* @param createdAt
* The time at which the permission was created.
*/
public void setCreatedAt(java.util.Date createdAt) {
this.createdAt = createdAt;
}
/**
*
* The time at which the permission was created.
*
*
* @return The time at which the permission was created.
*/
public java.util.Date getCreatedAt() {
return this.createdAt;
}
/**
*
* The time at which the permission was created.
*
*
* @param createdAt
* The time at which the permission was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Permission withCreatedAt(java.util.Date createdAt) {
setCreatedAt(createdAt);
return this;
}
/**
*
* The Amazon Web Services service or entity that holds the permission. At this time, the only valid principal is
* acm.amazonaws.com
.
*
*
* @param principal
* The Amazon Web Services service or entity that holds 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 entity that holds the permission. At this time, the only valid principal is
* acm.amazonaws.com
.
*
*
* @return The Amazon Web Services service or entity that holds 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 entity that holds the permission. At this time, the only valid principal is
* acm.amazonaws.com
.
*
*
* @param principal
* The Amazon Web Services service or entity that holds 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 Permission withPrincipal(String principal) {
setPrincipal(principal);
return this;
}
/**
*
* The ID of the account that assigned the permission.
*
*
* @param sourceAccount
* The ID of the account that assigned the permission.
*/
public void setSourceAccount(String sourceAccount) {
this.sourceAccount = sourceAccount;
}
/**
*
* The ID of the account that assigned the permission.
*
*
* @return The ID of the account that assigned the permission.
*/
public String getSourceAccount() {
return this.sourceAccount;
}
/**
*
* The ID of the account that assigned the permission.
*
*
* @param sourceAccount
* The ID of the account that assigned the permission.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Permission withSourceAccount(String sourceAccount) {
setSourceAccount(sourceAccount);
return this;
}
/**
*
* The private CA actions that can be performed by the designated Amazon Web Services service.
*
*
* @return The private CA actions that can be performed by the designated Amazon Web Services service.
* @see ActionType
*/
public java.util.List getActions() {
return actions;
}
/**
*
* The private CA actions that can be performed by the designated Amazon Web Services service.
*
*
* @param actions
* The private CA actions that can be performed by the designated Amazon Web Services service.
* @see ActionType
*/
public void setActions(java.util.Collection actions) {
if (actions == null) {
this.actions = null;
return;
}
this.actions = new java.util.ArrayList(actions);
}
/**
*
* The private CA actions that can be performed by the designated Amazon Web Services service.
*
*
* 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 private CA actions that can be performed by the designated Amazon Web Services service.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ActionType
*/
public Permission 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 private CA actions that can be performed by the designated Amazon Web Services service.
*
*
* @param actions
* The private CA actions that can be performed by the designated Amazon Web Services service.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ActionType
*/
public Permission withActions(java.util.Collection actions) {
setActions(actions);
return this;
}
/**
*
* The private CA actions that can be performed by the designated Amazon Web Services service.
*
*
* @param actions
* The private CA actions that can be performed by the designated Amazon Web Services service.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ActionType
*/
public Permission 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;
}
/**
*
* The name of the policy that is associated with the permission.
*
*
* @param policy
* The name of the policy that is associated with the permission.
*/
public void setPolicy(String policy) {
this.policy = policy;
}
/**
*
* The name of the policy that is associated with the permission.
*
*
* @return The name of the policy that is associated with the permission.
*/
public String getPolicy() {
return this.policy;
}
/**
*
* The name of the policy that is associated with the permission.
*
*
* @param policy
* The name of the policy that is associated with the permission.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Permission withPolicy(String policy) {
setPolicy(policy);
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 (getCreatedAt() != null)
sb.append("CreatedAt: ").append(getCreatedAt()).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()).append(",");
if (getPolicy() != null)
sb.append("Policy: ").append(getPolicy());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Permission == false)
return false;
Permission other = (Permission) obj;
if (other.getCertificateAuthorityArn() == null ^ this.getCertificateAuthorityArn() == null)
return false;
if (other.getCertificateAuthorityArn() != null && other.getCertificateAuthorityArn().equals(this.getCertificateAuthorityArn()) == false)
return false;
if (other.getCreatedAt() == null ^ this.getCreatedAt() == null)
return false;
if (other.getCreatedAt() != null && other.getCreatedAt().equals(this.getCreatedAt()) == 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;
if (other.getPolicy() == null ^ this.getPolicy() == null)
return false;
if (other.getPolicy() != null && other.getPolicy().equals(this.getPolicy()) == 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 + ((getCreatedAt() == null) ? 0 : getCreatedAt().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());
hashCode = prime * hashCode + ((getPolicy() == null) ? 0 : getPolicy().hashCode());
return hashCode;
}
@Override
public Permission clone() {
try {
return (Permission) 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.acmpca.model.transform.PermissionMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}