MongoDB C++ Driver mongocxx-3.7.0
Loading...
Searching...
No Matches
client_encryption.hpp
1// Copyright 2020 MongoDB Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <string>
18
19#include <bsoncxx/document/view_or_value.hpp>
20#include <bsoncxx/stdx/optional.hpp>
21#include <mongocxx/stdx.hpp>
22
23#include <mongocxx/config/prelude.hpp>
24
25namespace mongocxx {
26MONGOCXX_INLINE_NAMESPACE_BEGIN
27
28class client;
29class client_encryption;
30
31namespace options {
32
36class MONGOCXX_API client_encryption {
37 public:
52
59 const stdx::optional<mongocxx::client*>& key_vault_client() const;
60
77 using ns_pair = std::pair<std::string, std::string>;
78 client_encryption& key_vault_namespace(ns_pair ns);
79
87 const stdx::optional<ns_pair>& key_vault_namespace() const;
88
131
138 const stdx::optional<bsoncxx::document::view_or_value>& kms_providers() const;
139
161
168 const stdx::optional<bsoncxx::document::view_or_value>& tls_opts() const;
169
170 private:
171 friend class mongocxx::client_encryption;
172
173 MONGOCXX_PRIVATE void* convert() const;
174
175 stdx::optional<mongocxx::client*> _key_vault_client;
176 stdx::optional<ns_pair> _key_vault_namespace;
177 stdx::optional<bsoncxx::document::view_or_value> _kms_providers;
178 stdx::optional<bsoncxx::document::view_or_value> _tls_opts;
179};
180
181} // namespace options
182MONGOCXX_INLINE_NAMESPACE_END
183} // namespace mongocxx
184
185#include <mongocxx/config/postlude.hpp>
Class supporting operations for MongoDB Client-Side Field Level Encryption.
Definition client_encryption.hpp:31
Class representing a client connection to MongoDB.
Definition client.hpp:58
Class representing options for the object managing explicit client-side encryption.
Definition client_encryption.hpp:36
const stdx::optional< mongocxx::client * > & key_vault_client() const
Gets the key vault client.
client_encryption & kms_providers(bsoncxx::document::view_or_value kms_providers)
Sets the KMS providers to use for client side encryption.
client_encryption & tls_opts(bsoncxx::document::view_or_value tls_opts)
Sets the TLS options to use for client side encryption with a given KMS provider.
std::pair< std::string, std::string > ns_pair
Sets the namespace to use to access the key vault collection, which contains all data keys used for e...
Definition client_encryption.hpp:77
const stdx::optional< ns_pair > & key_vault_namespace() const
Gets the key vault namespace.
const stdx::optional< bsoncxx::document::view_or_value > & tls_opts() const
Gets the TLS options.
const stdx::optional< bsoncxx::document::view_or_value > & kms_providers() const
Gets the KMS providers.
client_encryption & key_vault_client(mongocxx::client *client)
When the key vault collection is on a separate MongoDB cluster, sets the optional client to use to ro...
Class representing the optional arguments to a MongoDB driver client object.
Definition client.hpp:36
Top level namespace for the MongoDB C++ driver.
Definition bulk_write.hpp:24