Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions openapi/wicketd.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,42 +440,6 @@
}
}
},
"/rack-setup/config/cert": {
"post": {
"summary": "Add an external certificate.",
"description": "This must be paired with its private key. They may be posted in either order, but one cannot post two certs in a row (or two keys in a row).",
"operationId": "post_rss_config_cert",
"requestBody": {
"content": {
"application/json": {
"schema": {
"title": "String",
"type": "string"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CertificateUploadResponse"
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
}
},
"/rack-setup/config/key": {
"post": {
"summary": "Add the private key of an external certificate.",
Expand Down
5 changes: 3 additions & 2 deletions wicket/src/cli/rack_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use wicketd_client::types::PutRssRecoveryUserPasswordHash;
use wicketd_client::types::SetBgpAuthKeyStatus;
use wicketd_commission_types::rack_setup::BgpAuthKey;
use wicketd_commission_types::rack_setup::BgpAuthKeyId;
use wicketd_commission_types::rack_setup::CertificatePem;
use wicketd_commission_types::rack_setup::CertificateUploadResponse;
use wicketd_commission_types::rack_setup::PutRssUserConfigInsensitive;
use zeroize::Zeroizing;
Expand Down Expand Up @@ -162,8 +163,8 @@ impl SetupArgs {
.context("failed to read certificate from stdin")?;

slog::info!(log, "uploading cert to wicketd...");
let result = client
.post_rss_config_cert(&cert)
let result = commission_client
.post_rss_config_cert(&CertificatePem(cert))
.await
.context("failed to upload cert to wicketd")?
.into_inner();
Expand Down
13 changes: 0 additions & 13 deletions wicketd-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,6 @@ pub trait WicketdApi {
body: TypedBody<MultirackJoinConfigBaseUserInput>,
) -> Result<HttpResponseUpdatedNoContent, HttpError>;

/// Add an external certificate.
///
/// This must be paired with its private key. They may be posted in either
/// order, but one cannot post two certs in a row (or two keys in a row).
#[endpoint {
method = POST,
path = "/rack-setup/config/cert"
}]
async fn post_rss_config_cert(
rqctx: RequestContext<Self::Context>,
body: TypedBody<String>,
) -> Result<HttpResponseOk<CertificateUploadResponse>, HttpError>;

/// Add the private key of an external certificate.
///
/// This must be paired with its certificate. They may be posted in either
Expand Down
19 changes: 0 additions & 19 deletions wicketd/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,25 +159,6 @@ impl WicketdApi for WicketdApiImpl {
Ok(HttpResponseUpdatedNoContent())
}

async fn post_rss_config_cert(
rqctx: RequestContext<Self::Context>,
body: TypedBody<String>,
) -> Result<HttpResponseOk<CertificateUploadResponse>, HttpError> {
let ctx = rqctx.context();

let mut config = ctx.rss_or_multirack_join_config.lock().unwrap();

let rss_config = config.rss_config_mut_or_conflict(
"cannot post certificates when not preparing for RSS",
)?;

let response = rss_config
.push_cert(body.into_inner())
.map_err(|err| HttpError::for_bad_request(None, err))?;

Ok(HttpResponseOk(response))
}

async fn post_rss_config_key(
rqctx: RequestContext<Self::Context>,
body: TypedBody<String>,
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.