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 GenerateDataKeyWithoutPlaintext operation.

Returns a data key encrypted by a customer master key without the plaintext copy of that key. Otherwise, this API functions exactly like GenerateDataKey. You can use this API to, for example, satisfy an audit requirement that an encrypted key be made available without exposing the plaintext copy of that key.

 
 public class GenerateDataKeyWithoutPlaintextRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
A unique identifier for the customer master key. This value can be a globally unique identifier, a fully specified ARN to either an alias or a key, or an alias name prefixed by "alias/".
  • Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
  • Alias ARN Example - arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
  • Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
  • Alias Name Example - alias/MyAliasName

Constraints:
Length: 1 - 256

 
     private String keyId;

    
Name:value pair that contains additional data to be authenticated during the encryption and decryption processes.
 
     private java.util.Map<String,StringencryptionContext;

    
Value that identifies the encryption algorithm and key size. Currently this can be AES_128 or AES_256.

Constraints:
Allowed Values: AES_256, AES_128

 
     private String keySpec;

    
Integer that contains the number of bytes to generate. Common values are 128, 256, 512, 1024 and so on. We recommend that you use the KeySpec parameter instead.

Constraints:
Range: 1 - 1024

 
     private Integer numberOfBytes;

    
For more information, see Grant Tokens.

Constraints:
Length: 0 - 10

 
A unique identifier for the customer master key. This value can be a globally unique identifier, a fully specified ARN to either an alias or a key, or an alias name prefixed by "alias/".
  • Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
  • Alias ARN Example - arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
  • Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
  • Alias Name Example - alias/MyAliasName

Constraints:
Length: 1 - 256

Returns:
A unique identifier for the customer master key. This value can be a globally unique identifier, a fully specified ARN to either an alias or a key, or an alias name prefixed by "alias/".
  • Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
  • Alias ARN Example - arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
  • Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
  • Alias Name Example - alias/MyAliasName
    public String getKeyId() {
        return ;
    }
    
    
A unique identifier for the customer master key. This value can be a globally unique identifier, a fully specified ARN to either an alias or a key, or an alias name prefixed by "alias/".
  • Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
  • Alias ARN Example - arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
  • Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
  • Alias Name Example - alias/MyAliasName

Constraints:
Length: 1 - 256

Parameters:
keyId A unique identifier for the customer master key. This value can be a globally unique identifier, a fully specified ARN to either an alias or a key, or an alias name prefixed by "alias/".
  • Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
  • Alias ARN Example - arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
  • Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
  • Alias Name Example - alias/MyAliasName
    public void setKeyId(String keyId) {
        this. = keyId;
    }
    
    
A unique identifier for the customer master key. This value can be a globally unique identifier, a fully specified ARN to either an alias or a key, or an alias name prefixed by "alias/".
  • Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
  • Alias ARN Example - arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
  • Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
  • Alias Name Example - alias/MyAliasName

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

Constraints:
Length: 1 - 256

Parameters:
keyId A unique identifier for the customer master key. This value can be a globally unique identifier, a fully specified ARN to either an alias or a key, or an alias name prefixed by "alias/".
  • Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
  • Alias ARN Example - arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
  • Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
  • Alias Name Example - alias/MyAliasName
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = keyId;
        return this;
    }

    
Name:value pair that contains additional data to be authenticated during the encryption and decryption processes.

Returns:
Name:value pair that contains additional data to be authenticated during the encryption and decryption processes.
        
        if ( == null) {
             = new java.util.HashMap<String,String>();
        }
        return ;
    }
    
    
Name:value pair that contains additional data to be authenticated during the encryption and decryption processes.

Parameters:
encryptionContext Name:value pair that contains additional data to be authenticated during the encryption and decryption processes.
    public void setEncryptionContext(java.util.Map<String,StringencryptionContext) {
        this. = encryptionContext;
    }
    
    
Name:value pair that contains additional data to be authenticated during the encryption and decryption processes.

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

Parameters:
encryptionContext Name:value pair that contains additional data to be authenticated during the encryption and decryption processes.
Returns:
A reference to this updated object so that method calls can be chained together.
        setEncryptionContext(encryptionContext);
        return this;
    }

    
Name:value pair that contains additional data to be authenticated during the encryption and decryption processes.

The method adds a new key-value pair into EncryptionContext parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key The key of the entry to be added into EncryptionContext.
value The corresponding value of the entry to be added into EncryptionContext.
    if (null == this.) {
      this. = new java.util.HashMap<String,String>();
    }
    if (this..containsKey(key))
      throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
    this..put(keyvalue);
    return this;
  }

  
Removes all the entries added into EncryptionContext.

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

    this. = null;
    return this;
  }
  
    
Value that identifies the encryption algorithm and key size. Currently this can be AES_128 or AES_256.

Constraints:
Allowed Values: AES_256, AES_128

Returns:
Value that identifies the encryption algorithm and key size. Currently this can be AES_128 or AES_256.
See also:
DataKeySpec
    public String getKeySpec() {
        return ;
    }
    
    
Value that identifies the encryption algorithm and key size. Currently this can be AES_128 or AES_256.

Constraints:
Allowed Values: AES_256, AES_128

Parameters:
keySpec Value that identifies the encryption algorithm and key size. Currently this can be AES_128 or AES_256.
See also:
DataKeySpec
    public void setKeySpec(String keySpec) {
        this. = keySpec;
    }
    
    
Value that identifies the encryption algorithm and key size. Currently this can be AES_128 or AES_256.

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

Constraints:
Allowed Values: AES_256, AES_128

Parameters:
keySpec Value that identifies the encryption algorithm and key size. Currently this can be AES_128 or AES_256.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
DataKeySpec
        this. = keySpec;
        return this;
    }

    
