You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
997 B
Rust
41 lines
997 B
Rust
use std::collections::HashMap;
|
|
|
|
use buildkit_proto::moby::buildkit::v1::frontend::CacheOptionsEntry as CacheOptionsEntryProto;
|
|
use serde::Deserialize;
|
|
|
|
#[derive(Clone, Debug, Deserialize, PartialEq)]
|
|
pub struct CacheOptionsEntry {
|
|
#[serde(rename = "Type")]
|
|
pub cache_type: CacheType,
|
|
|
|
#[serde(rename = "Attrs")]
|
|
pub attrs: HashMap<String, String>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize, PartialEq)]
|
|
#[serde(rename_all = "lowercase")]
|
|
pub enum CacheType {
|
|
Local,
|
|
Registry,
|
|
Inline,
|
|
}
|
|
|
|
impl Into<CacheOptionsEntryProto> for CacheOptionsEntry {
|
|
fn into(self) -> CacheOptionsEntryProto {
|
|
CacheOptionsEntryProto {
|
|
r#type: self.cache_type.into(),
|
|
attrs: self.attrs,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Into<String> for CacheType {
|
|
fn into(self) -> String {
|
|
match self {
|
|
CacheType::Local => "local".into(),
|
|
CacheType::Registry => "registry".into(),
|
|
CacheType::Inline => "inline".into(),
|
|
}
|
|
}
|
|
}
|