mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2024-11-26 00:42:42 +01:00
with objects
This commit is contained in:
parent
910ff4a72e
commit
5fef514801
16
Cargo.lock
generated
16
Cargo.lock
generated
@ -119,6 +119,15 @@ dependencies = [
|
|||||||
"unreachable",
|
"unreachable",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "convert_case"
|
||||||
|
version = "0.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-segmentation",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core-foundation"
|
name = "core-foundation"
|
||||||
version = "0.9.3"
|
version = "0.9.3"
|
||||||
@ -177,6 +186,7 @@ dependencies = [
|
|||||||
name = "dagger-codegen"
|
name = "dagger-codegen"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"convert_case",
|
||||||
"dagger-core",
|
"dagger-core",
|
||||||
"eyre",
|
"eyre",
|
||||||
"genco",
|
"genco",
|
||||||
@ -1360,6 +1370,12 @@ dependencies = [
|
|||||||
"tinyvec",
|
"tinyvec",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-segmentation"
|
||||||
|
version = "1.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unreachable"
|
name = "unreachable"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
@ -6,6 +6,7 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
convert_case = "0.6.0"
|
||||||
dagger-core = { path = "../dagger-core" }
|
dagger-core = { path = "../dagger-core" }
|
||||||
|
|
||||||
eyre = "0.6.8"
|
eyre = "0.6.8"
|
||||||
|
@ -8,9 +8,8 @@ use graphql_introspection_query::introspection_response::{
|
|||||||
FullType, IntrospectionResponse, Schema,
|
FullType, IntrospectionResponse, Schema,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::handlers::{
|
||||||
handlers::{enumeration::Enumeration, input::Input, scalar::Scalar, DynHandler, Handlers},
|
enumeration::Enumeration, input::Input, object::Object, scalar::Scalar, DynHandler, Handlers,
|
||||||
predicates::is_custom_scalar_type,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
@ -25,6 +24,7 @@ impl CodeGeneration {
|
|||||||
Arc::new(Scalar {}),
|
Arc::new(Scalar {}),
|
||||||
Arc::new(Enumeration {}),
|
Arc::new(Enumeration {}),
|
||||||
Arc::new(Input {}),
|
Arc::new(Input {}),
|
||||||
|
Arc::new(Object {}),
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,6 +47,10 @@ impl CodeGeneration {
|
|||||||
$(format!("// code generated by dagger. DO NOT EDIT."))
|
$(format!("// code generated by dagger. DO NOT EDIT."))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
output.push();
|
||||||
|
output.append(render_base_types());
|
||||||
|
output.push();
|
||||||
|
|
||||||
let types = get_types(schema)?;
|
let types = get_types(schema)?;
|
||||||
//let remaining: Vec<Option<String>> = types.into_iter().map(type_name).collect();
|
//let remaining: Vec<Option<String>> = types.into_iter().map(type_name).collect();
|
||||||
//
|
//
|
||||||
@ -93,7 +97,8 @@ impl CodeGeneration {
|
|||||||
pub fn type_name(&self, t: &FullType) -> Option<String> {
|
pub fn type_name(&self, t: &FullType) -> Option<String> {
|
||||||
let name = t.name.as_ref();
|
let name = t.name.as_ref();
|
||||||
if let Some(name) = name {
|
if let Some(name) = name {
|
||||||
if name.starts_with("_") || !is_custom_scalar_type(t) {
|
if name.starts_with("_") {
|
||||||
|
//|| !is_custom_scalar_type(t) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,13 +129,22 @@ impl CodeGeneration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn render_base_types() -> rust::Tokens {
|
||||||
|
let i = rust::import("dagger_core", "Int");
|
||||||
|
let b = rust::import("dagger_core", "Boolean");
|
||||||
|
|
||||||
|
quote! {
|
||||||
|
$(register(i))
|
||||||
|
$(register(b))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn get_types(schema: &Schema) -> eyre::Result<Vec<&FullType>> {
|
fn get_types(schema: &Schema) -> eyre::Result<Vec<&FullType>> {
|
||||||
let types = schema
|
let types = schema
|
||||||
.types
|
.types
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or(eyre::anyhow!("types not found on schema"))?;
|
.ok_or(eyre::anyhow!("types not found on schema"))?;
|
||||||
|
|
||||||
// 1. Get a list of all types and map it to handlers
|
|
||||||
let types: Vec<&FullType> = types
|
let types: Vec<&FullType> = types
|
||||||
.iter()
|
.iter()
|
||||||
.map(|t| t.as_ref().map(|t| &t.full_type))
|
.map(|t| t.as_ref().map(|t| &t.full_type))
|
||||||
|
@ -23,7 +23,9 @@ impl Handler for Enumeration {
|
|||||||
|
|
||||||
let out = quote! {
|
let out = quote! {
|
||||||
$description
|
$description
|
||||||
pub enum $name {}
|
pub enum $name {
|
||||||
|
// TODO: Add individual items
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(out)
|
Ok(out)
|
||||||
|
33
crates/dagger-codegen/src/handlers/fields.rs
Normal file
33
crates/dagger-codegen/src/handlers/fields.rs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
use convert_case::{Case, Casing};
|
||||||
|
use genco::{prelude::rust, quote};
|
||||||
|
use graphql_introspection_query::introspection_response::FullTypeFields;
|
||||||
|
|
||||||
|
use super::{
|
||||||
|
type_ref,
|
||||||
|
utility::{render_description, render_description_from_field},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub fn render_fields(fields: &Vec<FullTypeFields>) -> eyre::Result<Option<rust::Tokens>> {
|
||||||
|
let mut collected_fields: Vec<rust::Tokens> = vec![];
|
||||||
|
for field in fields.iter() {
|
||||||
|
let name = field.name.as_ref().map(|n| n.to_case(Case::Snake)).unwrap();
|
||||||
|
let output = render_field_output(field)?;
|
||||||
|
let description = render_description_from_field(field);
|
||||||
|
|
||||||
|
collected_fields.push(quote! {
|
||||||
|
$(if description.is_some() => $description)
|
||||||
|
pub fn $name(&self) -> $output {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(Some(quote! {
|
||||||
|
$(for field in collected_fields => $field $['\n'] )
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render_field_output(field: &FullTypeFields) -> eyre::Result<rust::Tokens> {
|
||||||
|
let inner = &field.type_.as_ref().unwrap();
|
||||||
|
type_ref::render_type_ref(&inner.type_ref)
|
||||||
|
}
|
@ -1,93 +1,12 @@
|
|||||||
use genco::prelude::rust;
|
use genco::prelude::rust;
|
||||||
use genco::prelude::*;
|
use genco::prelude::*;
|
||||||
use graphql_introspection_query::introspection_response::{FullType, FullTypeInputFields, TypeRef};
|
use graphql_introspection_query::introspection_response::FullType;
|
||||||
|
|
||||||
use crate::predicates::{
|
use crate::predicates::is_input_object_type;
|
||||||
is_custom_scalar_type_ref, is_input_object_type, is_list_type, is_required_type_ref,
|
|
||||||
is_scalar_type_ref,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::{utility::render_description, Handler};
|
use super::{input_field::render_input_fields, utility::render_description, Handler};
|
||||||
|
|
||||||
pub struct Input;
|
pub struct Input;
|
||||||
impl Input {
|
|
||||||
fn render_input_fields(
|
|
||||||
&self,
|
|
||||||
input_fields: &Vec<FullTypeInputFields>,
|
|
||||||
) -> eyre::Result<Option<rust::Tokens>> {
|
|
||||||
let mut fields: Vec<(String, rust::Tokens)> = vec![];
|
|
||||||
for field in input_fields.iter() {
|
|
||||||
fields.push((
|
|
||||||
field.input_value.name.clone(),
|
|
||||||
self.render_input_field(field)?,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(Some(quote! {
|
|
||||||
$(for (name, field) in fields => pub $name: $field $['\n'] )
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_input_field(&self, field: &FullTypeInputFields) -> eyre::Result<rust::Tokens> {
|
|
||||||
let inner = &field.input_value.type_;
|
|
||||||
self.render_type_ref(inner)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_type_ref(&self, inner: &TypeRef) -> eyre::Result<rust::Tokens> {
|
|
||||||
let extract_of_type = |t: &TypeRef| -> Option<TypeRef> {
|
|
||||||
return t.clone().of_type.map(|t| *t);
|
|
||||||
};
|
|
||||||
|
|
||||||
if !is_required_type_ref(inner) {
|
|
||||||
if let Some(inner_of_type) = extract_of_type(inner) {
|
|
||||||
let inner_field = self.render_type_ref(&inner_of_type)?;
|
|
||||||
return Ok(quote! {
|
|
||||||
Option<$inner_field>
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if is_list_type(&inner) {
|
|
||||||
if let Some(inner_of_type) = extract_of_type(inner) {
|
|
||||||
let inner_field = self.render_type_ref(&inner_of_type)?;
|
|
||||||
return Ok(quote! {
|
|
||||||
Vec<$inner_field>
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if is_custom_scalar_type_ref(&inner) {
|
|
||||||
if let Some(inner_of_type) = extract_of_type(inner) {
|
|
||||||
let inner_field = self.render_type_ref(&inner_of_type)?;
|
|
||||||
return Ok(quote! {
|
|
||||||
$inner_field
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if is_scalar_type_ref(&inner) {
|
|
||||||
let name = match inner.name.as_ref().map(|s| s.as_str()) {
|
|
||||||
Some("ID") => "ID",
|
|
||||||
Some("Int") => "Int",
|
|
||||||
Some("String") => "String",
|
|
||||||
Some("Float") => "Float",
|
|
||||||
Some("Boolean") => "Boolean",
|
|
||||||
Some("Date") => "Date",
|
|
||||||
Some("DateTime") => "DateTime",
|
|
||||||
Some("Time") => "Time",
|
|
||||||
Some("Decimal") => "Decimal",
|
|
||||||
Some(n) => n,
|
|
||||||
_ => eyre::bail!("missing type in the end of chain"),
|
|
||||||
};
|
|
||||||
|
|
||||||
return Ok(quote! {
|
|
||||||
$name
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
eyre::bail!("could not determine type")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Handler for Input {
|
impl Handler for Input {
|
||||||
fn predicate(&self, t: &FullType) -> bool {
|
fn predicate(&self, t: &FullType) -> bool {
|
||||||
@ -104,7 +23,7 @@ impl Handler for Input {
|
|||||||
let input = rust::import("dagger_core", "Input");
|
let input = rust::import("dagger_core", "Input");
|
||||||
|
|
||||||
let fields = match t.input_fields.as_ref() {
|
let fields = match t.input_fields.as_ref() {
|
||||||
Some(i) => self.render_input_fields(i)?,
|
Some(i) => render_input_fields(i)?,
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
22
crates/dagger-codegen/src/handlers/input_field.rs
Normal file
22
crates/dagger-codegen/src/handlers/input_field.rs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
use genco::{prelude::rust, quote};
|
||||||
|
use graphql_introspection_query::introspection_response::FullTypeInputFields;
|
||||||
|
|
||||||
|
use super::type_ref;
|
||||||
|
|
||||||
|
pub fn render_input_fields(
|
||||||
|
input_fields: &Vec<FullTypeInputFields>,
|
||||||
|
) -> eyre::Result<Option<rust::Tokens>> {
|
||||||
|
let mut fields: Vec<(String, rust::Tokens)> = vec![];
|
||||||
|
for field in input_fields.iter() {
|
||||||
|
fields.push((field.input_value.name.clone(), render_input_field(field)?));
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(Some(quote! {
|
||||||
|
$(for (name, field) in fields => pub $name: $field, $['\n'] )
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render_input_field(field: &FullTypeInputFields) -> eyre::Result<rust::Tokens> {
|
||||||
|
let inner = &field.input_value.type_;
|
||||||
|
type_ref::render_type_ref(inner)
|
||||||
|
}
|
@ -1,6 +1,10 @@
|
|||||||
pub mod enumeration;
|
pub mod enumeration;
|
||||||
|
mod fields;
|
||||||
pub mod input;
|
pub mod input;
|
||||||
|
mod input_field;
|
||||||
|
pub mod object;
|
||||||
pub mod scalar;
|
pub mod scalar;
|
||||||
|
mod type_ref;
|
||||||
mod utility;
|
mod utility;
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
101
crates/dagger-codegen/src/handlers/object.rs
Normal file
101
crates/dagger-codegen/src/handlers/object.rs
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
use genco::{prelude::rust, quote};
|
||||||
|
use graphql_introspection_query::introspection_response::FullType;
|
||||||
|
|
||||||
|
use crate::predicates::is_object_type;
|
||||||
|
|
||||||
|
use super::{fields, utility::render_description, Handler};
|
||||||
|
|
||||||
|
pub struct Object;
|
||||||
|
|
||||||
|
impl Handler for Object {
|
||||||
|
fn predicate(&self, t: &FullType) -> bool {
|
||||||
|
is_object_type(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render(&self, t: &FullType) -> eyre::Result<rust::Tokens> {
|
||||||
|
let name = t
|
||||||
|
.name
|
||||||
|
.as_ref()
|
||||||
|
.ok_or(eyre::anyhow!("could not find name"))?;
|
||||||
|
let description = render_description(t);
|
||||||
|
|
||||||
|
let input = rust::import("dagger_core", "Input");
|
||||||
|
|
||||||
|
let fields = match t.fields.as_ref() {
|
||||||
|
Some(i) => fields::render_fields(i)?,
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
|
||||||
|
let out = quote! {
|
||||||
|
$(if description.is_some() => $description)
|
||||||
|
pub struct $name {
|
||||||
|
}
|
||||||
|
|
||||||
|
impl $name {
|
||||||
|
$(if fields.is_some() => $fields)
|
||||||
|
}
|
||||||
|
|
||||||
|
impl $input for $name {}
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use graphql_introspection_query::introspection_response::{
|
||||||
|
FullType, FullTypeFields, FullTypeFieldsType, TypeRef, __TypeKind,
|
||||||
|
};
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
|
use crate::handlers::Handler;
|
||||||
|
|
||||||
|
use super::Object;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_render_object() {
|
||||||
|
let t: FullType = FullType {
|
||||||
|
kind: Some(__TypeKind::OBJECT),
|
||||||
|
name: Some("CacheVolume".into()),
|
||||||
|
description: Some("A directory whose contents persists across sessions".into()),
|
||||||
|
fields: Some(vec![FullTypeFields {
|
||||||
|
name: Some("id".into()),
|
||||||
|
description: None,
|
||||||
|
args: None,
|
||||||
|
type_: Some(FullTypeFieldsType {
|
||||||
|
type_ref: TypeRef {
|
||||||
|
kind: Some(__TypeKind::NON_NULL),
|
||||||
|
name: None,
|
||||||
|
of_type: Some(Box::new(TypeRef {
|
||||||
|
kind: Some(__TypeKind::SCALAR),
|
||||||
|
name: Some("CacheID".into()),
|
||||||
|
of_type: None,
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
is_deprecated: Some(false),
|
||||||
|
deprecation_reason: None,
|
||||||
|
}]),
|
||||||
|
input_fields: None,
|
||||||
|
interfaces: None,
|
||||||
|
enum_values: None,
|
||||||
|
possible_types: None,
|
||||||
|
};
|
||||||
|
let expected = r#"use dagger_core::Input;
|
||||||
|
|
||||||
|
|
||||||
|
/// A directory whose contents persists across sessions
|
||||||
|
pub struct CacheVolume {
|
||||||
|
pub id: Option<CacheID>
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for CacheVolume {}
|
||||||
|
"#;
|
||||||
|
let handler = Object {};
|
||||||
|
let obj = handler.render(&t).unwrap();
|
||||||
|
let actual = obj.to_file_string().unwrap();
|
||||||
|
|
||||||
|
assert_eq!(actual, expected);
|
||||||
|
}
|
||||||
|
}
|
72
crates/dagger-codegen/src/handlers/type_ref.rs
Normal file
72
crates/dagger-codegen/src/handlers/type_ref.rs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
use genco::prelude::rust;
|
||||||
|
use genco::prelude::*;
|
||||||
|
use graphql_introspection_query::introspection_response::TypeRef;
|
||||||
|
|
||||||
|
use crate::predicates::{
|
||||||
|
is_custom_scalar_type_ref, is_list_type, is_required_type_ref, is_scalar_type_ref,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub fn render_type_ref(inner: &TypeRef) -> eyre::Result<rust::Tokens> {
|
||||||
|
let extract_of_type = |t: &TypeRef| -> Option<TypeRef> {
|
||||||
|
return t.clone().of_type.map(|t| *t);
|
||||||
|
};
|
||||||
|
|
||||||
|
if !is_required_type_ref(inner) {
|
||||||
|
if let Some(inner_of_type) = extract_of_type(inner) {
|
||||||
|
let inner_field = render_type_ref(&inner_of_type)?;
|
||||||
|
return Ok(quote! {
|
||||||
|
Option<$inner_field>
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_list_type(&inner) {
|
||||||
|
if let Some(inner_of_type) = extract_of_type(inner) {
|
||||||
|
let inner_field = render_type_ref(&inner_of_type)?;
|
||||||
|
return Ok(quote! {
|
||||||
|
Vec<$inner_field>
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_custom_scalar_type_ref(&inner) {
|
||||||
|
if let Some(inner_of_type) = extract_of_type(inner) {
|
||||||
|
let inner_field = render_type_ref(&inner_of_type)?;
|
||||||
|
return Ok(quote! {
|
||||||
|
$inner_field
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_scalar_type_ref(&inner) {
|
||||||
|
let name = match inner.name.as_ref().map(|s| s.as_str()) {
|
||||||
|
Some("ID") => "ID",
|
||||||
|
Some("Int") => "Int",
|
||||||
|
Some("String") => "String",
|
||||||
|
Some("Float") => "Float",
|
||||||
|
Some("Boolean") => "Boolean",
|
||||||
|
Some("Date") => "Date",
|
||||||
|
Some("DateTime") => "DateTime",
|
||||||
|
Some("Time") => "Time",
|
||||||
|
Some("Decimal") => "Decimal",
|
||||||
|
Some(n) => n,
|
||||||
|
_ => eyre::bail!("missing type in the end of chain"),
|
||||||
|
};
|
||||||
|
|
||||||
|
return Ok(quote! {
|
||||||
|
$name
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(inner_type) = inner.of_type.as_ref() {
|
||||||
|
return render_type_ref(&inner_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(name) = inner.name.as_ref() {
|
||||||
|
return Ok(quote! {
|
||||||
|
$name
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
eyre::bail!("could not determine type")
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
use genco::{prelude::*, quote};
|
use genco::{prelude::*, quote};
|
||||||
use graphql_introspection_query::introspection_response::FullType;
|
use graphql_introspection_query::introspection_response::{FullType, FullTypeFields};
|
||||||
|
|
||||||
pub fn render_description(t: &FullType) -> Option<rust::Tokens> {
|
pub fn render_description(t: &FullType) -> Option<rust::Tokens> {
|
||||||
if let Some(description) = t.description.as_ref() {
|
if let Some(description) = t.description.as_ref() {
|
||||||
@ -13,3 +13,16 @@ pub fn render_description(t: &FullType) -> Option<rust::Tokens> {
|
|||||||
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn render_description_from_field(t: &FullTypeFields) -> Option<rust::Tokens> {
|
||||||
|
if let Some(description) = t.description.as_ref() {
|
||||||
|
let lines = description.split('\n');
|
||||||
|
let output: rust::Tokens = quote! {
|
||||||
|
$(for line in lines => $(format!("\n/// {line}")))
|
||||||
|
};
|
||||||
|
|
||||||
|
return Some(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
None
|
||||||
|
}
|
||||||
|
@ -55,6 +55,13 @@ pub fn is_list_type(t: &TypeRef) -> bool {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_object_type(t: &FullType) -> bool {
|
||||||
|
if let Some(introspection_response::__TypeKind::OBJECT) = t.kind {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_custom_scalar_type(t: &FullType) -> bool {
|
pub fn is_custom_scalar_type(t: &FullType) -> bool {
|
||||||
if is_scalar_type(t) {
|
if is_scalar_type(t) {
|
||||||
// TODO: Insert scalar
|
// TODO: Insert scalar
|
||||||
|
@ -1 +1,7 @@
|
|||||||
pub struct Scalar(String);
|
pub struct Scalar(String);
|
||||||
|
|
||||||
|
pub struct Boolean(bool);
|
||||||
|
|
||||||
|
pub struct Int(isize);
|
||||||
|
|
||||||
|
pub trait Input {}
|
||||||
|
@ -1,19 +1,16 @@
|
|||||||
use dagger_core::Scalar;
|
use dagger_core::{Boolean, Input, Int, Scalar};
|
||||||
|
|
||||||
// code generated by dagger. DO NOT EDIT.
|
// code generated by dagger. DO NOT EDIT.
|
||||||
|
|
||||||
/// A global cache volume identifier.
|
|
||||||
pub struct CacheID(Scalar);
|
|
||||||
|
|
||||||
/// A content-addressed directory identifier.
|
/// A content-addressed directory identifier.
|
||||||
pub struct DirectoryID(Scalar);
|
pub struct DirectoryID(Scalar);
|
||||||
|
|
||||||
|
/// A global cache volume identifier.
|
||||||
|
pub struct CacheID(Scalar);
|
||||||
|
|
||||||
/// A content-addressed socket identifier.
|
/// A content-addressed socket identifier.
|
||||||
pub struct SocketID(Scalar);
|
pub struct SocketID(Scalar);
|
||||||
|
|
||||||
/// A unique container identifier. Null designates an empty container (scratch).
|
|
||||||
pub struct ContainerID(Scalar);
|
|
||||||
|
|
||||||
/// A file identifier.
|
/// A file identifier.
|
||||||
pub struct FileID(Scalar);
|
pub struct FileID(Scalar);
|
||||||
|
|
||||||
@ -21,5 +18,661 @@ pub struct FileID(Scalar);
|
|||||||
/// The format is [os]/[platform]/[version] (e.g. darwin/arm64/v7, windows/amd64, linux/arm64).
|
/// The format is [os]/[platform]/[version] (e.g. darwin/arm64/v7, windows/amd64, linux/arm64).
|
||||||
pub struct Platform(Scalar);
|
pub struct Platform(Scalar);
|
||||||
|
|
||||||
|
/// A unique container identifier. Null designates an empty container (scratch).
|
||||||
|
pub struct ContainerID(Scalar);
|
||||||
|
|
||||||
/// A unique identifier for a secret.
|
/// A unique identifier for a secret.
|
||||||
pub struct SecretID(Scalar);
|
pub struct SecretID(Scalar);
|
||||||
|
|
||||||
|
///
|
||||||
|
pub struct BuildArg {
|
||||||
|
pub name: Option<String>,
|
||||||
|
|
||||||
|
pub value: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for BuildArg {}
|
||||||
|
|
||||||
|
/// A file.
|
||||||
|
pub struct File {}
|
||||||
|
|
||||||
|
impl File {
|
||||||
|
/// Retrieves the contents of the file.
|
||||||
|
pub fn contents(&self) -> Option<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Writes the file to a file path on the host.
|
||||||
|
pub fn export(&self) -> Option<Boolean> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves the content-addressed identifier of the file.
|
||||||
|
pub fn id(&self) -> Option<FileID> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves a secret referencing the contents of this file.
|
||||||
|
pub fn secret(&self) -> Option<Secret> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets the size of the file, in bytes.
|
||||||
|
pub fn size(&self) -> Option<Int> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this file with its created/modified timestamps set to the given time, in seconds from the Unix epoch.
|
||||||
|
pub fn with_timestamps(&self) -> Option<File> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for File {}
|
||||||
|
|
||||||
|
/// An OCI-compatible container, also known as a docker container.
|
||||||
|
pub struct Container {}
|
||||||
|
|
||||||
|
impl Container {
|
||||||
|
/// Initializes this container from a Dockerfile build, using the context, a dockerfile file path and some additional buildArgs.
|
||||||
|
pub fn build(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves default arguments for future commands.
|
||||||
|
pub fn default_args(&self) -> Vec<Option<String>> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves a directory at the given path. Mounts are included.
|
||||||
|
pub fn directory(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves entrypoint to be prepended to the arguments of all commands.
|
||||||
|
pub fn entrypoint(&self) -> Vec<Option<String>> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves the value of the specified environment variable.
|
||||||
|
pub fn env_variable(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves the list of environment variables passed to commands.
|
||||||
|
pub fn env_variables(&self) -> Option<Vec<Option<EnvVariable>>> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container after executing the specified command inside it.
|
||||||
|
pub fn exec(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Exit code of the last executed command. Zero means success.
|
||||||
|
/// Null if no command has been executed.
|
||||||
|
pub fn exit_code(&self) -> Int {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Writes the container as an OCI tarball to the destination file path on the host for the specified platformVariants.
|
||||||
|
/// Return true on success.
|
||||||
|
pub fn export(&self) -> Option<Boolean> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves a file at the given path. Mounts are included.
|
||||||
|
pub fn file(&self) -> Option<File> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initializes this container from the base image published at the given address.
|
||||||
|
pub fn from(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container's root filesystem. Mounts are not included.
|
||||||
|
pub fn fs(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A unique identifier for this container.
|
||||||
|
pub fn id(&self) -> Option<ContainerID> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves the value of the specified label.
|
||||||
|
pub fn label(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves the list of labels passed to container.
|
||||||
|
pub fn labels(&self) -> Option<Vec<Option<Label>>> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves the list of paths where a directory is mounted.
|
||||||
|
pub fn mounts(&self) -> Option<Vec<Option<String>>> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates a named sub-pipeline
|
||||||
|
pub fn pipeline(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The platform this container executes and publishes as.
|
||||||
|
pub fn platform(&self) -> Option<Platform> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Publishes this container as a new image to the specified address, for the platformVariants, returning a fully qualified ref.
|
||||||
|
pub fn publish(&self) -> Option<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container's root filesystem. Mounts are not included.
|
||||||
|
pub fn rootfs(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The error stream of the last executed command.
|
||||||
|
/// Null if no command has been executed.
|
||||||
|
pub fn stderr(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The output stream of the last executed command.
|
||||||
|
/// Null if no command has been executed.
|
||||||
|
pub fn stdout(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves the user to be set for all commands.
|
||||||
|
pub fn user(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Configures default arguments for future commands.
|
||||||
|
pub fn with_default_args(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container plus a directory written at the given path.
|
||||||
|
pub fn with_directory(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container but with a different command entrypoint.
|
||||||
|
pub fn with_entrypoint(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container plus the given environment variable.
|
||||||
|
pub fn with_env_variable(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container after executing the specified command inside it.
|
||||||
|
pub fn with_exec(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initializes this container from this DirectoryID.
|
||||||
|
pub fn with_fs(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container plus the contents of the given file copied to the given path.
|
||||||
|
pub fn with_file(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container plus the given label.
|
||||||
|
pub fn with_label(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container plus a cache volume mounted at the given path.
|
||||||
|
pub fn with_mounted_cache(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container plus a directory mounted at the given path.
|
||||||
|
pub fn with_mounted_directory(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container plus a file mounted at the given path.
|
||||||
|
pub fn with_mounted_file(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container plus a secret mounted into a file at the given path.
|
||||||
|
pub fn with_mounted_secret(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container plus a temporary directory mounted at the given path.
|
||||||
|
pub fn with_mounted_temp(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container plus a new file written at the given path.
|
||||||
|
pub fn with_new_file(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initializes this container from this DirectoryID.
|
||||||
|
pub fn with_rootfs(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container plus an env variable containing the given secret.
|
||||||
|
pub fn with_secret_variable(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container plus a socket forwarded to the given Unix socket path.
|
||||||
|
pub fn with_unix_socket(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this containers with a different command user.
|
||||||
|
pub fn with_user(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container with a different working directory.
|
||||||
|
pub fn with_workdir(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container minus the given environment variable.
|
||||||
|
pub fn without_env_variable(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container minus the given environment label.
|
||||||
|
pub fn without_label(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container after unmounting everything at the given path.
|
||||||
|
pub fn without_mount(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this container with a previously added Unix socket removed.
|
||||||
|
pub fn without_unix_socket(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves the working directory for all commands.
|
||||||
|
pub fn workdir(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for Container {}
|
||||||
|
|
||||||
|
/// A directory whose contents persist across runs.
|
||||||
|
pub struct CacheVolume {}
|
||||||
|
|
||||||
|
impl CacheVolume {
|
||||||
|
///
|
||||||
|
pub fn id(&self) -> Option<CacheID> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for CacheVolume {}
|
||||||
|
|
||||||
|
/// A git ref (tag, branch or commit).
|
||||||
|
pub struct GitRef {}
|
||||||
|
|
||||||
|
impl GitRef {
|
||||||
|
/// The digest of the current value of this ref.
|
||||||
|
pub fn digest(&self) -> Option<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The filesystem tree at this ref.
|
||||||
|
pub fn tree(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for GitRef {}
|
||||||
|
|
||||||
|
/// A reference to a secret value, which can be handled more safely than the value itself.
|
||||||
|
pub struct Secret {}
|
||||||
|
|
||||||
|
impl Secret {
|
||||||
|
/// The identifier for this secret.
|
||||||
|
pub fn id(&self) -> Option<SecretID> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The value of this secret.
|
||||||
|
pub fn plaintext(&self) -> Option<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for Secret {}
|
||||||
|
|
||||||
|
/// An environment variable on the host environment.
|
||||||
|
pub struct HostVariable {}
|
||||||
|
|
||||||
|
impl HostVariable {
|
||||||
|
/// A secret referencing the value of this variable.
|
||||||
|
pub fn secret(&self) -> Option<Secret> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The value of this variable.
|
||||||
|
pub fn value(&self) -> Option<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for HostVariable {}
|
||||||
|
|
||||||
|
///
|
||||||
|
pub struct Query {}
|
||||||
|
|
||||||
|
impl Query {
|
||||||
|
/// Constructs a cache volume for a given cache key.
|
||||||
|
pub fn cache_volume(&self) -> Option<CacheVolume> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Loads a container from ID.
|
||||||
|
/// Null ID returns an empty container (scratch).
|
||||||
|
/// Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host.
|
||||||
|
pub fn container(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The default platform of the builder.
|
||||||
|
pub fn default_platform(&self) -> Option<Platform> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Load a directory by ID. No argument produces an empty directory.
|
||||||
|
pub fn directory(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Loads a file by ID.
|
||||||
|
pub fn file(&self) -> File {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Queries a git repository.
|
||||||
|
pub fn git(&self) -> Option<GitRepository> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Queries the host environment.
|
||||||
|
pub fn host(&self) -> Option<Host> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a file containing an http remote url content.
|
||||||
|
pub fn http(&self) -> Option<File> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates a named sub-pipeline
|
||||||
|
pub fn pipeline(&self) -> Option<Query> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Look up a project by name
|
||||||
|
pub fn project(&self) -> Option<Project> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Loads a secret from its ID.
|
||||||
|
pub fn secret(&self) -> Option<Secret> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Loads a socket by its ID.
|
||||||
|
pub fn socket(&self) -> Option<Socket> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for Query {}
|
||||||
|
|
||||||
|
/// A directory.
|
||||||
|
pub struct Directory {}
|
||||||
|
|
||||||
|
impl Directory {
|
||||||
|
/// Gets the difference between this directory and an another directory.
|
||||||
|
pub fn diff(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves a directory at the given path.
|
||||||
|
pub fn directory(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Builds a new Docker container from this directory.
|
||||||
|
pub fn docker_build(&self) -> Option<Container> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a list of files and directories at the given path.
|
||||||
|
pub fn entries(&self) -> Option<Vec<Option<String>>> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Writes the contents of the directory to a path on the host.
|
||||||
|
pub fn export(&self) -> Option<Boolean> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves a file at the given path.
|
||||||
|
pub fn file(&self) -> Option<File> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The content-addressed identifier of the directory.
|
||||||
|
pub fn id(&self) -> Option<DirectoryID> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// load a project's metadata
|
||||||
|
pub fn load_project(&self) -> Option<Project> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates a named sub-pipeline.
|
||||||
|
pub fn pipeline(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this directory plus a directory written at the given path.
|
||||||
|
pub fn with_directory(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this directory plus the contents of the given file copied to the given path.
|
||||||
|
pub fn with_file(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this directory plus a new directory created at the given path.
|
||||||
|
pub fn with_new_directory(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this directory plus a new file written at the given path.
|
||||||
|
pub fn with_new_file(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this directory with all file/dir timestamps set to the given time, in seconds from the Unix epoch.
|
||||||
|
pub fn with_timestamps(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this directory with the directory at the given path removed.
|
||||||
|
pub fn without_directory(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves this directory with the file at the given path removed.
|
||||||
|
pub fn without_file(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for Directory {}
|
||||||
|
|
||||||
|
/// A set of scripts and/or extensions
|
||||||
|
pub struct Project {}
|
||||||
|
|
||||||
|
impl Project {
|
||||||
|
/// extensions in this project
|
||||||
|
pub fn extensions(&self) -> Vec<Option<Project>> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Code files generated by the SDKs in the project
|
||||||
|
pub fn generated_code(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// install the project's schema
|
||||||
|
pub fn install(&self) -> Option<Boolean> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// name of the project
|
||||||
|
pub fn name(&self) -> Option<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// schema provided by the project
|
||||||
|
pub fn schema(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// sdk used to generate code for and/or execute this project
|
||||||
|
pub fn sdk(&self) -> String {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for Project {}
|
||||||
|
|
||||||
|
///
|
||||||
|
pub struct Socket {}
|
||||||
|
|
||||||
|
impl Socket {
|
||||||
|
/// The content-addressed identifier of the socket.
|
||||||
|
pub fn id(&self) -> Option<SocketID> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for Socket {}
|
||||||
|
|
||||||
|
/// A simple key value object that represents a label.
|
||||||
|
pub struct Label {}
|
||||||
|
|
||||||
|
impl Label {
|
||||||
|
/// The label name.
|
||||||
|
pub fn name(&self) -> Option<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The label value.
|
||||||
|
pub fn value(&self) -> Option<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for Label {}
|
||||||
|
|
||||||
|
/// A git repository.
|
||||||
|
pub struct GitRepository {}
|
||||||
|
|
||||||
|
impl GitRepository {
|
||||||
|
/// Returns details on one branch.
|
||||||
|
pub fn branch(&self) -> Option<GitRef> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Lists of branches on the repository.
|
||||||
|
pub fn branches(&self) -> Option<Vec<Option<String>>> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns details on one commit.
|
||||||
|
pub fn commit(&self) -> Option<GitRef> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns details on one tag.
|
||||||
|
pub fn tag(&self) -> Option<GitRef> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Lists of tags on the repository.
|
||||||
|
pub fn tags(&self) -> Option<Vec<Option<String>>> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for GitRepository {}
|
||||||
|
|
||||||
|
/// A simple key value object that represents an environment variable.
|
||||||
|
pub struct EnvVariable {}
|
||||||
|
|
||||||
|
impl EnvVariable {
|
||||||
|
/// The environment variable name.
|
||||||
|
pub fn name(&self) -> Option<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The environment variable value.
|
||||||
|
pub fn value(&self) -> Option<String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for EnvVariable {}
|
||||||
|
|
||||||
|
/// Information about the host execution environment.
|
||||||
|
pub struct Host {}
|
||||||
|
|
||||||
|
impl Host {
|
||||||
|
/// Accesses a directory on the host.
|
||||||
|
pub fn directory(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Accesses an environment variable on the host.
|
||||||
|
pub fn env_variable(&self) -> HostVariable {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Accesses a Unix socket on the host.
|
||||||
|
pub fn unix_socket(&self) -> Option<Socket> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves the current working directory on the host.
|
||||||
|
pub fn workdir(&self) -> Option<Directory> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input for Host {}
|
||||||
|
Loading…
Reference in New Issue
Block a user