@@ -36,7 +36,7 @@ type NexusApiDescription = ApiDescription<Arc<ServerContext>>;
3636/// Returns a description of the internal nexus API
3737pub fn internal_api ( ) -> NexusApiDescription {
3838 fn register_endpoints ( api : & mut NexusApiDescription ) -> Result < ( ) , String > {
39- api. register ( cpapi_sled_agents_post ) ?;
39+ api. register ( sled_agent_put ) ?;
4040 api. register ( rack_initialization_complete) ?;
4141 api. register ( zpool_put) ?;
4242 api. register ( dataset_put) ?;
@@ -63,26 +63,22 @@ struct SledAgentPathParam {
6363}
6464
6565/// Report that the sled agent for the specified sled has come online.
66- // TODO: Should probably be "PUT", since:
67- // 1. We're upserting the value
68- // 2. The client supplies the UUID
69- // 3. This call is idempotent (mod "time_modified").
7066#[ endpoint {
7167 method = POST ,
7268 path = "/sled-agents/{sled_id}" ,
7369 } ]
74- async fn cpapi_sled_agents_post (
70+ async fn sled_agent_put (
7571 rqctx : Arc < RequestContext < Arc < ServerContext > > > ,
7672 path_params : Path < SledAgentPathParam > ,
7773 sled_info : TypedBody < SledAgentStartupInfo > ,
7874) -> Result < HttpResponseUpdatedNoContent , HttpError > {
7975 let apictx = rqctx. context ( ) ;
8076 let nexus = & apictx. nexus ;
8177 let path = path_params. into_inner ( ) ;
82- let si = sled_info. into_inner ( ) ;
78+ let info = sled_info. into_inner ( ) ;
8379 let sled_id = & path. sled_id ;
8480 let handler = async {
85- nexus. upsert_sled ( * sled_id, si . sa_address ) . await ?;
81+ nexus. upsert_sled ( * sled_id, info ) . await ?;
8682 Ok ( HttpResponseUpdatedNoContent ( ) )
8783 } ;
8884 apictx. internal_latencies . instrument_dropshot_handler ( & rqctx, handler) . await
0 commit comments