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
1 change: 0 additions & 1 deletion common/src/api/internal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
//! Internally facing APIs.

pub mod nexus;
pub mod sled_agent;
177 changes: 0 additions & 177 deletions common/src/api/internal/sled_agent.rs

This file was deleted.

111 changes: 19 additions & 92 deletions nexus-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
* from within the control plane
*/

use std::convert::TryFrom;

use omicron_common::generate_logging_api;

generate_logging_api!("../openapi/nexus-internal.json");
Expand All @@ -19,12 +17,6 @@ impl omicron_common::api::external::ClientError for types::Error {
}
}

impl From<types::Generation> for omicron_common::api::external::Generation {
fn from(s: types::Generation) -> Self {
Self::try_from(s.0 as i64).unwrap()
}
}

impl From<omicron_common::api::external::ByteCount> for types::ByteCount {
fn from(s: omicron_common::api::external::ByteCount) -> Self {
Self(s.to_bytes())
Expand Down Expand Up @@ -64,19 +56,6 @@ impl From<types::InstanceState>
}
}

impl From<omicron_common::api::internal::sled_agent::DatasetKind>
for types::DatasetKind
{
fn from(d: omicron_common::api::internal::sled_agent::DatasetKind) -> Self {
use omicron_common::api::internal::sled_agent::DatasetKind::*;
match d {
CockroachDb { .. } => types::DatasetKind::Cockroach,
Crucible { .. } => types::DatasetKind::Crucible,
Clickhouse { .. } => types::DatasetKind::Clickhouse,
}
}
}

impl From<omicron_common::api::internal::nexus::InstanceRuntimeState>
for types::InstanceRuntimeState
{
Expand All @@ -99,63 +78,22 @@ impl From<omicron_common::api::internal::nexus::InstanceRuntimeState>
}
}

impl From<&omicron_common::api::internal::nexus::InstanceRuntimeState>
for types::InstanceRuntimeState
{
fn from(
s: &omicron_common::api::internal::nexus::InstanceRuntimeState,
) -> Self {
Self {
run_state: s.run_state.into(),
sled_uuid: s.sled_uuid,
propolis_uuid: s.propolis_uuid,
dst_propolis_uuid: s.dst_propolis_uuid,
propolis_addr: s.propolis_addr.map(|addr| addr.to_string()),
migration_uuid: s.migration_uuid,
ncpus: s.ncpus.into(),
memory: s.memory.into(),
hostname: s.hostname.clone(),
gen: s.gen.into(),
time_updated: s.time_updated,
}
}
}

impl From<omicron_common::api::external::InstanceState>
for types::InstanceState
{
fn from(s: omicron_common::api::external::InstanceState) -> Self {
use omicron_common::api::external::InstanceState;
match s {
omicron_common::api::external::InstanceState::Creating => {
Self::Creating
}
omicron_common::api::external::InstanceState::Starting => {
Self::Starting
}
omicron_common::api::external::InstanceState::Running => {
Self::Running
}
omicron_common::api::external::InstanceState::Stopping => {
Self::Stopping
}
omicron_common::api::external::InstanceState::Stopped => {
Self::Stopped
}
omicron_common::api::external::InstanceState::Rebooting => {
Self::Rebooting
}
omicron_common::api::external::InstanceState::Migrating => {
Self::Migrating
}
omicron_common::api::external::InstanceState::Repairing => {
Self::Repairing
}
omicron_common::api::external::InstanceState::Failed => {
Self::Failed
}
omicron_common::api::external::InstanceState::Destroyed => {
Self::Destroyed
}
InstanceState::Creating => Self::Creating,
InstanceState::Starting => Self::Starting,
InstanceState::Running => Self::Running,
InstanceState::Stopping => Self::Stopping,
InstanceState::Stopped => Self::Stopped,
InstanceState::Rebooting => Self::Rebooting,
InstanceState::Migrating => Self::Migrating,
InstanceState::Repairing => Self::Repairing,
InstanceState::Failed => Self::Failed,
InstanceState::Destroyed => Self::Destroyed,
}
}
}
Expand Down Expand Up @@ -188,26 +126,15 @@ impl From<omicron_common::api::internal::nexus::DiskRuntimeState>

impl From<omicron_common::api::external::DiskState> for types::DiskState {
fn from(s: omicron_common::api::external::DiskState) -> Self {
use omicron_common::api::external::DiskState;
match s {
omicron_common::api::external::DiskState::Creating => {
Self::Creating
}
omicron_common::api::external::DiskState::Detached => {
Self::Detached
}
omicron_common::api::external::DiskState::Attaching(u) => {
Self::Attaching(u)
}
omicron_common::api::external::DiskState::Attached(u) => {
Self::Attached(u)
}
omicron_common::api::external::DiskState::Detaching(u) => {
Self::Detaching(u)
}
omicron_common::api::external::DiskState::Destroyed => {
Self::Destroyed
}
omicron_common::api::external::DiskState::Faulted => Self::Faulted,
DiskState::Creating => Self::Creating,
DiskState::Detached => Self::Detached,
DiskState::Attaching(u) => Self::Attaching(u),
DiskState::Attached(u) => Self::Attached(u),
DiskState::Detaching(u) => Self::Detaching(u),
DiskState::Destroyed => Self::Destroyed,
DiskState::Faulted => Self::Faulted,
}
}
}
Expand Down
Loading