MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
auto_encryption.hpp
Go to the documentation of this file.
1// Copyright 2009-present 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 <mongocxx/options/auto_encryption-fwd.hpp> // IWYU pragma: export
18
19//
20
23
24#include <mongocxx/v1/auto_encryption_options.hpp> // IWYU pragma: export
25
26#include <string> // IWYU pragma: keep: backward compatibility, to be removed.
27#include <utility>
28
30#include <mongocxx/pool-fwd.hpp>
31
34
36
37namespace mongocxx {
38namespace v_noabi {
39namespace options {
40
45 public:
49 auto_encryption() noexcept {}
50
69 _key_vault_client = client;
70 return *this;
71 }
72
80 return _key_vault_client;
81 }
82
105 _key_vault_pool = pool;
106 return *this;
107 }
108
116 return _key_vault_pool;
117 }
118
123
142 _key_vault_namespace = std::move(ns);
143 return *this;
144 }
145
154 return _key_vault_namespace;
155 }
156
202 _kms_providers = std::move(kms_providers);
203 return *this;
204 }
205
215
240 _tls_opts = std::move(tls_opts);
241 return *this;
242 }
243
253
278 _schema_map = std::move(schema_map);
279 return *this;
280 }
281
291
315
325
340 _bypass = should_bypass;
341 return *this;
342 }
343
351 return _bypass;
352 }
353
368 _bypass_query_analysis = should_bypass;
369 return *this;
370 }
371
379 return _bypass_query_analysis;
380 }
381
433 _extra_options = std::move(extra);
434 return *this;
435 }
436
446
447 class internal;
448
449 private:
450 bool _bypass = false;
451 bool _bypass_query_analysis = false;
460
461 /* explicit(false) */ auto_encryption(v1::auto_encryption_options opts);
462
463 explicit operator v1::auto_encryption_options() const;
464};
465
466} // namespace options
467} // namespace v_noabi
468} // namespace mongocxx
469
470namespace mongocxx {
471namespace v_noabi {
472
481
483 auto ret = from_v1(std::move(v));
484 ret.key_vault_client(client);
485 return ret;
486}
487
489 auto ret = from_v1(std::move(v));
490 ret.key_vault_pool(pool);
491 return ret;
492}
493
495
504
506 auto ret = to_v1(v);
507 ret.key_vault_client(client);
508 return ret;
509}
510
512 auto ret = to_v1(v);
513 ret.key_vault_pool(pool);
514 return ret;
515}
516
518
519} // namespace v_noabi
520} // namespace mongocxx
521
523
Declares mongocxx::v_noabi::options::auto_encryption.
Provides mongocxx::v1::auto_encryption_options.
A polyfill for std::optional<T>.
Definition optional.hpp:799
auto_encryption() noexcept
Default constructs a new auto_encryption object.
Definition auto_encryption.hpp:49
Options related In-Use Encryption configuration.
Definition auto_encryption_options.hpp:58
std::pair< std::string, std::string > ns_pair
The name of a database and a collection.
Definition auto_encryption_options.hpp:146
A connection to a MongoDB deployment.
Definition client.hpp:60
A thread-safe pool of client objects.
Definition pool.hpp:51
A client connection to a MongoDB server.
Definition client.hpp:76
Used by mongocxx::v_noabi::options::client::auto_encryption_opts.
Definition auto_encryption.hpp:44
auto_encryption & encrypted_fields_map(bsoncxx::v_noabi::document::view_or_value encrypted_fields_map)
Sets the local encrypted fields map.
Definition auto_encryption.hpp:311
auto_encryption & schema_map(bsoncxx::v_noabi::document::view_or_value schema_map)
Sets a local JSON schema.
Definition auto_encryption.hpp:277
bsoncxx::v_noabi::stdx::optional< ns_pair > const & key_vault_namespace() const
Gets the key vault namespace.
Definition auto_encryption.hpp:153
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > const & schema_map() const
Gets the schema map.
Definition auto_encryption.hpp:288
v1::auto_encryption_options::ns_pair ns_pair
Represents the name of a database and a collection.
Definition auto_encryption.hpp:122
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > const & kms_providers() const
Gets the KMS providers.
Definition auto_encryption.hpp:212
bool bypass_query_analysis() const
Gets a boolean specifying whether or not query analysis is bypassed.
Definition auto_encryption.hpp:378
auto_encryption() noexcept
Default constructs a new auto_encryption object.
Definition auto_encryption.hpp:49
auto_encryption & key_vault_client(v_noabi::client *client)
When the key vault collection is on a separate MongoDB cluster, sets the optional client to use to ro...
Definition auto_encryption.hpp:68
bool bypass_auto_encryption() const
Gets a boolean specifying whether or not auto encryption is bypassed.
Definition auto_encryption.hpp:350
auto_encryption & key_vault_pool(v_noabi::pool *pool)
When the key vault collection is on a separate MongoDB cluster, sets the optional client pool to use ...
Definition auto_encryption.hpp:104
auto_encryption & kms_providers(bsoncxx::v_noabi::document::view_or_value kms_providers)
Sets the KMS providers to use for client side encryption.
Definition auto_encryption.hpp:201
auto_encryption & bypass_query_analysis(bool should_bypass)
Query analysis is disabled when the 'bypassQueryAnalysis' option is true. Default is 'false' (i....
Definition auto_encryption.hpp:367
auto_encryption & bypass_auto_encryption(bool should_bypass)
Automatic encryption is disabled when the 'bypassAutoEncryption' option is true. Default is 'false,...
Definition auto_encryption.hpp:339
auto_encryption & key_vault_namespace(ns_pair ns)
Sets the namespace to use to access the key vault collection, which contains all data keys used for e...
Definition auto_encryption.hpp:141
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > const & tls_opts() const
Gets the TLS options.
Definition auto_encryption.hpp:250
bsoncxx::v_noabi::stdx::optional< v_noabi::client * > const & key_vault_client() const
Gets the key vault client.
Definition auto_encryption.hpp:79
auto_encryption & tls_opts(bsoncxx::v_noabi::document::view_or_value tls_opts)
Sets the TLS options to use for client side encryption with a given KMS provider.
Definition auto_encryption.hpp:239
bsoncxx::v_noabi::stdx::optional< v_noabi::pool * > const & key_vault_pool() const
Gets the key vault pool.
Definition auto_encryption.hpp:115
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > const & encrypted_fields_map() const
Get encrypted fields map.
Definition auto_encryption.hpp:322
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > const & extra_options() const
Gets extra options related to the mongocryptd process.
Definition auto_encryption.hpp:443
auto_encryption & extra_options(bsoncxx::v_noabi::document::view_or_value extra)
Set extra options related to the mongocryptd process. This options document may include the following...
Definition auto_encryption.hpp:432
Used by clients.
Definition client.hpp:42
Used by mongocxx::v_noabi::pool.
Definition pool.hpp:36
A pool of reusable client objects connected to the same MongoDB topology.
Definition pool.hpp:62
Provides bsoncxx::v_noabi::document::view_or_value.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v_noabi macro guard postlude header.
The mongocxx v_noabi macro guard prelude header.
v_noabi::view_or_value< v_noabi::document::view, v_noabi::document::value > view_or_value
Equivalent to v_noabi::view_or_value<v_noabi::document::view, v_noabi::document::value>.
Definition view_or_value.hpp:30
Declares entities representing options to use with various commands.
Declares entities whose ABI stability is NOT guaranteed.
v1::bulk_write to_v1(v_noabi::bulk_write v)
Convert to the mongocxx::v1 equivalent of v.
Definition bulk_write.hpp:162
v_noabi::bulk_write from_v1(v1::bulk_write v)
Convert to the mongocxx::v_noabi equivalent of v.
Definition bulk_write.hpp:155
The top-level namespace within which all mongocxx library entities are declared.
Declares mongocxx::v1::client.
Declares mongocxx::v1::pool.
Provides std::optional-related polyfills for library API usage.
Declares mongocxx::v_noabi::client.
Declares mongocxx::v_noabi::pool.