Skip to content
Merged
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
2 changes: 1 addition & 1 deletion omicron-bootstrap-agent/src/bin/bootstrap-agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use uuid::Uuid;

#[derive(Debug, StructOpt)]
#[structopt(
name = "boostrap_agent",
name = "bootstrap_agent",
about = "See README.adoc for more information"
)]
enum Args {
Expand Down
8 changes: 4 additions & 4 deletions omicron-bootstrap-agent/src/bootstrap_agent.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::bootstrap_agent_client::Client as BootstrapClient;
use omicron_common::api::BootstrapAgentShareResponse;
use omicron_common::api::Error;
use omicron_common::api::external::Error;
use omicron_common::api::internal::bootstrap_agent::ShareResponse;
use omicron_common::packaging::sha256_digest;

use slog::Logger;
Expand Down Expand Up @@ -49,14 +49,14 @@ impl BootstrapAgent {
pub async fn request_share(
&self,
identity: Vec<u8>,
) -> Result<BootstrapAgentShareResponse, Error> {
) -> Result<ShareResponse, Error> {
// TODO-correctness: Validate identity, return whatever
// information is necessary to establish trust quorum.
//
// This current implementation is a placeholder.
info!(&self.log, "request_share, received identity: {:x?}", identity);

Ok(BootstrapAgentShareResponse { shared_secret: vec![] })
Ok(ShareResponse { shared_secret: vec![] })
}

/// Performs device initialization:
Expand Down
13 changes: 6 additions & 7 deletions omicron-bootstrap-agent/src/bootstrap_agent_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* generated by the server.
*/

use omicron_common::api::BootstrapAgentShareRequest;
use omicron_common::api::BootstrapAgentShareResponse;
use omicron_common::api::Error;
use omicron_common::api::external::Error;
use omicron_common::api::internal::bootstrap_agent::ShareRequest;
use omicron_common::api::internal::bootstrap_agent::ShareResponse;
use omicron_common::http_client::HttpClient;

use http::Method;
Expand Down Expand Up @@ -38,18 +38,17 @@ impl Client {
pub async fn request_share(
&self,
identity: Vec<u8>,
) -> Result<BootstrapAgentShareResponse, Error> {
) -> Result<ShareResponse, Error> {
let path = "/request_share";
let body = Body::from(
serde_json::to_string(&BootstrapAgentShareRequest { identity })
.unwrap(),
serde_json::to_string(&ShareRequest { identity }).unwrap(),
);
let mut response = self.client.request(Method::GET, path, body).await?;
/* TODO-robustness handle 300-level? */
assert!(response.status().is_success());
let value = self
.client
.read_json::<BootstrapAgentShareResponse>(
.read_json::<ShareResponse>(
&self.client.error_message_base(&Method::GET, path),
&mut response,
)
Expand Down
8 changes: 4 additions & 4 deletions omicron-bootstrap-agent/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use dropshot::HttpError;
use dropshot::HttpResponseOk;
use dropshot::RequestContext;
use dropshot::TypedBody;
use omicron_common::api::{
BootstrapAgentShareRequest, BootstrapAgentShareResponse,
use omicron_common::api::internal::bootstrap_agent::{
ShareRequest, ShareResponse,
};
use std::sync::Arc;

Expand Down Expand Up @@ -39,8 +39,8 @@ pub fn ba_api() -> ApiDescription<Arc<BootstrapAgent>> {
}]
async fn api_request_share(
rqctx: Arc<RequestContext<Arc<BootstrapAgent>>>,
request: TypedBody<BootstrapAgentShareRequest>,
) -> Result<HttpResponseOk<BootstrapAgentShareResponse>, HttpError> {
request: TypedBody<ShareRequest>,
) -> Result<HttpResponseOk<ShareResponse>, HttpError> {
let bootstrap_agent = rqctx.context();

let request = request.into_inner();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* For HTTP-level error handling, see Dropshot.
*/

use crate::api::Name;
use crate::api::ResourceType;
use crate::api::external::Name;
use crate::api::external::ResourceType;
use dropshot::HttpError;
use dropshot::HttpErrorResponseBody;
use serde::Deserialize;
Expand Down Expand Up @@ -243,7 +243,7 @@ macro_rules! bail_unless {
};
($cond:expr, $($arg:tt)+) => {
if !$cond {
return Err($crate::api::Error::internal_error(&format!(
return Err($crate::api::external::Error::internal_error(&format!(
$($arg)*)))
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
* each resource paginated that way). Where possible, we should share code.
*/

use crate::api::DataPageParams;
use crate::api::Name;
use crate::api::ObjectIdentity;
use crate::api::PaginationOrder;
use crate::api::external::DataPageParams;
use crate::api::external::Name;
use crate::api::external::ObjectIdentity;
use crate::api::external::PaginationOrder;
use dropshot::HttpError;
use dropshot::PaginationParams;
use dropshot::RequestContext;
Expand Down Expand Up @@ -505,9 +505,8 @@ mod test {
use super::ScanByName;
use super::ScanByNameOrId;
use super::ScanParams;
use crate::api::IdentityMetadata;
use crate::api::ObjectIdentity;
use api_identity::ObjectIdentity;
use crate::api::external::IdentityMetadata;
use crate::api::external::ObjectIdentity;
use chrono::Utc;
use dropshot::PaginationOrder;
use dropshot::PaginationParams;
Expand Down
Loading