Value that identifies the encryption algorithm and key size. Currently this can be AES_128 or AES_256.

Constraints:
Allowed Values: AES_256, AES_128

Parameters:
keySpec Value that identifies the encryption algorithm and key size. Currently this can be AES_128 or AES_256.
See also:
DataKeySpec
    public void setKeySpec(DataKeySpec keySpec) {
        this. = keySpec.toString();
    }
    
    
Value that identifies the encryption algorithm and key size. Currently this can be AES_128 or AES_256.

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

Constraints:
Allowed Values: AES_256, AES_128

Parameters:
keySpec Value that identifies the encryption algorithm and key size. Currently this can be AES_128 or AES_256.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
DataKeySpec
        this. = keySpec.toString();
        return this;
    }

    
Integer that contains the number of bytes to generate. Common values are 128, 256, 512, 1024 and so on. We recommend that you use the KeySpec parameter instead.

Constraints:
Range: 1 - 1024

Returns:
Integer that contains the number of bytes to generate. Common values are 128, 256, 512, 1024 and so on. We recommend that you use the KeySpec parameter instead.
    public Integer getNumberOfBytes() {
        return ;
    }
    
    
Integer that contains the number of bytes to generate. Common values are 128, 256, 512, 1024 and so on. We recommend that you use the KeySpec parameter instead.

Constraints:
Range: 1 - 1024

Parameters:
numberOfBytes Integer that contains the number of bytes to generate. Common values are 128, 256, 512, 1024 and so on. We recommend that you use the KeySpec parameter instead.
    public void setNumberOfBytes(Integer numberOfBytes) {
        this. = numberOfBytes;
    }
    
    
Integer that contains the number of bytes to generate. Common values are 128, 256, 512, 1024 and so on. We recommend that you use the KeySpec parameter instead.

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

Constraints:
Range: 1 - 1024

Parameters:
numberOfBytes Integer that contains the number of bytes to generate. Common values are 128, 256, 512, 1024 and so on. We recommend that you use the KeySpec parameter instead.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = numberOfBytes;
        return this;
    }

    
For more information, see Grant Tokens.

Constraints:
Length: 0 - 10

Returns:
For more information, see Grant Tokens.
    public java.util.List<StringgetGrantTokens() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
For more information, see Grant Tokens.

Constraints:
Length: 0 - 10

Parameters:
grantTokens For more information, see Grant Tokens.
    public void setGrantTokens(java.util.Collection<StringgrantTokens) {
        if (grantTokens == null) {
            this. = null;
            return;
        }
        grantTokensCopy.addAll(grantTokens);
        this. = grantTokensCopy;
    }
    
    
For more information, see Grant Tokens.

NOTE: This method appends the values to the existing list (if any). Use setGrantTokens(java.util.Collection) or withGrantTokens(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.

Constraints:
Length: 0 - 10

Parameters:
grantTokens For more information, see Grant Tokens.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (getGrantTokens() == nullsetGrantTokens(new java.util.ArrayList<String>(grantTokens.length));
        for (String value : grantTokens) {
            getGrantTokens().add(value);
        }
        return this;
    }
    
    
For more information, see Grant Tokens.

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

Constraints:
Length: 0 - 10

Parameters:
grantTokens For more information, see Grant Tokens.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (grantTokens == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringgrantTokensCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(grantTokens.size());
            grantTokensCopy.addAll(grantTokens);
            this. = grantTokensCopy;
        }
        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 (getKeyId() != nullsb.append("KeyId: " + getKeyId() + ",");
        if (getEncryptionContext() != nullsb.append("EncryptionContext: " + getEncryptionContext() + ",");
        if (getKeySpec() != nullsb.append("KeySpec: " + getKeySpec() + ",");
        if (getNumberOfBytes() != nullsb.append("NumberOfBytes: " + getNumberOfBytes() + ",");
        if (getGrantTokens() != nullsb.append("GrantTokens: " + getGrantTokens() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getKeyId() == null) ? 0 : getKeyId().hashCode()); 
        hashCode = prime * hashCode + ((getEncryptionContext() == null) ? 0 : getEncryptionContext().hashCode()); 
        hashCode = prime * hashCode + ((getKeySpec() == null) ? 0 : getKeySpec().hashCode()); 
        hashCode = prime * hashCode + ((getNumberOfBytes() == null) ? 0 : getNumberOfBytes().hashCode()); 
        hashCode = prime * hashCode + ((getGrantTokens() == null) ? 0 : getGrantTokens().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof GenerateDataKeyWithoutPlaintextRequest == falsereturn false;
        
        if (other.getKeyId() == null ^ this.getKeyId() == nullreturn false;
        if (other.getKeyId() != null && other.getKeyId().equals(this.getKeyId()) == falsereturn false
        if (other.getEncryptionContext() == null ^ this.getEncryptionContext() == nullreturn false;
        if (other.getEncryptionContext() != null && other.getEncryptionContext().equals(this.getEncryptionContext()) == falsereturn false
        if (other.getKeySpec() == null ^ this.getKeySpec() == nullreturn false;
        if (other.getKeySpec() != null && other.getKeySpec().equals(this.getKeySpec()) == falsereturn false
        if (other.getNumberOfBytes() == null ^ this.getNumberOfBytes() == nullreturn false;
        if (other.getNumberOfBytes() != null && other.getNumberOfBytes().equals(this.getNumberOfBytes()) == falsereturn false
        if (other.getGrantTokens() == null ^ this.getGrantTokens() == nullreturn false;
        if (other.getGrantTokens() != null && other.getGrantTokens().equals(this.getGrantTokens()) == falsereturn false
        return true;
    }
    
    @Override
        
            return (GenerateDataKeyWithoutPlaintextRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X