chore(connlib): support can_be_disabled from the portal for internet resource (#6396)

In preparation for #6299

---------

Signed-off-by: Gabi <gabrielalejandro7@gmail.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
This commit is contained in:
Gabi
2024-08-22 01:32:11 -03:00
committed by GitHub
parent a1049b7d78
commit ebfa561c53
2 changed files with 11 additions and 3 deletions

View File

@@ -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<Site>,
/// Whether or not resource can be disabled from UI
pub can_be_disabled: Option<bool>,
}
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,
}
}

View File

@@ -78,7 +78,13 @@ pub fn cidr_resource(
pub fn internet_resource(
sites: impl Strategy<Value = Vec<Site>>,
) -> impl Strategy<Value = ResourceDescriptionInternet> {
(resource_id(), sites).prop_map(move |(id, sites)| ResourceDescriptionInternet { id, sites })
(resource_id(), sites, any::<bool>()).prop_map(move |(id, sites, can_be_disabled)| {
ResourceDescriptionInternet {
id,
sites,
can_be_disabled: Some(can_be_disabled),
}
})
}
pub fn address_description() -> impl Strategy<Value = Option<String>> {