diff --git a/crates/dagger-codegen/src/predicates.rs b/crates/dagger-codegen/src/predicates.rs index 9ee9016..d807bcc 100644 --- a/crates/dagger-codegen/src/predicates.rs +++ b/crates/dagger-codegen/src/predicates.rs @@ -40,9 +40,9 @@ pub fn is_required_type(t: &FullTypeInputFields) -> bool { pub fn is_required_type_ref(t: &TypeRef) -> bool { match t.kind { - Some(__TypeKind::NON_NULL) => return false, - Some(_) => return true, - _ => return false, + Some(__TypeKind::NON_NULL) => return true, + Some(_) => return false, + _ => return true, } } diff --git a/crates/dagger-sdk/src/gen.rs b/crates/dagger-sdk/src/gen.rs index 47aa9eb..5b885d9 100644 --- a/crates/dagger-sdk/src/gen.rs +++ b/crates/dagger-sdk/src/gen.rs @@ -2,9 +2,6 @@ use dagger_core::{Boolean, Input, Int, Scalar}; // code generated by dagger. DO NOT EDIT. -/// A file identifier. -pub struct FileID(Scalar); - /// A content-addressed directory identifier. pub struct DirectoryID(Scalar); @@ -15,8 +12,8 @@ pub struct CacheID(Scalar); /// 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 file identifier. +pub struct FileID(Scalar); /// A content-addressed socket identifier. pub struct SocketID(Scalar); @@ -24,120 +21,34 @@ pub struct SocketID(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); + /// pub struct BuildArg { - pub name: Option, + pub value: String, - pub value: Option, + pub name: String, } impl Input for BuildArg {} -/// A file. -pub struct File {} +/// A reference to a secret value, which can be handled more safely than the value itself. +pub struct Secret {} -impl File { - /// Retrieves the contents of the file. - pub fn contents(&self) -> Option { +impl Secret { + /// The identifier for this secret. + pub fn id(&self) -> SecretID { todo!() } - /// Writes the file to a file path on the host. - pub fn export(&self, path: Option) -> 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, timestamp: Option) -> Option { + /// The value of this secret. + pub fn plaintext(&self) -> String { todo!() } } -impl Input for File {} - -/// A set of scripts and/or extensions -pub struct Project {} - -impl Project { - /// extensions in this project - pub fn extensions(&self) -> Vec> { - todo!() - } - - /// Code files generated by the SDKs in the project - pub fn generated_code(&self) -> Option { - todo!() - } - - /// install the project's schema - pub fn install(&self) -> Option { - todo!() - } - - /// name of the project - pub fn name(&self) -> Option { - 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 {} - -/// A git repository. -pub struct GitRepository {} - -impl GitRepository { - /// Returns details on one branch. - pub fn branch(&self, name: Option) -> Option { - todo!() - } - - /// Lists of branches on the repository. - pub fn branches(&self) -> Option>> { - todo!() - } - - /// Returns details on one commit. - pub fn commit(&self, id: Option) -> Option { - todo!() - } - - /// Returns details on one tag. - pub fn tag(&self, name: Option) -> Option { - todo!() - } - - /// Lists of tags on the repository. - pub fn tags(&self) -> Option>> { - todo!() - } -} - -impl Input for GitRepository {} +impl Input for Secret {} /// Information about the host execution environment. pub struct Host {} @@ -146,69 +57,244 @@ impl Host { /// Accesses a directory on the host. pub fn directory( &self, - path: Option, - exclude: Vec>, - include: Vec>, - ) -> Option { + path: String, + exclude: Option, + include: Option, + ) -> Directory { todo!() } /// Accesses an environment variable on the host. - pub fn env_variable(&self, name: Option) -> HostVariable { + pub fn env_variable(&self, name: String) -> HostVariable { todo!() } /// Accesses a Unix socket on the host. - pub fn unix_socket(&self, path: Option) -> Option { + pub fn unix_socket(&self, path: String) -> Socket { todo!() } /// Retrieves the current working directory on the host. - pub fn workdir( - &self, - exclude: Vec>, - include: Vec>, - ) -> Option { + pub fn workdir(&self, exclude: Option, include: Option) -> Directory { todo!() } } impl Input for Host {} +/// A git repository. +pub struct GitRepository {} + +impl GitRepository { + /// Returns details on one branch. + pub fn branch(&self, name: String) -> GitRef { + todo!() + } + + /// Lists of branches on the repository. + pub fn branches(&self) -> Option { + todo!() + } + + /// Returns details on one commit. + pub fn commit(&self, id: String) -> GitRef { + todo!() + } + + /// Returns details on one tag. + pub fn tag(&self, name: String) -> GitRef { + todo!() + } + + /// Lists of tags on the repository. + pub fn tags(&self) -> Option { + todo!() + } +} + +impl Input for GitRepository {} + +/// 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) -> String { + todo!() + } + + /// The filesystem tree at this ref. + pub fn tree(&self, ssh_known_hosts: String, ssh_auth_socket: SocketID) -> Directory { + todo!() + } +} + +impl Input for GitRef {} + +/// An environment variable on the host environment. +pub struct HostVariable {} + +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 { + todo!() + } +} + +impl Input for HostVariable {} + +/// A directory whose contents persist across runs. +pub struct CacheVolume {} + +impl CacheVolume { + /// + pub fn id(&self) -> CacheID { + todo!() + } +} + +impl Input for CacheVolume {} + +/// A directory. +pub struct Directory {} + +impl Directory { + /// Gets the difference between this directory and an another directory. + pub fn diff(&self, other: DirectoryID) -> Directory { + todo!() + } + + /// Retrieves a directory at the given path. + pub fn directory(&self, path: String) -> Directory { + todo!() + } + + /// Builds a new Docker container from this directory. + /// # Arguments + /// + /// * `dockerfile` - Path to the Dockerfile to use. + /// Path to the Dockerfile to use. + /// Defaults to './Dockerfile'. + /// * `platform` - The platform to build. + /// The platform to build. + /// * `buildArgs` - Additional build arguments. + /// Additional build arguments. + /// * `target` - Target build stage to build. + /// Target build stage to build. + pub fn docker_build( + &self, + dockerfile: String, + platform: Platform, + build_args: Option, + target: String, + ) -> Container { + todo!() + } + + /// Returns a list of files and directories at the given path. + pub fn entries(&self, path: String) -> Option { + todo!() + } + + /// Writes the contents of the directory to a path on the host. + pub fn export(&self, path: String) -> Boolean { + todo!() + } + + /// Retrieves a file at the given path. + pub fn file(&self, path: String) -> File { + todo!() + } + + /// The content-addressed identifier of the directory. + pub fn id(&self) -> DirectoryID { + todo!() + } + + /// load a project's metadata + pub fn load_project(&self, config_path: String) -> Project { + todo!() + } + + /// Creates a named sub-pipeline. + pub fn pipeline(&self, name: String, description: String) -> Directory { + todo!() + } + + /// Retrieves this directory plus a directory written at the given path. + /// # Arguments + /// + /// * `exclude` - Exclude artifacts that match the given pattern. + /// Exclude artifacts that match the given pattern. + /// (e.g. ["node_modules/", ".git*"]). + /// * `include` - Include only artifacts that match the given pattern. + /// Include only artifacts that match the given pattern. + /// (e.g. ["app/", "package.*"]). + pub fn with_directory( + &self, + path: String, + directory: DirectoryID, + exclude: Option, + include: Option, + ) -> Directory { + todo!() + } + + /// 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: Int) -> Directory { + todo!() + } + + /// Retrieves this directory plus a new directory created at the given path. + pub fn with_new_directory(&self, path: String, permissions: Int) -> Directory { + todo!() + } + + /// Retrieves this directory plus a new file written at the given path. + pub fn with_new_file(&self, path: String, contents: String, permissions: Int) -> 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, timestamp: Int) -> Directory { + todo!() + } + + /// Retrieves this directory with the directory at the given path removed. + pub fn without_directory(&self, path: String) -> Directory { + todo!() + } + + /// Retrieves this directory with the file at the given path removed. + pub fn without_file(&self, path: String) -> Directory { + todo!() + } +} + +impl Input for Directory {} + /// A simple key value object that represents a label. pub struct Label {} impl Label { /// The label name. - pub fn name(&self) -> Option { + pub fn name(&self) -> String { todo!() } /// The label value. - pub fn value(&self) -> Option { + pub fn value(&self) -> String { todo!() } } impl Input for Label {} -/// 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 OCI-compatible container, also known as a docker container. pub struct Container {} @@ -227,36 +313,36 @@ impl Container { /// Target build stage to build. pub fn build( &self, - context: Option, + context: DirectoryID, dockerfile: String, - build_args: Vec>, + build_args: Option, target: String, - ) -> Option { + ) -> Container { todo!() } /// Retrieves default arguments for future commands. - pub fn default_args(&self) -> Vec> { + pub fn default_args(&self) -> Option { todo!() } /// Retrieves a directory at the given path. Mounts are included. - pub fn directory(&self, path: Option) -> Option { + pub fn directory(&self, path: String) -> Directory { todo!() } /// Retrieves entrypoint to be prepended to the arguments of all commands. - pub fn entrypoint(&self) -> Vec> { + pub fn entrypoint(&self) -> Option { todo!() } /// Retrieves the value of the specified environment variable. - pub fn env_variable(&self, name: Option) -> String { + pub fn env_variable(&self, name: String) -> String { todo!() } /// Retrieves the list of environment variables passed to commands. - pub fn env_variables(&self) -> Option>> { + pub fn env_variables(&self) -> Option { todo!() } @@ -277,12 +363,12 @@ impl Container { /// The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM. pub fn exec( &self, - args: Vec>, + args: Option, stdin: String, redirect_stdout: String, redirect_stderr: String, experimental_privileged_nesting: Boolean, - ) -> Option { + ) -> Container { todo!() } @@ -302,16 +388,12 @@ impl Container { /// * `platformVariants` - Identifiers for other platform specific containers. /// Identifiers for other platform specific containers. /// Used for multi-platform image. - pub fn export( - &self, - path: Option, - platform_variants: Vec>, - ) -> Option { + pub fn export(&self, path: String, platform_variants: Option) -> Boolean { todo!() } /// Retrieves a file at the given path. Mounts are included. - pub fn file(&self, path: Option) -> Option { + pub fn file(&self, path: String) -> File { todo!() } @@ -321,42 +403,42 @@ impl Container { /// * `address` - Image's address from its registry. /// Image's address from its registry. /// Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main). - pub fn from(&self, address: Option) -> Option { + pub fn from(&self, address: String) -> Container { todo!() } /// Retrieves this container's root filesystem. Mounts are not included. - pub fn fs(&self) -> Option { + pub fn fs(&self) -> Directory { todo!() } /// A unique identifier for this container. - pub fn id(&self) -> Option { + pub fn id(&self) -> ContainerID { todo!() } /// Retrieves the value of the specified label. - pub fn label(&self, name: Option) -> String { + pub fn label(&self, name: String) -> String { todo!() } /// Retrieves the list of labels passed to container. - pub fn labels(&self) -> Option>> { + pub fn labels(&self) -> Option