mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2025-08-03 14:23:26 +02:00
tested full flow initially
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
use std::process::Child;
|
||||
use std::sync::Arc;
|
||||
|
||||
use dagger_core::connect_params::ConnectParams;
|
||||
use dagger_core::{Boolean, Input, Int, Scalar};
|
||||
|
||||
use crate::client::graphql_client;
|
||||
use crate::querybuilder::Selection;
|
||||
|
||||
// code generated by dagger. DO NOT EDIT.
|
||||
|
||||
/// A global cache volume identifier.
|
||||
@@ -46,7 +53,11 @@ impl CacheVolume {
|
||||
impl Input for CacheVolume {}
|
||||
|
||||
/// An OCI-compatible container, also known as a docker container.
|
||||
pub struct Container {}
|
||||
pub struct Container {
|
||||
pub conn: ConnectParams,
|
||||
pub proc: Arc<Child>,
|
||||
pub selection: Selection,
|
||||
}
|
||||
|
||||
impl Container {
|
||||
/// Initializes this container from a Dockerfile build, using the context, a dockerfile file path and some additional buildArgs.
|
||||
@@ -104,13 +115,20 @@ impl Container {
|
||||
/// The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
|
||||
pub fn exec(
|
||||
&self,
|
||||
_args: Option<Vec<String>>,
|
||||
args: Option<Vec<String>>,
|
||||
_stdin: Option<String>,
|
||||
_redirect_stdout: Option<String>,
|
||||
_redirect_stderr: Option<String>,
|
||||
_experimental_privileged_nesting: Option<Boolean>,
|
||||
) -> Container {
|
||||
todo!()
|
||||
let query = self.selection.select("exec");
|
||||
let query = query.arg("args", args).unwrap();
|
||||
|
||||
Container {
|
||||
conn: self.conn.clone(),
|
||||
proc: self.proc.clone(),
|
||||
selection: query,
|
||||
}
|
||||
}
|
||||
|
||||
/// Exit code of the last executed command. Zero means success.
|
||||
@@ -141,8 +159,15 @@ impl Container {
|
||||
///
|
||||
/// * `address` - Image's address from its registry.
|
||||
/// Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
|
||||
pub fn from(&self, _address: String) -> Container {
|
||||
todo!()
|
||||
pub fn from(&self, address: String) -> Container {
|
||||
let query = self.selection.select("from");
|
||||
let query = query.arg("address", address).unwrap();
|
||||
|
||||
Container {
|
||||
conn: self.conn.clone(),
|
||||
proc: self.proc.clone(),
|
||||
selection: query,
|
||||
}
|
||||
}
|
||||
|
||||
/// Retrieves this container's root filesystem. Mounts are not included.
|
||||
@@ -187,7 +212,11 @@ impl Container {
|
||||
/// Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
|
||||
/// * `platformVariants` - Identifiers for other platform specific containers.
|
||||
/// Used for multi-platform image.
|
||||
pub fn publish(&self, _address: String, _platform_variants: Option<Vec<ContainerID>>) -> String {
|
||||
pub fn publish(
|
||||
&self,
|
||||
_address: String,
|
||||
_platform_variants: Option<Vec<ContainerID>>,
|
||||
) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
@@ -205,7 +234,9 @@ impl Container {
|
||||
/// The output stream of the last executed command.
|
||||
/// Null if no command has been executed.
|
||||
pub fn stdout(&self) -> Option<String> {
|
||||
todo!()
|
||||
let query = self.selection.select("stdout");
|
||||
|
||||
query.execute(&graphql_client(&self.conn)).unwrap()
|
||||
}
|
||||
|
||||
/// Retrieves the user to be set for all commands.
|
||||
@@ -251,7 +282,7 @@ impl Container {
|
||||
/// The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
|
||||
pub fn with_exec(
|
||||
&self,
|
||||
_args: Vec<String>,
|
||||
args: Vec<String>,
|
||||
_stdin: Option<String>,
|
||||
_redirect_stdout: Option<String>,
|
||||
_redirect_stderr: Option<String>,
|
||||
@@ -266,7 +297,12 @@ impl Container {
|
||||
}
|
||||
|
||||
/// Retrieves this container plus the contents of the given file copied to the given path.
|
||||
pub fn with_file(&self, _path: String, _source: FileID, _permissions: Option<Int>) -> Container {
|
||||
pub fn with_file(
|
||||
&self,
|
||||
_path: String,
|
||||
_source: FileID,
|
||||
_permissions: Option<Int>,
|
||||
) -> Container {
|
||||
todo!()
|
||||
}
|
||||
|
||||
@@ -448,7 +484,12 @@ impl Directory {
|
||||
}
|
||||
|
||||
/// Retrieves this directory plus the contents of the given file copied to the given path.
|
||||
pub fn with_file(&self, _path: String, _source: FileID, _permissions: Option<Int>) -> Directory {
|
||||
pub fn with_file(
|
||||
&self,
|
||||
_path: String,
|
||||
_source: FileID,
|
||||
_permissions: Option<Int>,
|
||||
) -> Directory {
|
||||
todo!()
|
||||
}
|
||||
|
||||
@@ -617,7 +658,11 @@ impl Host {
|
||||
}
|
||||
|
||||
/// Retrieves the current working directory on the host.
|
||||
pub fn workdir(&self, _exclude: Option<Vec<String>>, _include: Option<Vec<String>>) -> Directory {
|
||||
pub fn workdir(
|
||||
&self,
|
||||
_exclude: Option<Vec<String>>,
|
||||
_include: Option<Vec<String>>,
|
||||
) -> Directory {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
@@ -696,7 +741,11 @@ impl Project {
|
||||
impl Input for Project {}
|
||||
|
||||
///
|
||||
pub struct Query {}
|
||||
pub struct Query {
|
||||
pub conn: ConnectParams,
|
||||
pub proc: Arc<Child>,
|
||||
pub selection: Selection,
|
||||
}
|
||||
|
||||
impl Query {
|
||||
/// Constructs a cache volume for a given cache key.
|
||||
@@ -711,7 +760,13 @@ impl Query {
|
||||
/// 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, _id: Option<ContainerID>, _platform: Option<Platform>) -> Container {
|
||||
todo!()
|
||||
let query = self.selection.select("container");
|
||||
|
||||
return Container {
|
||||
conn: self.conn.clone(),
|
||||
proc: self.proc.clone(),
|
||||
selection: query,
|
||||
};
|
||||
}
|
||||
|
||||
/// The default platform of the builder.
|
||||
|
Reference in New Issue
Block a user