You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Manually refresh the IAM authentication token.
746
+
///
747
+
/// This function triggers an immediate refresh of the IAM token and updates the connection.
748
+
/// It is only available if the client was created with IAM authentication.
749
+
///
750
+
/// # Arguments
751
+
///
752
+
/// * `client_ptr` - A pointer to a valid client returned from [`create_client`].
753
+
/// * `callback_index` - A unique identifier for the callback to be called when the command completes.
754
+
///
755
+
/// # Safety
756
+
///
757
+
/// * `client_ptr` must not be `null`.
758
+
/// * `client_ptr` must be able to be safely casted to a valid [`Arc<Client>`] via [`Arc::from_raw`]. See the safety documentation of [`Arc::from_raw`].
759
+
/// * This function should only be called with a `client_ptr` created by [`create_client`], before [`close_client`] was called with the pointer.
760
+
#[unsafe(no_mangle)]
761
+
pubunsafeextern"C-unwind"fnrefresh_iam_token(
762
+
client_ptr:*constc_void,
763
+
callback_index:usize,
764
+
){
765
+
let client = unsafe{
766
+
Arc::increment_strong_count(client_ptr);
767
+
Arc::from_raw(client_ptr as*mutClient)
768
+
};
769
+
let core = client.core.clone();
770
+
771
+
letmut panic_guard = PanicGuard{
772
+
panicked:true,
773
+
failure_callback: core.failure_callback,
774
+
callback_index,
775
+
};
776
+
777
+
client.runtime.spawn(asyncmove{
778
+
letmut async_panic_guard = PanicGuard{
779
+
panicked:true,
780
+
failure_callback: core.failure_callback,
781
+
callback_index,
782
+
};
783
+
784
+
let result = core.client.clone().refresh_iam_token().await;
785
+
match result {
786
+
Ok(()) => {
787
+
let response = ResponseValue::from_value(redis::Value::Okay);
0 commit comments