dagger-rs/crates/dagger-sdk/src/gen.rs

853 lines
23 KiB
Rust
Raw Normal View History

2023-02-05 23:44:06 +01:00
use std::process::Child;
use std::sync::Arc;
use dagger_core::connect_params::ConnectParams;
2023-01-30 20:44:48 +01:00
use dagger_core::{Boolean, Input, Int, Scalar};
2023-01-29 20:14:52 +01:00
2023-02-05 23:44:06 +01:00
use crate::client::graphql_client;
use crate::querybuilder::Selection;
2023-01-29 15:23:03 +01:00
// code generated by dagger. DO NOT EDIT.
2023-02-01 16:42:50 +01:00
/// A global cache volume identifier.
pub struct CacheID(Scalar);
2023-02-01 15:32:38 +01:00
2023-02-01 16:34:59 +01:00
/// A unique container identifier. Null designates an empty container (scratch).
pub struct ContainerID(Scalar);
2023-02-01 15:27:44 +01:00
2023-01-30 22:21:16 +01:00
/// A content-addressed directory identifier.
pub struct DirectoryID(Scalar);
2023-02-01 16:34:59 +01:00
/// A file identifier.
pub struct FileID(Scalar);
2023-02-01 15:32:38 +01:00
2023-02-01 16:34:59 +01:00
/// The platform config OS and architecture in a Container.
/// The format is [os]/[platform]/[version] (e.g. darwin/arm64/v7, windows/amd64, linux/arm64).
pub struct Platform(Scalar);
2023-02-01 16:42:50 +01:00
/// A unique identifier for a secret.
pub struct SecretID(Scalar);
/// A content-addressed socket identifier.
pub struct SocketID(Scalar);
2023-01-30 22:21:16 +01:00
///
2023-01-30 20:44:48 +01:00
pub struct BuildArg {
2023-02-01 15:06:28 +01:00
pub name: String,
2023-02-01 15:27:44 +01:00
pub value: String,
2023-01-30 20:44:48 +01:00
}
impl Input for BuildArg {}
2023-02-01 16:34:59 +01:00
/// A directory whose contents persist across runs.
pub struct CacheVolume {}
impl CacheVolume {
///
pub fn id(&self) -> CacheID {
2023-02-01 15:32:38 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
}
2023-01-30 20:53:53 +01:00
2023-02-01 16:34:59 +01:00
impl Input for CacheVolume {}
/// An OCI-compatible container, also known as a docker container.
2023-02-05 23:44:06 +01:00
pub struct Container {
pub conn: ConnectParams,
pub proc: Arc<Child>,
pub selection: Selection,
}
2023-02-01 16:34:59 +01:00
impl Container {
/// Initializes this container from a Dockerfile build, using the context, a dockerfile file path and some additional buildArgs.
/// # Arguments
///
/// * `context` - Directory context used by the Dockerfile.
/// * `dockerfile` - Path to the Dockerfile to use.
/// Defaults to './Dockerfile'.
/// * `buildArgs` - Additional build arguments.
/// * `target` - Target build stage to build.
pub fn build(
2023-02-01 15:32:38 +01:00
&self,
2023-02-05 21:49:01 +01:00
_context: DirectoryID,
_dockerfile: Option<String>,
_build_args: Option<Vec<BuildArg>>,
_target: Option<String>,
2023-02-01 15:32:38 +01:00
) -> Container {
todo!()
}
2023-01-30 20:53:53 +01:00
2023-02-01 16:34:59 +01:00
/// Retrieves default arguments for future commands.
pub fn default_args(&self) -> Option<Vec<String>> {
2023-02-01 15:32:38 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves a directory at the given path. Mounts are included.
2023-02-05 21:49:01 +01:00
pub fn directory(&self, _path: String) -> Directory {
2023-02-01 15:32:38 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves entrypoint to be prepended to the arguments of all commands.
pub fn entrypoint(&self) -> Option<Vec<String>> {
2023-01-30 20:53:53 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves the value of the specified environment variable.
2023-02-05 21:49:01 +01:00
pub fn env_variable(&self, _name: String) -> Option<String> {
2023-01-30 20:53:53 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves the list of environment variables passed to commands.
pub fn env_variables(&self) -> Vec<EnvVariable> {
2023-01-30 20:53:53 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves this container after executing the specified command inside it.
/// # Arguments
///
/// * `args` - Command to run instead of the container's default command.
/// * `stdin` - Content to write to the command's standard input before closing.
/// * `redirectStdout` - Redirect the command's standard output to a file in the container.
/// * `redirectStderr` - Redirect the command's standard error to a file in the container.
/// * `experimentalPrivilegedNesting` - Provide dagger access to the executed command.
/// Do not use this option unless you trust the command being executed.
/// The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
pub fn exec(
&self,
2023-02-05 23:44:06 +01:00
args: Option<Vec<String>>,
2023-02-05 21:49:01 +01:00
_stdin: Option<String>,
_redirect_stdout: Option<String>,
_redirect_stderr: Option<String>,
_experimental_privileged_nesting: Option<Boolean>,
2023-02-01 16:34:59 +01:00
) -> Container {
2023-02-05 23:44:06 +01:00
let query = self.selection.select("exec");
let query = query.arg("args", args).unwrap();
Container {
conn: self.conn.clone(),
proc: self.proc.clone(),
selection: query,
}
2023-01-30 20:53:53 +01:00
}
2023-02-01 16:34:59 +01:00
/// Exit code of the last executed command. Zero means success.
/// Null if no command has been executed.
pub fn exit_code(&self) -> Option<Int> {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 15:06:28 +01:00
2023-02-01 16:34:59 +01:00
/// Writes the container as an OCI tarball to the destination file path on the host for the specified platformVariants.
/// Return true on success.
/// # Arguments
///
/// * `path` - Host's destination path.
/// Path can be relative to the engine's workdir or absolute.
/// * `platformVariants` - Identifiers for other platform specific containers.
/// Used for multi-platform image.
2023-02-05 21:49:01 +01:00
pub fn export(&self, _path: String, _platform_variants: Option<Vec<ContainerID>>) -> Boolean {
2023-02-01 15:27:44 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves a file at the given path. Mounts are included.
2023-02-05 21:49:01 +01:00
pub fn file(&self, _path: String) -> File {
2023-02-01 15:27:44 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Initializes this container from the base image published at the given address.
/// # Arguments
///
/// * `address` - Image's address from its registry.
/// Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
2023-02-05 23:44:06 +01:00
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,
}
2023-02-01 15:27:44 +01:00
}
2023-02-01 15:06:28 +01:00
2023-02-01 16:34:59 +01:00
/// Retrieves this container's root filesystem. Mounts are not included.
pub fn fs(&self) -> Directory {
2023-02-01 15:06:28 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// A unique identifier for this container.
pub fn id(&self) -> ContainerID {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-01-30 20:53:53 +01:00
2023-02-01 16:34:59 +01:00
/// Retrieves the value of the specified label.
2023-02-05 21:49:01 +01:00
pub fn label(&self, _name: String) -> Option<String> {
2023-02-01 15:32:38 +01:00
todo!()
}
2023-01-30 20:53:53 +01:00
2023-02-01 16:34:59 +01:00
/// Retrieves the list of labels passed to container.
pub fn labels(&self) -> Vec<Label> {
2023-01-30 20:53:53 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves the list of paths where a directory is mounted.
pub fn mounts(&self) -> Vec<String> {
2023-01-30 20:53:53 +01:00
todo!()
}
2023-02-01 15:06:28 +01:00
2023-02-01 16:34:59 +01:00
/// Creates a named sub-pipeline
2023-02-05 21:49:01 +01:00
pub fn pipeline(&self, _name: String, _description: Option<String>) -> Container {
2023-01-30 20:53:53 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// The platform this container executes and publishes as.
pub fn platform(&self) -> Platform {
2023-02-01 15:27:44 +01:00
todo!()
}
2023-02-01 15:06:28 +01:00
2023-02-01 16:34:59 +01:00
/// Publishes this container as a new image to the specified address, for the platformVariants, returning a fully qualified ref.
/// # Arguments
///
/// * `address` - Registry's address to publish the image to.
/// 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.
2023-02-05 23:44:06 +01:00
pub fn publish(
&self,
_address: String,
_platform_variants: Option<Vec<ContainerID>>,
) -> String {
2023-02-01 15:27:44 +01:00
todo!()
}
2023-02-01 15:06:28 +01:00
2023-02-01 16:34:59 +01:00
/// Retrieves this container's root filesystem. Mounts are not included.
pub fn rootfs(&self) -> Directory {
2023-01-30 20:53:53 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// The error stream of the last executed command.
/// Null if no command has been executed.
pub fn stderr(&self) -> Option<String> {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// The output stream of the last executed command.
/// Null if no command has been executed.
pub fn stdout(&self) -> Option<String> {
2023-02-05 23:44:06 +01:00
let query = self.selection.select("stdout");
query.execute(&graphql_client(&self.conn)).unwrap()
2023-02-01 15:06:28 +01:00
}
2023-01-30 20:53:53 +01:00
2023-02-01 16:34:59 +01:00
/// Retrieves the user to be set for all commands.
pub fn user(&self) -> Option<String> {
2023-02-01 15:06:28 +01:00
todo!()
}
2023-01-30 20:53:53 +01:00
2023-02-01 16:34:59 +01:00
/// Configures default arguments for future commands.
2023-02-05 21:49:01 +01:00
pub fn with_default_args(&self, _args: Option<Vec<String>>) -> Container {
2023-02-01 15:27:44 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves this container plus a directory written at the given path.
pub fn with_directory(
&self,
2023-02-05 21:49:01 +01:00
_path: String,
_directory: DirectoryID,
_exclude: Option<Vec<String>>,
_include: Option<Vec<String>>,
2023-02-01 16:34:59 +01:00
) -> Container {
2023-01-30 20:53:53 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves this container but with a different command entrypoint.
2023-02-05 21:49:01 +01:00
pub fn with_entrypoint(&self, _args: Vec<String>) -> Container {
2023-01-30 20:53:53 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves this container plus the given environment variable.
2023-02-05 21:49:01 +01:00
pub fn with_env_variable(&self, _name: String, _value: String) -> Container {
2023-01-30 20:53:53 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves this container after executing the specified command inside it.
/// # Arguments
///
/// * `args` - Command to run instead of the container's default command.
/// * `stdin` - Content to write to the command's standard input before closing.
/// * `redirectStdout` - Redirect the command's standard output to a file in the container.
/// * `redirectStderr` - Redirect the command's standard error to a file in the container.
/// * `experimentalPrivilegedNesting` - Provide dagger access to the executed command.
/// Do not use this option unless you trust the command being executed.
/// The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
pub fn with_exec(
&self,
2023-02-05 23:44:06 +01:00
args: Vec<String>,
2023-02-05 21:49:01 +01:00
_stdin: Option<String>,
_redirect_stdout: Option<String>,
_redirect_stderr: Option<String>,
_experimental_privileged_nesting: Option<Boolean>,
2023-02-01 16:34:59 +01:00
) -> Container {
2023-02-01 15:06:28 +01:00
todo!()
}
2023-01-30 20:44:48 +01:00
2023-02-01 16:34:59 +01:00
/// Initializes this container from this DirectoryID.
2023-02-05 21:49:01 +01:00
pub fn with_fs(&self, _id: DirectoryID) -> Container {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves this container plus the contents of the given file copied to the given path.
2023-02-05 23:44:06 +01:00
pub fn with_file(
&self,
_path: String,
_source: FileID,
_permissions: Option<Int>,
) -> Container {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves this container plus the given label.
2023-02-05 21:49:01 +01:00
pub fn with_label(&self, _name: String, _value: String) -> Container {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves this container plus a cache volume mounted at the given path.
pub fn with_mounted_cache(
&self,
2023-02-05 21:49:01 +01:00
_path: String,
_cache: CacheID,
_source: Option<DirectoryID>,
2023-02-01 16:34:59 +01:00
) -> Container {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves this container plus a directory mounted at the given path.
2023-02-05 21:49:01 +01:00
pub fn with_mounted_directory(&self, _path: String, _source: DirectoryID) -> Container {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves this container plus a file mounted at the given path.
2023-02-05 21:49:01 +01:00
pub fn with_mounted_file(&self, _path: String, _source: FileID) -> Container {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves this container plus a secret mounted into a file at the given path.
2023-02-05 21:49:01 +01:00
pub fn with_mounted_secret(&self, _path: String, _source: SecretID) -> Container {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves this container plus a temporary directory mounted at the given path.
2023-02-05 21:49:01 +01:00
pub fn with_mounted_temp(&self, _path: String) -> Container {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves this container plus a new file written at the given path.
pub fn with_new_file(
&self,
2023-02-05 21:49:01 +01:00
_path: String,
_contents: Option<String>,
_permissions: Option<Int>,
2023-02-01 16:34:59 +01:00
) -> Container {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:42:50 +01:00
/// Initializes this container from this DirectoryID.
2023-02-05 21:49:01 +01:00
pub fn with_rootfs(&self, _id: DirectoryID) -> Container {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Retrieves this container plus an env variable containing the given secret.
2023-02-05 21:49:01 +01:00
pub fn with_secret_variable(&self, _name: String, _secret: SecretID) -> Container {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Retrieves this container plus a socket forwarded to the given Unix socket path.
2023-02-05 21:49:01 +01:00
pub fn with_unix_socket(&self, _path: String, _source: SocketID) -> Container {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Retrieves this containers with a different command user.
2023-02-05 21:49:01 +01:00
pub fn with_user(&self, _name: String) -> Container {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Retrieves this container with a different working directory.
2023-02-05 21:49:01 +01:00
pub fn with_workdir(&self, _path: String) -> Container {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Retrieves this container minus the given environment variable.
2023-02-05 21:49:01 +01:00
pub fn without_env_variable(&self, _name: String) -> Container {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Retrieves this container minus the given environment label.
2023-02-05 21:49:01 +01:00
pub fn without_label(&self, _name: String) -> Container {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Retrieves this container after unmounting everything at the given path.
2023-02-05 21:49:01 +01:00
pub fn without_mount(&self, _path: String) -> Container {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Retrieves this container with a previously added Unix socket removed.
2023-02-05 21:49:01 +01:00
pub fn without_unix_socket(&self, _path: String) -> Container {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Retrieves the working directory for all commands.
pub fn workdir(&self) -> Option<String> {
todo!()
}
}
impl Input for Container {}
/// A directory.
pub struct Directory {}
impl Directory {
/// Gets the difference between this directory and an another directory.
2023-02-05 21:49:01 +01:00
pub fn diff(&self, _other: DirectoryID) -> Directory {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Retrieves a directory at the given path.
2023-02-05 21:49:01 +01:00
pub fn directory(&self, _path: String) -> Directory {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Builds a new Docker container from this directory.
/// # Arguments
///
/// * `dockerfile` - Path to the Dockerfile to use.
/// Defaults to './Dockerfile'.
/// * `platform` - The platform to build.
/// * `buildArgs` - Additional build arguments.
/// * `target` - Target build stage to build.
pub fn docker_build(
&self,
2023-02-05 21:49:01 +01:00
_dockerfile: Option<String>,
_platform: Option<Platform>,
_build_args: Option<Vec<BuildArg>>,
_target: Option<String>,
2023-02-01 16:42:50 +01:00
) -> Container {
todo!()
}
/// Returns a list of files and directories at the given path.
2023-02-05 21:49:01 +01:00
pub fn entries(&self, _path: Option<String>) -> Vec<String> {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Writes the contents of the directory to a path on the host.
2023-02-05 21:49:01 +01:00
pub fn export(&self, _path: String) -> Boolean {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Retrieves a file at the given path.
2023-02-05 21:49:01 +01:00
pub fn file(&self, _path: String) -> File {
2023-02-01 16:42:50 +01:00
todo!()
}
/// The content-addressed identifier of the directory.
pub fn id(&self) -> DirectoryID {
todo!()
}
/// load a project's metadata
2023-02-05 21:49:01 +01:00
pub fn load_project(&self, _config_path: String) -> Project {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Creates a named sub-pipeline.
2023-02-05 21:49:01 +01:00
pub fn pipeline(&self, _name: String, _description: Option<String>) -> Directory {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Retrieves this directory plus a directory written at the given path.
/// # Arguments
///
/// * `exclude` - Exclude artifacts that match the given pattern.
/// (e.g. ["node_modules/", ".git*"]).
/// * `include` - Include only artifacts that match the given pattern.
/// (e.g. ["app/", "package.*"]).
pub fn with_directory(
&self,
2023-02-05 21:49:01 +01:00
_path: String,
_directory: DirectoryID,
_exclude: Option<Vec<String>>,
_include: Option<Vec<String>>,
2023-02-01 16:42:50 +01:00
) -> Directory {
todo!()
}
/// Retrieves this directory plus the contents of the given file copied to the given path.
2023-02-05 23:44:06 +01:00
pub fn with_file(
&self,
_path: String,
_source: FileID,
_permissions: Option<Int>,
) -> Directory {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Retrieves this directory plus a new directory created at the given path.
2023-02-05 21:49:01 +01:00
pub fn with_new_directory(&self, _path: String, _permissions: Option<Int>) -> Directory {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Retrieves this directory plus a new file written at the given path.
pub fn with_new_file(
&self,
2023-02-05 21:49:01 +01:00
_path: String,
_contents: String,
_permissions: Option<Int>,
2023-02-01 16:42:50 +01:00
) -> Directory {
todo!()
}
/// Retrieves this directory with all file/dir timestamps set to the given time, in seconds from the Unix epoch.
2023-02-05 21:49:01 +01:00
pub fn with_timestamps(&self, _timestamp: Int) -> Directory {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Retrieves this directory with the directory at the given path removed.
2023-02-05 21:49:01 +01:00
pub fn without_directory(&self, _path: String) -> Directory {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:42:50 +01:00
/// Retrieves this directory with the file at the given path removed.
2023-02-05 21:49:01 +01:00
pub fn without_file(&self, _path: String) -> Directory {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:42:50 +01:00
}
2023-02-01 15:32:38 +01:00
2023-02-01 16:42:50 +01:00
impl Input for Directory {}
/// A simple key value object that represents an environment variable.
pub struct EnvVariable {}
impl EnvVariable {
/// The environment variable name.
pub fn name(&self) -> String {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 15:32:38 +01:00
2023-02-01 16:42:50 +01:00
/// The environment variable value.
pub fn value(&self) -> String {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:42:50 +01:00
}
2023-01-30 20:44:48 +01:00
2023-02-01 16:42:50 +01:00
impl Input for EnvVariable {}
/// A file.
pub struct File {}
impl File {
/// Retrieves the contents of the file.
pub fn contents(&self) -> String {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 15:32:38 +01:00
2023-02-01 16:42:50 +01:00
/// Writes the file to a file path on the host.
2023-02-05 21:49:01 +01:00
pub fn export(&self, _path: String) -> Boolean {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:42:50 +01:00
/// Retrieves the content-addressed identifier of the file.
pub fn id(&self) -> FileID {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:42:50 +01:00
/// Retrieves a secret referencing the contents of this file.
pub fn secret(&self) -> Secret {
2023-02-01 16:34:59 +01:00
todo!()
}
2023-02-01 15:32:38 +01:00
2023-02-01 16:42:50 +01:00
/// Gets the size of the file, in bytes.
pub fn size(&self) -> Int {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:42:50 +01:00
/// Retrieves this file with its created/modified timestamps set to the given time, in seconds from the Unix epoch.
2023-02-05 21:49:01 +01:00
pub fn with_timestamps(&self, _timestamp: Int) -> File {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 15:32:38 +01:00
}
2023-01-30 20:44:48 +01:00
2023-02-01 16:42:50 +01:00
impl Input for File {}
2023-02-01 15:32:38 +01:00
2023-02-01 16:34:59 +01:00
/// A git ref (tag, branch or commit).
pub struct GitRef {}
2023-01-30 20:44:48 +01:00
2023-02-01 16:34:59 +01:00
impl GitRef {
/// The digest of the current value of this ref.
pub fn digest(&self) -> String {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// The filesystem tree at this ref.
pub fn tree(
2023-01-30 22:21:16 +01:00
&self,
2023-02-05 21:49:01 +01:00
_ssh_known_hosts: Option<String>,
_ssh_auth_socket: Option<SocketID>,
2023-02-01 16:34:59 +01:00
) -> Directory {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
}
2023-01-30 20:44:48 +01:00
2023-02-01 16:34:59 +01:00
impl Input for GitRef {}
2023-01-30 20:44:48 +01:00
2023-02-01 16:42:50 +01:00
/// A git repository.
pub struct GitRepository {}
2023-01-30 20:44:48 +01:00
2023-02-01 16:42:50 +01:00
impl GitRepository {
/// Returns details on one branch.
2023-02-05 21:49:01 +01:00
pub fn branch(&self, _name: String) -> GitRef {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:42:50 +01:00
/// Lists of branches on the repository.
pub fn branches(&self) -> Vec<String> {
todo!()
}
/// Returns details on one commit.
2023-02-05 21:49:01 +01:00
pub fn commit(&self, _id: String) -> GitRef {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Returns details on one tag.
2023-02-05 21:49:01 +01:00
pub fn tag(&self, _name: String) -> GitRef {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Lists of tags on the repository.
pub fn tags(&self) -> Vec<String> {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
}
2023-01-30 20:44:48 +01:00
2023-02-01 16:42:50 +01:00
impl Input for GitRepository {}
2023-01-30 20:44:48 +01:00
2023-02-01 16:34:59 +01:00
/// Information about the host execution environment.
pub struct Host {}
2023-01-30 20:44:48 +01:00
2023-02-01 16:34:59 +01:00
impl Host {
/// Accesses a directory on the host.
pub fn directory(
2023-02-01 15:32:38 +01:00
&self,
2023-02-05 21:49:01 +01:00
_path: String,
_exclude: Option<Vec<String>>,
_include: Option<Vec<String>>,
2023-02-01 15:32:38 +01:00
) -> Directory {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Accesses an environment variable on the host.
2023-02-05 21:49:01 +01:00
pub fn env_variable(&self, _name: String) -> Option<HostVariable> {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Accesses a Unix socket on the host.
2023-02-05 21:49:01 +01:00
pub fn unix_socket(&self, _path: String) -> Socket {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
/// Retrieves the current working directory on the host.
2023-02-05 23:44:06 +01:00
pub fn workdir(
&self,
_exclude: Option<Vec<String>>,
_include: Option<Vec<String>>,
) -> Directory {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:34:59 +01:00
}
2023-01-30 20:44:48 +01:00
2023-02-01 16:34:59 +01:00
impl Input for Host {}
2023-01-30 20:44:48 +01:00
2023-02-01 16:42:50 +01:00
/// An environment variable on the host environment.
pub struct HostVariable {}
2023-01-30 20:44:48 +01:00
2023-02-01 16:42:50 +01:00
impl HostVariable {
/// A secret referencing the value of this variable.
pub fn secret(&self) -> Secret {
todo!()
}
/// The value of this variable.
pub fn value(&self) -> String {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 15:32:38 +01:00
}
2023-01-30 20:44:48 +01:00
2023-02-01 16:42:50 +01:00
impl Input for HostVariable {}
2023-02-01 15:32:38 +01:00
2023-02-01 16:42:50 +01:00
/// A simple key value object that represents a label.
pub struct Label {}
2023-02-01 15:32:38 +01:00
2023-02-01 16:42:50 +01:00
impl Label {
/// The label name.
pub fn name(&self) -> String {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:42:50 +01:00
/// The label value.
pub fn value(&self) -> String {
2023-01-30 20:44:48 +01:00
todo!()
}
2023-02-01 16:42:50 +01:00
}
2023-01-30 20:44:48 +01:00
2023-02-01 16:42:50 +01:00
impl Input for Label {}
/// A set of scripts and/or extensions
pub struct Project {}
impl Project {
/// extensions in this project
pub fn extensions(&self) -> Option<Vec<Project>> {
2023-02-01 16:34:59 +01:00
todo!()
}
2023-01-30 20:44:48 +01:00
2023-02-01 16:42:50 +01:00
/// Code files generated by the SDKs in the project
pub fn generated_code(&self) -> Directory {
2023-02-01 16:34:59 +01:00
todo!()
}
2023-01-30 20:44:48 +01:00
2023-02-01 16:42:50 +01:00
/// install the project's schema
pub fn install(&self) -> Boolean {
todo!()
}
/// name of the project
pub fn name(&self) -> String {
todo!()
}
/// schema provided by the project
pub fn schema(&self) -> Option<String> {
todo!()
}
/// sdk used to generate code for and/or execute this project
pub fn sdk(&self) -> Option<String> {
2023-01-30 20:44:48 +01:00
todo!()
}
}
2023-02-01 16:42:50 +01:00
impl Input for Project {}
///
2023-02-05 23:44:06 +01:00
pub struct Query {
pub conn: ConnectParams,
pub proc: Arc<Child>,
pub selection: Selection,
}
2023-02-01 16:42:50 +01:00
impl Query {
/// Constructs a cache volume for a given cache key.
/// # Arguments
///
/// * `key` - A string identifier to target this cache volume (e.g. "myapp-cache").
2023-02-05 21:49:01 +01:00
pub fn cache_volume(&self, _key: String) -> CacheVolume {
2023-02-01 16:42:50 +01:00
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.
2023-02-05 21:49:01 +01:00
pub fn container(&self, _id: Option<ContainerID>, _platform: Option<Platform>) -> Container {
2023-02-05 23:44:06 +01:00
let query = self.selection.select("container");
return Container {
conn: self.conn.clone(),
proc: self.proc.clone(),
selection: query,
};
2023-02-01 16:42:50 +01:00
}
/// The default platform of the builder.
pub fn default_platform(&self) -> Platform {
todo!()
}
/// Load a directory by ID. No argument produces an empty directory.
2023-02-05 21:49:01 +01:00
pub fn directory(&self, _id: Option<DirectoryID>) -> Directory {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Loads a file by ID.
2023-02-05 21:49:01 +01:00
pub fn file(&self, _id: FileID) -> Option<File> {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Queries a git repository.
2023-02-05 21:49:01 +01:00
pub fn git(&self, _url: String, _keep_git_dir: Option<Boolean>) -> GitRepository {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Queries the host environment.
pub fn host(&self) -> Host {
todo!()
}
/// Returns a file containing an http remote url content.
2023-02-05 21:49:01 +01:00
pub fn http(&self, _url: String) -> File {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Creates a named sub-pipeline
2023-02-05 21:49:01 +01:00
pub fn pipeline(&self, _name: String, _description: Option<String>) -> Query {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Look up a project by name
2023-02-05 21:49:01 +01:00
pub fn project(&self, _name: String) -> Project {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Loads a secret from its ID.
2023-02-05 21:49:01 +01:00
pub fn secret(&self, _id: SecretID) -> Secret {
2023-02-01 16:42:50 +01:00
todo!()
}
/// Loads a socket by its ID.
2023-02-05 21:49:01 +01:00
pub fn socket(&self, _id: Option<SocketID>) -> Socket {
2023-02-01 16:42:50 +01:00
todo!()
}
}
impl Input for Query {}
/// 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) -> SecretID {
todo!()
}
/// The value of this secret.
pub fn plaintext(&self) -> String {
todo!()
}
}
impl Input for Secret {}
///
pub struct Socket {}
impl Socket {
/// The content-addressed identifier of the socket.
pub fn id(&self) -> SocketID {
todo!()
}
}
impl Input for Socket {}