Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(3/5) [nexus] Add CRUD implementations for Affinity/Anti-Affinity Groups #7445

Open
wants to merge 10 commits into
base: affinity-db-model
Choose a base branch
from
6 changes: 6 additions & 0 deletions common/src/api/external/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ impl<'a> From<&'a Name> for &'a str {
}
}

impl From<Name> for String {
fn from(name: Name) -> Self {
name.0
}
}

/// `Name` instances are comparable like Strings, primarily so that they can
/// be used as keys in trees.
impl<S> PartialEq<S> for Name
Expand Down
16 changes: 16 additions & 0 deletions nexus/auth/src/authz/api_resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,22 @@ authz_resource! {
polar_snippet = InProject,
}

authz_resource! {
name = "AffinityGroup",
parent = "Project",
primary_key = Uuid,
roles_allowed = false,
polar_snippet = InProject,
}

authz_resource! {
name = "AntiAffinityGroup",
parent = "Project",
primary_key = Uuid,
roles_allowed = false,
polar_snippet = InProject,
}

authz_resource! {
name = "InstanceNetworkInterface",
parent = "Instance",
Expand Down
2 changes: 2 additions & 0 deletions nexus/auth/src/authz/oso_generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ pub fn make_omicron_oso(log: &slog::Logger) -> Result<OsoInit, anyhow::Error> {
Disk::init(),
Snapshot::init(),
ProjectImage::init(),
AffinityGroup::init(),
AntiAffinityGroup::init(),
Instance::init(),
IpPool::init(),
InstanceNetworkInterface::init(),
Expand Down
Loading
Loading