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;
 
 
Container for the parameters to the CreateKey operation.

Creates a customer master key. Customer master keys can be used to encrypt small amounts of data (less than 4K) directly, but they are most commonly used to encrypt or envelope data keys that are then used to encrypt customer data. For more information about data keys, see GenerateDataKey and GenerateDataKeyWithoutPlaintext.

 
 public class CreateKeyRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
Policy to be attached to the key. This is required and delegates back to the account. The key is the root of trust.

Constraints:
Length: 1 - 131072
Pattern: [\u0009\u000A\u000D\u0020-\u00FF]+

 
     private String policy;

    
Description of the key. We recommend that you choose a description that helps your customer decide whether the key is appropriate for a task.

Constraints:
Length: 0 - 8192

 
     private String description;

    
Specifies the intended use of the key. Currently this defaults to ENCRYPT/DECRYPT, and only symmetric encryption and decryption are supported.

Constraints:
Allowed Values: ENCRYPT_DECRYPT

 
     private String keyUsage;

    
Policy to be attached to the key. This is required and delegates back to the account. The key is the root of trust.

Constraints:
Length: 1 - 131072
Pattern: [\u0009\u000A\u000D\u0020-\u00FF]+

Returns:
Policy to be attached to the key. This is required and delegates back to the account. The key is the root of trust.
 
     public String getPolicy() {
         return ;
     }
    
    
Policy to be attached to the key. This is required and delegates back to the account. The key is the root of trust.

Constraints:
Length: 1 - 131072
Pattern: [\u0009\u000A\u000D\u0020-\u00FF]+

Parameters:
policy Policy to be attached to the key. This is required and delegates back to the account. The key is the root of trust.
 
     public void setPolicy(String policy) {
         this. = policy;
     }
    
    
Policy to be attached to the key. This is required and delegates back to the account. The key is the root of trust.

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

Constraints:
Length: 1 - 131072
Pattern: [\u0009\u000A\u000D\u0020-\u00FF]+

Parameters:
policy Policy to be attached to the key. This is required and delegates back to the account. The key is the root of trust.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateKeyRequest withPolicy(String policy) {
        this. = policy;
        return this;
    }

    
Description of the key. We recommend that you choose a description that helps your customer decide whether the key is appropriate for a task.

Constraints:
Length: 0 - 8192

Returns:
Description of the key. We recommend that you choose a description that helps your customer decide whether the key is appropriate for a task.
    public String getDescription() {
        return ;
    }
    
    
Description of the key. We recommend that you choose a description that helps your customer decide whether the key is appropriate for a task.

Constraints:
Length: 0 - 8192

Parameters:
description Description of the key. We recommend that you choose a description that helps your customer decide whether the key is appropriate for a task.
    public void setDescription(String description) {
        this. = description;
    }
    
    
Description of the key. We recommend that you choose a description that helps your customer decide whether the key is appropriate for a task.

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

Constraints:
Length: 0 - 8192

Parameters:
description Description of the key. We recommend that you choose a description that helps your customer decide whether the key is appropriate for a task.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateKeyRequest withDescription(String description) {
        this. = description;
        return this;
    }

    
Specifies the intended use of the key. Currently this defaults to ENCRYPT/DECRYPT, and only symmetric encryption and decryption are supported.

Constraints:
Allowed Values: ENCRYPT_DECRYPT

Returns:
Specifies the intended use of the key. Currently this defaults to ENCRYPT/DECRYPT, and only symmetric encryption and decryption are supported.
See also:
KeyUsageType
    public String getKeyUsage() {
        return ;
    }
    
    
Specifies the intended use of the key. Currently this defaults to ENCRYPT/DECRYPT, and only symmetric encryption and decryption are supported.

Constraints:
Allowed Values: ENCRYPT_DECRYPT

Parameters:
keyUsage Specifies the intended use of the key. Currently this defaults to ENCRYPT/DECRYPT, and only symmetric encryption and decryption are supported.
See also:
KeyUsageType
    public void setKeyUsage(String keyUsage) {
        this. = keyUsage;
    }
    
    
Specifies the intended use of the key. Currently this defaults to ENCRYPT/DECRYPT, and only symmetric encryption and decryption are supported.

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

Constraints:
Allowed Values: ENCRYPT_DECRYPT

Parameters:
keyUsage Specifies the intended use of the key. Currently this defaults to ENCRYPT/DECRYPT, and only symmetric encryption and decryption are supported.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
KeyUsageType
    public CreateKeyRequest withKeyUsage(String keyUsage) {
        this. = keyUsage;
        return this;
    }

    
Specifies the intended use of the key. Currently this defaults to ENCRYPT/DECRYPT, and only symmetric encryption and decryption are supported.

Constraints:
Allowed Values: ENCRYPT_DECRYPT

Parameters:
keyUsage Specifies the intended use of the key. Currently this defaults to ENCRYPT/DECRYPT, and only symmetric encryption and decryption are supported.
See also:
KeyUsageType
    public void setKeyUsage(KeyUsageType keyUsage) {
        this. = keyUsage.toString();
    }
    
    
Specifies the intended use of the key. Currently this defaults to ENCRYPT/DECRYPT, and only symmetric encryption and decryption are supported.

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

Constraints:
Allowed Values: ENCRYPT_DECRYPT

Parameters:
keyUsage Specifies the intended use of the key. Currently this defaults to ENCRYPT/DECRYPT, and only symmetric encryption and decryption are supported.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
KeyUsageType
    public CreateKeyRequest 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 (getPolicy() != nullsb.append("Policy: " + getPolicy() + ",");
        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 + ((getPolicy() == null) ? 0 : getPolicy().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 CreateKeyRequest == falsereturn false;
        CreateKeyRequest other = (CreateKeyRequest)obj;
        
        if (other.getPolicy() == null ^ this.getPolicy() == nullreturn false;
        if (other.getPolicy() != null && other.getPolicy().equals(this.getPolicy()) == 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 CreateKeyRequest clone() {
        
            return (CreateKeyRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X