11use std:: time:: { SystemTime , UNIX_EPOCH } ;
22
3- use code0_flow:: flow_service:: retry:: create_channel_with_retry;
4- use tonic:: transport:: Channel ;
3+ use code0_flow:: flow_service:: {
4+ auth:: get_authorization_metadata, retry:: create_channel_with_retry,
5+ } ;
6+ use tonic:: { Extensions , Request , transport:: Channel } ;
57use tucana:: {
68 aquila:: {
79 RuntimeStatusUpdateRequest , runtime_status_service_client:: RuntimeStatusServiceClient ,
@@ -14,23 +16,31 @@ pub struct TaurusRuntimeStatusService {
1416 channel : Channel ,
1517 identifier : String ,
1618 features : Vec < RuntimeFeature > ,
19+ aquila_token : String ,
1720}
1821
1922impl TaurusRuntimeStatusService {
2023 pub async fn from_url (
2124 aquila_url : String ,
25+ aquila_token : String ,
2226 identifier : String ,
2327 features : Vec < RuntimeFeature > ,
2428 ) -> Self {
2529 let channel = create_channel_with_retry ( "Aquila" , aquila_url) . await ;
26- Self :: new ( channel, identifier, features)
30+ Self :: new ( channel, aquila_token , identifier, features)
2731 }
2832
29- pub fn new ( channel : Channel , identifier : String , features : Vec < RuntimeFeature > ) -> Self {
33+ pub fn new (
34+ channel : Channel ,
35+ aquila_token : String ,
36+ identifier : String ,
37+ features : Vec < RuntimeFeature > ,
38+ ) -> Self {
3039 TaurusRuntimeStatusService {
3140 channel,
3241 identifier,
3342 features,
43+ aquila_token,
3444 }
3545 }
3646
@@ -50,14 +60,18 @@ impl TaurusRuntimeStatusService {
5060 }
5161 } ;
5262
53- let request = RuntimeStatusUpdateRequest {
54- status : Some ( Status :: ExecutionRuntimeStatus ( ExecutionRuntimeStatus {
55- status : status. into ( ) ,
56- timestamp : timestamp as i64 ,
57- identifier : self . identifier . clone ( ) ,
58- features : self . features . clone ( ) ,
59- } ) ) ,
60- } ;
63+ let request = Request :: from_parts (
64+ get_authorization_metadata ( & self . aquila_token ) ,
65+ Extensions :: new ( ) ,
66+ RuntimeStatusUpdateRequest {
67+ status : Some ( Status :: ExecutionRuntimeStatus ( ExecutionRuntimeStatus {
68+ status : status. into ( ) ,
69+ timestamp : timestamp as i64 ,
70+ identifier : self . identifier . clone ( ) ,
71+ features : self . features . clone ( ) ,
72+ } ) ) ,
73+ } ,
74+ ) ;
6175
6276 match client. update ( request) . await {
6377 Ok ( response) => {
0 commit comments