From ebfa561c53b83e07e0fe0b546b85a4f21a9fff71 Mon Sep 17 00:00:00 2001 From: Gabi Date: Thu, 22 Aug 2024 01:32:11 -0300 Subject: [PATCH] chore(connlib): support can_be_disabled from the portal for internet resource (#6396) In preparation for #6299 --------- Signed-off-by: Gabi Co-authored-by: Thomas Eizinger --- rust/connlib/shared/src/messages/client.rs | 6 ++++-- rust/connlib/tunnel/src/proptest.rs | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/rust/connlib/shared/src/messages/client.rs b/rust/connlib/shared/src/messages/client.rs index dbb63b85b..5eef44813 100644 --- a/rust/connlib/shared/src/messages/client.rs +++ b/rust/connlib/shared/src/messages/client.rs @@ -78,9 +78,11 @@ impl ResourceDescriptionCidr { pub struct ResourceDescriptionInternet { /// Resource's id. pub id: ResourceId, - // TBD + /// Sites for the internet resource #[serde(rename = "gateway_groups")] pub sites: Vec, + /// Whether or not resource can be disabled from UI + pub can_be_disabled: Option, } impl ResourceDescriptionInternet { @@ -90,7 +92,7 @@ impl ResourceDescriptionInternet { address: "All internet addresses".to_string(), id: self.id, sites: self.sites, - can_be_disabled: false, + can_be_disabled: self.can_be_disabled.unwrap_or_default(), status, } } diff --git a/rust/connlib/tunnel/src/proptest.rs b/rust/connlib/tunnel/src/proptest.rs index 980af98f5..d95d78ba1 100644 --- a/rust/connlib/tunnel/src/proptest.rs +++ b/rust/connlib/tunnel/src/proptest.rs @@ -78,7 +78,13 @@ pub fn cidr_resource( pub fn internet_resource( sites: impl Strategy>, ) -> impl Strategy { - (resource_id(), sites).prop_map(move |(id, sites)| ResourceDescriptionInternet { id, sites }) + (resource_id(), sites, any::()).prop_map(move |(id, sites, can_be_disabled)| { + ResourceDescriptionInternet { + id, + sites, + can_be_disabled: Some(can_be_disabled), + } + }) } pub fn address_description() -> impl Strategy> {