From e331ca003546f4ebe00f33b65c3b45c6b0586514 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Wed, 22 Feb 2023 23:09:20 +0100 Subject: [PATCH] chore(sdk): fix whitespace --- crates/dagger-sdk/src/gen.rs | 552 +++++++++++++++++++++++++++++++---- 1 file changed, 494 insertions(+), 58 deletions(-) diff --git a/crates/dagger-sdk/src/gen.rs b/crates/dagger-sdk/src/gen.rs index a044a57..2984260 100644 --- a/crates/dagger-sdk/src/gen.rs +++ b/crates/dagger-sdk/src/gen.rs @@ -22,8 +22,8 @@ pub struct SecretId(String); pub struct SocketId(String); #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] pub struct BuildArg { - pub value: String, pub name: String, + pub value: String, } #[derive(Debug, Clone)] pub struct CacheVolume { @@ -31,9 +31,11 @@ pub struct CacheVolume { pub selection: Selection, pub conn: ConnectParams, } + impl CacheVolume { pub async fn id(&self) -> eyre::Result { let query = self.selection.select("id"); + query.execute(&graphql_client(&self.conn)).await } } @@ -43,6 +45,7 @@ pub struct Container { pub selection: Selection, pub conn: ConnectParams, } + #[derive(Builder, Debug, PartialEq)] pub struct ContainerBuildOpts<'a> { /// Path to the Dockerfile to use. @@ -145,24 +148,35 @@ pub struct ContainerWithNewFileOpts<'a> { #[builder(setter(into, strip_option))] pub permissions: Option, } + 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. + /// + /// # Arguments + /// + /// * `context` - Directory context used by the Dockerfile. /// * `opt` - optional argument, see inner type for documentation, use _opts to use pub fn build(&self, context: DirectoryId) -> Container { let mut query = self.selection.select("build"); + query = query.arg("context", context); + return Container { proc: self.proc.clone(), selection: query, conn: self.conn.clone(), }; } + /// 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. + /// + /// # Arguments + /// + /// * `context` - Directory context used by the Dockerfile. /// * `opt` - optional argument, see inner type for documentation, use _opts to use pub fn build_opts<'a>(&self, context: DirectoryId, opts: ContainerBuildOpts<'a>) -> Container { let mut query = self.selection.select("build"); + query = query.arg("context", context); if let Some(dockerfile) = opts.dockerfile { query = query.arg("dockerfile", dockerfile); @@ -173,6 +187,7 @@ impl Container { if let Some(target) = opts.target { query = query.arg("target", target); } + return Container { proc: self.proc.clone(), selection: query, @@ -182,12 +197,15 @@ impl Container { /// Retrieves default arguments for future commands. pub async fn default_args(&self) -> eyre::Result> { let query = self.selection.select("defaultArgs"); + query.execute(&graphql_client(&self.conn)).await } /// Retrieves a directory at the given path. Mounts are included. pub fn directory(&self, path: impl Into) -> Directory { let mut query = self.selection.select("directory"); + query = query.arg("path", path.into()); + return Directory { proc: self.proc.clone(), selection: query, @@ -197,17 +215,21 @@ impl Container { /// Retrieves entrypoint to be prepended to the arguments of all commands. pub async fn entrypoint(&self) -> eyre::Result> { let query = self.selection.select("entrypoint"); + query.execute(&graphql_client(&self.conn)).await } /// Retrieves the value of the specified environment variable. pub async fn env_variable(&self, name: impl Into) -> eyre::Result { let mut query = self.selection.select("envVariable"); + query = query.arg("name", name.into()); + query.execute(&graphql_client(&self.conn)).await } /// Retrieves the list of environment variables passed to commands. pub fn env_variables(&self) -> Vec { let query = self.selection.select("envVariables"); + return vec![EnvVariable { proc: self.proc.clone(), selection: query, @@ -215,19 +237,28 @@ impl Container { }]; } /// Retrieves this container after executing the specified command inside it. - /// /// # Arguments /// /// * `opt` - optional argument, see inner type for documentation, use _opts to use + /// + /// # Arguments + /// + /// * `opt` - optional argument, see inner type for documentation, use _opts to use pub fn exec(&self) -> Container { let query = self.selection.select("exec"); + return Container { proc: self.proc.clone(), selection: query, conn: self.conn.clone(), }; } + /// Retrieves this container after executing the specified command inside it. - /// /// # Arguments /// /// * `opt` - optional argument, see inner type for documentation, use _opts to use + /// + /// # Arguments + /// + /// * `opt` - optional argument, see inner type for documentation, use _opts to use pub fn exec_opts<'a>(&self, opts: ContainerExecOpts<'a>) -> Container { let mut query = self.selection.select("exec"); + if let Some(args) = opts.args { query = query.arg("args", args); } @@ -246,6 +277,7 @@ impl Container { experimental_privileged_nesting, ); } + return Container { proc: self.proc.clone(), selection: query, @@ -256,21 +288,31 @@ impl Container { /// Null if no command has been executed. pub async fn exit_code(&self) -> eyre::Result { let query = self.selection.select("exitCode"); + query.execute(&graphql_client(&self.conn)).await } /// 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. + /// + /// # Arguments + /// + /// * `path` - Host's destination path. /// Path can be relative to the engine's workdir or absolute. /// * `opt` - optional argument, see inner type for documentation, use _opts to use pub async fn export(&self, path: impl Into) -> eyre::Result { let mut query = self.selection.select("export"); + query = query.arg("path", path.into()); + query.execute(&graphql_client(&self.conn)).await } + /// 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. + /// + /// # Arguments + /// + /// * `path` - Host's destination path. /// Path can be relative to the engine's workdir or absolute. /// * `opt` - optional argument, see inner type for documentation, use _opts to use pub async fn export_opts( @@ -279,16 +321,20 @@ impl Container { opts: ContainerExportOpts, ) -> eyre::Result { let mut query = self.selection.select("export"); + query = query.arg("path", path.into()); if let Some(platform_variants) = opts.platform_variants { query = query.arg("platformVariants", platform_variants); } + query.execute(&graphql_client(&self.conn)).await } /// Retrieves a file at the given path. Mounts are included. pub fn file(&self, path: impl Into) -> File { let mut query = self.selection.select("file"); + query = query.arg("path", path.into()); + return File { proc: self.proc.clone(), selection: query, @@ -296,11 +342,16 @@ impl Container { }; } /// Initializes this container from the base image published at the given address. - /// /// # Arguments /// /// * `address` - Image's address from its registry. + /// + /// # Arguments + /// + /// * `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: impl Into) -> Container { let mut query = self.selection.select("from"); + query = query.arg("address", address.into()); + return Container { proc: self.proc.clone(), selection: query, @@ -310,6 +361,7 @@ impl Container { /// Retrieves this container's root filesystem. Mounts are not included. pub fn fs(&self) -> Directory { let query = self.selection.select("fs"); + return Directory { proc: self.proc.clone(), selection: query, @@ -319,17 +371,21 @@ impl Container { /// A unique identifier for this container. pub async fn id(&self) -> eyre::Result { let query = self.selection.select("id"); + query.execute(&graphql_client(&self.conn)).await } /// Retrieves the value of the specified label. pub async fn label(&self, name: impl Into) -> eyre::Result { let mut query = self.selection.select("label"); + query = query.arg("name", name.into()); + query.execute(&graphql_client(&self.conn)).await } /// Retrieves the list of labels passed to container. pub fn labels(&self) -> Vec