All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mongodb.client.model.vault.DataKeyOptions Maven / Gradle / Ivy

Go to download

The MongoDB Java Driver uber-artifact, containing mongodb-driver, mongodb-driver-core, and bson

There is a newer version: 3.12.14
Show newest version
/*
 * Copyright 2008-present MongoDB, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License 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.mongodb.client.model.vault;

import org.bson.BsonDocument;

import java.util.List;

/**
 * The options for creating a data key.
 *
 * @since 3.11
 */
public class DataKeyOptions {
    private List keyAltNames;
    private BsonDocument masterKey;

    /**
     * Set the alternate key names.
     *
     * @param keyAltNames a list of alternate key names
     * @return this
     * @see #getKeyAltNames()
     */
    public DataKeyOptions keyAltNames(final List keyAltNames) {
        this.keyAltNames = keyAltNames;
        return this;
    }

    /**
     * Sets the master key document.
     *
     * @param masterKey the master key document
     * @return this
     * @see #getMasterKey()
     */
    public DataKeyOptions masterKey(final BsonDocument masterKey) {
        this.masterKey = masterKey;
        return this;
    }

    /**
     * Gets the alternate key names.
     *
     * 

* An optional list of alternate names used to reference a key. If a key is created with alternate names, then encryption may refer * to the key by the unique alternate name instead of by _id. *

* * @return the list of alternate key names */ public List getKeyAltNames() { return keyAltNames; } /** * Gets the master key document * *

* The masterKey identifies a KMS-specific key used to encrypt the new data key. If the kmsProvider is "aws" it is required and * must have the following fields: *

*
    *
  • region: a String containing the AWS region in which to locate the master key
  • *
  • key: a String containing the Amazon Resource Name (ARN) to the AWS customer master key
  • *
*

* If the kmsProvider is "local" the masterKey is not applicable. *

* @return the master key document */ public BsonDocument getMasterKey() { return masterKey; } @Override public String toString() { return "DataKeyOptions{" + "keyAltNames=" + keyAltNames + ", masterKey=" + masterKey + '}'; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy