@@ -51,6 +51,19 @@ pub struct EventLog {
5151 event_payload : String ,
5252}
5353
54+ #[ derive( bon:: Builder , Serialize ) ]
55+ pub struct TlsKeyConfig {
56+ #[ builder( into) ]
57+ pub subject : Option < String > ,
58+ pub alt_names : Option < Vec < String > > ,
59+ #[ builder( default = false ) ]
60+ pub usage_ra_tls : bool ,
61+ #[ builder( default = true ) ]
62+ pub usage_server_auth : bool ,
63+ #[ builder( default = false ) ]
64+ pub usage_client_auth : bool ,
65+ }
66+
5467#[ derive( Serialize , Deserialize ) ]
5568pub struct GetKeyResponse {
5669 pub key : String ,
@@ -248,22 +261,8 @@ impl DstackClient {
248261 Ok ( ( ) )
249262 }
250263
251- pub async fn get_tls_key (
252- & self ,
253- subject : Option < String > ,
254- alt_names : Option < Vec < String > > ,
255- usage_ra_tls : bool ,
256- usage_server_auth : bool ,
257- usage_client_auth : bool ,
258- ) -> Result < GetTlsKeyResponse > {
259- let data = json ! ( {
260- "subject" : subject. unwrap_or_default( ) ,
261- "alt_names" : alt_names. unwrap_or_default( ) ,
262- "usage_ra_tls" : usage_ra_tls,
263- "usage_server_auth" : usage_server_auth,
264- "usage_client_auth" : usage_client_auth
265- } ) ;
266- let response = self . send_rpc_request ( "/GetTlsKey" , & data) . await ?;
264+ pub async fn get_tls_key ( & self , tls_key_config : TlsKeyConfig ) -> Result < GetTlsKeyResponse > {
265+ let response = self . send_rpc_request ( "/GetTlsKey" , & tls_key_config) . await ?;
267266 let response = serde_json:: from_value :: < GetTlsKeyResponse > ( response) ?;
268267
269268 Ok ( response)
0 commit comments