I am very new to Rust and trying to get a bit of code working that can push a record to a kinesis firehose stream.
struct AuditRecord{
user_id : String,
request : Value,
request_id : String,
timestamp_raw : i64,
}
...
let client = KinesisClient::new(Region::UsEast1);
let record = PutRecordInput{
partition_key : requestId.to_string(),
stream_name : streamName,
data : auditRecord
};
When I tried this it wants the data in bytes::bytes::Bytes
but I am unclear as to how to convert my struct to a bytes::bytes::Bytes
representation. Any examples of how to go about this would be appreciated.
For clarification I am using
rusoto = "0.24.2"
rusoto_kinesis = "0.43.0"
rusoto_core = "0.43.0"
Also if anyone know of a good place to see real examples of how to use rusoto to talk with varios AWS entities that would be appreciated.
As other people have stated, It really depends on your choice of serialization. If you chose a string based encoding like xml or json, then you could use something like:
Where you replace "some message" with your string sterilization of choice.
Though technically, using some binary encoding like protobuf or something are usually a lot more compact, but then whatever is on the other side must be able to interpret the format.