Skip to main content

nominal_api/conjure/objects/scout/metadata/
get_metadata_usage_count_request.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    PartialEq,
7    Eq,
8    PartialOrd,
9    Ord,
10    Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct GetMetadataUsageCountRequest {
16    #[builder(custom(type = super::MetadataUsageQuery, convert = Box::new))]
17    #[serde(rename = "query")]
18    query: Box<super::MetadataUsageQuery>,
19    #[builder(default, into)]
20    #[serde(rename = "resourceTypes", skip_serializing_if = "Option::is_none", default)]
21    resource_types: Option<std::collections::BTreeSet<super::ResourceType>>,
22    #[builder(default, into)]
23    #[serde(rename = "workspaces", skip_serializing_if = "Option::is_none", default)]
24    workspaces: Option<std::collections::BTreeSet<conjure_object::ResourceIdentifier>>,
25}
26impl GetMetadataUsageCountRequest {
27    /// Constructs a new instance of the type.
28    #[inline]
29    pub fn new(query: super::MetadataUsageQuery) -> Self {
30        Self::builder().query(query).build()
31    }
32    #[inline]
33    pub fn query(&self) -> &super::MetadataUsageQuery {
34        &*self.query
35    }
36    /// If omitted, all resource types are included.
37    #[inline]
38    pub fn resource_types(
39        &self,
40    ) -> Option<&std::collections::BTreeSet<super::ResourceType>> {
41        self.resource_types.as_ref().map(|o| &*o)
42    }
43    /// If omitted, results will come from all workspaces the user belongs to.
44    #[inline]
45    pub fn workspaces(
46        &self,
47    ) -> Option<&std::collections::BTreeSet<conjure_object::ResourceIdentifier>> {
48        self.workspaces.as_ref().map(|o| &*o)
49    }
50}