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 metadata associated with a specific key.

 
 public class KeyMetadata implements SerializableCloneable {

    
Account ID number.
 
     private String aWSAccountId;

    
Unique identifier for the key.

Constraints:
Length: 1 - 256

 
     private String keyId;

    
Key ARN (Amazon Resource Name).

Constraints:
Length: 20 - 2048

 
     private String arn;

    
Date the key was created.
 
     private java.util.Date creationDate;

    
Value that specifies whether the key is enabled.
 
     private Boolean enabled;

    
The description of the key.

Constraints:
Length: 0 - 8192

 
     private String description;

    
A value that specifies what operation(s) the key can perform.

Constraints:
Allowed Values: ENCRYPT_DECRYPT

 
     private String keyUsage;

    
Account ID number.

Returns:
Account ID number.
 
     public String getAWSAccountId() {
         return ;
     }
    
    
Account ID number.

Parameters:
aWSAccountId Account ID number.
 
     public void setAWSAccountId(String aWSAccountId) {
         this. = aWSAccountId;
     }
    
    
Account ID number.

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

Parameters:
aWSAccountId Account ID number.
Returns:
A reference to this updated object so that method calls can be chained together.
    public KeyMetadata withAWSAccountId(String aWSAccountId) {
        this. = aWSAccountId;
        return this;
    }

    
Unique identifier for the key.

Constraints:
Length: 1 - 256

Returns:
Unique identifier for the key.
    public String getKeyId() {
        return ;
    }
    
    
Unique identifier for the key.

Constraints:
Length: 1 - 256

Parameters:
keyId Unique identifier for the key.
    public void setKeyId(String keyId) {
        this. = keyId;
    }
    
    
Unique identifier for the key.

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

Constraints:
Length: 1 - 256

Parameters:
keyId Unique identifier for the key.
Returns:
A reference to this updated object so that method calls can be chained together.
    public KeyMetadata withKeyId(String keyId) {
        this. = keyId;
        return this;
    }

    
Key ARN (Amazon Resource Name).

Constraints:
Length: 20 - 2048

Returns:
Key ARN (Amazon Resource Name).
    public String getArn() {
        return ;
    }
    
    
Key ARN (Amazon Resource Name).

Constraints:
Length: 20 - 2048

Parameters:
arn Key ARN (Amazon Resource Name).
    public void setArn(String arn) {
        this. = arn;
    }
    
    
Key ARN (Amazon Resource Name).

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

Constraints:
Length: 20 - 2048

Parameters:
arn Key ARN (Amazon Resource Name).
Returns:
A reference to this updated object so that method calls can be chained together.
    public KeyMetadata withArn(String arn) {
        this. = arn;
        return this;
    }

    
Date the key was created.

Returns:
Date the key was created.
    public java.util.Date getCreationDate() {
        return ;
    }
    
    
Date the key was created.

Parameters:
creationDate Date the key was created.
    public void setCreationDate(java.util.Date creationDate) {
        this. = creationDate;
    }
    
    
Date the key was created.

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

Parameters:
creationDate Date the key was created.
Returns:
A reference to this updated object so that method calls can be chained together.
    public KeyMetadata withCreationDate(java.util.Date creationDate) {
        this. = creationDate;
        return this;
    }

    
Value that specifies whether the key is enabled.

Returns:
Value that specifies whether the key is enabled.
    public Boolean isEnabled() {
        return ;
    }
    
    
Value that specifies whether the key is enabled.

Parameters:
enabled Value that specifies whether the key is enabled.
    public void setEnabled(Boolean enabled) {
        this. = enabled;
    }
    
    
Value that specifies whether the key is enabled.

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

Parameters:
enabled Value that specifies whether the key is enabled.
Returns:
A reference to this updated object so that method calls can be chained together.
    public KeyMetadata withEnabled(Boolean enabled) {
        this. = enabled;
        return this;
    }

    
Value that specifies whether the key is enabled.

Returns:
Value that specifies whether the key is enabled.
    public Boolean getEnabled() {
        return ;
    }

    
The description of the key.

Constraints:
Length: 0 - 8192

Returns:
The description of the key.
    public String getDescription() {
        return ;
    }
    
    
The description of the key.

Constraints:
Length: 0 - 8192

Parameters:
description The description of the key.
    public void setDescription(String description) {
        this. = description;
    }
    
    
The description of the key.

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

Constraints:
Length: 0 - 8192

Parameters:
description The description of the key.
Returns:
A reference to this updated object so that method calls can be chained together.
    public KeyMetadata withDescription(String description) {
        this. = description;
        return this;
    }

    
A value that specifies what operation(s) the key can perform.

Constraints:
Allowed Values: ENCRYPT_DECRYPT

Returns:
A value that specifies what operation(s) the key can perform.
See also:
KeyUsageType
    public String getKeyUsage() {
        return ;
    }
    
    
A value that specifies what operation(s) the key can perform.

Constraints:
Allowed Values: ENCRYPT_DECRYPT

Parameters:
keyUsage A value that specifies what operation(s) the key can perform.
See also:
KeyUsageType
    public void setKeyUsage(String keyUsage) {
        this. = keyUsage;
    }
    
    
A value that specifies what operation(s) the key can perform.

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

Constraints:
Allowed Values: ENCRYPT_DECRYPT

Parameters:
keyUsage A value that specifies what operation(s) the key can perform.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
KeyUsageType
    public KeyMetadata withKeyUsage(String keyUsage) {
        this. = keyUsage;
        return this;
    }

    
A value that specifies what operation(s) the key can perform.

Constraints:
Allowed Values: ENCRYPT_DECRYPT

Parameters:
keyUsage A value that specifies what operation(s) the key can perform.
See also:
KeyUsageType
    public void setKeyUsage(KeyUsageType keyUsage) {
        this. = keyUsage.toString();
    }
    
    
A value that specifies what operation(s) the key can perform.

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

Constraints:
Allowed Values: ENCRYPT_DECRYPT

Parameters:
keyUsage A value that specifies what operation(s) the key can perform.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
KeyUsageType
    public KeyMetadata withKeyUsage(KeyUsageType keyUsage) {
        this. = keyUsage.toString();
        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 (getAWSAccountId() != nullsb.append("AWSAccountId: " + getAWSAccountId() + ",");
        if (getKeyId() != nullsb.append("KeyId: " + getKeyId() + ",");
        if (getArn() != nullsb.append("Arn: " + getArn() + ",");
        if (getCreationDate() != nullsb.append("CreationDate: " + getCreationDate() + ",");
        if (isEnabled() != nullsb.append("Enabled: " + isEnabled() + ",");
        if (getDescription() != nullsb.append("Description: " + getDescription() + ",");
        if (getKeyUsage() != nullsb.append("KeyUsage: " + getKeyUsage() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getAWSAccountId() == null) ? 0 : getAWSAccountId().hashCode()); 
        hashCode = prime * hashCode + ((getKeyId() == null) ? 0 : getKeyId().hashCode()); 
        hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode()); 
        hashCode = prime * hashCode + ((getCreationDate() == null) ? 0 : getCreationDate().hashCode()); 
        hashCode = prime * hashCode + ((isEnabled() == null) ? 0 : isEnabled().hashCode()); 
        hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); 
        hashCode = prime * hashCode + ((getKeyUsage() == null) ? 0 : getKeyUsage().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof KeyMetadata == falsereturn false;
        KeyMetadata other = (KeyMetadata)obj;
        
        if (other.getAWSAccountId() == null ^ this.getAWSAccountId() == nullreturn false;
        if (other.getAWSAccountId() != null && other.getAWSAccountId().equals(this.getAWSAccountId()) == falsereturn false
        if (other.getKeyId() == null ^ this.getKeyId() == nullreturn false;
        if (other.getKeyId() != null && other.getKeyId().equals(this.getKeyId()) == falsereturn false
        if (other.getArn() == null ^ this.getArn() == nullreturn false;
        if (other.getArn() != null && other.getArn().equals(this.getArn()) == falsereturn false
        if (other.getCreationDate() == null ^ this.getCreationDate() == nullreturn false;
        if (other.getCreationDate() != null && other.getCreationDate().equals(this.getCreationDate()) == falsereturn false
        if (other.isEnabled() == null ^ this.isEnabled() == nullreturn false;
        if (other.isEnabled() != null && other.isEnabled().equals(this.isEnabled()) == falsereturn false
        if (other.getDescription() == null ^ this.getDescription() == nullreturn false;
        if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == falsereturn false
        if (other.getKeyUsage() == null ^ this.getKeyUsage() == nullreturn false;
        if (other.getKeyUsage() != null && other.getKeyUsage().equals(this.getKeyUsage()) == falsereturn false
        return true;
    }
    
    @Override
    public KeyMetadata clone() {
        try {
            return (KeyMetadatasuper.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