From b858aa1623017434cfcac3035927f7b400a864c6 Mon Sep 17 00:00:00 2001 From: Nathan Flurry Date: Sat, 23 Nov 2024 07:04:34 -0800 Subject: [PATCH] chore: add support for tar images for js --- ACTOR_CRASH_COURSE.md | 40 +++++ examples/actor-layer/index.ts | 44 +++++ examples/js-deno/rivet.jsonc | 2 +- examples/js-deno/rng_http.ts | 3 +- examples/js-kv/index.js | 8 + examples/js-kv/rivet.jsonc | 11 ++ packages/toolchain/src/config/build/docker.rs | 1 + .../toolchain/src/config/build/javascript.rs | 7 +- packages/toolchain/src/config/build/mod.rs | 1 + packages/toolchain/src/config/mod.rs | 11 +- packages/toolchain/src/tasks/deploy/js.rs | 154 +++++++----------- packages/toolchain/src/tasks/deploy/mod.rs | 1 - packages/toolchain/src/util/build.rs | 44 +++++ packages/toolchain/src/util/docker/archive.rs | 31 +--- packages/toolchain/src/util/docker/push.rs | 84 ++++------ packages/toolchain/src/util/mod.rs | 1 + sdks/rust/docs/ActorPrepareBuildRequest.md | 2 - sdks/rust/docs/ActorPrepareBuildResponse.md | 3 +- .../src/models/actor_prepare_build_request.rs | 6 - .../models/actor_prepare_build_response.rs | 20 +-- 20 files changed, 262 insertions(+), 212 deletions(-) create mode 100644 ACTOR_CRASH_COURSE.md create mode 100644 examples/actor-layer/index.ts create mode 100644 examples/js-kv/index.js create mode 100644 examples/js-kv/rivet.jsonc create mode 100644 packages/toolchain/src/util/build.rs diff --git a/ACTOR_CRASH_COURSE.md b/ACTOR_CRASH_COURSE.md new file mode 100644 index 00000000..b461fdd8 --- /dev/null +++ b/ACTOR_CRASH_COURSE.md @@ -0,0 +1,40 @@ +# Actor Crash Course + +## Prerequisites + +- Must have Rivet docker compose running +- Must have hub running just for the device link + +## Actor test + +```bash +cargo build +cd examples/js-deno +../../target/debug/rivet login --api-endpoint http://localhost:8080 +# copy the path to localhost:5080/device/link/... and finish linking +../../target/debug/rivet deploy default +# copy build id +../../target/debug/rivet actor create default -t name=rng --build MY_BUILD_ID --region local --network-mode host --port protocol=tcp,name=http,host +# copy public_hostname and public_port +curl 127.0.0.1:20081 +../../target/debug/rivet actor destroy default --id MY_ACTOR_ID +``` + +## Reference + +- See `rivet --help` for more commands +- rivet.jsonc config spec at `packages/toolchain/src/config/mod.rs` +- WIP typedefs for actors [here](https://github.com/rivet-gg/rivet/blob/925b9b5c2f024f40615e910e9670655249eb2bc7/sdks/actor-types/src/internal/90_rivet_ns.ts) + +## Known issues + +- Only supports host networking +- Networking is not working (afaik) +- LZ4 compression for JS tars don't work (defaults to correct compression, no action needed) + +## Troubleshooting + +### `Error getting bootstrap: get project failed` + +Make sure to run `rivet logout` if you reset the core cluster. + diff --git a/examples/actor-layer/index.ts b/examples/actor-layer/index.ts new file mode 100644 index 00000000..62f44a43 --- /dev/null +++ b/examples/actor-layer/index.ts @@ -0,0 +1,44 @@ +// Without Rivet actor class + +const portStr = Deno.env.get("PORT_http") ?? Deno.env.get("HTTP_PORT"); +if (!portStr) throw "Missing port"; +const port = parseInt(portStr); +if (!isFinite(port)) throw "Invalid port"; + +const server = Deno.serve({ + handler, + port, + hostname: "0.0.0.0", +}); + +await server.finished; + +async function handler(req: Request) { + console.log("Received request"); + + let newCount = (await Rivet.kv.get("count") ?? 0) + 1; + await Rivet.kv.put("count", newCount); + + return new Response(newCount.toString()); +} + +// With Rivet actor class + +import { Actor } from "@rivet-gg/rivet"; + +interface State { + count: number; +} + +class Counter extends Actor { + initialize(): State { + return { count: 0 }; + } + + async onRequest(req) { + this.count += 1; + return new Response(this.count.toString()); + } +} + +Rivet.run(Counter); diff --git a/examples/js-deno/rivet.jsonc b/examples/js-deno/rivet.jsonc index c08a6878..e989dc59 100644 --- a/examples/js-deno/rivet.jsonc +++ b/examples/js-deno/rivet.jsonc @@ -2,7 +2,7 @@ "version": "2.0", "builds": [ { - "tags": { "name": "rng-http" }, + "tags": { "name": "rng" }, "runtime": "javascript", "script": "rng_http.ts" } diff --git a/examples/js-deno/rng_http.ts b/examples/js-deno/rng_http.ts index d9163118..2418c3dc 100644 --- a/examples/js-deno/rng_http.ts +++ b/examples/js-deno/rng_http.ts @@ -1,8 +1,9 @@ import { randomIntegerBetween, randomSeeded } from "@std/random"; +console.log("Hello, world!"); console.log(Deno.env.toObject()); -const portStr = Deno.env.get("PORT_ds_http") ?? Deno.env.get("HTTP_PORT"); +const portStr = Deno.env.get("PORT_http") ?? Deno.env.get("HTTP_PORT"); if (!portStr) throw "Missing port"; const port = parseInt(portStr); if (!isFinite(port)) throw "Invalid port"; diff --git a/examples/js-kv/index.js b/examples/js-kv/index.js new file mode 100644 index 00000000..a7de34e1 --- /dev/null +++ b/examples/js-kv/index.js @@ -0,0 +1,8 @@ +await Rivet.kv.put("count", 0); + +console.log('Started', Deno.env.toObject()); +setInterval(async () => { + let x = await Rivet.kv.get("count"); + await Rivet.kv.put("count", x + 1); + console.log('Count', x); +}, 1000); diff --git a/examples/js-kv/rivet.jsonc b/examples/js-kv/rivet.jsonc new file mode 100644 index 00000000..8c7880e1 --- /dev/null +++ b/examples/js-kv/rivet.jsonc @@ -0,0 +1,11 @@ +{ + "version": "2.0", + "builds": [ + { + "tags": { "name": "kv" }, + "runtime": "javascript", + "bundler": "none", + "script": "index.js" + } + ] +} diff --git a/packages/toolchain/src/config/build/docker.rs b/packages/toolchain/src/config/build/docker.rs index 6f24b90c..1ad638fc 100644 --- a/packages/toolchain/src/config/build/docker.rs +++ b/packages/toolchain/src/config/build/docker.rs @@ -66,6 +66,7 @@ pub enum BuildMethod { } #[derive(Debug, Copy, Clone, Serialize, Deserialize, strum::AsRefStr)] +#[serde(rename_all = "snake_case")] pub enum BundleKind { /// Legacy option. Docker image archive output from `docker save`. Slower lobby start /// times. diff --git a/packages/toolchain/src/config/build/javascript.rs b/packages/toolchain/src/config/build/javascript.rs index d1f61fa2..3199a6a2 100644 --- a/packages/toolchain/src/config/build/javascript.rs +++ b/packages/toolchain/src/config/build/javascript.rs @@ -41,8 +41,7 @@ pub struct Unstable { pub minify: Option, pub analyze_result: Option, pub esbuild_log_level: Option, - // TODO(RVT-4127): Add compression support - // pub compression: Option, + pub compression: Option, } impl Unstable { @@ -60,8 +59,8 @@ impl Unstable { .unwrap_or_else(|| "error".to_string()) } - // TODO(RVT-4127): Add compression support pub fn compression(&self) -> Compression { - Compression::None + // TODO: Change back to Lz4 default + self.compression.unwrap_or(Compression::None) } } diff --git a/packages/toolchain/src/config/build/mod.rs b/packages/toolchain/src/config/build/mod.rs index ffaa0aa2..493b04e2 100644 --- a/packages/toolchain/src/config/build/mod.rs +++ b/packages/toolchain/src/config/build/mod.rs @@ -12,6 +12,7 @@ pub enum Runtime { } #[derive(Debug, Copy, Clone, Serialize, Deserialize, strum::AsRefStr)] +#[serde(rename_all = "snake_case")] pub enum Compression { /// No compression. #[strum(serialize = "none")] diff --git a/packages/toolchain/src/config/mod.rs b/packages/toolchain/src/config/mod.rs index a6ae4b8b..0ef5f6d9 100644 --- a/packages/toolchain/src/config/mod.rs +++ b/packages/toolchain/src/config/mod.rs @@ -64,13 +64,4 @@ pub struct Build { #[derive(Default, Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "snake_case", deny_unknown_fields)] -pub struct Unstable { - #[serde(skip_serializing_if = "Option::is_none")] - pub multipart_enabled: Option, -} - -impl Unstable { - pub fn multipart_enabled(&self) -> bool { - self.multipart_enabled.unwrap_or(true) - } -} +pub struct Unstable {} diff --git a/packages/toolchain/src/tasks/deploy/js.rs b/packages/toolchain/src/tasks/deploy/js.rs index 64071658..f2389bbf 100644 --- a/packages/toolchain/src/tasks/deploy/js.rs +++ b/packages/toolchain/src/tasks/deploy/js.rs @@ -12,11 +12,11 @@ use crate::{ util::{js_utils, net::upload, task, term}, }; +/// File name for the index path to the script. const BUILD_INDEX_NAME: &str = "index.js"; pub struct BuildAndUploadOpts { pub env: TEMPEnvironment, - pub config: config::Config, pub build_config: config::build::javascript::Build, pub version_name: String, } @@ -35,7 +35,6 @@ pub async fn build_and_upload( let build_dir = tempfile::TempDir::new()?; // Bundle JS - let compression = opts.build_config.unstable.compression(); match opts.build_config.bundler() { config::build::javascript::Bundler::Deno => { // Validate that the script path has a .ts or .js extension @@ -47,28 +46,24 @@ pub async fn build_and_upload( ); // Search for deno.json or deno.jsonc - let deno_config_path = ["deno.json", "deno.jsonc"] - .iter() - .find_map(|file_name| { - let path = project_root.join(file_name); - if path.exists() { - Some(path.display().to_string()) - } else { - None - } - }); + let deno_config_path = ["deno.json", "deno.jsonc"].iter().find_map(|file_name| { + let path = project_root.join(file_name); + if path.exists() { + Some(path.display().to_string()) + } else { + None + } + }); // Search for a Deno lockfile - let deno_lockfile_path = ["deno.lock"] - .iter() - .find_map(|file_name| { - let path = project_root.join(file_name); - if path.exists() { - Some(path.display().to_string()) - } else { - None - } - }); + let deno_lockfile_path = ["deno.lock"].iter().find_map(|file_name| { + let path = project_root.join(file_name); + if path.exists() { + Some(path.display().to_string()) + } else { + None + } + }); // Build the bundle to the output dir. This will bundle all Deno dependencies into a // single JS file. @@ -84,13 +79,15 @@ pub async fn build_and_upload( entry_point: script_path, out_dir: build_dir.path().to_path_buf(), deno: js_utils::schemas::build::Deno { - config_path: deno_config_path.or_else(|| opts - .build_config - .deno - .config_path - .map(|x| project_root.join(x).display().to_string())), + config_path: deno_config_path.or_else(|| { + opts.build_config + .deno + .config_path + .map(|x| project_root.join(x).display().to_string()) + }), import_map_url: opts.build_config.deno.import_map_url.clone(), - lock_path: deno_lockfile_path.or_else(|| opts.build_config.deno.lock_path.clone()), + lock_path: deno_lockfile_path + .or_else(|| opts.build_config.deno.lock_path.clone()), }, bundle: js_utils::schemas::build::Bundle { minify: opts.build_config.unstable.minify(), @@ -123,14 +120,10 @@ pub async fn build_and_upload( ctx, task.clone(), &UploadBundleOpts { - config: opts.config.clone(), env: opts.env, version_name: opts.version_name, build_path: build_dir.path().into(), - build_manifest: BuildManifest { - files: vec![BUILD_INDEX_NAME.into()], - }, - compression, + compression: opts.build_config.unstable.compression(), }, ) .await?; @@ -138,37 +131,13 @@ pub async fn build_and_upload( Ok(build_id) } -// pub struct JsBundleOpts { -// pub config: config::Config, -// pub env: TEMPEnvironment, -// } -// -// pub struct JsBundleOutput { -// pub path: PathBuf, -// pub manifest: BuildManafest, -// } -// -// /// Bundle a JS build -// pub async fn bundle_js( -// ctx: &ToolchainCtx, -// task: task::TaskCtx, -// current_dir: &Path, -// bundle_opts: &JsBundleOpts, -// ) -> Result<()> { -// todo!() -// } - struct UploadBundleOpts { - config: config::Config, env: TEMPEnvironment, version_name: String, /// Path to the root of the built files. build_path: PathBuf, - /// Manifest of files in the bundle. - build_manifest: BuildManifest, - compression: config::build::Compression, } @@ -178,25 +147,38 @@ async fn upload_bundle( task: task::TaskCtx, push_opts: &UploadBundleOpts, ) -> Result { - let multipart_enabled: bool = push_opts.config.unstable().multipart_enabled(); + // Validate bundle + match fs::metadata(push_opts.build_path.join(BUILD_INDEX_NAME)).await { + Result::Ok(_) => {} + Err(err) => { + if err.kind() == std::io::ErrorKind::NotFound { + bail!("index.js does not exist in javascript bundle") + } else { + bail!("error reading javascript index.js: {err}") + } + } + } + + // Archive build + let build_tar_file = tempfile::NamedTempFile::new()?; + let mut build_archive = tar::Builder::new(build_tar_file); + build_archive.append_dir_all(".", &push_opts.build_path)?; + let build_tar_file = build_archive.into_inner()?; + + let build_kind = models::ActorBuildKind::Javascript; + let build_compression = match push_opts.compression { + config::build::Compression::None => models::ActorBuildCompression::None, + config::build::Compression::Lz4 => models::ActorBuildCompression::Lz4, + }; + + // Compress build + let compressed_path = + crate::util::build::compress_build(build_tar_file.as_ref(), push_opts.compression).await?; - // Prepare index for upload - ensure!( - push_opts.build_manifest.files.len() == 1, - "must only upload bundle file" - ); - ensure!( - push_opts.build_manifest.files[0] == BUILD_INDEX_NAME, - "build file must be named `{}`", - BUILD_INDEX_NAME - ); - let index_path = push_opts - .build_path - .join(&push_opts.build_manifest.files[0]); let image_file = upload::prepare_upload_file( - &index_path, - &push_opts.build_manifest.files[0], - fs::metadata(&index_path).await?, + &compressed_path, + &crate::util::build::file_name(build_kind, build_compression), + fs::metadata(&compressed_path).await?, )?; let files = vec![image_file.clone()]; @@ -220,14 +202,8 @@ async fn upload_bundle( name: push_opts.version_name.clone(), image_tag: None, image_file: Box::new(image_file.prepared), - kind: Some(models::ActorBuildKind::Javascript), - compression: Some(match push_opts.compression { - config::build::Compression::None => models::ActorBuildCompression::None, - config::build::Compression::Lz4 => models::ActorBuildCompression::Lz4, - }), - multipart_upload: Some(multipart_enabled), - // TODO(RVT-4124): - prewarm_regions: None, + kind: Some(build_kind), + compression: Some(build_compression), }, Some(&ctx.project.name_id), Some(&push_opts.env.slug), @@ -239,15 +215,7 @@ async fn upload_bundle( let reqwest_client = Arc::new(reqwest::Client::new()); let pb = term::EitherProgressBar::Multi(term::multi_progress_bar(task.clone())); - let presigned_requests = if let Some(presigned_requests) = prepare_res.image_presigned_requests - { - presigned_requests - } else if let Some(image_presigned_request) = prepare_res.image_presigned_request { - vec![*image_presigned_request] - } else { - bail!("neither `image_presigned_request` or `image_presigned_requests` provided") - }; - futures_util::stream::iter(presigned_requests) + futures_util::stream::iter(prepare_res.presigned_requests) .map(Ok) .try_for_each_concurrent(8, |presigned_req| { let task = task.clone(); @@ -291,7 +259,3 @@ async fn upload_bundle( Ok(prepare_res.build) } - -struct BuildManifest { - files: Vec, -} diff --git a/packages/toolchain/src/tasks/deploy/mod.rs b/packages/toolchain/src/tasks/deploy/mod.rs index 0c68d636..23934fe9 100644 --- a/packages/toolchain/src/tasks/deploy/mod.rs +++ b/packages/toolchain/src/tasks/deploy/mod.rs @@ -121,7 +121,6 @@ async fn build_and_upload( task.clone(), js::BuildAndUploadOpts { env: env.clone(), - config: config.clone(), build_config: js.clone(), version_name: version_name.to_string(), }, diff --git a/packages/toolchain/src/util/build.rs b/packages/toolchain/src/util/build.rs new file mode 100644 index 00000000..f3dcfc86 --- /dev/null +++ b/packages/toolchain/src/util/build.rs @@ -0,0 +1,44 @@ +use anyhow::*; +use rivet_api::models::{ActorBuildCompression, ActorBuildKind}; +use std::path::Path; + +use crate::{config, util::lz4}; + +/// Generates the file name that holds the build tar. +pub fn file_name(kind: ActorBuildKind, compression: ActorBuildCompression) -> String { + let file_name = match kind { + ActorBuildKind::DockerImage => "image", + ActorBuildKind::OciBundle => "oci-bundle", + ActorBuildKind::Javascript => "js-bundle", + }; + let file_ext = "tar"; + let file_ext_compression = match compression { + ActorBuildCompression::None => "", + ActorBuildCompression::Lz4 => ".lz4", + }; + format!("{file_name}.{file_ext}{file_ext_compression}") +} + +/// Compresses a given file with the given build compression. This is used as the last step in the +/// build process before uploading the output file. +pub async fn compress_build( + input_path: &Path, + compression: config::build::Compression, +) -> Result { + // Compress the bundle + let compressed_file = tempfile::NamedTempFile::new()?; + let compressed_file_path = compressed_file.into_temp_path(); + match compression { + config::build::Compression::None => { + tokio::fs::rename(&input_path, &compressed_file_path).await?; + } + config::build::Compression::Lz4 => { + let input_path = input_path.to_owned(); + let compressed_file_path = compressed_file_path.to_owned(); + tokio::task::spawn_blocking(move || lz4::compress(&input_path, &compressed_file_path)) + .await??; + } + } + + Ok(compressed_file_path) +} diff --git a/packages/toolchain/src/util/docker/archive.rs b/packages/toolchain/src/util/docker/archive.rs index bbfba708..6976a815 100644 --- a/packages/toolchain/src/util/docker/archive.rs +++ b/packages/toolchain/src/util/docker/archive.rs @@ -1,7 +1,7 @@ use anyhow::*; use serde::Deserialize; use serde_json::json; -use std::{io::Read, path::Path}; +use std::io::Read; use typed_path::{TryAsRef, UnixPath}; use uuid::Uuid; @@ -9,7 +9,7 @@ use crate::{ config::{self}, util::{ cmd::{self, shell_cmd, shell_cmd_std}, - lz4, task, + task, }, }; @@ -37,7 +37,8 @@ pub async fn create_archive( }; // Compress archive - let compressed_path = compress_archive(build_tar_path.as_ref(), build_compression).await?; + let compressed_path = + crate::util::build::compress_build(build_tar_path.as_ref(), build_compression).await?; Ok(compressed_path) } @@ -425,27 +426,3 @@ fn copy_container_to_rootfs( group_file, }) } - -async fn compress_archive( - build_tar_path: &Path, - compression: config::build::Compression, -) -> Result { - // Compress the bundle - let build_tar_compressed_file = tempfile::NamedTempFile::new()?; - let build_tar_compressed_path = build_tar_compressed_file.into_temp_path(); - match compression { - config::build::Compression::None => { - tokio::fs::rename(&build_tar_path, &build_tar_compressed_path).await?; - } - config::build::Compression::Lz4 => { - let build_tar_path = build_tar_path.to_owned(); - let build_tar_compressed_path = build_tar_compressed_path.to_owned(); - tokio::task::spawn_blocking(move || { - lz4::compress(&build_tar_path, &build_tar_compressed_path) - }) - .await??; - } - } - - Ok(build_tar_compressed_path) -} diff --git a/packages/toolchain/src/util/docker/push.rs b/packages/toolchain/src/util/docker/push.rs index d48f93e9..f5b7e580 100644 --- a/packages/toolchain/src/util/docker/push.rs +++ b/packages/toolchain/src/util/docker/push.rs @@ -41,8 +41,6 @@ pub async fn push_tar( task: task::TaskCtx, push_opts: &PushOpts, ) -> Result { - let multipart_enabled: bool = push_opts.config.unstable().multipart_enabled(); - let reqwest_client = Arc::new(reqwest::Client::new()); // Inspect the image @@ -62,29 +60,28 @@ pub async fn push_tar( size = upload::format_file_size(image_file_meta.len())? )); + let build_kind = match push_opts.bundle { + config::build::docker::BundleKind::DockerImage => models::ActorBuildKind::DockerImage, + config::build::docker::BundleKind::OciBundle => models::ActorBuildKind::OciBundle, + }; + + let build_compression = match push_opts.compression { + config::build::Compression::None => models::ActorBuildCompression::None, + config::build::Compression::Lz4 => models::ActorBuildCompression::Lz4, + }; + let build_res = apis::actor_builds_api::actor_builds_prepare( &ctx.openapi_config_cloud, models::ActorPrepareBuildRequest { name: display_name.clone(), image_tag: Some(push_opts.docker_tag.clone()), image_file: Box::new(models::UploadPrepareFile { - path: "image.tar".into(), + path: crate::util::build::file_name(build_kind, build_compression), content_type: Some(content_type.into()), content_length: image_file_meta.len() as i64, }), - kind: Some(match push_opts.bundle { - config::build::docker::BundleKind::DockerImage => { - models::ActorBuildKind::DockerImage - } - config::build::docker::BundleKind::OciBundle => models::ActorBuildKind::OciBundle, - }), - compression: Some(match push_opts.compression { - config::build::Compression::None => models::ActorBuildCompression::None, - config::build::Compression::Lz4 => models::ActorBuildCompression::Lz4, - }), - multipart_upload: Some(multipart_enabled), - // TODO(RVT-4124): - prewarm_regions: None, + kind: Some(build_kind), + compression: Some(build_compression), }, Some(&ctx.project.name_id), Some(&push_opts.env.slug), @@ -97,41 +94,28 @@ pub async fn push_tar( let build_id = build_res.build; let pb = term::EitherProgressBar::Multi(term::multi_progress_bar(task.clone())); - if multipart_enabled { - // Upload chunks in parallel - futures_util::stream::iter(build_res.image_presigned_requests.unwrap()) - .map(|presigned_request| { - let task = task.clone(); - let reqwest_client = reqwest_client.clone(); - let pb = pb.clone(); - - async move { - upload::upload_file( - task.clone(), - &reqwest_client, - &presigned_request, - &push_opts.path, - Some(content_type), - pb, - ) - .await - } - }) - .buffer_unordered(8) - .try_collect::>() - .await?; - } else { - // Upload file - upload::upload_file( - task.clone(), - &reqwest_client, - &build_res.image_presigned_request.unwrap(), - &push_opts.path, - Some(content_type), - pb, - ) + // Upload chunks in parallel + futures_util::stream::iter(build_res.presigned_requests) + .map(|presigned_request| { + let task = task.clone(); + let reqwest_client = reqwest_client.clone(); + let pb = pb.clone(); + + async move { + upload::upload_file( + task.clone(), + &reqwest_client, + &presigned_request, + &push_opts.path, + Some(content_type), + pb, + ) + .await + } + }) + .buffer_unordered(8) + .try_collect::>() .await?; - } let complete_res = apis::actor_builds_api::actor_builds_complete( &ctx.openapi_config_cloud, diff --git a/packages/toolchain/src/util/mod.rs b/packages/toolchain/src/util/mod.rs index cb0470ef..9a365c66 100644 --- a/packages/toolchain/src/util/mod.rs +++ b/packages/toolchain/src/util/mod.rs @@ -1,4 +1,5 @@ pub mod api; +pub mod build; pub mod cmd; pub mod docker; pub mod js_utils; diff --git a/sdks/rust/docs/ActorPrepareBuildRequest.md b/sdks/rust/docs/ActorPrepareBuildRequest.md index e96e8012..17428f10 100644 --- a/sdks/rust/docs/ActorPrepareBuildRequest.md +++ b/sdks/rust/docs/ActorPrepareBuildRequest.md @@ -8,9 +8,7 @@ Name | Type | Description | Notes **image_file** | [**crate::models::UploadPrepareFile**](UploadPrepareFile.md) | | **image_tag** | Option<**String**> | A tag given to the project build. | [optional] **kind** | Option<[**crate::models::ActorBuildKind**](ActorBuildKind.md)> | | [optional] -**multipart_upload** | Option<**bool**> | | [optional] **name** | **String** | | -**prewarm_regions** | Option<**Vec**> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/sdks/rust/docs/ActorPrepareBuildResponse.md b/sdks/rust/docs/ActorPrepareBuildResponse.md index 5943b524..a9a76163 100644 --- a/sdks/rust/docs/ActorPrepareBuildResponse.md +++ b/sdks/rust/docs/ActorPrepareBuildResponse.md @@ -5,8 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **build** | [**uuid::Uuid**](uuid::Uuid.md) | | -**image_presigned_request** | Option<[**crate::models::UploadPresignedRequest**](UploadPresignedRequest.md)> | | [optional] -**image_presigned_requests** | Option<[**Vec**](UploadPresignedRequest.md)> | | [optional] +**presigned_requests** | [**Vec**](UploadPresignedRequest.md) | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/sdks/rust/src/models/actor_prepare_build_request.rs b/sdks/rust/src/models/actor_prepare_build_request.rs index e9da4afe..6eb91109 100644 --- a/sdks/rust/src/models/actor_prepare_build_request.rs +++ b/sdks/rust/src/models/actor_prepare_build_request.rs @@ -19,12 +19,8 @@ pub struct ActorPrepareBuildRequest { pub image_tag: Option, #[serde(rename = "kind", skip_serializing_if = "Option::is_none")] pub kind: Option, - #[serde(rename = "multipart_upload", skip_serializing_if = "Option::is_none")] - pub multipart_upload: Option, #[serde(rename = "name")] pub name: String, - #[serde(rename = "prewarm_regions", skip_serializing_if = "Option::is_none")] - pub prewarm_regions: Option>, } impl ActorPrepareBuildRequest { @@ -37,9 +33,7 @@ impl ActorPrepareBuildRequest { image_file: Box::new(image_file), image_tag: None, kind: None, - multipart_upload: None, name, - prewarm_regions: None, } } } diff --git a/sdks/rust/src/models/actor_prepare_build_response.rs b/sdks/rust/src/models/actor_prepare_build_response.rs index e0ceb050..c36ee93a 100644 --- a/sdks/rust/src/models/actor_prepare_build_response.rs +++ b/sdks/rust/src/models/actor_prepare_build_response.rs @@ -12,24 +12,18 @@ pub struct ActorPrepareBuildResponse { #[serde(rename = "build")] pub build: uuid::Uuid, - #[serde( - rename = "image_presigned_request", - skip_serializing_if = "Option::is_none" - )] - pub image_presigned_request: Option>, - #[serde( - rename = "image_presigned_requests", - skip_serializing_if = "Option::is_none" - )] - pub image_presigned_requests: Option>, + #[serde(rename = "presigned_requests")] + pub presigned_requests: Vec, } impl ActorPrepareBuildResponse { - pub fn new(build: uuid::Uuid) -> ActorPrepareBuildResponse { + pub fn new( + build: uuid::Uuid, + presigned_requests: Vec, + ) -> ActorPrepareBuildResponse { ActorPrepareBuildResponse { build, - image_presigned_request: None, - image_presigned_requests: None, + presigned_requests, } } }