mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2025-12-29 03:01:03 +01:00
fix arguments
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use dagger_core::introspection::{FullType, InputValue, TypeRef, __TypeKind};
|
use dagger_core::introspection::{FullType, FullTypeFields, InputValue, TypeRef, __TypeKind};
|
||||||
use eyre::ContextCompat;
|
use eyre::ContextCompat;
|
||||||
|
|
||||||
use crate::utility::OptionExt;
|
use crate::utility::OptionExt;
|
||||||
@@ -154,6 +154,19 @@ pub fn type_ref_is_optional(type_ref: &TypeRef) -> bool {
|
|||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn type_field_has_optional(field: &FullTypeFields) -> bool {
|
||||||
|
field
|
||||||
|
.args
|
||||||
|
.pipe(|a| {
|
||||||
|
a.iter()
|
||||||
|
.map(|a| a.pipe(|a| &a.input_value))
|
||||||
|
.flatten()
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
})
|
||||||
|
.pipe(|s| input_values_has_optionals(s.as_slice()))
|
||||||
|
.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn type_ref_is_scalar(type_ref: &TypeRef) -> bool {
|
pub fn type_ref_is_scalar(type_ref: &TypeRef) -> bool {
|
||||||
type_ref
|
type_ref
|
||||||
.kind
|
.kind
|
||||||
@@ -175,7 +188,7 @@ pub fn type_ref_is_list(type_ref: &TypeRef) -> bool {
|
|||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn input_values_has_optionals(input_values: &[InputValue]) -> bool {
|
pub fn input_values_has_optionals(input_values: &[&InputValue]) -> bool {
|
||||||
input_values
|
input_values
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|k| type_ref_is_optional(&k.type_))
|
.map(|k| type_ref_is_optional(&k.type_))
|
||||||
@@ -324,7 +337,7 @@ mod test {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
let output = input_values_has_optionals(&input);
|
let output = input_values_has_optionals(input.iter().collect::<Vec<_>>().as_slice());
|
||||||
|
|
||||||
assert_eq!(output, true);
|
assert_eq!(output, true);
|
||||||
}
|
}
|
||||||
@@ -354,7 +367,7 @@ mod test {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
let output = input_values_has_optionals(&input);
|
let output = input_values_has_optionals(input.iter().collect::<Vec<_>>().as_slice());
|
||||||
|
|
||||||
assert_eq!(output, false);
|
assert_eq!(output, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ impl FormatTypeFuncs for FormatTypeFunc {
|
|||||||
input: bool,
|
input: bool,
|
||||||
) -> String {
|
) -> String {
|
||||||
let mut rep = representation.to_string();
|
let mut rep = representation.to_string();
|
||||||
rep.push_str(ref_name);
|
rep.push_str(&format_name(ref_name));
|
||||||
rep
|
rep
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ impl FormatTypeFuncs for FormatTypeFunc {
|
|||||||
|
|
||||||
fn format_kind_enum(&self, representation: &str, ref_name: &str) -> String {
|
fn format_kind_enum(&self, representation: &str, ref_name: &str) -> String {
|
||||||
let mut rep = representation.to_string();
|
let mut rep = representation.to_string();
|
||||||
rep.push_str(ref_name);
|
rep.push_str(&format_name(ref_name));
|
||||||
rep
|
rep
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
use convert_case::{Case, Casing};
|
use convert_case::{Case, Casing};
|
||||||
use dagger_core::introspection::FullTypeFields;
|
use dagger_core::introspection::FullTypeFields;
|
||||||
|
use genco::prelude::rust;
|
||||||
|
use genco::quote;
|
||||||
|
|
||||||
|
use crate::functions::{
|
||||||
|
input_values_has_optionals, type_field_has_optional, type_ref_is_optional, CommonFunctions,
|
||||||
|
};
|
||||||
|
use crate::utility::OptionExt;
|
||||||
|
|
||||||
pub fn format_name(s: &str) -> String {
|
pub fn format_name(s: &str) -> String {
|
||||||
s.to_case(Case::Pascal)
|
s.to_case(Case::Pascal)
|
||||||
@@ -18,3 +25,61 @@ pub fn field_options_struct_name(field: &FullTypeFields) -> Option<String> {
|
|||||||
.zip(field.name.as_ref().map(|n| format_name(n)))
|
.zip(field.name.as_ref().map(|n| format_name(n)))
|
||||||
.map(|(parent_name, field_name)| format!("{parent_name}{field_name}Opts"))
|
.map(|(parent_name, field_name)| format!("{parent_name}{field_name}Opts"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn format_function(funcs: &CommonFunctions, field: &FullTypeFields) -> Option<rust::Tokens> {
|
||||||
|
let signature = quote! {
|
||||||
|
pub fn $(field.name.pipe(|n | format_struct_name(n)))
|
||||||
|
};
|
||||||
|
let args = format_function_args(funcs, field);
|
||||||
|
|
||||||
|
let output_type = field
|
||||||
|
.type_
|
||||||
|
.pipe(|t| &t.type_ref)
|
||||||
|
.pipe(|t| funcs.format_output_type(t));
|
||||||
|
|
||||||
|
Some(quote! {
|
||||||
|
$(signature)(
|
||||||
|
$(args)
|
||||||
|
) -> $(output_type) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn format_function_args(funcs: &CommonFunctions, field: &FullTypeFields) -> Option<rust::Tokens> {
|
||||||
|
if let Some(args) = field.args.as_ref() {
|
||||||
|
let args = args
|
||||||
|
.into_iter()
|
||||||
|
.map(|a| {
|
||||||
|
a.as_ref().and_then(|s| {
|
||||||
|
if type_ref_is_optional(&s.input_value.type_) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let t = funcs.format_input_type(&s.input_value.type_);
|
||||||
|
let n = format_struct_name(&s.input_value.name);
|
||||||
|
|
||||||
|
Some(quote! {
|
||||||
|
$(n): $(t),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.flatten()
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
let required_args = quote! {
|
||||||
|
&self,
|
||||||
|
$(for arg in args join ($['\r']) => $arg)
|
||||||
|
};
|
||||||
|
|
||||||
|
if type_field_has_optional(field) {
|
||||||
|
Some(quote! {
|
||||||
|
$(required_args)
|
||||||
|
opts: Option<$(field_options_struct_name(field))>
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Some(required_args)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,8 +2,12 @@ use dagger_core::introspection::{FullType, FullTypeFields, FullTypeFieldsArgs};
|
|||||||
use genco::prelude::rust;
|
use genco::prelude::rust;
|
||||||
use genco::quote;
|
use genco::quote;
|
||||||
|
|
||||||
use crate::functions::CommonFunctions;
|
use crate::functions::{
|
||||||
use crate::rust::functions::{field_options_struct_name, format_name, format_struct_name};
|
input_values_has_optionals, type_field_has_optional, type_ref_is_optional, CommonFunctions,
|
||||||
|
};
|
||||||
|
use crate::rust::functions::{
|
||||||
|
field_options_struct_name, format_function, format_name, format_struct_name,
|
||||||
|
};
|
||||||
use crate::utility::OptionExt;
|
use crate::utility::OptionExt;
|
||||||
|
|
||||||
pub fn render_object(funcs: &CommonFunctions, t: &FullType) -> eyre::Result<rust::Tokens> {
|
pub fn render_object(funcs: &CommonFunctions, t: &FullType) -> eyre::Result<rust::Tokens> {
|
||||||
@@ -15,7 +19,7 @@ pub fn render_object(funcs: &CommonFunctions, t: &FullType) -> eyre::Result<rust
|
|||||||
$(t.fields.pipe(|f| render_optional_args(funcs, f)))
|
$(t.fields.pipe(|f| render_optional_args(funcs, f)))
|
||||||
|
|
||||||
impl $(t.name.pipe(|s| format_name(s))) {
|
impl $(t.name.pipe(|s| format_name(s))) {
|
||||||
|
$(t.fields.pipe(|f| render_functions(funcs, f)))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -44,6 +48,11 @@ fn render_optional_arg(funcs: &CommonFunctions, field: &FullTypeFields) -> Optio
|
|||||||
let fields = field
|
let fields = field
|
||||||
.args
|
.args
|
||||||
.pipe(|t| t.into_iter().flatten().collect::<Vec<_>>())
|
.pipe(|t| t.into_iter().flatten().collect::<Vec<_>>())
|
||||||
|
.map(|t| {
|
||||||
|
t.into_iter()
|
||||||
|
.filter(|t| type_ref_is_optional(&t.input_value.type_))
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
})
|
||||||
.pipe(|t| render_optional_field_args(funcs, t))
|
.pipe(|t| render_optional_field_args(funcs, t))
|
||||||
.flatten();
|
.flatten();
|
||||||
|
|
||||||
@@ -67,7 +76,7 @@ fn render_optional_field_args(
|
|||||||
}
|
}
|
||||||
let rendered_args = args.into_iter().map(|a| &a.input_value).map(|a| {
|
let rendered_args = args.into_iter().map(|a| &a.input_value).map(|a| {
|
||||||
quote! {
|
quote! {
|
||||||
pub $(format_struct_name(&a.name)): $(funcs.format_output_type(&a.type_)),
|
pub $(format_struct_name(&a.name)): Option<$(funcs.format_output_type(&a.type_))>,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -75,3 +84,24 @@ fn render_optional_field_args(
|
|||||||
$(for arg in rendered_args join ($['\r']) => $arg)
|
$(for arg in rendered_args join ($['\r']) => $arg)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn render_functions(funcs: &CommonFunctions, fields: &Vec<FullTypeFields>) -> Option<rust::Tokens> {
|
||||||
|
let rendered_functions = fields
|
||||||
|
.iter()
|
||||||
|
.map(|f| render_function(funcs, f))
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
if rendered_functions.len() > 0 {
|
||||||
|
Some(quote! {
|
||||||
|
$(for func in rendered_functions join ($['\r']) => $func)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render_function(funcs: &CommonFunctions, field: &FullTypeFields) -> Option<rust::Tokens> {
|
||||||
|
Some(quote! {
|
||||||
|
$(format_function(funcs, field))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ use genco::prelude::rust;
|
|||||||
use genco::quote;
|
use genco::quote;
|
||||||
|
|
||||||
use crate::rust::functions::format_name;
|
use crate::rust::functions::format_name;
|
||||||
|
use crate::utility::OptionExt;
|
||||||
|
|
||||||
pub fn render_scalar(t: &FullType) -> eyre::Result<rust::Tokens> {
|
pub fn render_scalar(t: &FullType) -> eyre::Result<rust::Tokens> {
|
||||||
Ok(quote! {
|
Ok(quote! {
|
||||||
pub struct $(format_name(&t.name.as_ref().unwrap()))(String);
|
pub struct $(t.name.pipe(|n|format_name(n)))(String);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,361 +9,519 @@ pub struct BuildArg {
|
|||||||
pub name: String,
|
pub name: String,
|
||||||
pub value: String,
|
pub value: String,
|
||||||
}
|
}
|
||||||
pub struct CacheVolume {
|
pub struct CacheVolume {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CacheVolume {
|
impl CacheVolume {
|
||||||
|
pub fn id(&self) -> CacheId {
|
||||||
}
|
todo!()
|
||||||
pub struct Container {
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
pub struct Container {}
|
||||||
|
|
||||||
pub struct ContainerBuildOpts {
|
pub struct ContainerBuildOpts {
|
||||||
pub context: DirectoryID,
|
pub dockerfile: Option<String>,
|
||||||
pub dockerfile: String,
|
pub build_args: Option<Vec<BuildArg>>,
|
||||||
pub build_args: Vec<BuildArg>,
|
pub target: Option<String>,
|
||||||
pub target: String,
|
|
||||||
}
|
|
||||||
pub struct ContainerDirectoryOpts {
|
|
||||||
pub path: String,
|
|
||||||
}
|
|
||||||
pub struct ContainerEnvVariableOpts {
|
|
||||||
pub name: String,
|
|
||||||
}
|
}
|
||||||
pub struct ContainerExecOpts {
|
pub struct ContainerExecOpts {
|
||||||
pub args: Vec<String>,
|
pub args: Option<Vec<String>>,
|
||||||
pub stdin: String,
|
pub stdin: Option<String>,
|
||||||
pub redirect_stdout: String,
|
pub redirect_stdout: Option<String>,
|
||||||
pub redirect_stderr: String,
|
pub redirect_stderr: Option<String>,
|
||||||
pub experimental_privileged_nesting: bool,
|
pub experimental_privileged_nesting: Option<bool>,
|
||||||
}
|
}
|
||||||
pub struct ContainerExportOpts {
|
pub struct ContainerExportOpts {
|
||||||
pub path: String,
|
pub platform_variants: Option<Vec<ContainerId>>,
|
||||||
pub platform_variants: Vec<ContainerID>,
|
|
||||||
}
|
|
||||||
pub struct ContainerFileOpts {
|
|
||||||
pub path: String,
|
|
||||||
}
|
|
||||||
pub struct ContainerFromOpts {
|
|
||||||
pub address: String,
|
|
||||||
}
|
|
||||||
pub struct ContainerLabelOpts {
|
|
||||||
pub name: String,
|
|
||||||
}
|
}
|
||||||
pub struct ContainerPipelineOpts {
|
pub struct ContainerPipelineOpts {
|
||||||
pub name: String,
|
pub description: Option<String>,
|
||||||
pub description: String,
|
|
||||||
}
|
}
|
||||||
pub struct ContainerPublishOpts {
|
pub struct ContainerPublishOpts {
|
||||||
pub address: String,
|
pub platform_variants: Option<Vec<ContainerId>>,
|
||||||
pub platform_variants: Vec<ContainerID>,
|
|
||||||
}
|
}
|
||||||
pub struct ContainerWithDefaultArgsOpts {
|
pub struct ContainerWithDefaultArgsOpts {
|
||||||
pub args: Vec<String>,
|
pub args: Option<Vec<String>>,
|
||||||
}
|
}
|
||||||
pub struct ContainerWithDirectoryOpts {
|
pub struct ContainerWithDirectoryOpts {
|
||||||
pub path: String,
|
pub exclude: Option<Vec<String>>,
|
||||||
pub directory: DirectoryID,
|
pub include: Option<Vec<String>>,
|
||||||
pub exclude: Vec<String>,
|
|
||||||
pub include: Vec<String>,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithEntrypointOpts {
|
|
||||||
pub args: Vec<String>,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithEnvVariableOpts {
|
|
||||||
pub name: String,
|
|
||||||
pub value: String,
|
|
||||||
}
|
}
|
||||||
pub struct ContainerWithExecOpts {
|
pub struct ContainerWithExecOpts {
|
||||||
pub args: Vec<String>,
|
pub stdin: Option<String>,
|
||||||
pub stdin: String,
|
pub redirect_stdout: Option<String>,
|
||||||
pub redirect_stdout: String,
|
pub redirect_stderr: Option<String>,
|
||||||
pub redirect_stderr: String,
|
pub experimental_privileged_nesting: Option<bool>,
|
||||||
pub experimental_privileged_nesting: bool,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithFsOpts {
|
|
||||||
pub id: DirectoryID,
|
|
||||||
}
|
}
|
||||||
pub struct ContainerWithFileOpts {
|
pub struct ContainerWithFileOpts {
|
||||||
pub path: String,
|
pub permissions: Option<isize>,
|
||||||
pub source: FileID,
|
|
||||||
pub permissions: isize,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithLabelOpts {
|
|
||||||
pub name: String,
|
|
||||||
pub value: String,
|
|
||||||
}
|
}
|
||||||
pub struct ContainerWithMountedCacheOpts {
|
pub struct ContainerWithMountedCacheOpts {
|
||||||
pub path: String,
|
pub source: Option<DirectoryId>,
|
||||||
pub cache: CacheID,
|
|
||||||
pub source: DirectoryID,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithMountedDirectoryOpts {
|
|
||||||
pub path: String,
|
|
||||||
pub source: DirectoryID,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithMountedFileOpts {
|
|
||||||
pub path: String,
|
|
||||||
pub source: FileID,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithMountedSecretOpts {
|
|
||||||
pub path: String,
|
|
||||||
pub source: SecretID,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithMountedTempOpts {
|
|
||||||
pub path: String,
|
|
||||||
}
|
}
|
||||||
pub struct ContainerWithNewFileOpts {
|
pub struct ContainerWithNewFileOpts {
|
||||||
pub path: String,
|
pub contents: Option<String>,
|
||||||
pub contents: String,
|
pub permissions: Option<isize>,
|
||||||
pub permissions: isize,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithRootfsOpts {
|
|
||||||
pub id: DirectoryID,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithSecretVariableOpts {
|
|
||||||
pub name: String,
|
|
||||||
pub secret: SecretID,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithUnixSocketOpts {
|
|
||||||
pub path: String,
|
|
||||||
pub source: SocketID,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithUserOpts {
|
|
||||||
pub name: String,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithWorkdirOpts {
|
|
||||||
pub path: String,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithoutEnvVariableOpts {
|
|
||||||
pub name: String,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithoutLabelOpts {
|
|
||||||
pub name: String,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithoutMountOpts {
|
|
||||||
pub path: String,
|
|
||||||
}
|
|
||||||
pub struct ContainerWithoutUnixSocketOpts {
|
|
||||||
pub path: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Container {
|
impl Container {
|
||||||
|
pub fn build(&self, context: DirectoryId, opts: Option<ContainerBuildOpts>) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn default_args(&self) -> Vec<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn directory(&self, path: String) -> Directory {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn entrypoint(&self) -> Vec<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn env_variable(&self, name: String) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn env_variables(&self) -> Vec<EnvVariable> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn exec(&self, opts: Option<ContainerExecOpts>) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn exit_code(&self) -> isize {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn export(&self, path: String, opts: Option<ContainerExportOpts>) -> bool {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn file(&self, path: String) -> File {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn from(&self, address: String) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn fs(&self) -> Directory {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn id(&self) -> ContainerId {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn label(&self, name: String) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn labels(&self) -> Vec<Label> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn mounts(&self) -> Vec<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn pipeline(&self, name: String, opts: Option<ContainerPipelineOpts>) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn platform(&self) -> Platform {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn publish(&self, address: String, opts: Option<ContainerPublishOpts>) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn rootfs(&self) -> Directory {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn stderr(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn stdout(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn user(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_default_args(&self, opts: Option<ContainerWithDefaultArgsOpts>) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_directory(
|
||||||
|
&self,
|
||||||
|
path: String,
|
||||||
|
directory: DirectoryId,
|
||||||
|
opts: Option<ContainerWithDirectoryOpts>,
|
||||||
|
) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_entrypoint(&self, args: Vec<String>) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_env_variable(&self, name: String, value: String) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_exec(&self, args: Vec<String>, opts: Option<ContainerWithExecOpts>) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_fs(&self, id: DirectoryId) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_file(
|
||||||
|
&self,
|
||||||
|
path: String,
|
||||||
|
source: FileId,
|
||||||
|
opts: Option<ContainerWithFileOpts>,
|
||||||
|
) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_label(&self, name: String, value: String) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_mounted_cache(
|
||||||
|
&self,
|
||||||
|
path: String,
|
||||||
|
cache: CacheId,
|
||||||
|
opts: Option<ContainerWithMountedCacheOpts>,
|
||||||
|
) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_mounted_directory(&self, path: String, source: DirectoryId) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_mounted_file(&self, path: String, source: FileId) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_mounted_secret(&self, path: String, source: SecretId) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_mounted_temp(&self, path: String) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_new_file(&self, path: String, opts: Option<ContainerWithNewFileOpts>) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_rootfs(&self, id: DirectoryId) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_secret_variable(&self, name: String, secret: SecretId) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_unix_socket(&self, path: String, source: SocketId) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_user(&self, name: String) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_workdir(&self, path: String) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn without_env_variable(&self, name: String) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn without_label(&self, name: String) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn without_mount(&self, path: String) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn without_unix_socket(&self, path: String) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn workdir(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub struct Directory {}
|
||||||
|
|
||||||
}
|
|
||||||
pub struct Directory {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct DirectoryDiffOpts {
|
|
||||||
pub other: DirectoryID,
|
|
||||||
}
|
|
||||||
pub struct DirectoryDirectoryOpts {
|
|
||||||
pub path: String,
|
|
||||||
}
|
|
||||||
pub struct DirectoryDockerBuildOpts {
|
pub struct DirectoryDockerBuildOpts {
|
||||||
pub dockerfile: String,
|
pub dockerfile: Option<String>,
|
||||||
pub platform: Platform,
|
pub platform: Option<Platform>,
|
||||||
pub build_args: Vec<BuildArg>,
|
pub build_args: Option<Vec<BuildArg>>,
|
||||||
pub target: String,
|
pub target: Option<String>,
|
||||||
}
|
}
|
||||||
pub struct DirectoryEntriesOpts {
|
pub struct DirectoryEntriesOpts {
|
||||||
pub path: String,
|
pub path: Option<String>,
|
||||||
}
|
|
||||||
pub struct DirectoryExportOpts {
|
|
||||||
pub path: String,
|
|
||||||
}
|
|
||||||
pub struct DirectoryFileOpts {
|
|
||||||
pub path: String,
|
|
||||||
}
|
|
||||||
pub struct DirectoryLoadProjectOpts {
|
|
||||||
pub config_path: String,
|
|
||||||
}
|
}
|
||||||
pub struct DirectoryPipelineOpts {
|
pub struct DirectoryPipelineOpts {
|
||||||
pub name: String,
|
pub description: Option<String>,
|
||||||
pub description: String,
|
|
||||||
}
|
}
|
||||||
pub struct DirectoryWithDirectoryOpts {
|
pub struct DirectoryWithDirectoryOpts {
|
||||||
pub path: String,
|
pub exclude: Option<Vec<String>>,
|
||||||
pub directory: DirectoryID,
|
pub include: Option<Vec<String>>,
|
||||||
pub exclude: Vec<String>,
|
|
||||||
pub include: Vec<String>,
|
|
||||||
}
|
}
|
||||||
pub struct DirectoryWithFileOpts {
|
pub struct DirectoryWithFileOpts {
|
||||||
pub path: String,
|
pub permissions: Option<isize>,
|
||||||
pub source: FileID,
|
|
||||||
pub permissions: isize,
|
|
||||||
}
|
}
|
||||||
pub struct DirectoryWithNewDirectoryOpts {
|
pub struct DirectoryWithNewDirectoryOpts {
|
||||||
pub path: String,
|
pub permissions: Option<isize>,
|
||||||
pub permissions: isize,
|
|
||||||
}
|
}
|
||||||
pub struct DirectoryWithNewFileOpts {
|
pub struct DirectoryWithNewFileOpts {
|
||||||
pub path: String,
|
pub permissions: Option<isize>,
|
||||||
pub contents: String,
|
|
||||||
pub permissions: isize,
|
|
||||||
}
|
|
||||||
pub struct DirectoryWithTimestampsOpts {
|
|
||||||
pub timestamp: isize,
|
|
||||||
}
|
|
||||||
pub struct DirectoryWithoutDirectoryOpts {
|
|
||||||
pub path: String,
|
|
||||||
}
|
|
||||||
pub struct DirectoryWithoutFileOpts {
|
|
||||||
pub path: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Directory {
|
impl Directory {
|
||||||
|
pub fn diff(&self, other: DirectoryId) -> Directory {
|
||||||
}
|
todo!()
|
||||||
pub struct EnvVariable {
|
}
|
||||||
|
pub fn directory(&self, path: String) -> Directory {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn docker_build(&self, opts: Option<DirectoryDockerBuildOpts>) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn entries(&self, opts: Option<DirectoryEntriesOpts>) -> Vec<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn export(&self, path: String) -> bool {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn file(&self, path: String) -> File {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn id(&self) -> DirectoryId {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn load_project(&self, config_path: String) -> Project {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn pipeline(&self, name: String, opts: Option<DirectoryPipelineOpts>) -> Directory {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_directory(
|
||||||
|
&self,
|
||||||
|
path: String,
|
||||||
|
directory: DirectoryId,
|
||||||
|
opts: Option<DirectoryWithDirectoryOpts>,
|
||||||
|
) -> Directory {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_file(
|
||||||
|
&self,
|
||||||
|
path: String,
|
||||||
|
source: FileId,
|
||||||
|
opts: Option<DirectoryWithFileOpts>,
|
||||||
|
) -> Directory {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_new_directory(
|
||||||
|
&self,
|
||||||
|
path: String,
|
||||||
|
opts: Option<DirectoryWithNewDirectoryOpts>,
|
||||||
|
) -> Directory {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_new_file(
|
||||||
|
&self,
|
||||||
|
path: String,
|
||||||
|
contents: String,
|
||||||
|
opts: Option<DirectoryWithNewFileOpts>,
|
||||||
|
) -> Directory {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_timestamps(&self, timestamp: isize) -> Directory {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn without_directory(&self, path: String) -> Directory {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn without_file(&self, path: String) -> Directory {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
pub struct EnvVariable {}
|
||||||
|
|
||||||
impl EnvVariable {
|
impl EnvVariable {
|
||||||
|
pub fn name(&self) -> String {
|
||||||
}
|
todo!()
|
||||||
pub struct File {
|
}
|
||||||
|
pub fn value(&self) -> String {
|
||||||
}
|
todo!()
|
||||||
|
}
|
||||||
pub struct FileExportOpts {
|
|
||||||
pub path: String,
|
|
||||||
}
|
|
||||||
pub struct FileWithTimestampsOpts {
|
|
||||||
pub timestamp: isize,
|
|
||||||
}
|
}
|
||||||
|
pub struct File {}
|
||||||
|
|
||||||
impl File {
|
impl File {
|
||||||
|
pub fn contents(&self) -> String {
|
||||||
}
|
todo!()
|
||||||
pub struct GitRef {
|
}
|
||||||
|
pub fn export(&self, path: String) -> bool {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn id(&self) -> FileId {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn secret(&self) -> Secret {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn size(&self) -> isize {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn with_timestamps(&self, timestamp: isize) -> File {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
pub struct GitRef {}
|
||||||
|
|
||||||
pub struct GitRefTreeOpts {
|
pub struct GitRefTreeOpts {
|
||||||
pub ssh_known_hosts: String,
|
pub ssh_known_hosts: Option<String>,
|
||||||
pub ssh_auth_socket: SocketID,
|
pub ssh_auth_socket: Option<SocketId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GitRef {
|
impl GitRef {
|
||||||
|
pub fn digest(&self) -> String {
|
||||||
}
|
todo!()
|
||||||
pub struct GitRepository {
|
}
|
||||||
|
pub fn tree(&self, opts: Option<GitRefTreeOpts>) -> Directory {
|
||||||
}
|
todo!()
|
||||||
|
}
|
||||||
pub struct GitRepositoryBranchOpts {
|
|
||||||
pub name: String,
|
|
||||||
}
|
|
||||||
pub struct GitRepositoryCommitOpts {
|
|
||||||
pub id: String,
|
|
||||||
}
|
|
||||||
pub struct GitRepositoryTagOpts {
|
|
||||||
pub name: String,
|
|
||||||
}
|
}
|
||||||
|
pub struct GitRepository {}
|
||||||
|
|
||||||
impl GitRepository {
|
impl GitRepository {
|
||||||
|
pub fn branch(&self, name: String) -> GitRef {
|
||||||
}
|
todo!()
|
||||||
pub struct Host {
|
}
|
||||||
|
pub fn branches(&self) -> Vec<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn commit(&self, id: String) -> GitRef {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn tag(&self, name: String) -> GitRef {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn tags(&self) -> Vec<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
pub struct Host {}
|
||||||
|
|
||||||
pub struct HostDirectoryOpts {
|
pub struct HostDirectoryOpts {
|
||||||
pub path: String,
|
pub exclude: Option<Vec<String>>,
|
||||||
pub exclude: Vec<String>,
|
pub include: Option<Vec<String>>,
|
||||||
pub include: Vec<String>,
|
|
||||||
}
|
|
||||||
pub struct HostEnvVariableOpts {
|
|
||||||
pub name: String,
|
|
||||||
}
|
|
||||||
pub struct HostUnixSocketOpts {
|
|
||||||
pub path: String,
|
|
||||||
}
|
}
|
||||||
pub struct HostWorkdirOpts {
|
pub struct HostWorkdirOpts {
|
||||||
pub exclude: Vec<String>,
|
pub exclude: Option<Vec<String>>,
|
||||||
pub include: Vec<String>,
|
pub include: Option<Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Host {
|
impl Host {
|
||||||
|
pub fn directory(&self, path: String, opts: Option<HostDirectoryOpts>) -> Directory {
|
||||||
}
|
todo!()
|
||||||
pub struct HostVariable {
|
}
|
||||||
|
pub fn env_variable(&self, name: String) -> HostVariable {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn unix_socket(&self, path: String) -> Socket {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn workdir(&self, opts: Option<HostWorkdirOpts>) -> Directory {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
pub struct HostVariable {}
|
||||||
|
|
||||||
impl HostVariable {
|
impl HostVariable {
|
||||||
|
pub fn secret(&self) -> Secret {
|
||||||
}
|
todo!()
|
||||||
pub struct Label {
|
}
|
||||||
|
pub fn value(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
pub struct Label {}
|
||||||
|
|
||||||
impl Label {
|
impl Label {
|
||||||
|
pub fn name(&self) -> String {
|
||||||
}
|
todo!()
|
||||||
pub struct Project {
|
}
|
||||||
|
pub fn value(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
pub struct Project {}
|
||||||
|
|
||||||
impl Project {
|
impl Project {
|
||||||
|
pub fn extensions(&self) -> Vec<Project> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn generated_code(&self) -> Directory {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn install(&self) -> bool {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn name(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn schema(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn sdk(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pub struct Query {
|
pub struct Query {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct QueryCacheVolumeOpts {
|
|
||||||
pub key: String,
|
|
||||||
}
|
|
||||||
pub struct QueryContainerOpts {
|
pub struct QueryContainerOpts {
|
||||||
pub id: ContainerID,
|
pub id: Option<ContainerId>,
|
||||||
pub platform: Platform,
|
pub platform: Option<Platform>,
|
||||||
}
|
}
|
||||||
pub struct QueryDirectoryOpts {
|
pub struct QueryDirectoryOpts {
|
||||||
pub id: DirectoryID,
|
pub id: Option<DirectoryId>,
|
||||||
}
|
|
||||||
pub struct QueryFileOpts {
|
|
||||||
pub id: FileID,
|
|
||||||
}
|
}
|
||||||
pub struct QueryGitOpts {
|
pub struct QueryGitOpts {
|
||||||
pub url: String,
|
pub keep_git_dir: Option<bool>,
|
||||||
pub keep_git_dir: bool,
|
|
||||||
}
|
|
||||||
pub struct QueryHttpOpts {
|
|
||||||
pub url: String,
|
|
||||||
}
|
}
|
||||||
pub struct QueryPipelineOpts {
|
pub struct QueryPipelineOpts {
|
||||||
pub name: String,
|
pub description: Option<String>,
|
||||||
pub description: String,
|
|
||||||
}
|
|
||||||
pub struct QueryProjectOpts {
|
|
||||||
pub name: String,
|
|
||||||
}
|
|
||||||
pub struct QuerySecretOpts {
|
|
||||||
pub id: SecretID,
|
|
||||||
}
|
}
|
||||||
pub struct QuerySocketOpts {
|
pub struct QuerySocketOpts {
|
||||||
pub id: SocketID,
|
pub id: Option<SocketId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Query {
|
impl Query {
|
||||||
|
pub fn cache_volume(&self, key: String) -> CacheVolume {
|
||||||
}
|
todo!()
|
||||||
pub struct Secret {
|
}
|
||||||
|
pub fn container(&self, opts: Option<QueryContainerOpts>) -> Container {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn default_platform(&self) -> Platform {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn directory(&self, opts: Option<QueryDirectoryOpts>) -> Directory {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn file(&self, id: FileId) -> File {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn git(&self, url: String, opts: Option<QueryGitOpts>) -> GitRepository {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn host(&self) -> Host {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn http(&self, url: String) -> File {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn pipeline(&self, name: String, opts: Option<QueryPipelineOpts>) -> Query {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn project(&self, name: String) -> Project {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn secret(&self, id: SecretId) -> Secret {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
pub fn socket(&self, opts: Option<QuerySocketOpts>) -> Socket {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
pub struct Secret {}
|
||||||
|
|
||||||
impl Secret {
|
impl Secret {
|
||||||
|
pub fn id(&self) -> SecretId {
|
||||||
}
|
todo!()
|
||||||
pub struct Socket {
|
}
|
||||||
|
pub fn plaintext(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
pub struct Socket {}
|
||||||
|
|
||||||
impl Socket {
|
impl Socket {
|
||||||
|
pub fn id(&self) -> SocketId {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user