|
24 | 24 | #include "core/app_telemetry_meter.hxx" |
25 | 25 | #include "core/app_telemetry_reporter.hxx" |
26 | 26 | #include "core/diagnostics.hxx" |
| 27 | +#include "core/error.hxx" |
27 | 28 | #include "core/impl/get_replica.hxx" |
28 | 29 | #include "core/impl/lookup_in_replica.hxx" |
29 | 30 | #include "core/impl/observe_seqno.hxx" |
@@ -521,6 +522,21 @@ class cluster_impl : public std::enable_shared_from_this<cluster_impl> |
521 | 522 | return handler({}); |
522 | 523 | } |
523 | 524 |
|
| 525 | + auto update_credentials(cluster_credentials auth) -> core::error |
| 526 | + { |
| 527 | + if (stopped_) { |
| 528 | + return { errc::network::cluster_closed, {} }; |
| 529 | + } |
| 530 | + |
| 531 | + if (auth.requires_tls() && !origin_.options().enable_tls) { |
| 532 | + return { errc::common::invalid_argument, |
| 533 | + "TLS not enabled but the provided authenticator requires TLS" }; |
| 534 | + } |
| 535 | + |
| 536 | + origin_.update_credentials(std::move(auth)); |
| 537 | + return {}; |
| 538 | + } |
| 539 | + |
524 | 540 | auto origin() const -> std::pair<std::error_code, couchbase::core::origin> |
525 | 541 | { |
526 | 542 | if (stopped_) { |
@@ -1437,6 +1453,15 @@ cluster::origin() const -> std::pair<std::error_code, couchbase::core::origin> |
1437 | 1453 | return { errc::network::cluster_closed, {} }; |
1438 | 1454 | } |
1439 | 1455 |
|
| 1456 | +auto |
| 1457 | +cluster::update_credentials(core::cluster_credentials auth) -> core::error |
| 1458 | +{ |
| 1459 | + if (impl_) { |
| 1460 | + return impl_->update_credentials(std::move(auth)); |
| 1461 | + } |
| 1462 | + return { errc::network::cluster_closed, {} }; |
| 1463 | +} |
| 1464 | + |
1440 | 1465 | auto |
1441 | 1466 | cluster::io_context() const -> asio::io_context& |
1442 | 1467 | { |
|
0 commit comments