Skip to main content

DeliveryBus

Struct DeliveryBus 

Source
pub struct DeliveryBus { /* private fields */ }
Expand description

Cross-service message delivery.

Services use this to deliver messages to other services without direct dependencies between service crates. The server wires up the delivery functions at startup.

Implementations§

Source§

impl DeliveryBus

Source

pub fn new() -> Self

Source

pub fn with_cognito_jwt_verifier( self, verifier: Arc<dyn CognitoJwtVerifier>, ) -> Self

Source

pub fn with_kms_hook(self, hook: Arc<dyn KmsHook>) -> Self

Source

pub fn kms_encrypt( &self, account_id: &str, region: &str, key_id: &str, plaintext: &[u8], service_principal: &str, encryption_context: HashMap<String, String>, ) -> Result<String, String>

Encrypt plaintext with the supplied KMS key. Returns Err when no KMS hook is wired or the encryption fails.

Source

pub fn kms_decrypt( &self, account_id: &str, ciphertext_b64: &str, service_principal: &str, encryption_context: HashMap<String, String>, ) -> Result<Vec<u8>, String>

Decrypt a KMS ciphertext blob. Returns Err when no KMS hook is wired or the decryption fails.

Source

pub fn verify_cognito_jwt( &self, account_id: &str, user_pool_arn: &str, token: &str, ) -> Result<Value, String>

Verify a Cognito JWT against a user pool. Returns Err when no verifier is wired or when the token fails validation.

Source

pub fn with_cloudwatch_metrics( self, sender: Arc<dyn CloudwatchDelivery>, ) -> Self

Source

pub fn put_cloudwatch_metric( &self, account_id: &str, region: &str, namespace: &str, metric_name: &str, value: f64, unit: Option<&str>, dimensions: BTreeMap<String, String>, timestamp_ms: i64, )

Publish a CloudWatch metric data point. Silently no-ops when no CloudWatch sender is wired (in-process tests not exercising the metrics path).

Source

pub fn with_cloudwatch_logs( self, sender: Arc<dyn CloudwatchLogsDelivery>, ) -> Self

Source

pub fn put_log_events( &self, account_id: &str, log_group_name: &str, log_stream_name: &str, events: &[(i64, String)], )

Put log events to a CloudWatch Logs log group / stream. Silently no-ops when no CloudWatch Logs sender is wired.

Source

pub fn with_ses_dispatcher( self, dispatcher: Arc<dyn SesSendEmailDispatcher>, ) -> Self

Source

pub fn with_ecs_task_runner(self, runner: Arc<dyn EcsTaskRunner>) -> Self

Source

pub fn with_elbv2_target_registration( self, reg: Arc<dyn Elbv2TargetRegistration>, ) -> Self

Source

pub fn register_elbv2_targets( &self, account_id: &str, target_group_arn: &str, targets: Vec<(String, Option<i64>)>, )

Register targets with an ELBv2 target group. Silently no-ops when no ELBv2 target registration hook is wired.

Source

pub fn deregister_elbv2_targets( &self, account_id: &str, target_group_arn: &str, targets: Vec<(String, Option<i64>)>, )

Deregister targets from an ELBv2 target group. Silently no-ops when no ELBv2 target registration hook is wired.

Source

pub fn send_ses_email( &self, account_id: &str, from: &str, to: Vec<String>, cc: Vec<String>, bcc: Vec<String>, subject: Option<&str>, text_body: Option<&str>, html_body: Option<&str>, ) -> Result<(), String>

Send an email via SES. Returns Err when no SES dispatcher is wired or the underlying impl rejects (bad source/dest).

Source

pub fn run_ecs_task( &self, account_id: &str, cluster: &str, task_definition: &str, launch_type: Option<&str>, count: usize, ) -> Result<(), String>

Run an ECS task. Returns Err when no ECS runner is wired or the impl rejects (unknown cluster / task definition).

Source

pub fn with_s3(self, sender: Arc<dyn S3Delivery>) -> Self

