org.apache.inlong.sort.filesystem.shaded.com.amazonaws.services.kms.model.GrantListEntry Maven / Gradle / Ivy
/*
* Copyright 2017-2022 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.kms.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Contains information about a grant.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GrantListEntry implements Serializable, Cloneable, StructuredPojo {
/**
*
* The unique identifier for the KMS key to which the grant applies.
*
*/
private String keyId;
/**
*
* The unique identifier for the grant.
*
*/
private String grantId;
/**
*
* The friendly name that identifies the grant. If a name was provided in the CreateGrant request, that name
* is returned. Otherwise this value is null.
*
*/
private String name;
/**
*
* The date and time when the grant was created.
*
*/
private java.util.Date creationDate;
/**
*
* The identity that gets the permissions in the grant.
*
*
* The GranteePrincipal
field in the ListGrants
response usually contains the user or role
* designated as the grantee principal in the grant. However, when the grantee principal in the grant is an Amazon
* Web Services service, the GranteePrincipal
field contains the service principal, which might represent several different grantee principals.
*
*/
private String granteePrincipal;
/**
*
* The principal that can retire the grant.
*
*/
private String retiringPrincipal;
/**
*
* The Amazon Web Services account under which the grant was issued.
*
*/
private String issuingAccount;
/**
*
* The list of operations permitted by the grant.
*
*/
private com.amazonaws.internal.SdkInternalList operations;
/**
*
* A list of key-value pairs that must be present in the encryption context of certain subsequent operations that
* the grant allows.
*
*/
private GrantConstraints constraints;
/**
*
* The unique identifier for the KMS key to which the grant applies.
*
*
* @param keyId
* The unique identifier for the KMS key to which the grant applies.
*/
public void setKeyId(String keyId) {
this.keyId = keyId;
}
/**
*
* The unique identifier for the KMS key to which the grant applies.
*
*
* @return The unique identifier for the KMS key to which the grant applies.
*/
public String getKeyId() {
return this.keyId;
}
/**
*
* The unique identifier for the KMS key to which the grant applies.
*
*
* @param keyId
* The unique identifier for the KMS key to which the grant applies.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GrantListEntry withKeyId(String keyId) {
setKeyId(keyId);
return this;
}
/**
*
* The unique identifier for the grant.
*
*
* @param grantId
* The unique identifier for the grant.
*/
public void setGrantId(String grantId) {
this.grantId = grantId;
}
/**
*
* The unique identifier for the grant.
*
*
* @return The unique identifier for the grant.
*/
public String getGrantId() {
return this.grantId;
}
/**
*
* The unique identifier for the grant.
*
*
* @param grantId
* The unique identifier for the grant.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GrantListEntry withGrantId(String grantId) {
setGrantId(grantId);
return this;
}
/**
*
* The friendly name that identifies the grant. If a name was provided in the CreateGrant request, that name
* is returned. Otherwise this value is null.
*
*
* @param name
* The friendly name that identifies the grant. If a name was provided in the CreateGrant request,
* that name is returned. Otherwise this value is null.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* The friendly name that identifies the grant. If a name was provided in the CreateGrant request, that name
* is returned. Otherwise this value is null.
*
*
* @return The friendly name that identifies the grant. If a name was provided in the CreateGrant request,
* that name is returned. Otherwise this value is null.
*/
public String getName() {
return this.name;
}
/**
*
* The friendly name that identifies the grant. If a name was provided in the CreateGrant request, that name
* is returned. Otherwise this value is null.
*
*
* @param name
* The friendly name that identifies the grant. If a name was provided in the CreateGrant request,
* that name is returned. Otherwise this value is null.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GrantListEntry withName(String name) {
setName(name);
return this;
}
/**
*
* The date and time when the grant was created.
*
*
* @param creationDate
* The date and time when the grant was created.
*/
public void setCreationDate(java.util.Date creationDate) {
this.creationDate = creationDate;
}
/**
*
* The date and time when the grant was created.
*
*
* @return The date and time when the grant was created.
*/
public java.util.Date getCreationDate() {
return this.creationDate;
}
/**
*
* The date and time when the grant was created.
*
*
* @param creationDate
* The date and time when the grant was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GrantListEntry withCreationDate(java.util.Date creationDate) {
setCreationDate(creationDate);
return this;
}
/**
*
* The identity that gets the permissions in the grant.
*
*
* The GranteePrincipal
field in the ListGrants
response usually contains the user or role
* designated as the grantee principal in the grant. However, when the grantee principal in the grant is an Amazon
* Web Services service, the GranteePrincipal
field contains the service principal, which might represent several different grantee principals.
*
*
* @param granteePrincipal
* The identity that gets the permissions in the grant.
*
* The GranteePrincipal
field in the ListGrants
response usually contains the user
* or role designated as the grantee principal in the grant. However, when the grantee principal in the grant
* is an Amazon Web Services service, the GranteePrincipal
field contains the service principal, which might represent several different grantee principals.
*/
public void setGranteePrincipal(String granteePrincipal) {
this.granteePrincipal = granteePrincipal;
}
/**
*
* The identity that gets the permissions in the grant.
*
*
* The GranteePrincipal
field in the ListGrants
response usually contains the user or role
* designated as the grantee principal in the grant. However, when the grantee principal in the grant is an Amazon
* Web Services service, the GranteePrincipal
field contains the service principal, which might represent several different grantee principals.
*
*
* @return The identity that gets the permissions in the grant.
*
* The GranteePrincipal
field in the ListGrants
response usually contains the user
* or role designated as the grantee principal in the grant. However, when the grantee principal in the
* grant is an Amazon Web Services service, the GranteePrincipal
field contains the service principal, which might represent several different grantee principals.
*/
public String getGranteePrincipal() {
return this.granteePrincipal;
}
/**
*
* The identity that gets the permissions in the grant.
*
*
* The GranteePrincipal
field in the ListGrants
response usually contains the user or role
* designated as the grantee principal in the grant. However, when the grantee principal in the grant is an Amazon
* Web Services service, the GranteePrincipal
field contains the service principal, which might represent several different grantee principals.
*
*
* @param granteePrincipal
* The identity that gets the permissions in the grant.
*
* The GranteePrincipal
field in the ListGrants
response usually contains the user
* or role designated as the grantee principal in the grant. However, when the grantee principal in the grant
* is an Amazon Web Services service, the GranteePrincipal
field contains the service principal, which might represent several different grantee principals.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GrantListEntry withGranteePrincipal(String granteePrincipal) {
setGranteePrincipal(granteePrincipal);
return this;
}
/**
*
* The principal that can retire the grant.
*
*
* @param retiringPrincipal
* The principal that can retire the grant.
*/
public void setRetiringPrincipal(String retiringPrincipal) {
this.retiringPrincipal = retiringPrincipal;
}
/**
*
* The principal that can retire the grant.
*
*
* @return The principal that can retire the grant.
*/
public String getRetiringPrincipal() {
return this.retiringPrincipal;
}
/**
*
* The principal that can retire the grant.
*
*
* @param retiringPrincipal
* The principal that can retire the grant.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GrantListEntry withRetiringPrincipal(String retiringPrincipal) {
setRetiringPrincipal(retiringPrincipal);
return this;
}
/**
*
* The Amazon Web Services account under which the grant was issued.
*
*
* @param issuingAccount
* The Amazon Web Services account under which the grant was issued.
*/
public void setIssuingAccount(String issuingAccount) {
this.issuingAccount = issuingAccount;
}
/**
*
* The Amazon Web Services account under which the grant was issued.
*
*
* @return The Amazon Web Services account under which the grant was issued.
*/
public String getIssuingAccount() {
return this.issuingAccount;
}
/**
*
* The Amazon Web Services account under which the grant was issued.
*
*
* @param issuingAccount
* The Amazon Web Services account under which the grant was issued.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GrantListEntry withIssuingAccount(String issuingAccount) {
setIssuingAccount(issuingAccount);
return this;
}
/**
*
* The list of operations permitted by the grant.
*
*
* @return The list of operations permitted by the grant.
* @see GrantOperation
*/
public java.util.List getOperations() {
if (operations == null) {
operations = new com.amazonaws.internal.SdkInternalList();
}
return operations;
}
/**
*
* The list of operations permitted by the grant.
*
*
* @param operations
* The list of operations permitted by the grant.
* @see GrantOperation
*/
public void setOperations(java.util.Collection operations) {
if (operations == null) {
this.operations = null;
return;
}
this.operations = new com.amazonaws.internal.SdkInternalList(operations);
}
/**
*
* The list of operations permitted by the grant.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setOperations(java.util.Collection)} or {@link #withOperations(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param operations
* The list of operations permitted by the grant.
* @return Returns a reference to this object so that method calls can be chained together.
* @see GrantOperation
*/
public GrantListEntry withOperations(String... operations) {
if (this.operations == null) {
setOperations(new com.amazonaws.internal.SdkInternalList(operations.length));
}
for (String ele : operations) {
this.operations.add(ele);
}
return this;
}
/**
*
* The list of operations permitted by the grant.
*
*
* @param operations
* The list of operations permitted by the grant.
* @return Returns a reference to this object so that method calls can be chained together.
* @see GrantOperation
*/
public GrantListEntry withOperations(java.util.Collection operations) {
setOperations(operations);
return this;
}
/**
*
* The list of operations permitted by the grant.
*
*
* @param operations
* The list of operations permitted by the grant.
* @return Returns a reference to this object so that method calls can be chained together.
* @see GrantOperation
*/
public GrantListEntry withOperations(GrantOperation... operations) {
com.amazonaws.internal.SdkInternalList operationsCopy = new com.amazonaws.internal.SdkInternalList(operations.length);
for (GrantOperation value : operations) {
operationsCopy.add(value.toString());
}
if (getOperations() == null) {
setOperations(operationsCopy);
} else {
getOperations().addAll(operationsCopy);
}
return this;
}
/**
*
* A list of key-value pairs that must be present in the encryption context of certain subsequent operations that
* the grant allows.
*
*
* @param constraints
* A list of key-value pairs that must be present in the encryption context of certain subsequent operations
* that the grant allows.
*/
public void setConstraints(GrantConstraints constraints) {
this.constraints = constraints;
}
/**
*
* A list of key-value pairs that must be present in the encryption context of certain subsequent operations that
* the grant allows.
*
*
* @return A list of key-value pairs that must be present in the encryption context of certain subsequent operations
* that the grant allows.
*/
public GrantConstraints getConstraints() {
return this.constraints;
}
/**
*
* A list of key-value pairs that must be present in the encryption context of certain subsequent operations that
* the grant allows.
*
*
* @param constraints
* A list of key-value pairs that must be present in the encryption context of certain subsequent operations
* that the grant allows.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GrantListEntry withConstraints(GrantConstraints constraints) {
setConstraints(constraints);
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 (getKeyId() != null)
sb.append("KeyId: ").append(getKeyId()).append(",");
if (getGrantId() != null)
sb.append("GrantId: ").append(getGrantId()).append(",");
if (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getCreationDate() != null)
sb.append("CreationDate: ").append(getCreationDate()).append(",");
if (getGranteePrincipal() != null)
sb.append("GranteePrincipal: ").append(getGranteePrincipal()).append(",");
if (getRetiringPrincipal() != null)
sb.append("RetiringPrincipal: ").append(getRetiringPrincipal()).append(",");
if (getIssuingAccount() != null)
sb.append("IssuingAccount: ").append(getIssuingAccount()).append(",");
if (getOperations() != null)
sb.append("Operations: ").append(getOperations()).append(",");
if (getConstraints() != null)
sb.append("Constraints: ").append(getConstraints());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof GrantListEntry == false)
return false;
GrantListEntry other = (GrantListEntry) obj;
if (other.getKeyId() == null ^ this.getKeyId() == null)
return false;
if (other.getKeyId() != null && other.getKeyId().equals(this.getKeyId()) == false)
return false;
if (other.getGrantId() == null ^ this.getGrantId() == null)
return false;
if (other.getGrantId() != null && other.getGrantId().equals(this.getGrantId()) == false)
return false;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == false)
return false;
if (other.getCreationDate() == null ^ this.getCreationDate() == null)
return false;
if (other.getCreationDate() != null && other.getCreationDate().equals(this.getCreationDate()) == false)
return false;
if (other.getGranteePrincipal() == null ^ this.getGranteePrincipal() == null)
return false;
if (other.getGranteePrincipal() != null && other.getGranteePrincipal().equals(this.getGranteePrincipal()) == false)
return false;
if (other.getRetiringPrincipal() == null ^ this.getRetiringPrincipal() == null)
return false;
if (other.getRetiringPrincipal() != null && other.getRetiringPrincipal().equals(this.getRetiringPrincipal()) == false)
return false;
if (other.getIssuingAccount() == null ^ this.getIssuingAccount() == null)
return false;
if (other.getIssuingAccount() != null && other.getIssuingAccount().equals(this.getIssuingAccount()) == false)
return false;
if (other.getOperations() == null ^ this.getOperations() == null)
return false;
if (other.getOperations() != null && other.getOperations().equals(this.getOperations()) == false)
return false;
if (other.getConstraints() == null ^ this.getConstraints() == null)
return false;
if (other.getConstraints() != null && other.getConstraints().equals(this.getConstraints()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getKeyId() == null) ? 0 : getKeyId().hashCode());
hashCode = prime * hashCode + ((getGrantId() == null) ? 0 : getGrantId().hashCode());
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getCreationDate() == null) ? 0 : getCreationDate().hashCode());
hashCode = prime * hashCode + ((getGranteePrincipal() == null) ? 0 : getGranteePrincipal().hashCode());
hashCode = prime * hashCode + ((getRetiringPrincipal() == null) ? 0 : getRetiringPrincipal().hashCode());
hashCode = prime * hashCode + ((getIssuingAccount() == null) ? 0 : getIssuingAccount().hashCode());
hashCode = prime * hashCode + ((getOperations() == null) ? 0 : getOperations().hashCode());
hashCode = prime * hashCode + ((getConstraints() == null) ? 0 : getConstraints().hashCode());
return hashCode;
}
@Override
public GrantListEntry clone() {
try {
return (GrantListEntry) 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.kms.model.transform.GrantListEntryMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}