use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Secret {
pub name: String,
#[serde(default)]
#[serde(skip_serializing_if = "HashMap::is_empty")]
pub labels: HashMap<String, String>,
#[serde(default)]
#[serde(skip_serializing_if = "HashMap::is_empty")]
pub annotations: HashMap<String, String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub etag: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub replication: Option<Replication>,
#[serde(skip_serializing_if = "Option::is_none")]
pub create_time: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub expire_time: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub rotation: Option<Rotation>,
}
impl Secret {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {
name: "test-secret".into(),
labels: Default::default(),
annotations: Default::default(),
etag: Some("test-etag".into()),
replication: Some(Replication::fixture()),
create_time: Some("test-create_time".into()),
expire_time: Some("test-expire_time".into()),
rotation: Some(Rotation::fixture()),
}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Replication {
#[serde(skip_serializing_if = "Option::is_none")]
pub user_managed: Option<UserManaged>,
#[serde(skip_serializing_if = "Option::is_none")]
pub automatic: Option<Automatic>,
}
impl Replication {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {
user_managed: Some(UserManaged::fixture()),
automatic: Some(Automatic::fixture()),
}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Automatic {
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_managed_encryption: Option<CustomerManagedEncryption>,
}
impl Automatic {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {
customer_managed_encryption: Some(CustomerManagedEncryption::fixture()),
}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct UserManaged {
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub replicas: Vec<Replica>,
}
impl UserManaged {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self { replicas: vec![] }
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Replica {
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_managed_encryption: Option<CustomerManagedEncryption>,
}
impl Replica {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {
location: Some("test-location".into()),
customer_managed_encryption: Some(CustomerManagedEncryption::fixture()),
}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CustomerManagedEncryption {
#[serde(skip_serializing_if = "Option::is_none")]
pub kms_key_name: Option<String>,
}
impl CustomerManagedEncryption {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {
kms_key_name: Some("test-kms_key_name".into()),
}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Rotation {
#[serde(skip_serializing_if = "Option::is_none")]
pub next_rotation_time: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub rotation_period: Option<String>,
}
impl Rotation {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {
next_rotation_time: Some("test-next_rotation_time".into()),
rotation_period: Some("test-rotation_period".into()),
}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ListSecretsResponse {
#[serde(skip_serializing_if = "Option::is_none")]
pub total_size: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub next_page_token: Option<String>,
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub secrets: Vec<Secret>,
}
impl ListSecretsResponse {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {
total_size: Some(100),
next_page_token: Some("test-next_page_token".into()),
secrets: vec![],
}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Empty {}
impl Empty {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {}
}
}