#[non_exhaustive]pub struct PushEvent {
pub kind: PushKind,
pub id: String,
pub scope: String,
pub event_type: Option<String>,
pub subject: Option<String>,
pub time: Option<String>,
pub attributes: BTreeMap<String, String>,
pub data: Value,
pub sender: Option<VerifiedSender>,
}Expand description
One verified delivery, decoded.
§Example
use adk_server::google_triggers::{PushEvent, PushKind};
let event = PushEvent::new(PushKind::PubSub, "136969346945", "projects/p/subscriptions/orders", serde_json::json!({"order": 7}));
assert_eq!(event.idempotency_key("orders"), "pubsub:orders:projects/p/subscriptions/orders:136969346945");Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.kind: PushKindWhere it came from.
id: StringThe Pub/Sub messageId, or the CloudEvent id.
scope: StringWhat the id is unique within: the Pub/Sub subscription, or the CloudEvent source.
event_type: Option<String>The CloudEvent type; None for Pub/Sub.
subject: Option<String>The CloudEvent subject, when it has one.
time: Option<String>The Pub/Sub publishTime, or the CloudEvent time.
attributes: BTreeMap<String, String>The Pub/Sub message’s attributes.
data: ValueThe data: JSON when it parses as JSON, else UTF-8 text, else {"base64": ...}.
sender: Option<VerifiedSender>The service account that delivered it.
Implementations§
Source§impl PushEvent
impl PushEvent
Sourcepub fn new(
kind: PushKind,
id: impl Into<String>,
scope: impl Into<String>,
data: Value,
) -> Self
pub fn new( kind: PushKind, id: impl Into<String>, scope: impl Into<String>, data: Value, ) -> Self
An event of kind with id unique within scope, carrying data.
Sourcepub fn idempotency_key(&self, trigger: &str) -> String
pub fn idempotency_key(&self, trigger: &str) -> String
The idempotency key of the run trigger trigger enqueues for the event:
pubsub:{trigger}:{subscription}:{messageId} or eventarc:{trigger}:{source}:{id}.
Trait Implementations§
impl StructuralPartialEq for PushEvent
Auto Trait Implementations§
impl Forget for PushEvent
impl Freeze for PushEventwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const LeafNode<String, String> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, String)>>: Freeze,
PhantomData<Value>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
impl Move for PushEvent
impl RefUnwindSafe for PushEvent
impl Send for PushEvent
impl Sync for PushEvent
impl Unpin for PushEvent
impl UnsafeUnpin for PushEventwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, String)>>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
impl UnwindSafe for PushEventwhere
RawVecInner: UnwindSafe,
BTreeMap<String, String>: UnwindSafe,
BTreeMap<String, Value>: UnwindSafe,
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