#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct ResourceInfoParams {
pub model: String,
pub resource_id: Option<String>,
}
impl ResourceInfoParams {
pub fn new(model: impl Into<String>) -> Self {
Self {
model: model.into(),
resource_id: None,
}
}
pub fn with_resource_id(mut self, resource_id: impl Into<String>) -> Self {
self.resource_id = Some(resource_id.into());
self
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct QueryResourceNameParams {
pub subject_ids: Vec<String>,
}
impl QueryResourceNameParams {
pub fn new(subject_ids: impl Into<Vec<String>>) -> Self {
Self {
subject_ids: subject_ids.into(),
}
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct ConfigResourceInfoParams {
pub subject_id: String,
pub resource_id: String,
pub name: String,
}
impl ConfigResourceInfoParams {
pub fn new(
subject_id: impl Into<String>,
resource_id: impl Into<String>,
name: impl Into<String>,
) -> Self {
Self {
subject_id: subject_id.into(),
resource_id: resource_id.into(),
name: name.into(),
}
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct ResourceValueQuery {
pub subject_id: String,
pub resource_ids: Option<Vec<String>>,
}
impl ResourceValueQuery {
pub fn new(subject_id: impl Into<String>) -> Self {
Self {
subject_id: subject_id.into(),
resource_ids: None,
}
}
pub fn with_resource_ids(mut self, resource_ids: impl Into<Vec<String>>) -> Self {
self.resource_ids = Some(resource_ids.into());
self
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct QueryResourceValueParams {
pub resources: Vec<ResourceValueQuery>,
}
impl QueryResourceValueParams {
pub fn new(resources: impl Into<Vec<ResourceValueQuery>>) -> Self {
Self {
resources: resources.into(),
}
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct WriteResource {
pub resource_id: String,
pub value: String,
}
impl WriteResource {
pub fn new(resource_id: impl Into<String>, value: impl Into<String>) -> Self {
Self {
resource_id: resource_id.into(),
value: value.into(),
}
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct WriteResourceDeviceItem {
pub subject_id: String,
pub resources: Vec<WriteResource>,
}
impl WriteResourceDeviceItem {
pub fn new(subject_id: impl Into<String>, resources: impl Into<Vec<WriteResource>>) -> Self {
Self {
subject_id: subject_id.into(),
resources: resources.into(),
}
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct WriteResourceDeviceParams {
pub data: Vec<WriteResourceDeviceItem>,
}
impl WriteResourceDeviceParams {
pub fn new(data: impl Into<Vec<WriteResourceDeviceItem>>) -> Self {
Self { data: data.into() }
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct FetchResourceHistoryParams {
pub subject_id: String,
pub resource_ids: Vec<String>,
pub start_time: String,
pub end_time: Option<String>,
pub size: Option<u32>,
pub scan_id: Option<String>,
}
impl FetchResourceHistoryParams {
pub fn new(
subject_id: impl Into<String>,
resource_ids: impl Into<Vec<String>>,
start_time: impl Into<String>,
) -> Self {
Self {
subject_id: subject_id.into(),
resource_ids: resource_ids.into(),
start_time: start_time.into(),
end_time: None,
size: None,
scan_id: None,
}
}
pub fn with_end_time(mut self, end_time: impl Into<String>) -> Self {
self.end_time = Some(end_time.into());
self
}
pub fn with_size(mut self, size: u32) -> Self {
self.size = Some(size);
self
}
pub fn with_scan_id(mut self, scan_id: impl Into<String>) -> Self {
self.scan_id = Some(scan_id.into());
self
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct ResourceStatisticsQuery {
pub subject_id: String,
pub resource_ids: Vec<String>,
pub aggr_types: Vec<i32>,
}
impl ResourceStatisticsQuery {
pub fn new(
subject_id: impl Into<String>,
resource_ids: impl Into<Vec<String>>,
aggr_types: impl Into<Vec<i32>>,
) -> Self {
Self {
subject_id: subject_id.into(),
resource_ids: resource_ids.into(),
aggr_types: aggr_types.into(),
}
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct FetchResourceStatisticsParams {
pub resources: ResourceStatisticsQuery,
pub start_time: String,
pub end_time: Option<String>,
pub dimension: String,
pub size: Option<u32>,
pub scan_id: Option<String>,
}
impl FetchResourceStatisticsParams {
pub fn new(
resources: ResourceStatisticsQuery,
start_time: impl Into<String>,
dimension: impl Into<String>,
) -> Self {
Self {
resources,
start_time: start_time.into(),
end_time: None,
dimension: dimension.into(),
size: None,
scan_id: None,
}
}
pub fn with_end_time(mut self, end_time: impl Into<String>) -> Self {
self.end_time = Some(end_time.into());
self
}
pub fn with_size(mut self, size: u32) -> Self {
self.size = Some(size);
self
}
pub fn with_scan_id(mut self, scan_id: impl Into<String>) -> Self {
self.scan_id = Some(scan_id.into());
self
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct CommandDeviceResourceParams {
pub position_id: String,
pub query_text: String,
}
impl CommandDeviceResourceParams {
pub fn new(position_id: impl Into<String>, query_text: impl Into<String>) -> Self {
Self {
position_id: position_id.into(),
query_text: query_text.into(),
}
}
}