MongoDB C++ Driver  mongocxx-3.10.2
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 <mongocxx/client-fwd.hpp>
20 #include <mongocxx/options/auto_encryption-fwd.hpp>
21 #include <mongocxx/pool-fwd.hpp>
22 
23 #include <bsoncxx/document/view_or_value.hpp>
24 #include <bsoncxx/stdx/optional.hpp>
25 #include <mongocxx/stdx.hpp>
26 
27 #include <mongocxx/config/prelude.hpp>
28 
29 namespace mongocxx {
30 namespace v_noabi {
31 namespace options {
32 
37  public:
41  auto_encryption() noexcept;
42 
60 
67  const stdx::optional<mongocxx::v_noabi::client*>& key_vault_client() const;
68 
90 
97  const stdx::optional<mongocxx::v_noabi::pool*>& key_vault_pool() const;
98 
115  using ns_pair = std::pair<std::string, std::string>;
117 
125  const stdx::optional<ns_pair>& key_vault_namespace() const;
126 
170  auto_encryption& kms_providers(bsoncxx::v_noabi::document::view_or_value kms_providers);
171 
178  const stdx::optional<bsoncxx::v_noabi::document::view_or_value>& kms_providers() const;
179 
202  auto_encryption& tls_opts(bsoncxx::v_noabi::document::view_or_value tls_opts);
203 
210  const stdx::optional<bsoncxx::v_noabi::document::view_or_value>& tls_opts() const;
211 
234  auto_encryption& schema_map(bsoncxx::v_noabi::document::view_or_value schema_map);
235 
242  const stdx::optional<bsoncxx::v_noabi::document::view_or_value>& schema_map() const;
243 
262  bsoncxx::v_noabi::document::view_or_value encrypted_fields_map);
263 
270  const stdx::optional<bsoncxx::v_noabi::document::view_or_value>& encrypted_fields_map() const;
271 
285 
293 
307 
314  bool bypass_query_analysis() const;
315 
365  auto_encryption& extra_options(bsoncxx::v_noabi::document::view_or_value extra);
366 
373  const stdx::optional<bsoncxx::v_noabi::document::view_or_value>& extra_options() const;
374 
375  private:
376  friend ::mongocxx::v_noabi::client;
377  friend ::mongocxx::v_noabi::pool;
378 
379  MONGOCXX_PRIVATE void* convert() const;
380 
381  bool _bypass;
382  bool _bypass_query_analysis;
383  stdx::optional<mongocxx::v_noabi::client*> _key_vault_client;
384  stdx::optional<mongocxx::v_noabi::pool*> _key_vault_pool;
385  stdx::optional<ns_pair> _key_vault_namespace;
386  stdx::optional<bsoncxx::v_noabi::document::view_or_value> _kms_providers;
387  stdx::optional<bsoncxx::v_noabi::document::view_or_value> _tls_opts;
388  stdx::optional<bsoncxx::v_noabi::document::view_or_value> _schema_map;
389  stdx::optional<bsoncxx::v_noabi::document::view_or_value> _encrypted_fields_map;
390  stdx::optional<bsoncxx::v_noabi::document::view_or_value> _extra_options;
391 };
392 
393 } // namespace options
394 } // namespace v_noabi
395 } // namespace mongocxx
396 
397 // CXX-2770: missing include of postlude header.
398 #if defined(MONGOCXX_TEST_MACRO_GUARDS_FIX_MISSING_POSTLUDE)
399 #include <mongocxx/config/postlude.hpp>
400 #endif
Class representing options for automatic client-side encryption.
Definition: auto_encryption.hpp:36
const stdx::optional< mongocxx::v_noabi::pool * > & key_vault_pool() const
Gets the key vault pool.
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & kms_providers() const
Gets the KMS providers.
bool bypass_query_analysis() const
Gets a boolean specifying whether or not query analysis is bypassed.
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & extra_options() const
Gets extra options related to the mongocryptd process.
auto_encryption() noexcept
Default constructs a new auto_encryption object.
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & schema_map() const
Gets the schema map.
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & tls_opts() const
Gets the TLS options.
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & encrypted_fields_map() const
Get encrypted fields map.
bool bypass_auto_encryption() const
Gets a boolean specifying whether or not auto encryption is bypassed.
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
const stdx::optional< mongocxx::v_noabi::client * > & key_vault_client() const
Gets the key vault client.
const stdx::optional< ns_pair > & key_vault_namespace() const
Gets the key vault namespace.
Class representing the optional arguments to a MongoDB driver client object.
Definition: client.hpp:38
Class representing the optional arguments to a MongoDB driver pool object.
Definition: pool.hpp:31
The top-level namespace for bsoncxx library entities.
Definition: element-fwd.hpp:19
The top-level namespace for mongocxx library entities.
Definition: bulk_write-fwd.hpp:19