Loading...
Searching...
No Matches
client_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/client_encryption-fwd.hpp> // IWYU pragma: export
//
#include <mongocxx/v1/client_encryption.hpp> // IWYU pragma: export
#include <string>
#include <utility>
#include <mongocxx/client-fwd.hpp>
#include <mongocxx/client_encryption-fwd.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
#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 client_encryption {
public:
client_encryption() = default;
client_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;
}
using ns_pair = std::pair<std::string, std::string>;
client_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;
}
client_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;
}
client_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;
}
class internal;
private:
bsoncxx::v_noabi::stdx::optional<v_noabi::client*> _key_vault_client;
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;
/* explicit(false) */ MONGOCXX_ABI_NO_EXPORT client_encryption(v1::client_encryption::options opts);
explicit MONGOCXX_ABI_NO_EXPORT operator v1::client_encryption::options() const;
};
} // namespace options
} // namespace v_noabi
} // namespace mongocxx
namespace mongocxx {
namespace v_noabi {
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(v_noabi::options::client_encryption) from_v1(v1::client_encryption::options v);
inline v_noabi::options::client_encryption from_v1(v1::client_encryption::options v, v_noabi::client* client) {
auto ret = from_v1(std::move(v));
ret.key_vault_client(client);
return ret;
}
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(v1::client_encryption::options) to_v1(v_noabi::options::client_encryption const& v);
inline v1::client_encryption::options to_v1(v_noabi::options::client_encryption const& v, v1::client* client) {
auto ret = to_v1(v);
ret.key_vault_client(client);
return ret;
}
} // namespace v_noabi
} // namespace mongocxx
#include <mongocxx/config/postlude.hpp>
bsoncxx::v1::stdx::optional
A polyfill for std::optional<T>.
Definition optional.hpp:799
mongocxx::options::client_encryption::client_encryption
client_encryption()=default
Default initialization.
mongocxx::v1::client_encryption::options
Options for mongocxx::v1::client_encryption.
Definition client_encryption.hpp:288
mongocxx::v1::client
A connection to a MongoDB deployment.
Definition client.hpp:60
mongocxx::v_noabi::client
A client connection to a MongoDB server.
Definition client.hpp:77
mongocxx::v_noabi::options::client_encryption
Used by mongocxx::v_noabi::client_encryption.
Definition client_encryption.hpp:41
mongocxx::v_noabi::options::client_encryption::client_encryption
client_encryption()=default
Default initialization.
mongocxx::v_noabi::options::client_encryption::key_vault_namespace
bsoncxx::v_noabi::stdx::optional< ns_pair > const & key_vault_namespace() const
Gets the key vault namespace.
Definition client_encryption.hpp:111
mongocxx::v_noabi::options::client_encryption::key_vault_namespace
client_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 client_encryption.hpp:99
mongocxx::v_noabi::options::client_encryption::tls_opts
client_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 client_encryption.hpp:197
mongocxx::v_noabi::options::client_encryption::kms_providers
client_encryption & kms_providers(bsoncxx::v_noabi::document::view_or_value kms_providers)
Sets the KMS providers to use for client side encryption.
Definition client_encryption.hpp:159
mongocxx::v_noabi::options::client_encryption::kms_providers
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > const & kms_providers() const
Gets the KMS providers.
Definition client_encryption.hpp:170
mongocxx::v_noabi::options::client_encryption::key_vault_client
bsoncxx::v_noabi::stdx::optional< v_noabi::client * > const & key_vault_client() const
Gets the key vault client.
Definition client_encryption.hpp:73
mongocxx::v_noabi::options::client_encryption::tls_opts
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > const & tls_opts() const
Gets the TLS options.
Definition client_encryption.hpp:208
mongocxx::v_noabi::options::client_encryption::ns_pair
std::pair< std::string, std::string > ns_pair
Represents the name of a database and a collection.
Definition client_encryption.hpp:80
mongocxx::v_noabi::options::client_encryption::key_vault_client
client_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 client_encryption.hpp:62
mongocxx::v_noabi::options::client
Used by clients.
Definition client.hpp:43
view_or_value.hpp
Provides bsoncxx::v_noabi::document::view_or_value.
MONGOCXX_ABI_NO_EXPORT
#define MONGOCXX_ABI_NO_EXPORT
Excludes the associated entity from being part of the ABI.
Definition export.hpp:20
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_encryption.hpp
Provides mongocxx::v1::client_encryption.
optional.hpp
Provides std::optional-related polyfills for library API usage.
client-fwd.hpp
Declares mongocxx::v_noabi::client.
client_encryption-fwd.hpp
Declares mongocxx::v_noabi::client_encryption.
client_encryption-fwd.hpp
Declares mongocxx::v_noabi::options::client_encryption.