client.hpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. // Copyright 2014 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. #pragma once
  15. #include <string>
  16. #include <bsoncxx/stdx/optional.hpp>
  17. #include <mongocxx/options/apm.hpp>
  18. #include <mongocxx/options/auto_encryption.hpp>
  19. #include <mongocxx/options/tls.hpp>
  20. #include <mongocxx/config/prelude.hpp>
  21. namespace mongocxx {
  22. MONGOCXX_INLINE_NAMESPACE_BEGIN
  23. namespace options {
  24. // NOTE: client options interface still evolving
  25. ///
  26. /// Class representing the optional arguments to a MongoDB driver client object.
  27. ///
  28. class MONGOCXX_API client {
  29. public:
  30. ///
  31. /// Sets the SSL-related options.
  32. ///
  33. /// @param ssl_opts
  34. /// The SSL-related options.
  35. ///
  36. /// @return
  37. /// A reference to the object on which this member function is being called. This
  38. /// facilitates method chaining.
  39. ///
  40. /// @deprecated
  41. /// Please use tls_opts instead.
  42. ///
  43. MONGOCXX_DEPRECATED client& ssl_opts(tls ssl_opts);
  44. ///
  45. /// Sets the TLS-related options.
  46. ///
  47. /// @param tls_opts
  48. /// The TLS-related options.
  49. ///
  50. /// @return
  51. /// A reference to the object on which this member function is being called. This facilitates
  52. /// method chaining.
  53. ///
  54. client& tls_opts(tls tls_opts);
  55. ///
  56. /// The current SSL-related options.
  57. ///
  58. /// @return The SSL-related options.
  59. ///
  60. /// @deprecated Please use tls_opts instead.
  61. ///
  62. MONGOCXX_DEPRECATED const stdx::optional<tls>& ssl_opts() const;
  63. ///
  64. /// The current TLS-related options.
  65. ///
  66. /// @return The TLS-related options.
  67. ///
  68. const stdx::optional<tls>& tls_opts() const;
  69. ///
  70. /// Sets the automatic encryption options.
  71. ///
  72. /// @param auto_encryption_opts
  73. /// The options for automatic encryption.
  74. ///
  75. /// @return
  76. /// A reference to the object on which this member function is being called. This facilitates
  77. /// method chaining.
  78. ///
  79. client& auto_encryption_opts(auto_encryption auto_encryption_opts);
  80. ///
  81. /// Gets the current automatic encryption options.
  82. ///
  83. /// @return
  84. /// The automatic encryption opts.
  85. ///
  86. const stdx::optional<auto_encryption>& auto_encryption_opts() const;
  87. ///
  88. /// Sets the APM-related options.
  89. ///
  90. /// @param apm_opts
  91. /// The APM-related options.
  92. ///
  93. /// @return
  94. /// A reference to the object on which this member function is being called. This facilitates
  95. /// method chaining.
  96. ///
  97. client& apm_opts(apm apm_opts);
  98. ///
  99. /// The current APM-related options.
  100. ///
  101. /// @return The APM-related options.
  102. ///
  103. const stdx::optional<apm>& apm_opts() const;
  104. private:
  105. stdx::optional<tls> _tls_opts;
  106. stdx::optional<apm> _apm_opts;
  107. stdx::optional<auto_encryption> _auto_encrypt_opts;
  108. };
  109. } // namespace options
  110. MONGOCXX_INLINE_NAMESPACE_END
  111. } // namespace mongocxx
  112. #include <mongocxx/config/postlude.hpp>