MongoDB C++ Driver  mongocxx-3.10.2
tls.hpp
1 // Copyright 2019 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/options/tls-fwd.hpp>
20 
21 #include <bsoncxx/stdx/optional.hpp>
22 #include <bsoncxx/string/view_or_value.hpp>
23 #include <mongocxx/stdx.hpp>
24 
25 #include <mongocxx/config/prelude.hpp>
26 
27 namespace mongocxx {
28 namespace v_noabi {
29 namespace options {
30 
34 class tls {
35  public:
48 
54  const stdx::optional<bsoncxx::v_noabi::string::view_or_value>& pem_file() const;
55 
67 
73  const stdx::optional<bsoncxx::v_noabi::string::view_or_value>& pem_password() const;
74 
87 
93  const stdx::optional<bsoncxx::v_noabi::string::view_or_value>& ca_file() const;
94 
106 
112  const stdx::optional<bsoncxx::v_noabi::string::view_or_value>& ca_dir() const;
113 
125 
131  const stdx::optional<bsoncxx::v_noabi::string::view_or_value>& crl_file() const;
132 
144 
150  const stdx::optional<bool>& allow_invalid_certificates() const;
151 
152  private:
153  stdx::optional<bsoncxx::v_noabi::string::view_or_value> _pem_file;
154  stdx::optional<bsoncxx::v_noabi::string::view_or_value> _pem_password;
155  stdx::optional<bsoncxx::v_noabi::string::view_or_value> _ca_file;
156  stdx::optional<bsoncxx::v_noabi::string::view_or_value> _ca_dir;
157  stdx::optional<bsoncxx::v_noabi::string::view_or_value> _crl_file;
158  stdx::optional<bool> _allow_invalid_certificates;
159 };
160 
161 } // namespace options
162 } // namespace v_noabi
163 } // namespace mongocxx
164 
165 #include <mongocxx/config/postlude.hpp>
Class representing a view-or-value variant type for strings.
Definition: view_or_value.hpp:38
Class representing the optional arguments to a MongoDB driver client (TLS)
Definition: tls.hpp:34
tls & ca_file(bsoncxx::v_noabi::string::view_or_value ca_file)
The path to the .pem file that contains the root certificate chain from the Certificate Authority.
tls & pem_file(bsoncxx::v_noabi::string::view_or_value pem_file)
The path to the .pem file containing a public key certificate and its associated private key.
tls & pem_password(bsoncxx::v_noabi::string::view_or_value pem_password)
The pass phrase used to decrypt an encrypted PEM file.
tls & allow_invalid_certificates(bool allow_invalid_certificates)
If true, the driver will not verify the server's CA file.
const stdx::optional< bsoncxx::v_noabi::string::view_or_value > & ca_dir() const
Retrieves the current path to the CA directory.
tls & ca_dir(bsoncxx::v_noabi::string::view_or_value ca_dir)
The path to the Certificate Authority directory.
tls & crl_file(bsoncxx::v_noabi::string::view_or_value crl_file)
The path to the .pem file that contains revoked certificates.
const stdx::optional< bsoncxx::v_noabi::string::view_or_value > & crl_file() const
Retrieves the current path to the .pem file that contains revoked certificates.
const stdx::optional< bool > & allow_invalid_certificates() const
Retrieves whether or not the driver will check the server's CA file.
const stdx::optional< bsoncxx::v_noabi::string::view_or_value > & pem_password() const
Retrieves the current decryption pass phrase.
const stdx::optional< bsoncxx::v_noabi::string::view_or_value > & pem_file() const
Retrieves the current path to the .pem file.
const stdx::optional< bsoncxx::v_noabi::string::view_or_value > & ca_file() const
Retrieves the current path to the CA file.
The top-level namespace for mongocxx library entities.
Definition: bulk_write-fwd.hpp:19