Skip to content

Commit

Permalink
[π˜€π—½π—Ώ] initial version
Browse files Browse the repository at this point in the history
Created using spr 1.3.6-beta.1
  • Loading branch information
sunshowers committed Jul 11, 2024
1 parent cdf2e92 commit ecb7b17
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 29 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion cockroach-admin/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::cockroach_cli::NodeDecommission;
use crate::cockroach_cli::NodeStatus;
use crate::context::ServerContext;
use dropshot::endpoint;
use dropshot::ApiDescriptionRegisterError;
use dropshot::HttpError;
use dropshot::HttpResponseOk;
use dropshot::RequestContext;
Expand All @@ -19,7 +20,9 @@ use std::sync::Arc;
type CrdbApiDescription = dropshot::ApiDescription<Arc<ServerContext>>;

pub fn api() -> CrdbApiDescription {
fn register_endpoints(api: &mut CrdbApiDescription) -> Result<(), String> {
fn register_endpoints(
api: &mut CrdbApiDescription,
) -> Result<(), ApiDescriptionRegisterError> {
api.register(local_node_id)?;
api.register(node_status)?;
api.register(node_decommission)?;
Expand Down
3 changes: 2 additions & 1 deletion gateway/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use crate::ServerContext;
use base64::Engine;
use dropshot::endpoint;
use dropshot::ApiDescription;
use dropshot::ApiDescriptionRegisterError;
use dropshot::HttpError;
use dropshot::HttpResponseOk;
use dropshot::HttpResponseUpdatedNoContent;
Expand Down Expand Up @@ -1677,7 +1678,7 @@ type GatewayApiDescription = ApiDescription<Arc<ServerContext>>;
pub fn api() -> GatewayApiDescription {
fn register_endpoints(
api: &mut GatewayApiDescription,
) -> Result<(), String> {
) -> Result<(), ApiDescriptionRegisterError> {
api.register(sp_get)?;
api.register(sp_startup_options_get)?;
api.register(sp_startup_options_set)?;
Expand Down
8 changes: 4 additions & 4 deletions installinator-artifactd/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
// Copyright 2022 Oxide Computer Company

use dropshot::{
endpoint, ApiDescription, FreeformBody, HttpError, HttpResponseHeaders,
HttpResponseOk, HttpResponseUpdatedNoContent, Path, RequestContext,
TypedBody,
endpoint, ApiDescription, ApiDescriptionRegisterError, FreeformBody,
HttpError, HttpResponseHeaders, HttpResponseOk,
HttpResponseUpdatedNoContent, Path, RequestContext, TypedBody,
};
use hyper::{header, Body, StatusCode};
use installinator_common::EventReport;
Expand All @@ -24,7 +24,7 @@ type ArtifactServerApiDesc = ApiDescription<ServerContext>;
pub fn api() -> ArtifactServerApiDesc {
fn register_endpoints(
api: &mut ArtifactServerApiDesc,
) -> Result<(), String> {
) -> Result<(), ApiDescriptionRegisterError> {
api.register(get_artifact_by_hash)?;
api.register(report_progress)?;
Ok(())
Expand Down
10 changes: 6 additions & 4 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::HttpError;
use dropshot::HttpResponseAccepted;
use dropshot::HttpResponseCreated;
use dropshot::HttpResponseDeleted;
Expand All @@ -32,6 +31,7 @@ use dropshot::{
channel, endpoint, WebsocketChannelResult, WebsocketConnection,
};
use dropshot::{ApiDescription, StreamingBody};
use dropshot::{ApiDescriptionRegisterError, HttpError};
use dropshot::{ApiEndpoint, EmptyScanParams};
use ipnetwork::IpNetwork;
use nexus_db_queries::db;
Expand Down Expand Up @@ -100,7 +100,9 @@ type NexusApiDescription = ApiDescription<ApiContext>;

/// Returns a description of the external nexus API
pub(crate) fn external_api() -> NexusApiDescription {
fn register_endpoints(api: &mut NexusApiDescription) -> Result<(), String> {
fn register_endpoints(
api: &mut NexusApiDescription,
) -> Result<(), ApiDescriptionRegisterError> {
api.register(ping)?;

api.register(system_policy_view)?;
Expand Down Expand Up @@ -368,7 +370,7 @@ pub(crate) fn external_api() -> NexusApiDescription {
fn register_experimental<T>(
api: &mut NexusApiDescription,
endpoint: T,
) -> Result<(), String>
) -> Result<(), ApiDescriptionRegisterError>
where
T: Into<ApiEndpoint<ApiContext>>,
{
Expand All @@ -381,7 +383,7 @@ pub(crate) fn external_api() -> NexusApiDescription {

fn register_experimental_endpoints(
api: &mut NexusApiDescription,
) -> Result<(), String> {
) -> Result<(), ApiDescriptionRegisterError> {
register_experimental(api, probe_list)?;
register_experimental(api, probe_view)?;
register_experimental(api, probe_create)?;
Expand Down
5 changes: 4 additions & 1 deletion nexus/src/internal_api/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use super::params::{OximeterInfo, RackInitializationRequest};
use crate::context::ApiContext;
use dropshot::endpoint;
use dropshot::ApiDescription;
use dropshot::ApiDescriptionRegisterError;
use dropshot::FreeformBody;
use dropshot::HttpError;
use dropshot::HttpResponseCreated;
Expand Down Expand Up @@ -68,7 +69,9 @@ type NexusApiDescription = ApiDescription<ApiContext>;

/// Returns a description of the internal nexus API
pub(crate) fn internal_api() -> NexusApiDescription {
fn register_endpoints(api: &mut NexusApiDescription) -> Result<(), String> {
fn register_endpoints(
api: &mut NexusApiDescription,
) -> Result<(), ApiDescriptionRegisterError> {
api.register(sled_agent_get)?;
api.register(sled_agent_put)?;
api.register(sled_firewall_rules_request)?;
Expand Down
3 changes: 2 additions & 1 deletion sled-agent/src/bootstrap/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use crate::bootstrap::rack_ops::{RackInitId, RackResetId};
use crate::updates::ConfigUpdates;
use crate::updates::{Component, UpdateManager};
use bootstore::schemes::v0 as bootstore;
use dropshot::ApiDescriptionRegisterError;
use dropshot::{
endpoint, ApiDescription, HttpError, HttpResponseOk,
HttpResponseUpdatedNoContent, RequestContext, TypedBody,
Expand Down Expand Up @@ -63,7 +64,7 @@ type BootstrapApiDescription = ApiDescription<BootstrapServerContext>;
pub(crate) fn api() -> BootstrapApiDescription {
fn register_endpoints(
api: &mut BootstrapApiDescription,
) -> Result<(), String> {
) -> Result<(), ApiDescriptionRegisterError> {
api.register(baseboard_get)?;
api.register(components_get)?;
api.register(rack_initialization_status)?;
Expand Down
12 changes: 7 additions & 5 deletions sled-agent/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ use bootstore::schemes::v0::NetworkConfig;
use camino::Utf8PathBuf;
use display_error_chain::DisplayErrorChain;
use dropshot::{
endpoint, ApiDescription, FreeformBody, HttpError, HttpResponseCreated,
HttpResponseDeleted, HttpResponseHeaders, HttpResponseOk,
HttpResponseUpdatedNoContent, Path, Query, RequestContext, StreamingBody,
TypedBody,
endpoint, ApiDescription, ApiDescriptionRegisterError, FreeformBody,
HttpError, HttpResponseCreated, HttpResponseDeleted, HttpResponseHeaders,
HttpResponseOk, HttpResponseUpdatedNoContent, Path, Query, RequestContext,
StreamingBody, TypedBody,
};
use illumos_utils::opte::params::VirtualNetworkInterfaceHost;
use installinator_common::M2Slot;
Expand All @@ -46,7 +46,9 @@ type SledApiDescription = ApiDescription<SledAgent>;

/// Returns a description of the sled agent API
pub fn api() -> SledApiDescription {
fn register_endpoints(api: &mut SledApiDescription) -> Result<(), String> {
fn register_endpoints(
api: &mut SledApiDescription,
) -> Result<(), ApiDescriptionRegisterError> {
api.register(disk_put)?;
api.register(cockroachdb_init)?;
api.register(instance_issue_disk_snapshot_request)?;
Expand Down
6 changes: 4 additions & 2 deletions sled-agent/src/sim/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ use crate::params::{
InstancePutStateResponse, InstanceUnregisterResponse, Inventory,
OmicronPhysicalDisksConfig, OmicronZonesConfig, VpcFirewallRulesEnsureBody,
};
use dropshot::endpoint;
use dropshot::ApiDescription;
use dropshot::HttpError;
use dropshot::HttpResponseOk;
use dropshot::HttpResponseUpdatedNoContent;
use dropshot::Path;
use dropshot::RequestContext;
use dropshot::TypedBody;
use dropshot::{endpoint, ApiDescriptionRegisterError};
use illumos_utils::opte::params::VirtualNetworkInterfaceHost;
use omicron_common::api::internal::nexus::DiskRuntimeState;
use omicron_common::api::internal::nexus::SledInstanceState;
Expand All @@ -40,7 +40,9 @@ type SledApiDescription = ApiDescription<Arc<SledAgent>>;

/// Returns a description of the sled agent API
pub fn api() -> SledApiDescription {
fn register_endpoints(api: &mut SledApiDescription) -> Result<(), String> {
fn register_endpoints(
api: &mut SledApiDescription,
) -> Result<(), ApiDescriptionRegisterError> {
api.register(instance_put_migration_ids)?;
api.register(instance_put_state)?;
api.register(instance_get_state)?;
Expand Down
7 changes: 4 additions & 3 deletions sled-agent/src/sim/http_entrypoints_pantry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
//! HTTP entrypoint functions for simulating the crucible pantry API.
use dropshot::{
endpoint, ApiDescription, HttpError, HttpResponseDeleted, HttpResponseOk,
HttpResponseUpdatedNoContent, Path as TypedPath, RequestContext, TypedBody,
endpoint, ApiDescription, ApiDescriptionRegisterError, HttpError,
HttpResponseDeleted, HttpResponseOk, HttpResponseUpdatedNoContent,
Path as TypedPath, RequestContext, TypedBody,
};
use propolis_client::types::VolumeConstructionRequest;
use schemars::JsonSchema;
Expand All @@ -21,7 +22,7 @@ type CruciblePantryApiDescription = ApiDescription<Arc<Pantry>>;
pub fn api() -> CruciblePantryApiDescription {
fn register_endpoints(
api: &mut CruciblePantryApiDescription,
) -> Result<(), String> {
) -> Result<(), ApiDescriptionRegisterError> {
api.register(attach)?;
api.register(is_job_finished)?;
api.register(job_result_ok)?;
Expand Down
7 changes: 4 additions & 3 deletions sled-agent/src/sim/http_entrypoints_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ use crucible_agent_client::types::{
Snapshot,
};
use dropshot::{
endpoint, ApiDescription, HttpError, HttpResponseDeleted, HttpResponseOk,
Path as TypedPath, RequestContext, TypedBody,
endpoint, ApiDescription, ApiDescriptionRegisterError, HttpError,
HttpResponseDeleted, HttpResponseOk, Path as TypedPath, RequestContext,
TypedBody,
};
use schemars::JsonSchema;
use serde::Deserialize;
Expand All @@ -24,7 +25,7 @@ type CrucibleAgentApiDescription = ApiDescription<Arc<CrucibleData>>;
pub fn api() -> CrucibleAgentApiDescription {
fn register_endpoints(
api: &mut CrucibleAgentApiDescription,
) -> Result<(), String> {
) -> Result<(), ApiDescriptionRegisterError> {
api.register(region_list)?;
api.register(region_create)?;
api.register(region_get)?;
Expand Down
3 changes: 2 additions & 1 deletion wicketd/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use bootstrap_agent_client::types::RackOperationStatus;
use bootstrap_agent_client::types::RackResetId;
use dropshot::endpoint;
use dropshot::ApiDescription;
use dropshot::ApiDescriptionRegisterError;
use dropshot::HttpError;
use dropshot::HttpResponseOk;
use dropshot::HttpResponseUpdatedNoContent;
Expand Down Expand Up @@ -59,7 +60,7 @@ type WicketdApiDescription = ApiDescription<ServerContext>;
pub fn api() -> WicketdApiDescription {
fn register_endpoints(
api: &mut WicketdApiDescription,
) -> Result<(), String> {
) -> Result<(), ApiDescriptionRegisterError> {
api.register(get_bootstrap_sleds)?;
api.register(get_rss_config)?;
api.register(put_rss_config)?;
Expand Down

0 comments on commit ecb7b17

Please sign in to comment.