MongoDB C++ Driver mongocxx-3.7.0
Loading...
Searching...
No Matches
auto_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 pool;
30
31namespace options {
32
36class MONGOCXX_API auto_encryption {
37 public:
41 auto_encryption() noexcept;
42
59 auto_encryption& key_vault_client(client* client);
60
67 const stdx::optional<client*>& key_vault_client() const;
68
89 auto_encryption& key_vault_pool(pool* pool);
90
97 const stdx::optional<pool*>& key_vault_pool() const;
98
115 using ns_pair = std::pair<std::string, std::string>;
116 auto_encryption& key_vault_namespace(ns_pair ns);
117
125 const stdx::optional<ns_pair>& key_vault_namespace() const;
126
168 auto_encryption& kms_providers(bsoncxx::document::view_or_value kms_providers);
169
176 const stdx::optional<bsoncxx::document::view_or_value>& kms_providers() const;
177
198 auto_encryption& tls_opts(bsoncxx::document::view_or_value tls_opts);
199
206 const stdx::optional<bsoncxx::document::view_or_value>& tls_opts() const;
207
230 auto_encryption& schema_map(bsoncxx::document::view_or_value schema_map);
231
238 const stdx::optional<bsoncxx::document::view_or_value>& schema_map() const;
239
252 auto_encryption& bypass_auto_encryption(bool should_bypass);
253
260 bool bypass_auto_encryption() const;
261
284 auto_encryption& extra_options(bsoncxx::document::view_or_value extra);
285
292 const stdx::optional<bsoncxx::document::view_or_value>& extra_options() const;
293
294 private:
295 friend class mongocxx::client;
296 friend class mongocxx::pool;
297
298 MONGOCXX_PRIVATE void* convert() const;
299
300 bool _bypass;
301 stdx::optional<mongocxx::client*> _key_vault_client;
302 stdx::optional<mongocxx::pool*> _key_vault_pool;
303 stdx::optional<ns_pair> _key_vault_namespace;
304 stdx::optional<bsoncxx::document::view_or_value> _kms_providers;
305 stdx::optional<bsoncxx::document::view_or_value> _tls_opts;
306 stdx::optional<bsoncxx::document::view_or_value> _schema_map;
307 stdx::optional<bsoncxx::document::view_or_value> _extra_options;
308};
309
310} // namespace options
311MONGOCXX_INLINE_NAMESPACE_END
312} // namespace mongocxx
Class representing options for automatic client-side encryption.
Definition auto_encryption.hpp:36
auto_encryption() noexcept
Default constructs a new auto_encryption object.
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 auto_encryption.hpp:115
Class representing the optional arguments to a MongoDB driver client object.
Definition client.hpp:36
Class representing the optional arguments to a MongoDB driver pool object.
Definition pool.hpp:29
Top level namespace for MongoDB C++ BSON functionality.
Definition element.hpp:24
Top level namespace for the MongoDB C++ driver.
Definition bulk_write.hpp:24