Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Created using spr 1.3.5
  • Loading branch information
sunshowers committed Jan 17, 2024
1 parent 51c64a9 commit c012765
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 101 deletions.
5 changes: 0 additions & 5 deletions common/src/api/external/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,11 +764,6 @@ pub enum ResourceType {
TufRepo,
TufArtifact,
SwitchPort,
SystemUpdate,
ComponentUpdate,
SystemUpdateComponentUpdate,
UpdateDeployment,
UpdateableComponent,
UserBuiltin,
Zpool,
Vmm,
Expand Down
16 changes: 0 additions & 16 deletions nexus/db-queries/src/authz/api_resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1031,22 +1031,6 @@ authz_resource! {
polar_snippet = Custom,
}

authz_resource! {
name = "SystemUpdate",
parent = "Fleet",
primary_key = Uuid,
roles_allowed = false,
polar_snippet = FleetChild,
}

authz_resource! {
name = "UpdateDeployment",
parent = "Fleet",
primary_key = Uuid,
roles_allowed = false,
polar_snippet = FleetChild,
}

authz_resource! {
name = "IpPool",
parent = "Fleet",
Expand Down
2 changes: 0 additions & 2 deletions nexus/db-queries/src/authz/oso_generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ pub fn make_omicron_oso(log: &slog::Logger) -> Result<OsoInit, anyhow::Error> {
Zpool::init(),
Service::init(),
UserBuiltin::init(),
SystemUpdate::init(),
UpdateDeployment::init(),
];

for init in generated_inits {
Expand Down
16 changes: 0 additions & 16 deletions nexus/db-queries/src/authz/policy_test/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,6 @@ pub async fn make_resources(
LookupType::ByCompositeId(artifact_id_desc),
));

let system_update_id =
"9c86d713-1bc2-4927-9892-ada3eb6f5f62".parse().unwrap();
builder.new_resource(authz::SystemUpdate::new(
authz::FLEET,
system_update_id,
LookupType::ById(system_update_id),
));

let update_deployment_id =
"c617a035-7c42-49ff-a36a-5dfeee382832".parse().unwrap();
builder.new_resource(authz::UpdateDeployment::new(
authz::FLEET,
update_deployment_id,
LookupType::ById(update_deployment_id),
));

let address_lot_id =
"43259fdc-c5c0-4a21-8b1d-2f673ad00d93".parse().unwrap();
builder.new_resource(authz::AddressLot::new(
Expand Down
4 changes: 2 additions & 2 deletions nexus/db-queries/tests/output/authz-roles.out
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ resource: DeviceAccessToken "a-device-access-token"
silo1-proj1-viewer ✘ ✘ ✘ ✘ ✘ ✘ ✘ ✘
unauthenticated ! ! ! ! ! ! ! !

resource: SystemUpdate id "9c86d713-1bc2-4927-9892-ada3eb6f5f62"
resource: TufRepo id "3c52d72f-cbf7-4951-a62f-a4154e74da87"

USER Q R LC RP M MP CC D
fleet-admin ✘ ✔ ✔ ✔ ✔ ✔ ✔ ✔
Expand All @@ -936,7 +936,7 @@ resource: SystemUpdate id "9c86d713-1bc2-4927-9892-ada3eb6f5f62"
silo1-proj1-viewer ✘ ✘ ✘ ✘ ✘ ✘ ✘ ✘
unauthenticated ! ! ! ! ! ! ! !

resource: UpdateDeployment id "c617a035-7c42-49ff-a36a-5dfeee382832"
resource: TufArtifact id "a v1.0.0 (b)"

USER Q R LC RP M MP CC D
fleet-admin ✘ ✔ ✔ ✔ ✔ ✔ ✔ ✔
Expand Down
61 changes: 1 addition & 60 deletions nexus/types/src/external_api/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use chrono::DateTime;
use chrono::Utc;
use omicron_common::api::external::{
ByteCount, Digest, IdentityMetadata, InstanceState, Ipv4Net, Ipv6Net, Name,
ObjectIdentity, RoleName, SemverVersion, SimpleIdentity,
ObjectIdentity, RoleName, SimpleIdentity,
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -559,65 +559,6 @@ pub enum DeviceAccessTokenType {
Bearer,
}

// SYSTEM UPDATES

#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq)]
pub struct VersionRange {
pub low: SemverVersion,
pub high: SemverVersion,
}

#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq)]
#[serde(tag = "status", rename_all = "snake_case")]
pub enum UpdateStatus {
Updating,
Steady,
}

#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq)]
pub struct SystemVersion {
pub version_range: VersionRange,
pub status: UpdateStatus,
// TODO: time_released? time_last_applied? I got a fever and the only
// prescription is more timestamps
}

#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
pub struct SystemUpdate {
#[serde(flatten)]
pub identity: AssetIdentityMetadata,
pub version: SemverVersion,
}

#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
pub struct ComponentUpdate {
#[serde(flatten)]
pub identity: AssetIdentityMetadata,

pub component_type: shared::UpdateableComponentType,
pub version: SemverVersion,
}

#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
pub struct UpdateableComponent {
#[serde(flatten)]
pub identity: AssetIdentityMetadata,

pub device_id: String,
pub component_type: shared::UpdateableComponentType,
pub version: SemverVersion,
pub system_version: SemverVersion,
pub status: UpdateStatus,
}

#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
pub struct UpdateDeployment {
#[serde(flatten)]
pub identity: AssetIdentityMetadata,
pub version: SemverVersion,
pub status: UpdateStatus,
}

// SYSTEM HEALTH

#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, JsonSchema)]
Expand Down

0 comments on commit c012765

Please sign in to comment.