Skip to content

Commit

Permalink
Support bundle download endpoints could distinguish success and failu…
Browse files Browse the repository at this point in the history
…re status codes in OpenAPI
  • Loading branch information
ahl committed Jan 15, 2025
1 parent 1c92838 commit 8b2d5bd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
6 changes: 3 additions & 3 deletions nexus/external-api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::BTreeMap;

use anyhow::anyhow;
use dropshot::Body;
use dropshot::{Body, FreeformBody};
use dropshot::{
EmptyScanParams, EndpointTagPolicy, HttpError, HttpResponseAccepted,
HttpResponseCreated, HttpResponseDeleted, HttpResponseFound,
Expand Down Expand Up @@ -2824,7 +2824,7 @@ pub trait NexusExternalApi {
async fn support_bundle_download(
rqctx: RequestContext<Self::Context>,
path_params: Path<params::SupportBundlePath>,
) -> Result<Response<Body>, HttpError>;
) -> Result<HttpResponseOk<FreeformBody>, HttpError>;

/// Download a file within a support bundle
#[endpoint {
Expand All @@ -2835,7 +2835,7 @@ pub trait NexusExternalApi {
async fn support_bundle_download_file(
rqctx: RequestContext<Self::Context>,
path_params: Path<params::SupportBundleFilePath>,
) -> Result<Response<Body>, HttpError>;
) -> Result<HttpResponseOk<FreeformBody>, HttpError>;

/// Download the metadata of a support bundle
#[endpoint {
Expand Down
6 changes: 3 additions & 3 deletions nexus/src/external_api/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use super::{
},
};
use crate::{context::ApiContext, external_api::shared};
use dropshot::Body;
use dropshot::EmptyScanParams;
use dropshot::HttpError;
use dropshot::HttpResponseDeleted;
Expand All @@ -29,6 +28,7 @@ use dropshot::ResultsPage;
use dropshot::TypedBody;
use dropshot::WhichPage;
use dropshot::{ApiDescription, StreamingBody};
use dropshot::{Body, FreeformBody};
use dropshot::{HttpResponseAccepted, HttpResponseFound, HttpResponseSeeOther};
use dropshot::{HttpResponseCreated, HttpResponseHeaders};
use dropshot::{WebsocketChannelResult, WebsocketConnection};
Expand Down Expand Up @@ -6099,7 +6099,7 @@ impl NexusExternalApi for NexusExternalApiImpl {
async fn support_bundle_download(
rqctx: RequestContext<Self::Context>,
_path_params: Path<params::SupportBundlePath>,
) -> Result<Response<Body>, HttpError> {
) -> Result<HttpResponseOk<FreeformBody>, HttpError> {
let apictx = rqctx.context();
let handler = async {
let nexus = &apictx.context.nexus;
Expand All @@ -6122,7 +6122,7 @@ impl NexusExternalApi for NexusExternalApiImpl {
async fn support_bundle_download_file(
rqctx: RequestContext<Self::Context>,
_path_params: Path<params::SupportBundleFilePath>,
) -> Result<Response<Body>, HttpError> {
) -> Result<HttpResponseOk<FreeformBody>, HttpError> {
let apictx = rqctx.context();
let handler = async {
let nexus = &apictx.context.nexus;
Expand Down
16 changes: 14 additions & 2 deletions openapi/nexus.json
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,19 @@
}
],
"responses": {
"default": {
"200": {
"description": "",
"content": {
"*/*": {
"schema": {}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
},
Expand Down Expand Up @@ -544,13 +550,19 @@
}
],
"responses": {
"default": {
"200": {
"description": "",
"content": {
"*/*": {
"schema": {}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
},
Expand Down

0 comments on commit 8b2d5bd

Please sign in to comment.