use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum ServiceStateEnum {
StateUnspecified,
Disabled,
Enabled,
#[serde(other)]
Unknown,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum CheckIfServiceHasUsage {
CheckIfServiceHasUsageUnspecified,
Skip,
Check,
#[serde(other)]
Unknown,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ServiceState {
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub parent: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<ServiceStateEnum>,
}
impl ServiceState {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {
name: "test-google_api_serviceusage_v1_service".into(),
parent: Some("test-parent".into()),
state: Some(ServiceStateEnum::StateUnspecified),
}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DisableServiceRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub disable_dependent_services: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub check_if_service_has_usage: Option<CheckIfServiceHasUsage>,
}
impl DisableServiceRequest {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {
disable_dependent_services: Some(false),
check_if_service_has_usage: Some(
CheckIfServiceHasUsage::CheckIfServiceHasUsageUnspecified,
),
}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EnableServiceRequest {}
impl EnableServiceRequest {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ServiceUsageLro {
pub name: String,
#[serde(default)]
pub done: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<serde_json::Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub response: Option<serde_json::Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<serde_json::Value>,
}
impl ServiceUsageLro {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self::fixture_done()
}
#[cfg(any(test, feature = "test-support"))]
pub fn fixture_pending() -> Self {
Self {
name: "operation-pending".into(),
done: false,
..Default::default()
}
}
#[cfg(any(test, feature = "test-support"))]
pub fn fixture_done() -> Self {
Self {
name: "operation-done".into(),
done: true,
..Default::default()
}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct BatchEnableServicesRequest {
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub service_ids: Vec<String>,
}
impl BatchEnableServicesRequest {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {
service_ids: vec![],
}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ListServicesResponse {
#[serde(default)]
pub services: Vec<ServiceState>,
#[serde(skip_serializing_if = "Option::is_none")]
pub next_page_token: Option<String>,
}
impl ListServicesResponse {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {
services: vec![],
next_page_token: None,
}
}
}