22// License, v. 2.0. If a copy of the MPL was not distributed with this
33// file, You can obtain one at https://mozilla.org/MPL/2.0/.
44
5- use cockroach_admin_types :: { NodeDecommission , NodeStatus } ;
5+ use cockroach_admin_types_versions :: latest ;
66use dropshot:: {
77 HttpError , HttpResponseOk , HttpResponseUpdatedNoContent , RequestContext ,
88 TypedBody ,
99} ;
1010use dropshot_api_manager_types:: api_versions;
11- use omicron_uuid_kinds:: OmicronZoneUuid ;
12- use schemars:: JsonSchema ;
13- use serde:: { Deserialize , Serialize } ;
1411
1512api_versions ! ( [
1613 // WHEN CHANGING THE API (part 1 of 2):
@@ -70,7 +67,7 @@ pub trait CockroachAdminApi {
7067 } ]
7168 async fn node_status (
7269 rqctx : RequestContext < Self :: Context > ,
73- ) -> Result < HttpResponseOk < ClusterNodeStatus > , HttpError > ;
70+ ) -> Result < HttpResponseOk < latest :: node :: ClusterNodeStatus > , HttpError > ;
7471
7572 /// Get the CockroachDB node ID of the local cockroach instance.
7673 #[ endpoint {
@@ -79,7 +76,7 @@ pub trait CockroachAdminApi {
7976 } ]
8077 async fn local_node_id (
8178 rqctx : RequestContext < Self :: Context > ,
82- ) -> Result < HttpResponseOk < LocalNodeId > , HttpError > ;
79+ ) -> Result < HttpResponseOk < latest :: node :: LocalNodeId > , HttpError > ;
8380
8481 /// Decommission a node from the CRDB cluster.
8582 #[ endpoint {
@@ -88,8 +85,8 @@ pub trait CockroachAdminApi {
8885 } ]
8986 async fn node_decommission (
9087 rqctx : RequestContext < Self :: Context > ,
91- body : TypedBody < NodeId > ,
92- ) -> Result < HttpResponseOk < NodeDecommission > , HttpError > ;
88+ body : TypedBody < latest :: node :: NodeId > ,
89+ ) -> Result < HttpResponseOk < latest :: node :: NodeDecommission > , HttpError > ;
9390
9491 /// Proxy to CockroachDB's /_status/vars endpoint
9592 //
@@ -114,35 +111,3 @@ pub trait CockroachAdminApi {
114111 rqctx : RequestContext < Self :: Context > ,
115112 ) -> Result < HttpResponseOk < String > , HttpError > ;
116113}
117-
118- #[ derive( Debug , Clone , PartialEq , Eq , Deserialize , Serialize , JsonSchema ) ]
119- #[ serde( rename_all = "snake_case" ) ]
120- pub struct ClusterNodeStatus {
121- pub all_nodes : Vec < NodeStatus > ,
122- }
123-
124- /// CockroachDB Node ID
125- #[ derive( Debug , Clone , PartialEq , Eq , Deserialize , Serialize , JsonSchema ) ]
126- #[ serde( rename_all = "snake_case" ) ]
127- pub struct LocalNodeId {
128- /// The ID of this Omicron zone.
129- ///
130- /// This is included to ensure correctness even if a socket address on a
131- /// sled is reused for a different zone; if our caller is trying to
132- /// determine the node ID for a particular Omicron CockroachDB zone, they'll
133- /// contact us by socket address. We include our zone ID in the response for
134- /// their confirmation that we are the zone they intended to contact.
135- pub zone_id : OmicronZoneUuid ,
136- // CockroachDB node IDs are integers, in practice, but our use of them is as
137- // input and output to the `cockroach` CLI. We use a string which is a bit
138- // more natural (no need to parse CLI output or stringify an ID to send it
139- // as input) and leaves open the door for the format to change in the
140- // future.
141- pub node_id : String ,
142- }
143-
144- #[ derive( Debug , Clone , PartialEq , Eq , Deserialize , Serialize , JsonSchema ) ]
145- #[ serde( rename_all = "snake_case" ) ]
146- pub struct NodeId {
147- pub node_id : String ,
148- }
0 commit comments