use crate::error::OciSpecError;
use derive_builder::Builder;
use getset::{CopyGetters, Getters, Setters};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(
Builder,
Clone,
Debug,
Default,
Deserialize,
Eq,
CopyGetters,
Getters,
Setters,
PartialEq,
Serialize,
)]
#[serde(rename_all = "camelCase")]
#[builder(
default,
pattern = "owned",
setter(into, strip_option),
build_fn(error = "OciSpecError")
)]
pub struct Windows {
#[serde(default, skip_serializing_if = "Option::is_none")]
#[getset(get = "pub", set = "pub")]
layer_folders: Option<Vec<String>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[getset(get = "pub", set = "pub")]
devices: Option<Vec<WindowsDevice>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[getset(get_copy = "pub", set = "pub")]
resources: Option<WindowsResources>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[getset(get = "pub", set = "pub")]
credential_spec: Option<HashMap<String, Option<serde_json::Value>>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[getset(get_copy = "pub", set = "pub")]
servicing: Option<bool>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[getset(get_copy = "pub", set = "pub")]
ignore_flushes_during_boot: Option<bool>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[getset(get = "pub", set = "pub")]
hyperv: Option<WindowsHyperV>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[getset(get = "pub", set = "pub")]
network: Option<WindowsNetwork>,
}
#[derive(
Builder, Clone, Debug, Default, Deserialize, Eq, Getters, Setters, PartialEq, Serialize,
)]
#[serde(rename_all = "camelCase")]
#[builder(
default,
pattern = "owned",
setter(into, strip_option),
build_fn(error = "OciSpecError")
)]
#[getset(get = "pub", set = "pub")]
pub struct WindowsDevice {
id: String,
id_type: String,
}
#[derive(
Builder, Clone, Copy, Debug, Default, Deserialize, Eq, Getters, Setters, PartialEq, Serialize,
)]
#[builder(
default,
pattern = "owned",
setter(into, strip_option),
build_fn(error = "OciSpecError")
)]
#[getset(get_copy = "pub", set = "pub")]
pub struct WindowsResources {
#[serde(default, skip_serializing_if = "Option::is_none")]
memory: Option<WindowsMemoryResources>,
#[serde(default, skip_serializing_if = "Option::is_none")]
cpu: Option<WindowsCPUResources>,
#[serde(default, skip_serializing_if = "Option::is_none")]
storage: Option<WindowsStorageResources>,
}
#[derive(
Builder, Clone, Copy, Debug, Default, Deserialize, Eq, Getters, Setters, PartialEq, Serialize,
)]
#[builder(
default,
pattern = "owned",
setter(into, strip_option),
build_fn(error = "OciSpecError")
)]
#[getset(get_copy = "pub", set = "pub")]
pub struct WindowsMemoryResources {
#[serde(default, skip_serializing_if = "Option::is_none")]
limit: Option<u64>,
}
#[derive(
Builder, Clone, Copy, Debug, Default, Deserialize, Eq, Getters, Setters, PartialEq, Serialize,
)]
#[builder(
default,
pattern = "owned",
setter(into, strip_option),
build_fn(error = "OciSpecError")
)]
#[getset(get_copy = "pub", set = "pub")]
pub struct WindowsCPUResources {
#[serde(default, skip_serializing_if = "Option::is_none")]
count: Option<u64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
shares: Option<u16>,
#[serde(default, skip_serializing_if = "Option::is_none")]
maximum: Option<u16>,
}
#[derive(
Builder, Clone, Copy, Debug, Default, Deserialize, Eq, Getters, Setters, PartialEq, Serialize,
)]
#[serde(rename_all = "camelCase")]
#[builder(
default,
pattern = "owned",
setter(into, strip_option),
build_fn(error = "OciSpecError")
)]
#[getset(get_copy = "pub", set = "pub")]
pub struct WindowsStorageResources {
#[serde(default, skip_serializing_if = "Option::is_none")]
iops: Option<u64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
bps: Option<u64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
sandbox_size: Option<u64>,
}
#[derive(
Builder, Clone, Debug, Default, Deserialize, Eq, Getters, Setters, PartialEq, Serialize,
)]
#[serde(rename_all = "camelCase")]
#[builder(
default,
pattern = "owned",
setter(into, strip_option),
build_fn(error = "OciSpecError")
)]
#[getset(get = "pub", set = "pub")]
pub struct WindowsHyperV {
#[serde(default, skip_serializing_if = "Option::is_none")]
utility_vm_path: Option<String>,
}
#[derive(
Builder, Clone, Debug, Default, Deserialize, Eq, Getters, Setters, PartialEq, Serialize,
)]
#[serde(rename_all = "camelCase")]
#[builder(
default,
pattern = "owned",
setter(into, strip_option),
build_fn(error = "OciSpecError")
)]
pub struct WindowsNetwork {
#[serde(default, skip_serializing_if = "Option::is_none")]
#[getset(get = "pub", set = "pub")]
endpoint_list: Option<Vec<String>>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
rename = "allowUnqualifiedDNSQuery"
)]
#[getset(get_copy = "pub", set = "pub")]
allow_unqualified_dns_query: Option<bool>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
rename = "DNSSearchList"
)]
#[getset(get = "pub", set = "pub")]
dns_search_list: Option<Vec<String>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[getset(get = "pub", set = "pub")]
network_shared_container_name: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[getset(get = "pub", set = "pub")]
network_namespace: Option<String>,
}