MongoDB C++ Driver  mongocxx-3.7.0
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 <bsoncxx/stdx/optional.hpp>
20 #include <bsoncxx/string/view_or_value.hpp>
21 #include <mongocxx/stdx.hpp>
22 
23 #include <mongocxx/config/prelude.hpp>
24 
25 namespace mongocxx {
26 MONGOCXX_INLINE_NAMESPACE_BEGIN
27 namespace options {
28 
32 class MONGOCXX_API tls {
33  public:
45  tls& pem_file(bsoncxx::string::view_or_value pem_file);
46 
52  const stdx::optional<bsoncxx::string::view_or_value>& pem_file() const;
53 
64  tls& pem_password(bsoncxx::string::view_or_value pem_password);
65 
71  const stdx::optional<bsoncxx::string::view_or_value>& pem_password() const;
72 
84  tls& ca_file(bsoncxx::string::view_or_value ca_file);
85 
91  const stdx::optional<bsoncxx::string::view_or_value>& ca_file() const;
92 
103  tls& ca_dir(bsoncxx::string::view_or_value ca_dir);
104 
110  const stdx::optional<bsoncxx::string::view_or_value>& ca_dir() const;
111 
122  tls& crl_file(bsoncxx::string::view_or_value crl_file);
123 
129  const stdx::optional<bsoncxx::string::view_or_value>& crl_file() const;
130 
141  tls& allow_invalid_certificates(bool allow_invalid_certificates);
142 
148  const stdx::optional<bool>& allow_invalid_certificates() const;
149 
150  private:
151  stdx::optional<bsoncxx::string::view_or_value> _pem_file;
152  stdx::optional<bsoncxx::string::view_or_value> _pem_password;
153  stdx::optional<bsoncxx::string::view_or_value> _ca_file;
154  stdx::optional<bsoncxx::string::view_or_value> _ca_dir;
155  stdx::optional<bsoncxx::string::view_or_value> _crl_file;
156  stdx::optional<bool> _allow_invalid_certificates;
157 };
158 
159 } // namespace options
160 MONGOCXX_INLINE_NAMESPACE_END
161 } // namespace mongocxx
162 
163 #include <mongocxx/config/postlude.hpp>
mongocxx
Top level namespace for the MongoDB C++ driver.
Definition: bulk_write.hpp:24
bsoncxx::string::view_or_value
Class representing a view-or-value variant type for strings.
Definition: view_or_value.hpp:36
mongocxx::options::tls
Class representing the optional arguments to a MongoDB driver client (TLS)
Definition: tls.hpp:32