Loading...
Searching...
No Matches
auto_encryption.hpp
Go to the documentation of this file.
// Copyright 2009-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.
#pragma once
#include <mongocxx/options/auto_encryption-fwd.hpp> // IWYU pragma: export
//
#include <mongocxx/v1/client-fwd.hpp>
#include <mongocxx/v1/pool-fwd.hpp>
#include <mongocxx/v1/auto_encryption_options.hpp> // IWYU pragma: export
#include <string> // IWYU pragma: keep: backward compatibility, to be removed.
#include <utility>
#include <mongocxx/client-fwd.hpp>
#include <mongocxx/pool-fwd.hpp>
#include <bsoncxx/document/view_or_value.hpp>
#include <bsoncxx/stdx/optional.hpp>
#include <mongocxx/config/prelude.hpp>
namespace mongocxx {
namespace v_noabi {
namespace options {
class auto_encryption {
public:
auto_encryption() noexcept {}
auto_encryption& key_vault_client(v_noabi::client* client) {
_key_vault_client = client;
return *this;
}
bsoncxx::v_noabi::stdx::optional<v_noabi::client*> const& key_vault_client() const {
return _key_vault_client;
}
auto_encryption& key_vault_pool(v_noabi::pool* pool) {
_key_vault_pool = pool;
return *this;
}
bsoncxx::v_noabi::stdx::optional<v_noabi::pool*> const& key_vault_pool() const {
return _key_vault_pool;
}
using ns_pair = v1::auto_encryption_options::ns_pair;
auto_encryption& key_vault_namespace(ns_pair ns) {
_key_vault_namespace = std::move(ns);
return *this;
}
bsoncxx::v_noabi::stdx::optional<ns_pair> const& key_vault_namespace() const {
return _key_vault_namespace;
}
auto_encryption& kms_providers(bsoncxx::v_noabi::document::view_or_value kms_providers) {
_kms_providers = std::move(kms_providers);
return *this;
}
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> const& kms_providers() const {
return _kms_providers;
}
auto_encryption& tls_opts(bsoncxx::v_noabi::document::view_or_value tls_opts) {
_tls_opts = std::move(tls_opts);
return *this;
}
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> const& tls_opts() const {
return _tls_opts;
}
auto_encryption& schema_map(bsoncxx::v_noabi::document::view_or_value schema_map) {
_schema_map = std::move(schema_map);
return *this;
}
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> const& schema_map() const {
return _schema_map;
}
auto_encryption& encrypted_fields_map(bsoncxx::v_noabi::document::view_or_value encrypted_fields_map) {
_encrypted_fields_map = std::move(encrypted_fields_map);
return *this;
}
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> const& encrypted_fields_map() const {
return _encrypted_fields_map;
}
auto_encryption& bypass_auto_encryption(bool should_bypass) {
_bypass = should_bypass;
return *this;
}
bool bypass_auto_encryption() const {
return _bypass;
}
auto_encryption& bypass_query_analysis(bool should_bypass) {
_bypass_query_analysis = should_bypass;
return *this;
}
bool bypass_query_analysis() const {
return _bypass_query_analysis;
}
auto_encryption& extra_options(bsoncxx::v_noabi::document::view_or_value extra) {
_extra_options = std::move(extra);
return *this;
}
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> const& extra_options() const {
return _extra_options;
}
class internal;
private:
bool _bypass = false;
bool _bypass_query_analysis = false;
bsoncxx::v_noabi::stdx::optional<v_noabi::client*> _key_vault_client;
bsoncxx::v_noabi::stdx::optional<v_noabi::pool*> _key_vault_pool;
bsoncxx::v_noabi::stdx::optional<ns_pair> _key_vault_namespace;
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _kms_providers;
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _tls_opts;
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _schema_map;
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _encrypted_fields_map;
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _extra_options;
/* explicit(false) */ auto_encryption(v1::auto_encryption_options opts);
explicit operator v1::auto_encryption_options() const;
};
} // namespace options
} // namespace v_noabi
} // namespace mongocxx
namespace mongocxx {
namespace v_noabi {
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(v_noabi::options::auto_encryption) from_v1(v1::auto_encryption_options v);
inline v_noabi::options::auto_encryption from_v1(v1::auto_encryption_options v, v_noabi::client* client) {
auto ret = from_v1(std::move(v));
ret.key_vault_client(client);
return ret;
}
inline v_noabi::options::auto_encryption from_v1(v1::auto_encryption_options v, v_noabi::pool* pool) {
auto ret = from_v1(std::move(v));
ret.key_vault_pool(pool);
return ret;
}
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(v1::auto_encryption_options) to_v1(v_noabi::options::auto_encryption const& v);
inline v1::auto_encryption_options to_v1(v_noabi::options::auto_encryption const& v, v1::client* client) {
auto ret = to_v1(v);
ret.key_vault_client(client);
return ret;
}
inline v1::auto_encryption_options to_v1(v_noabi::options::auto_encryption const& v, v1::pool* pool) {
auto ret = to_v1(v);
ret.key_vault_pool(pool);
return ret;
}
} // namespace v_noabi
} // namespace mongocxx
#include <mongocxx/config/postlude.hpp>
auto_encryption-fwd.hpp
Declares mongocxx::v_noabi::options::auto_encryption.
auto_encryption_options.hpp
Provides mongocxx::v1::auto_encryption_options.
bsoncxx::v1::stdx::optional
A polyfill for std::optional<T>.
Definition optional.hpp:799
mongocxx::options::auto_encryption::auto_encryption
auto_encryption() noexcept
Default constructs a new auto_encryption object.
Definition auto_encryption.hpp:49
mongocxx::v1::auto_encryption_options
Options related In-Use Encryption configuration.
Definition auto_encryption_options.hpp:58
mongocxx::v1::auto_encryption_options::ns_pair
std::pair< std::string, std::string > ns_pair
The name of a database and a collection.
Definition auto_encryption_options.hpp:146
mongocxx::v1::client
A connection to a MongoDB deployment.
Definition client.hpp:60
mongocxx::v1::pool
A thread-safe pool of client objects.
Definition pool.hpp:49
mongocxx::v_noabi::client
A client connection to a MongoDB server.
Definition client.hpp:77
mongocxx::v_noabi::options::auto_encryption
Used by mongocxx::v_noabi::options::client::auto_encryption_opts.
Definition auto_encryption.hpp:44
mongocxx::v_noabi::options::auto_encryption::encrypted_fields_map
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
mongocxx::v_noabi::options::auto_encryption::schema_map
auto_encryption & schema_map(bsoncxx::v_noabi::document::view_or_value schema_map)
Sets a local JSON schema.
Definition auto_encryption.hpp:277
mongocxx::v_noabi::options::auto_encryption::key_vault_namespace
bsoncxx::v_noabi::stdx::optional< ns_pair > const & key_vault_namespace() const
Gets the key vault namespace.
Definition auto_encryption.hpp:153
mongocxx::v_noabi::options::auto_encryption::schema_map
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
mongocxx::v_noabi::options::auto_encryption::ns_pair
v1::auto_encryption_options::ns_pair ns_pair
Represents the name of a database and a collection.
Definition auto_encryption.hpp:122
mongocxx::v_noabi::options::auto_encryption::kms_providers
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
mongocxx::v_noabi::options::auto_encryption::bypass_query_analysis
bool bypass_query_analysis() const
Gets a boolean specifying whether or not query analysis is bypassed.
Definition auto_encryption.hpp:378
mongocxx::v_noabi::options::auto_encryption::auto_encryption
auto_encryption() noexcept
Default constructs a new auto_encryption object.
Definition auto_encryption.hpp:49
mongocxx::v_noabi::options::auto_encryption::key_vault_client
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
mongocxx::v_noabi::options::auto_encryption::bypass_auto_encryption
bool bypass_auto_encryption() const
Gets a boolean specifying whether or not auto encryption is bypassed.
Definition auto_encryption.hpp:350
mongocxx::v_noabi::options::auto_encryption::key_vault_pool
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
mongocxx::v_noabi::options::auto_encryption::kms_providers
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
mongocxx::v_noabi::options::auto_encryption::bypass_query_analysis
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
mongocxx::v_noabi::options::auto_encryption::bypass_auto_encryption
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
mongocxx::v_noabi::options::auto_encryption::key_vault_namespace
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
mongocxx::v_noabi::options::auto_encryption::tls_opts
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
mongocxx::v_noabi::options::auto_encryption::key_vault_client
bsoncxx::v_noabi::stdx::optional< v_noabi::client * > const & key_vault_client() const
Gets the key vault client.
Definition auto_encryption.hpp:79
mongocxx::v_noabi::options::auto_encryption::tls_opts
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
mongocxx::v_noabi::options::auto_encryption::key_vault_pool
bsoncxx::v_noabi::stdx::optional< v_noabi::pool * > const & key_vault_pool() const
Gets the key vault pool.
Definition auto_encryption.hpp:115
mongocxx::v_noabi::options::auto_encryption::encrypted_fields_map
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
mongocxx::v_noabi::options::auto_encryption::extra_options
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
mongocxx::v_noabi::options::auto_encryption::extra_options
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
mongocxx::v_noabi::options::client
Used by clients.
Definition client.hpp:43
mongocxx::v_noabi::options::pool
Used by mongocxx::v_noabi::pool.
Definition pool.hpp:36
mongocxx::v_noabi::pool
A pool of reusable client objects connected to the same MongoDB topology.
Definition pool.hpp:62
view_or_value.hpp
Provides bsoncxx::v_noabi::document::view_or_value.
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE
#define MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(...)
Equivalent to MONGOCXX_ABI_EXPORT_UNSTABLE with MONGOCXX_ABI_CDECL.
Definition config.hpp:28
postlude.hpp
The mongocxx v_noabi macro guard postlude header.
prelude.hpp
The mongocxx v_noabi macro guard prelude header.
bsoncxx::v_noabi::document::view_or_value
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
mongocxx::v_noabi::options
Declares entities representing options to use with various commands.
mongocxx::v_noabi
Declares entities whose ABI stability is NOT guaranteed.
mongocxx::v_noabi::to_v1
v1::bulk_write to_v1(v_noabi::bulk_write v)
Convert to the mongocxx::v1 equivalent of v.
Definition bulk_write.hpp:162
mongocxx::v_noabi::from_v1
v_noabi::bulk_write from_v1(v1::bulk_write v)
Convert to the mongocxx::v_noabi equivalent of v.
Definition bulk_write.hpp:155
mongocxx
The top-level namespace within which all mongocxx library entities are declared.
client-fwd.hpp
Declares mongocxx::v1::client.
pool-fwd.hpp
Declares mongocxx::v1::pool.
optional.hpp
Provides std::optional-related polyfills for library API usage.
client-fwd.hpp
Declares mongocxx::v_noabi::client.
pool-fwd.hpp
Declares mongocxx::v_noabi::pool.