From d2cddff365c636feceb3f20a73df812fcab11a19 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Mon, 30 Jan 2023 20:53:53 +0100 Subject: [PATCH] add input_fields --- crates/dagger-codegen/src/handlers/object.rs | 8 +- crates/dagger-sdk/src/gen.rs | 1230 ++++++++++-------- 2 files changed, 676 insertions(+), 562 deletions(-) diff --git a/crates/dagger-codegen/src/handlers/object.rs b/crates/dagger-codegen/src/handlers/object.rs index 45b9379..a24c917 100644 --- a/crates/dagger-codegen/src/handlers/object.rs +++ b/crates/dagger-codegen/src/handlers/object.rs @@ -3,7 +3,7 @@ use graphql_introspection_query::introspection_response::FullType; use crate::predicates::is_object_type; -use super::{fields, utility::render_description, Handler}; +use super::{fields, input_field, utility::render_description, Handler}; pub struct Object; @@ -26,9 +26,15 @@ impl Handler for Object { None => None, }; + let input_fields = match t.input_fields.as_ref() { + Some(i) => input_field::render_input_fields(i)?, + None => None, + }; + let out = quote! { $(if description.is_some() => $description) pub struct $name { + $(if input_fields.is_some() => $input_fields) } impl $name { diff --git a/crates/dagger-sdk/src/gen.rs b/crates/dagger-sdk/src/gen.rs index 2d8cbf3..c6bc0af 100644 --- a/crates/dagger-sdk/src/gen.rs +++ b/crates/dagger-sdk/src/gen.rs @@ -2,8 +2,12 @@ use dagger_core::{Boolean, Input, Int, Scalar}; // code generated by dagger. DO NOT EDIT. -/// A content-addressed directory identifier. -pub struct DirectoryID(Scalar); +/// 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); + +/// A unique identifier for a secret. +pub struct SecretID(Scalar); /// A global cache volume identifier. pub struct CacheID(Scalar); @@ -11,20 +15,16 @@ pub struct CacheID(Scalar); /// A content-addressed socket identifier. pub struct SocketID(Scalar); -/// A file identifier. -pub struct FileID(Scalar); - -/// 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); - /// A unique container identifier. Null designates an empty container (scratch). pub struct ContainerID(Scalar); -/// A unique identifier for a secret. -pub struct SecretID(Scalar); +/// A file identifier. +pub struct FileID(Scalar); -/// +/// A content-addressed directory identifier. +pub struct DirectoryID(Scalar); + +/// pub struct BuildArg { pub name: Option, @@ -33,538 +33,42 @@ pub struct BuildArg { impl Input for BuildArg {} -/// A file. -pub struct File {} - -impl File { - /// Retrieves the contents of the file. - pub fn contents(&self) -> Option { - todo!() - } - - /// Writes the file to a file path on the host. - pub fn export(&self) -> Option { - todo!() - } - - /// Retrieves the content-addressed identifier of the file. - pub fn id(&self) -> Option { - todo!() - } - - /// Retrieves a secret referencing the contents of this file. - pub fn secret(&self) -> Option { - todo!() - } - - /// Gets the size of the file, in bytes. - pub fn size(&self) -> Option { - 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 { - 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 { - todo!() - } - - /// Retrieves default arguments for future commands. - pub fn default_args(&self) -> Vec> { - todo!() - } - - /// Retrieves a directory at the given path. Mounts are included. - pub fn directory(&self) -> Option { - todo!() - } - - /// Retrieves entrypoint to be prepended to the arguments of all commands. - pub fn entrypoint(&self) -> Vec> { - 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>> { - todo!() - } - - /// Retrieves this container after executing the specified command inside it. - pub fn exec(&self) -> Option { - 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 { - todo!() - } - - /// Retrieves a file at the given path. Mounts are included. - pub fn file(&self) -> Option { - todo!() - } - - /// Initializes this container from the base image published at the given address. - pub fn from(&self) -> Option { - todo!() - } - - /// Retrieves this container's root filesystem. Mounts are not included. - pub fn fs(&self) -> Option { - todo!() - } - - /// A unique identifier for this container. - pub fn id(&self) -> Option { - 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>> { - todo!() - } - - /// Retrieves the list of paths where a directory is mounted. - pub fn mounts(&self) -> Option>> { - todo!() - } - - /// Creates a named sub-pipeline - pub fn pipeline(&self) -> Option { - todo!() - } - - /// The platform this container executes and publishes as. - pub fn platform(&self) -> Option { - 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 { - todo!() - } - - /// Retrieves this container's root filesystem. Mounts are not included. - pub fn rootfs(&self) -> Option { - 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 { - todo!() - } - - /// Retrieves this container plus a directory written at the given path. - pub fn with_directory(&self) -> Option { - todo!() - } - - /// Retrieves this container but with a different command entrypoint. - pub fn with_entrypoint(&self) -> Option { - todo!() - } - - /// Retrieves this container plus the given environment variable. - pub fn with_env_variable(&self) -> Option { - todo!() - } - - /// Retrieves this container after executing the specified command inside it. - pub fn with_exec(&self) -> Option { - todo!() - } - - /// Initializes this container from this DirectoryID. - pub fn with_fs(&self) -> Option { - todo!() - } - - /// Retrieves this container plus the contents of the given file copied to the given path. - pub fn with_file(&self) -> Option { - todo!() - } - - /// Retrieves this container plus the given label. - pub fn with_label(&self) -> Option { - todo!() - } - - /// Retrieves this container plus a cache volume mounted at the given path. - pub fn with_mounted_cache(&self) -> Option { - todo!() - } - - /// Retrieves this container plus a directory mounted at the given path. - pub fn with_mounted_directory(&self) -> Option { - todo!() - } - - /// Retrieves this container plus a file mounted at the given path. - pub fn with_mounted_file(&self) -> Option { - todo!() - } - - /// Retrieves this container plus a secret mounted into a file at the given path. - pub fn with_mounted_secret(&self) -> Option { - todo!() - } - - /// Retrieves this container plus a temporary directory mounted at the given path. - pub fn with_mounted_temp(&self) -> Option { - todo!() - } - - /// Retrieves this container plus a new file written at the given path. - pub fn with_new_file(&self) -> Option { - todo!() - } - - /// Initializes this container from this DirectoryID. - pub fn with_rootfs(&self) -> Option { - todo!() - } - - /// Retrieves this container plus an env variable containing the given secret. - pub fn with_secret_variable(&self) -> Option { - todo!() - } - - /// Retrieves this container plus a socket forwarded to the given Unix socket path. - pub fn with_unix_socket(&self) -> Option { - todo!() - } - - /// Retrieves this containers with a different command user. - pub fn with_user(&self) -> Option { - todo!() - } - - /// Retrieves this container with a different working directory. - pub fn with_workdir(&self) -> Option { - todo!() - } - - /// Retrieves this container minus the given environment variable. - pub fn without_env_variable(&self) -> Option { - todo!() - } - - /// Retrieves this container minus the given environment label. - pub fn without_label(&self) -> Option { - todo!() - } - - /// Retrieves this container after unmounting everything at the given path. - pub fn without_mount(&self) -> Option { - todo!() - } - - /// Retrieves this container with a previously added Unix socket removed. - pub fn without_unix_socket(&self) -> Option { - 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 { - 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 { - todo!() - } - - /// The filesystem tree at this ref. - pub fn tree(&self) -> Option { - 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 { - todo!() - } - - /// The value of this secret. - pub fn plaintext(&self) -> Option { - 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 { - todo!() - } - - /// The value of this variable. - pub fn value(&self) -> Option { - 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 { - 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 { - todo!() - } - - /// The default platform of the builder. - pub fn default_platform(&self) -> Option { - todo!() - } - - /// Load a directory by ID. No argument produces an empty directory. - pub fn directory(&self) -> Option { - todo!() - } - - /// Loads a file by ID. - pub fn file(&self) -> File { - todo!() - } - - /// Queries a git repository. - pub fn git(&self) -> Option { - todo!() - } - - /// Queries the host environment. - pub fn host(&self) -> Option { - todo!() - } - - /// Returns a file containing an http remote url content. - pub fn http(&self) -> Option { - todo!() - } - - /// Creates a named sub-pipeline - pub fn pipeline(&self) -> Option { - todo!() - } - - /// Look up a project by name - pub fn project(&self) -> Option { - todo!() - } - - /// Loads a secret from its ID. - pub fn secret(&self) -> Option { - todo!() - } - - /// Loads a socket by its ID. - pub fn socket(&self) -> Option { - 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 { - todo!() - } - - /// Retrieves a directory at the given path. - pub fn directory(&self) -> Option { - todo!() - } - - /// Builds a new Docker container from this directory. - pub fn docker_build(&self) -> Option { - todo!() - } - - /// Returns a list of files and directories at the given path. - pub fn entries(&self) -> Option>> { - todo!() - } - - /// Writes the contents of the directory to a path on the host. - pub fn export(&self) -> Option { - todo!() - } - - /// Retrieves a file at the given path. - pub fn file(&self) -> Option { - todo!() - } - - /// The content-addressed identifier of the directory. - pub fn id(&self) -> Option { - todo!() - } - - /// load a project's metadata - pub fn load_project(&self) -> Option { - todo!() - } - - /// Creates a named sub-pipeline. - pub fn pipeline(&self) -> Option { - todo!() - } - - /// Retrieves this directory plus a directory written at the given path. - pub fn with_directory(&self) -> Option { - todo!() - } - - /// Retrieves this directory plus the contents of the given file copied to the given path. - pub fn with_file(&self) -> Option { - todo!() - } - - /// Retrieves this directory plus a new directory created at the given path. - pub fn with_new_directory(&self) -> Option { - todo!() - } - - /// Retrieves this directory plus a new file written at the given path. - pub fn with_new_file(&self) -> Option { - 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 { - todo!() - } - - /// Retrieves this directory with the directory at the given path removed. - pub fn without_directory(&self) -> Option { - todo!() - } - - /// Retrieves this directory with the file at the given path removed. - pub fn without_file(&self) -> Option { - todo!() - } -} - -impl Input for Directory {} - /// A set of scripts and/or extensions pub struct Project {} impl Project { - /// extensions in this project + +/// extensions in this project pub fn extensions(&self) -> Vec> { todo!() } - /// Code files generated by the SDKs in the project + +/// Code files generated by the SDKs in the project pub fn generated_code(&self) -> Option { todo!() } - /// install the project's schema + +/// install the project's schema pub fn install(&self) -> Option { todo!() } - /// name of the project + +/// name of the project pub fn name(&self) -> Option { todo!() } - /// schema provided by the project + +/// schema provided by the project pub fn schema(&self) -> String { todo!() } - /// sdk used to generate code for and/or execute this project + +/// sdk used to generate code for and/or execute this project pub fn sdk(&self) -> String { todo!() } @@ -572,60 +76,86 @@ impl Project { impl Input for Project {} -/// -pub struct Socket {} +/// Information about the host execution environment. +pub struct Host {} -impl Socket { - /// The content-addressed identifier of the socket. - pub fn id(&self) -> Option { +impl Host { + +/// Accesses a directory on the host. + pub fn directory(&self) -> Option { + 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 { + todo!() + } + + +/// Retrieves the current working directory on the host. + pub fn workdir(&self) -> Option { todo!() } } -impl Input for Socket {} +impl Input for Host {} -/// A simple key value object that represents a label. -pub struct Label {} +/// An environment variable on the host environment. +pub struct HostVariable {} -impl Label { - /// The label name. - pub fn name(&self) -> Option { +impl HostVariable { + +/// A secret referencing the value of this variable. + pub fn secret(&self) -> Option { todo!() } - /// The label value. + +/// The value of this variable. pub fn value(&self) -> Option { todo!() } } -impl Input for Label {} +impl Input for HostVariable {} /// A git repository. pub struct GitRepository {} impl GitRepository { - /// Returns details on one branch. + +/// Returns details on one branch. pub fn branch(&self) -> Option { todo!() } - /// Lists of branches on the repository. + +/// Lists of branches on the repository. pub fn branches(&self) -> Option>> { todo!() } - /// Returns details on one commit. + +/// Returns details on one commit. pub fn commit(&self) -> Option { todo!() } - /// Returns details on one tag. + +/// Returns details on one tag. pub fn tag(&self) -> Option { todo!() } - /// Lists of tags on the repository. + +/// Lists of tags on the repository. pub fn tags(&self) -> Option>> { todo!() } @@ -633,16 +163,602 @@ impl GitRepository { impl Input for GitRepository {} -/// A simple key value object that represents an environment variable. -pub struct EnvVariable {} +/// A directory. +pub struct Directory {} -impl EnvVariable { - /// The environment variable name. +impl Directory { + +/// Gets the difference between this directory and an another directory. + pub fn diff(&self) -> Option { + todo!() + } + + +/// Retrieves a directory at the given path. + pub fn directory(&self) -> Option { + todo!() + } + + +/// Builds a new Docker container from this directory. + pub fn docker_build(&self) -> Option { + todo!() + } + + +/// Returns a list of files and directories at the given path. + pub fn entries(&self) -> Option>> { + todo!() + } + + +/// Writes the contents of the directory to a path on the host. + pub fn export(&self) -> Option { + todo!() + } + + +/// Retrieves a file at the given path. + pub fn file(&self) -> Option { + todo!() + } + + +/// The content-addressed identifier of the directory. + pub fn id(&self) -> Option { + todo!() + } + + +/// load a project's metadata + pub fn load_project(&self) -> Option { + todo!() + } + + +/// Creates a named sub-pipeline. + pub fn pipeline(&self) -> Option { + todo!() + } + + +/// Retrieves this directory plus a directory written at the given path. + pub fn with_directory(&self) -> Option { + todo!() + } + + +/// Retrieves this directory plus the contents of the given file copied to the given path. + pub fn with_file(&self) -> Option { + todo!() + } + + +/// Retrieves this directory plus a new directory created at the given path. + pub fn with_new_directory(&self) -> Option { + todo!() + } + + +/// Retrieves this directory plus a new file written at the given path. + pub fn with_new_file(&self) -> Option { + 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 { + todo!() + } + + +/// Retrieves this directory with the directory at the given path removed. + pub fn without_directory(&self) -> Option { + todo!() + } + + +/// Retrieves this directory with the file at the given path removed. + pub fn without_file(&self) -> Option { + todo!() + } +} + +impl Input for Directory {} + +/// 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 { + todo!() + } + + +/// Retrieves default arguments for future commands. + pub fn default_args(&self) -> Vec> { + todo!() + } + + +/// Retrieves a directory at the given path. Mounts are included. + pub fn directory(&self) -> Option { + todo!() + } + + +/// Retrieves entrypoint to be prepended to the arguments of all commands. + pub fn entrypoint(&self) -> Vec> { + 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>> { + todo!() + } + + +/// Retrieves this container after executing the specified command inside it. + pub fn exec(&self) -> Option { + 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 { + todo!() + } + + +/// Retrieves a file at the given path. Mounts are included. + pub fn file(&self) -> Option { + todo!() + } + + +/// Initializes this container from the base image published at the given address. + pub fn from(&self) -> Option { + todo!() + } + + +/// Retrieves this container's root filesystem. Mounts are not included. + pub fn fs(&self) -> Option { + todo!() + } + + +/// A unique identifier for this container. + pub fn id(&self) -> Option { + 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>> { + todo!() + } + + +/// Retrieves the list of paths where a directory is mounted. + pub fn mounts(&self) -> Option>> { + todo!() + } + + +/// Creates a named sub-pipeline + pub fn pipeline(&self) -> Option { + todo!() + } + + +/// The platform this container executes and publishes as. + pub fn platform(&self) -> Option { + 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 { + todo!() + } + + +/// Retrieves this container's root filesystem. Mounts are not included. + pub fn rootfs(&self) -> Option { + 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 { + todo!() + } + + +/// Retrieves this container plus a directory written at the given path. + pub fn with_directory(&self) -> Option { + todo!() + } + + +/// Retrieves this container but with a different command entrypoint. + pub fn with_entrypoint(&self) -> Option { + todo!() + } + + +/// Retrieves this container plus the given environment variable. + pub fn with_env_variable(&self) -> Option { + todo!() + } + + +/// Retrieves this container after executing the specified command inside it. + pub fn with_exec(&self) -> Option { + todo!() + } + + +/// Initializes this container from this DirectoryID. + pub fn with_fs(&self) -> Option { + todo!() + } + + +/// Retrieves this container plus the contents of the given file copied to the given path. + pub fn with_file(&self) -> Option { + todo!() + } + + +/// Retrieves this container plus the given label. + pub fn with_label(&self) -> Option { + todo!() + } + + +/// Retrieves this container plus a cache volume mounted at the given path. + pub fn with_mounted_cache(&self) -> Option { + todo!() + } + + +/// Retrieves this container plus a directory mounted at the given path. + pub fn with_mounted_directory(&self) -> Option { + todo!() + } + + +/// Retrieves this container plus a file mounted at the given path. + pub fn with_mounted_file(&self) -> Option { + todo!() + } + + +/// Retrieves this container plus a secret mounted into a file at the given path. + pub fn with_mounted_secret(&self) -> Option { + todo!() + } + + +/// Retrieves this container plus a temporary directory mounted at the given path. + pub fn with_mounted_temp(&self) -> Option { + todo!() + } + + +/// Retrieves this container plus a new file written at the given path. + pub fn with_new_file(&self) -> Option { + todo!() + } + + +/// Initializes this container from this DirectoryID. + pub fn with_rootfs(&self) -> Option { + todo!() + } + + +/// Retrieves this container plus an env variable containing the given secret. + pub fn with_secret_variable(&self) -> Option { + todo!() + } + + +/// Retrieves this container plus a socket forwarded to the given Unix socket path. + pub fn with_unix_socket(&self) -> Option { + todo!() + } + + +/// Retrieves this containers with a different command user. + pub fn with_user(&self) -> Option { + todo!() + } + + +/// Retrieves this container with a different working directory. + pub fn with_workdir(&self) -> Option { + todo!() + } + + +/// Retrieves this container minus the given environment variable. + pub fn without_env_variable(&self) -> Option { + todo!() + } + + +/// Retrieves this container minus the given environment label. + pub fn without_label(&self) -> Option { + todo!() + } + + +/// Retrieves this container after unmounting everything at the given path. + pub fn without_mount(&self) -> Option { + todo!() + } + + +/// Retrieves this container with a previously added Unix socket removed. + pub fn without_unix_socket(&self) -> Option { + todo!() + } + + +/// Retrieves the working directory for all commands. + pub fn workdir(&self) -> String { + todo!() + } +} + +impl Input for Container {} + +/// A simple key value object that represents a label. +pub struct Label {} + +impl Label { + +/// The label name. pub fn name(&self) -> Option { todo!() } - /// The environment variable value. + +/// The label value. + pub fn value(&self) -> Option { + todo!() + } +} + +impl Input for Label {} + +/// +pub struct Socket {} + +impl Socket { + +/// The content-addressed identifier of the socket. + pub fn id(&self) -> Option { + todo!() + } +} + +impl Input for Socket {} + +/// 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 { + todo!() + } + + +/// The value of this secret. + pub fn plaintext(&self) -> Option { + todo!() + } +} + +impl Input for Secret {} + +/// A directory whose contents persist across runs. +pub struct CacheVolume {} + +impl CacheVolume { + +/// + pub fn id(&self) -> Option { + todo!() + } +} + +impl Input for CacheVolume {} + +/// +pub struct Query {} + +impl Query { + +/// Constructs a cache volume for a given cache key. + pub fn cache_volume(&self) -> Option { + 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 { + todo!() + } + + +/// The default platform of the builder. + pub fn default_platform(&self) -> Option { + todo!() + } + + +/// Load a directory by ID. No argument produces an empty directory. + pub fn directory(&self) -> Option { + todo!() + } + + +/// Loads a file by ID. + pub fn file(&self) -> File { + todo!() + } + + +/// Queries a git repository. + pub fn git(&self) -> Option { + todo!() + } + + +/// Queries the host environment. + pub fn host(&self) -> Option { + todo!() + } + + +/// Returns a file containing an http remote url content. + pub fn http(&self) -> Option { + todo!() + } + + +/// Creates a named sub-pipeline + pub fn pipeline(&self) -> Option { + todo!() + } + + +/// Look up a project by name + pub fn project(&self) -> Option { + todo!() + } + + +/// Loads a secret from its ID. + pub fn secret(&self) -> Option { + todo!() + } + + +/// Loads a socket by its ID. + pub fn socket(&self) -> Option { + todo!() + } +} + +impl Input for Query {} + +/// A file. +pub struct File {} + +impl File { + +/// Retrieves the contents of the file. + pub fn contents(&self) -> Option { + todo!() + } + + +/// Writes the file to a file path on the host. + pub fn export(&self) -> Option { + todo!() + } + + +/// Retrieves the content-addressed identifier of the file. + pub fn id(&self) -> Option { + todo!() + } + + +/// Retrieves a secret referencing the contents of this file. + pub fn secret(&self) -> Option { + todo!() + } + + +/// Gets the size of the file, in bytes. + pub fn size(&self) -> Option { + 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 { + todo!() + } +} + +impl Input for File {} + +/// A simple key value object that represents an environment variable. +pub struct EnvVariable {} + +impl EnvVariable { + +/// The environment variable name. + pub fn name(&self) -> Option { + todo!() + } + + +/// The environment variable value. pub fn value(&self) -> Option { todo!() } @@ -650,29 +766,21 @@ impl EnvVariable { impl Input for EnvVariable {} -/// Information about the host execution environment. -pub struct Host {} +/// A git ref (tag, branch or commit). +pub struct GitRef {} -impl Host { - /// Accesses a directory on the host. - pub fn directory(&self) -> Option { +impl GitRef { + +/// The digest of the current value of this ref. + pub fn digest(&self) -> Option { 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 { - todo!() - } - - /// Retrieves the current working directory on the host. - pub fn workdir(&self) -> Option { + +/// The filesystem tree at this ref. + pub fn tree(&self) -> Option { todo!() } } -impl Input for Host {} +impl Input for GitRef {}