pub struct PushTrigger { /* private fields */ }Expand description
A named push endpoint and the runs it starts.
§Example
use adk_server::google_triggers::{GoogleOidcVerifier, PushKind, PushTrigger};
let verifier = GoogleOidcVerifier::new("https://agents.example.com/triggers/eventarc/uploads", ["eventarc@p.iam.gserviceaccount.com"])?;
let trigger = PushTrigger::eventarc("uploads", verifier, "media", "upload_agent").with_queue("background");
assert_eq!((trigger.name(), trigger.kind()), ("uploads", PushKind::Eventarc));Implementations§
Source§impl PushTrigger
impl PushTrigger
Sourcepub fn pubsub(
name: impl Into<String>,
verifier: GoogleOidcVerifier,
app_name: impl Into<String>,
target: impl Into<String>,
) -> Self
pub fn pubsub( name: impl Into<String>, verifier: GoogleOidcVerifier, app_name: impl Into<String>, target: impl Into<String>, ) -> Self
A Pub/Sub push trigger served at POST /triggers/pubsub/{name}, whose runs execute
target of app_name.
Sourcepub fn eventarc(
name: impl Into<String>,
verifier: GoogleOidcVerifier,
app_name: impl Into<String>,
target: impl Into<String>,
) -> Self
pub fn eventarc( name: impl Into<String>, verifier: GoogleOidcVerifier, app_name: impl Into<String>, target: impl Into<String>, ) -> Self
An Eventarc trigger served at POST /triggers/eventarc/{name}, whose runs execute
target of app_name.
Sourcepub fn with_queue(self, queue: impl Into<String>) -> Self
pub fn with_queue(self, queue: impl Into<String>) -> Self
Enqueues on queue instead of default: the queue of the worker that runs target.
Sourcepub fn with_user_id(self, user_id: impl Into<String>) -> Self
pub fn with_user_id(self, user_id: impl Into<String>) -> Self
Runs act for user_id instead of pubsub:{name} or eventarc:{name}.
Sourcepub fn with_max_attempts(self, max_attempts: u32) -> Self
pub fn with_max_attempts(self, max_attempts: u32) -> Self
Sets the attempts each run may take.
Sourcepub fn with_mapper(
self,
mapper: impl Fn(&PushDelivery<'_>) -> Result<NewRun> + Send + Sync + 'static,
) -> Self
pub fn with_mapper( self, mapper: impl Fn(&PushDelivery<'_>) -> Result<NewRun> + Send + Sync + 'static, ) -> Self
Builds each delivery’s run with mapper; the ingress still sets its idempotency key
and service subject.
Trait Implementations§
Source§impl Clone for PushTrigger
impl Clone for PushTrigger
Auto Trait Implementations§
impl !RefUnwindSafe for PushTrigger
impl !UnwindSafe for PushTrigger
impl Forget for PushTrigger
impl Freeze for PushTriggerwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<GoogleOidcVerifier> is !null: Freeze,
PhantomData<ArcInner<GoogleOidcVerifier>>: Freeze,
*const ArcInner<dyn Fn(&PushDelivery<'_>) -> Result<NewRun, AdkError> + Sync + Send> is !null: Freeze,
PhantomData<ArcInner<dyn Fn(&PushDelivery<'_>) -> Result<NewRun, AdkError> + Sync + Send>>: Freeze,
impl Move for PushTrigger
impl Send for PushTrigger
impl Sync for PushTrigger
impl Unpin for PushTrigger
impl UnsafeUnpin for PushTriggerwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<GoogleOidcVerifier> is !null: UnsafeUnpin,
PhantomData<ArcInner<GoogleOidcVerifier>>: UnsafeUnpin,
*const ArcInner<dyn Fn(&PushDelivery<'_>) -> Result<NewRun, AdkError> + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(&PushDelivery<'_>) -> Result<NewRun, AdkError> + Sync + Send>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more