Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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;
 

Contains information about each entry in the grant list.

 
 public class GrantListEntry implements SerializableCloneable {

    
Unique grant identifier.

Constraints:
Length: 1 - 128

 
     private String grantId;

    
The principal that receives the grant permission.

Constraints:
Length: 1 - 256

 
     private String granteePrincipal;

    
The principal that can retire the account.

Constraints:
Length: 1 - 256

 
     private String retiringPrincipal;

    
The account under which the grant was issued.

Constraints:
Length: 1 - 256

 
     private String issuingAccount;

    
List of operations permitted by the grant. This can be any combination of one or more of the following values:
  1. Decrypt
  2. Encrypt
  3. GenerateDataKey
  4. GenerateDataKeyWithoutPlaintext
  5. ReEncryptFrom
  6. ReEncryptTo
  7. CreateGrant
 
Specifies the conditions under which the actions specified by the Operations parameter are allowed.
 
     private GrantConstraints constraints;

    
Unique grant identifier.

Constraints:
Length: 1 - 128

Returns:
Unique grant identifier.
 
     public String getGrantId() {
         return ;
     }
    
    
Unique grant identifier.

Constraints:
Length: 1 - 128

Parameters:
grantId Unique grant identifier.
 
     public void setGrantId(String grantId) {
         this. = grantId;
     }
    
    
Unique grant identifier.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 - 128

Parameters:
grantId Unique grant identifier.
Returns:
A reference to this updated object so that method calls can be chained together.
    public GrantListEntry withGrantId(String grantId) {
        this. = grantId;
        return this;
    }

    
The principal that receives the grant permission.

Constraints:
Length: 1 - 256

Returns:
The principal that receives the grant permission.
    public String getGranteePrincipal() {
        return ;
    }
    
    
The principal that receives the grant permission.

Constraints:
Length: 1 - 256

Parameters:
granteePrincipal The principal that receives the grant permission.
    public void setGranteePrincipal(String granteePrincipal) {
        this. = granteePrincipal;
    }
    
    
The principal that receives the grant permission.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 - 256

Parameters:
granteePrincipal The principal that receives the grant permission.
Returns:
A reference to this updated object so that method calls can be chained together.
    public GrantListEntry withGranteePrincipal(String granteePrincipal) {
        this. = granteePrincipal;
        return this;
    }

    
The principal that can retire the account.

Constraints:
Length: 1 - 256

Returns:
The principal that can retire the account.
    public String getRetiringPrincipal() {
        return ;
    }
    
    
The principal that can retire the account.

Constraints:
Length: 1 - 256

Parameters:
retiringPrincipal The principal that can retire the account.
    public void setRetiringPrincipal(String retiringPrincipal) {
        this. = retiringPrincipal;
    }
    
    
The principal that can retire the account.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 - 256

Parameters:
retiringPrincipal The principal that can retire the account.
Returns:
A reference to this updated object so that method calls can be chained together.
    public GrantListEntry withRetiringPrincipal(String retiringPrincipal) {
        this. = retiringPrincipal;
        return this;
    }

    
The account under which the grant was issued.

Constraints:
Length: 1 - 256

Returns:
The account under which the grant was issued.
    public String getIssuingAccount() {
        return ;
    }
    
    
The account under which the grant was issued.

Constraints:
Length: 1 - 256

Parameters:
issuingAccount The account under which the grant was issued.
    public void setIssuingAccount(String issuingAccount) {
        this. = issuingAccount;
    }
    
    
The account under which the grant was issued.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 - 256

Parameters:
issuingAccount The account under which the grant was issued.
Returns:
A reference to this updated object so that method calls can be chained together.
    public GrantListEntry withIssuingAccount(String issuingAccount) {
        this. = issuingAccount;
        return this;
    }

    
List of operations permitted by the grant. This can be any combination of one or more of the following values:
  1. Decrypt
  2. Encrypt
  3. GenerateDataKey
  4. GenerateDataKeyWithoutPlaintext
  5. ReEncryptFrom
  6. ReEncryptTo
  7. CreateGrant

Returns:
List of operations permitted by the grant. This can be any combination of one or more of the following values:
  1. Decrypt
  2. Encrypt
  3. GenerateDataKey
  4. GenerateDataKeyWithoutPlaintext
  5. ReEncryptFrom
  6. ReEncryptTo
  7. CreateGrant
    public java.util.List<StringgetOperations() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
List of operations permitted by the grant. This can be any combination of one or more of the following values:
  1. Decrypt
  2. Encrypt
  3. GenerateDataKey
  4. GenerateDataKeyWithoutPlaintext
  5. ReEncryptFrom
  6. ReEncryptTo
  7. CreateGrant

Parameters:
operations List of operations permitted by the grant. This can be any combination of one or more of the following values:
  1. Decrypt
  2. Encrypt
  3. GenerateDataKey
  4. GenerateDataKeyWithoutPlaintext
  5. ReEncryptFrom
  6. ReEncryptTo
  7. CreateGrant
    public void setOperations(java.util.Collection<Stringoperations) {
        if (operations == null) {
            this. = null;
            return;
        }
        operationsCopy.addAll(operations);
        this. = operationsCopy;
    }
    
    
List of operations permitted by the grant. This can be any combination of one or more of the following values:
  1. Decrypt
  2. Encrypt
  3. GenerateDataKey
  4. GenerateDataKeyWithoutPlaintext
  5. ReEncryptFrom
  6. ReEncryptTo
  7. CreateGrant

NOTE: This method appends the values to the existing list (if any). Use setOperations(java.util.Collection) or withOperations(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Parameters:
operations List of operations permitted by the grant. This can be any combination of one or more of the following values:
  1. Decrypt
  2. Encrypt
  3. GenerateDataKey
  4. GenerateDataKeyWithoutPlaintext
  5. ReEncryptFrom
  6. ReEncryptTo
  7. CreateGrant
Returns:
A reference to this updated object so that method calls can be chained together.
    public GrantListEntry withOperations(String... operations) {
        if (getOperations() == nullsetOperations(new java.util.ArrayList<String>(operations.length));
        for (String value : operations) {
            getOperations().add(value);
        }
        return this;
    }
    
    
List of operations permitted by the grant. This can be any combination of one or more of the following values:
  1. Decrypt
  2. Encrypt
  3. GenerateDataKey
  4. GenerateDataKeyWithoutPlaintext
  5. ReEncryptFrom
  6. ReEncryptTo
  7. CreateGrant

Returns a reference to this object so that method calls can be chained together.

Parameters:
operations List of operations permitted by the grant. This can be any combination of one or more of the following values:
  1. Decrypt
  2. Encrypt
  3. GenerateDataKey
  4. GenerateDataKeyWithoutPlaintext
  5. ReEncryptFrom
  6. ReEncryptTo
  7. CreateGrant
Returns:
A reference to this updated object so that method calls can be chained together.
    public GrantListEntry withOperations(java.util.Collection<Stringoperations) {
        if (operations == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringoperationsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(operations.size());
            operationsCopy.addAll(operations);
            this. = operationsCopy;
        }
        return this;
    }

    
List of operations permitted by the grant. This can be any combination of one or more of the following values:
  1. Decrypt
  2. Encrypt
  3. GenerateDataKey
  4. GenerateDataKeyWithoutPlaintext
  5. ReEncryptFrom
  6. ReEncryptTo
  7. CreateGrant

Returns a reference to this object so that method calls can be chained together.

Parameters:
operations List of operations permitted by the grant. This can be any combination of one or more of the following values:
  1. Decrypt
  2. Encrypt
  3. GenerateDataKey
  4. GenerateDataKeyWithoutPlaintext
  5. ReEncryptFrom
  6. ReEncryptTo
  7. CreateGrant
Returns:
A reference to this updated object so that method calls can be chained together.
    public GrantListEntry withOperations(GrantOperation... operations) {
        java.util.ArrayList<StringoperationsCopy = new java.util.ArrayList<String>(operations.length);
        for (GrantOperation member : operations) {
            operationsCopy.add(member.toString());
        }
        if (getOperations() == null) {
            setOperations(operationsCopy);
        } else {
            getOperations().addAll(operationsCopy);
        }
        return this;
    }

    
Specifies the conditions under which the actions specified by the Operations parameter are allowed.

Returns:
Specifies the conditions under which the actions specified by the Operations parameter are allowed.
    public GrantConstraints getConstraints() {
        return ;
    }
    
    
Specifies the conditions under which the actions specified by the Operations parameter are allowed.

Parameters:
constraints Specifies the conditions under which the actions specified by the Operations parameter are allowed.
    public void setConstraints(GrantConstraints constraints) {
        this. = constraints;
    }
    
    
Specifies the conditions under which the actions specified by the Operations parameter are allowed.

Returns a reference to this object so that method calls can be chained together.

Parameters:
constraints Specifies the conditions under which the actions specified by the Operations parameter are allowed.
Returns:
A reference to this updated object so that method calls can be chained together.
    public GrantListEntry withConstraints(GrantConstraints constraints) {
        this. = constraints;
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getGrantId() != nullsb.append("GrantId: " + getGrantId() + ",");
        if (getGranteePrincipal() != nullsb.append("GranteePrincipal: " + getGranteePrincipal() + ",");
        if (getRetiringPrincipal() != nullsb.append("RetiringPrincipal: " + getRetiringPrincipal() + ",");
        if (getIssuingAccount() != nullsb.append("IssuingAccount: " + getIssuingAccount() + ",");
        if (getOperations() != nullsb.append("Operations: " + getOperations() + ",");
        if (getConstraints() != nullsb.append("Constraints: " + getConstraints() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getGrantId() == null) ? 0 : getGrantId().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 boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof GrantListEntry == falsereturn false;
        GrantListEntry other = (GrantListEntry)obj;
        
        if (other.getGrantId() == null ^ this.getGrantId() == nullreturn false;
        if (other.getGrantId() != null && other.getGrantId().equals(this.getGrantId()) == falsereturn false
        if (other.getGranteePrincipal() == null ^ this.getGranteePrincipal() == nullreturn false;
        if (other.getGranteePrincipal() != null && other.getGranteePrincipal().equals(this.getGranteePrincipal()) == falsereturn false
        if (other.getRetiringPrincipal() == null ^ this.getRetiringPrincipal() == nullreturn false;
        if (other.getRetiringPrincipal() != null && other.getRetiringPrincipal().equals(this.getRetiringPrincipal()) == falsereturn false
        if (other.getIssuingAccount() == null ^ this.getIssuingAccount() == nullreturn false;
        if (other.getIssuingAccount() != null && other.getIssuingAccount().equals(this.getIssuingAccount()) == falsereturn false
        if (other.getOperations() == null ^ this.getOperations() == nullreturn false;
        if (other.getOperations() != null && other.getOperations().equals(this.getOperations()) == falsereturn false
        if (other.getConstraints() == null ^ this.getConstraints() == nullreturn false;
        if (other.getConstraints() != null && other.getConstraints().equals(this.getConstraints()) == falsereturn false
        return true;
    }
    
    @Override
    public GrantListEntry clone() {
        try {
            return (GrantListEntrysuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X