Source

pub fn with_firehose(self, sender: Arc<dyn FirehoseDelivery>) -> Self

Source

pub fn put_record_to_firehose(&self, delivery_stream_arn: &str, data: &[u8])

Send a single record to a Firehose delivery stream by ARN. Silently no-ops when no Firehose sender is wired (in-process tests). Production wiring goes through fakecloud_firehose.

Source

pub fn put_object_to_s3( &self, account_id: &str, bucket: &str, key: &str, body: Vec<u8>, content_type: Option<&str>, ) -> Result<(), String>

Write content to S3. Returns Err when no S3 writer is wired or when the underlying impl rejects the bucket / payload.

Source

pub fn get_object_from_s3( &self, account_id: &str, bucket: &str, key: &str, ) -> Result<Vec<u8>, String>

Read content from S3. Returns Err when no S3 client is wired or when the underlying impl cannot resolve the object.

Source

pub fn with_sqs(self, sender: Arc<dyn SqsDelivery>) -> Self

Source

pub fn with_sns(self, sender: Arc<dyn SnsDelivery>) -> Self

Source

pub fn with_eventbridge(self, sender: Arc<dyn EventBridgeDelivery>) -> Self

Source

pub fn with_lambda(self, invoker: Arc<dyn LambdaDelivery>) -> Self

Source

pub fn with_kinesis(self, sender: Arc<dyn KinesisDelivery>) -> Self

Source

pub fn put_record_to_kinesis( &self, stream_arn: &str, data: &str, partition_key: &str, )

Put a record to a Kinesis Data Stream identified by ARN. Silently no-ops when no Kinesis sender is wired.

Source

pub fn with_stepfunctions(self, starter: Arc<dyn StepFunctionsDelivery>) -> Self

Source

pub fn send_to_sqs( &self, queue_arn: &str, message_body: &str, attributes: &HashMap<String, String>, )

Send a message to an SQS queue identified by ARN.

Source

pub fn send_to_sqs_with_attrs( &self, queue_arn: &str, message_body: &str, message_attributes: &HashMap<String, SqsMessageAttribute>, message_group_id: Option<&str>, message_dedup_id: Option<&str>, )

Send a message to an SQS queue with message attributes and FIFO fields.

Source

pub fn try_send_to_sqs_with_attrs( &self, queue_arn: &str, message_body: &str, message_attributes: &HashMap<String, SqsMessageAttribute>, message_group_id: Option<&str>, message_dedup_id: Option<&str>, ) -> Result<(), SqsDeliveryError>

Fallible SQS send — returns Err when the target queue does not exist, so callers (Scheduler) can route to a DLQ. Returns Err(QueueNotFound) when no SQS sender is wired up at all, matching the “target unreachable” semantics Scheduler relies on.

Source

pub fn publish_to_sns( &self, topic_arn: &str, message: &str, subject: Option<&str>, )

Publish a message to an SNS topic identified by ARN.

Source

pub fn put_event_to_eventbridge( &self, source: &str, detail_type: &str, detail: &str, event_bus_name: &str, )

Put an event onto an EventBridge bus in the default account.

Source

pub fn put_event_to_eventbridge_for_account( &self, source: &str, detail_type: &str, detail: &str, event_bus_name: &str, target_account_id: &str, )

Put an event onto an EventBridge bus in a specific account. Used by Scheduler to deliver to cross-account event buses.

Source

pub async fn invoke_lambda( &self, function_arn: &str, payload: &str, ) -> Option<Result<Vec<u8>, String>>

Invoke a Lambda function identified by ARN.

Source

pub fn send_to_kinesis(&self, stream_arn: &str, data: &str, partition_key: &str)

Put a record to a Kinesis stream identified by ARN.

Source

pub fn start_stepfunctions_execution( &self, state_machine_arn: &str, input: &str, )

Start a Step Functions execution identified by state machine ARN.

Trait Implementations§

Source§

impl Default for DeliveryBus

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more