From a7b7824966d86b10c23feb762288a23f5ab6208f Mon Sep 17 00:00:00 2001 From: Juniper Hovey Date: Thu, 7 Dec 2023 16:59:18 -0600 Subject: [PATCH 1/8] feat(mantle): support container and instance metadata AWS credential providers (#202) * Add container and instance metadata credential providers * Undo formatting * Add MANTLE_AWS_INHERIT_IAM_ROLE * Fix aws credentials provider * Add documentation for IAM env var --- docs/site/pages/docs/authentication.mdx | 11 +++-- .../src/state/aws_credentials_provider.rs | 40 ++++++++++++++++++- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/docs/site/pages/docs/authentication.mdx b/docs/site/pages/docs/authentication.mdx index d51e46b..ffabf6c 100644 --- a/docs/site/pages/docs/authentication.mdx +++ b/docs/site/pages/docs/authentication.mdx @@ -1,11 +1,10 @@ -import { Callout, Tabs, Tab } from 'nextra-theme-docs'; +import { Callout, Tabs, Tab } from "nextra-theme-docs"; # Authentication - Remember to never save your secrets in source control or any insecure - environment. Anybody who gets access to them could use them to steal your - accounts. + Remember to never save your secrets in source control or any insecure environment. Anybody who + gets access to them could use them to steal your accounts. ## Resource management @@ -112,6 +111,10 @@ The simplest method is to set the `MANTLE_AWS_ACCESS_KEY_ID` and `MANTLE_AWS_SEC variables. Mantle also supports the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` variables but recommends you scope your variables to Mantle to avoid conflicts with other tools. +If you're using Mantle within an AWS EC2 instance or AWS Elastic Container Service, you can set the +`MANTLE_AWS_INHERIT_IAM_ROLE` environment variable to `true` to inherit the permission set granted to the host +runner via either the EC2 instance's IAM role or the Elastic Container Service task execution IAM role. + You can set your environment variables in various ways, like the following: diff --git a/mantle/rbx_mantle/src/state/aws_credentials_provider.rs b/mantle/rbx_mantle/src/state/aws_credentials_provider.rs index 76ff153..dc95878 100644 --- a/mantle/rbx_mantle/src/state/aws_credentials_provider.rs +++ b/mantle/rbx_mantle/src/state/aws_credentials_provider.rs @@ -1,21 +1,47 @@ use async_trait::async_trait; use rusoto_core::credential::{ - AwsCredentials, CredentialsError, EnvironmentProvider, ProfileProvider, ProvideAwsCredentials, + AwsCredentials, ContainerProvider, CredentialsError, EnvironmentProvider, + InstanceMetadataProvider, ProfileProvider, ProvideAwsCredentials, }; +use std::env; +use std::time::Duration; #[derive(Clone, Debug)] pub struct AwsCredentialsProvider { prefixed_environment_provider: EnvironmentProvider, environment_provider: EnvironmentProvider, profile_provider: Option, + container_provider: Option, + instance_metadata_provider: Option, } impl AwsCredentialsProvider { pub fn new() -> AwsCredentialsProvider { + let mut inherit_iam_role = false; + if let Ok(value) = env::var("MANTLE_AWS_INHERIT_IAM_ROLE") { + if value == "true" { + inherit_iam_role = true; + } + } + AwsCredentialsProvider { prefixed_environment_provider: EnvironmentProvider::with_prefix("MANTLE_AWS"), environment_provider: EnvironmentProvider::default(), profile_provider: ProfileProvider::new().ok(), + container_provider: if inherit_iam_role { + let mut provider = ContainerProvider::new(); + provider.set_timeout(Duration::from_secs(15)); + Some(provider) + } else { + None + }, + instance_metadata_provider: if inherit_iam_role { + let mut provider = InstanceMetadataProvider::new(); + provider.set_timeout(Duration::from_secs(15)); + Some(provider) + } else { + None + }, } } } @@ -34,8 +60,18 @@ async fn chain_provider_credentials( return Ok(creds); } } + if let Some(ref container_provider) = provider.container_provider { + if let Ok(creds) = container_provider.credentials().await { + return Ok(creds); + } + } + if let Some(ref instance_metadata_provider) = provider.instance_metadata_provider { + if let Ok(creds) = instance_metadata_provider.credentials().await { + return Ok(creds); + } + } Err(CredentialsError::new( - "Couldn't find AWS credentials in environment or credentials file.", + "Couldn't find AWS credentials in environment, credentials file, or instance/container IAM role.", )) } From 2a5c89d1b034502205cd8946e8687167a12da0c3 Mon Sep 17 00:00:00 2001 From: Blake Mealey Date: Fri, 15 Dec 2023 20:28:25 -0600 Subject: [PATCH 2/8] feat(mantle): add diff command --- mantle/Cargo.lock | 1 + mantle/mantle/Cargo.toml | 1 + mantle/mantle/src/cli.rs | 23 +++++ mantle/mantle/src/commands/diff.rs | 110 ++++++++++++++++++++++ mantle/mantle/src/commands/mod.rs | 1 + mantle/rbx_mantle/src/resource_graph.rs | 119 +++++++++++++++++++++++- 6 files changed, 254 insertions(+), 1 deletion(-) create mode 100644 mantle/mantle/src/commands/diff.rs diff --git a/mantle/Cargo.lock b/mantle/Cargo.lock index 1f403fb..1f274fb 100644 --- a/mantle/Cargo.lock +++ b/mantle/Cargo.lock @@ -1341,6 +1341,7 @@ name = "mantle" version = "0.11.11" dependencies = [ "clap", + "difference", "dotenv", "env_logger", "integration_executor", diff --git a/mantle/mantle/Cargo.toml b/mantle/mantle/Cargo.toml index dff4051..0364783 100644 --- a/mantle/mantle/Cargo.toml +++ b/mantle/mantle/Cargo.toml @@ -14,6 +14,7 @@ serde_json = { version = "1.0.59" } serde_yaml = { version = "0.8" } serde = { version = "1.0", features = ["derive"] } clap = "2.33.0" +difference = "2.0.0" tokio = { version = "1", features = ["full"] } yansi = "0.5.0" log = "0.4.14" diff --git a/mantle/mantle/src/cli.rs b/mantle/mantle/src/cli.rs index 8196dcb..74e4739 100644 --- a/mantle/mantle/src/cli.rs +++ b/mantle/mantle/src/cli.rs @@ -26,6 +26,22 @@ fn get_app() -> App<'static, 'static> { Arg::with_name("allow_purchases") .long("allow-purchases") .help("Gives Mantle permission to make purchases with Robux.")) + ) + .subcommand( + SubCommand::with_name("diff") + .about("Prints the diff between the current state file and project configuration.") + .arg( + Arg::with_name("PROJECT") + .index(1) + .help("The Mantle project: either the path to a directory containing a 'mantle.yml' file or the path to a configuration file. Defaults to the current directory.") + .takes_value(true)) + .arg( + Arg::with_name("environment") + .long("environment") + .short("e") + .help("The label of the environment to deploy to. If not specified, attempts to match the current git branch to each environment's `branches` property.") + .value_name("ENVIRONMENT") + .takes_value(true)) ) .subcommand( SubCommand::with_name("destroy") @@ -147,6 +163,13 @@ pub async fn run_with(args: Vec) -> i32 { ) .await } + ("diff", Some(diff_matches)) => { + commands::diff::run( + diff_matches.value_of("PROJECT"), + diff_matches.value_of("environment"), + ) + .await + } ("destroy", Some(destroy_matches)) => { commands::destroy::run( destroy_matches.value_of("PROJECT"), diff --git a/mantle/mantle/src/commands/diff.rs b/mantle/mantle/src/commands/diff.rs new file mode 100644 index 0000000..4c61b7d --- /dev/null +++ b/mantle/mantle/src/commands/diff.rs @@ -0,0 +1,110 @@ +use std::str; + +use difference::Changeset; +use yansi::Paint; + +use rbx_mantle::{ + config::load_project_config, + project::{load_project, Project}, + resource_graph::ResourceGraphDiff, + state::get_desired_graph, +}; + +fn get_changeset(previous_hash: &str, new_hash: &str) -> Changeset { + Changeset::new(previous_hash, new_hash, "\n") +} + +fn print_diff(diff: ResourceGraphDiff) { + for (resource_id, r) in diff.removals.into_iter() { + logger::start_action(format!("{} Removed {}:", Paint::red("-"), resource_id)); + logger::log("Inputs:"); + logger::log_changeset(get_changeset(&r.previous_inputs_hash, "")); + logger::end_action_without_message(); + } + + for (resource_id, r) in diff.additions.into_iter() { + logger::start_action(format!("{} Added {}:", Paint::green("+"), resource_id)); + logger::log("Inputs:"); + logger::log_changeset(get_changeset("", &r.current_inputs_hash)); + logger::end_action_without_message(); + } + + for (resource_id, r) in diff.changes.into_iter() { + logger::start_action(format!("{} Changed {}:", Paint::yellow("~"), resource_id)); + logger::log("Inputs:"); + logger::log_changeset(get_changeset( + &r.previous_inputs_hash, + &r.current_inputs_hash, + )); + logger::end_action_without_message(); + } + + for (resource_id, r) in diff.dependency_changes.into_iter() { + logger::start_action(format!( + "{} Dependency Changed {}:", + Paint::new("○").dimmed(), + resource_id + )); + logger::log("Changed dependencies:"); + for dependency_id in r.changed_dependencies.into_iter() { + logger::log(format!( + " {} {}", + Paint::new("-").dimmed(), + Paint::yellow(dependency_id) + )) + } + logger::end_action_without_message(); + } +} + +pub async fn run(project: Option<&str>, environment: Option<&str>) -> i32 { + logger::start_action("Loading project:"); + let (project_path, config) = match load_project_config(project) { + Ok(v) => v, + Err(e) => { + logger::end_action(Paint::red(e)); + return 1; + } + }; + let Project { + current_graph, + target_config, + owner_config, + .. + } = match load_project(project_path.clone(), config, environment).await { + Ok(Some(v)) => v, + Ok(None) => { + logger::end_action("No diff available"); + return 0; + } + Err(e) => { + logger::end_action(Paint::red(e)); + return 1; + } + }; + let mut next_graph = + match get_desired_graph(project_path.as_path(), &target_config, &owner_config) { + Ok(v) => v, + Err(e) => { + logger::end_action(Paint::red(e)); + return 1; + } + }; + logger::end_action("Succeeded"); + + logger::start_action("Diffing resource graphs:"); + + let diff = next_graph.diff(¤t_graph); + + match diff { + Ok(diff) => { + print_diff(diff); + logger::end_action("Succeeded"); + return 0; + } + Err(e) => { + logger::end_action(Paint::red(e)); + return 1; + } + } +} diff --git a/mantle/mantle/src/commands/mod.rs b/mantle/mantle/src/commands/mod.rs index c1fffd0..adb240d 100644 --- a/mantle/mantle/src/commands/mod.rs +++ b/mantle/mantle/src/commands/mod.rs @@ -1,5 +1,6 @@ pub mod deploy; pub mod destroy; +pub mod diff; pub mod download; pub mod import; pub mod outputs; diff --git a/mantle/rbx_mantle/src/resource_graph.rs b/mantle/rbx_mantle/src/resource_graph.rs index bdda778..e990c0c 100644 --- a/mantle/rbx_mantle/src/resource_graph.rs +++ b/mantle/rbx_mantle/src/resource_graph.rs @@ -521,7 +521,7 @@ where continue; } - let operation_result = self + let operation_result: OperationResult = self .evaluate_delete(previous_graph, manager, resource_id) .await; self.handle_operation_result( @@ -556,4 +556,121 @@ where Ok(results) } } + + pub fn diff( + &mut self, + previous_graph: &ResourceGraph, + ) -> Result { + let mut diff = ResourceGraphDiff { + removals: BTreeMap::new(), + additions: BTreeMap::new(), + changes: BTreeMap::new(), + dependency_changes: BTreeMap::new(), + }; + + // Iterate over previous resources in reverse order so that leaf resources are removed first + let mut previous_resource_order = previous_graph.get_topological_order()?; + previous_resource_order.reverse(); + + for resource_id in previous_resource_order.iter() { + if self.resources.get(resource_id).is_some() { + continue; + } + + diff.removals.insert( + resource_id.to_owned(), + ResourceRemoval { + previous_inputs_hash: previous_graph + .resources + .get(resource_id) + .unwrap() + .get_inputs_hash(), + previous_outputs_hash: previous_graph + .resources + .get(resource_id) + .unwrap() + .get_outputs_hash(), + }, + ); + } + + let resource_order = self.get_topological_order()?; + for resource_id in resource_order.iter() { + let resource = self.resources.get(resource_id).unwrap(); + let inputs_hash = resource.get_inputs_hash(); + + let previous_resource = previous_graph.resources.get(resource_id); + + if let Some(previous_resource) = previous_resource { + let previous_hash = previous_resource.get_inputs_hash(); + if previous_hash != inputs_hash { + diff.changes.insert( + resource_id.to_owned(), + ResourceChange { + previous_inputs_hash: previous_hash, + previous_outputs_hash: previous_resource.get_outputs_hash(), + current_inputs_hash: inputs_hash, + }, + ); + } else { + let dependencies = resource.get_dependencies(); + let changed_dependencies: Vec<_> = dependencies + .iter() + .cloned() + .filter(|x| diff.additions.contains_key(x) || diff.changes.contains_key(x)) + .collect(); + + if !changed_dependencies.is_empty() { + diff.dependency_changes.insert( + resource_id.to_owned(), + ResourceDependencyChange { + previous_inputs_hash: previous_hash, + previous_outputs_hash: previous_resource.get_outputs_hash(), + current_inputs_hash: inputs_hash, + changed_dependencies, + }, + ); + } + } + } else { + diff.additions.insert( + resource_id.to_owned(), + ResourceAddition { + current_inputs_hash: inputs_hash, + }, + ); + } + } + + Ok(diff) + } +} + +pub struct ResourceGraphDiff { + pub removals: BTreeMap, + pub additions: BTreeMap, + pub changes: BTreeMap, + pub dependency_changes: BTreeMap, +} + +pub struct ResourceRemoval { + pub previous_inputs_hash: String, + pub previous_outputs_hash: String, +} + +pub struct ResourceAddition { + pub current_inputs_hash: String, +} + +pub struct ResourceChange { + pub previous_inputs_hash: String, + pub previous_outputs_hash: String, + pub current_inputs_hash: String, +} + +pub struct ResourceDependencyChange { + pub previous_inputs_hash: String, + pub previous_outputs_hash: String, + pub current_inputs_hash: String, + pub changed_dependencies: Vec, } From 14c02467710537fd0698121f1d4a3e0cdf63dee8 Mon Sep 17 00:00:00 2001 From: Blake Mealey Date: Fri, 15 Dec 2023 20:37:41 -0600 Subject: [PATCH 3/8] fix(mantle): write non-data logs to stderr --- mantle/logger/src/lib.rs | 2 +- mantle/mantle/src/commands/outputs.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mantle/logger/src/lib.rs b/mantle/logger/src/lib.rs index b2774f4..27d5e2f 100644 --- a/mantle/logger/src/lib.rs +++ b/mantle/logger/src/lib.rs @@ -40,7 +40,7 @@ where S: Display, { let line_prefix = get_line_prefix(); - println!("{}", with_prefix(&message, line_prefix)); + eprintln!("{}", with_prefix(&message, line_prefix)); } pub fn start_action(title: S) diff --git a/mantle/mantle/src/commands/outputs.rs b/mantle/mantle/src/commands/outputs.rs index bca1bff..2b4c077 100644 --- a/mantle/mantle/src/commands/outputs.rs +++ b/mantle/mantle/src/commands/outputs.rs @@ -42,7 +42,9 @@ pub async fn run( .collect::>(); let outputs_string = match match format { - "json" => serde_json::to_string_pretty(&outputs_map).map_err(|e| e.to_string()), + "json" => serde_json::to_string_pretty(&outputs_map) + .map(|x| x + "\n") + .map_err(|e| e.to_string()), "yaml" => serde_yaml::to_string(&outputs_map).map_err(|e| e.to_string()), _ => Err(format!("Unknown format: {}", format)), } { @@ -62,7 +64,7 @@ pub async fn run( return 1; } } else { - logger::log(outputs_string); + print!("{}", outputs_string); } 0 From e2ecf2bfe63f3ac3f97b134d5899cbab72958a60 Mon Sep 17 00:00:00 2001 From: Blake Mealey Date: Fri, 15 Dec 2023 20:57:36 -0600 Subject: [PATCH 4/8] feat(mantle): add json and yaml formats to diff command --- mantle/mantle/src/cli.rs | 17 ++++++++++++ mantle/mantle/src/commands/diff.rs | 36 +++++++++++++++++++++++-- mantle/rbx_mantle/src/resource_graph.rs | 5 ++++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/mantle/mantle/src/cli.rs b/mantle/mantle/src/cli.rs index 74e4739..c25aa6f 100644 --- a/mantle/mantle/src/cli.rs +++ b/mantle/mantle/src/cli.rs @@ -42,6 +42,21 @@ fn get_app() -> App<'static, 'static> { .help("The label of the environment to deploy to. If not specified, attempts to match the current git branch to each environment's `branches` property.") .value_name("ENVIRONMENT") .takes_value(true)) + .arg( + Arg::with_name("output") + .long("output") + .short("o") + .help("A file path to print the diff to, if a format is provided") + .value_name("FILE") + .takes_value(true)) + .arg( + Arg::with_name("format") + .long("format") + .short("f") + .help("The format to print the diff in") + .value_name("FORMAT") + .takes_value(true) + .possible_values(&["json","yaml"])) ) .subcommand( SubCommand::with_name("destroy") @@ -167,6 +182,8 @@ pub async fn run_with(args: Vec) -> i32 { commands::diff::run( diff_matches.value_of("PROJECT"), diff_matches.value_of("environment"), + diff_matches.value_of("output"), + diff_matches.value_of("format"), ) .await } diff --git a/mantle/mantle/src/commands/diff.rs b/mantle/mantle/src/commands/diff.rs index 4c61b7d..439de56 100644 --- a/mantle/mantle/src/commands/diff.rs +++ b/mantle/mantle/src/commands/diff.rs @@ -1,4 +1,4 @@ -use std::str; +use std::{fs, str}; use difference::Changeset; use yansi::Paint; @@ -57,7 +57,12 @@ fn print_diff(diff: ResourceGraphDiff) { } } -pub async fn run(project: Option<&str>, environment: Option<&str>) -> i32 { +pub async fn run( + project: Option<&str>, + environment: Option<&str>, + output: Option<&str>, + format: Option<&str>, +) -> i32 { logger::start_action("Loading project:"); let (project_path, config) = match load_project_config(project) { Ok(v) => v, @@ -98,8 +103,35 @@ pub async fn run(project: Option<&str>, environment: Option<&str>) -> i32 { match diff { Ok(diff) => { + let outputs_string = format.map(|format| match format { + "json" => serde_json::to_string_pretty(&diff) + .map(|x| x + "\n") + .map_err(|e| e.to_string()), + "yaml" => serde_yaml::to_string(&diff).map_err(|e| e.to_string()), + _ => Err(format!("Unknown format: {}", format)), + }); + print_diff(diff); logger::end_action("Succeeded"); + + if let Some(outputs_string) = outputs_string { + if let Ok(outputs_string) = outputs_string { + if let Some(output) = output { + if let Err(e) = fs::write(output, outputs_string).map_err(|e| { + format!("Unable to write outputs file: {}\n\t{}", output, e) + }) { + logger::log(Paint::red(e)); + return 1; + } + } else { + print!("{}", outputs_string); + } + } else { + logger::log(Paint::red("Failed to serialize outputs")); + return 1; + } + } + return 0; } Err(e) => { diff --git a/mantle/rbx_mantle/src/resource_graph.rs b/mantle/rbx_mantle/src/resource_graph.rs index e990c0c..93a1d02 100644 --- a/mantle/rbx_mantle/src/resource_graph.rs +++ b/mantle/rbx_mantle/src/resource_graph.rs @@ -646,6 +646,7 @@ where } } +#[derive(Serialize)] pub struct ResourceGraphDiff { pub removals: BTreeMap, pub additions: BTreeMap, @@ -653,21 +654,25 @@ pub struct ResourceGraphDiff { pub dependency_changes: BTreeMap, } +#[derive(Serialize)] pub struct ResourceRemoval { pub previous_inputs_hash: String, pub previous_outputs_hash: String, } +#[derive(Serialize)] pub struct ResourceAddition { pub current_inputs_hash: String, } +#[derive(Serialize)] pub struct ResourceChange { pub previous_inputs_hash: String, pub previous_outputs_hash: String, pub current_inputs_hash: String, } +#[derive(Serialize)] pub struct ResourceDependencyChange { pub previous_inputs_hash: String, pub previous_outputs_hash: String, From 6fa367a4a85529d357d995acd3f010188e010bed Mon Sep 17 00:00:00 2001 From: Blake Mealey Date: Fri, 15 Dec 2023 21:05:29 -0600 Subject: [PATCH 5/8] chore(mantle): fix lint warnings --- mantle/mantle/src/commands/diff.rs | 4 ++-- mantle/rbx_mantle/src/resource_graph.rs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mantle/mantle/src/commands/diff.rs b/mantle/mantle/src/commands/diff.rs index 439de56..53648a4 100644 --- a/mantle/mantle/src/commands/diff.rs +++ b/mantle/mantle/src/commands/diff.rs @@ -132,11 +132,11 @@ pub async fn run( } } - return 0; + 0 } Err(e) => { logger::end_action(Paint::red(e)); - return 1; + 1 } } } diff --git a/mantle/rbx_mantle/src/resource_graph.rs b/mantle/rbx_mantle/src/resource_graph.rs index 93a1d02..abaa4ce 100644 --- a/mantle/rbx_mantle/src/resource_graph.rs +++ b/mantle/rbx_mantle/src/resource_graph.rs @@ -614,6 +614,7 @@ where ); } else { let dependencies = resource.get_dependencies(); + #[allow(clippy::iter_overeager_cloned)] let changed_dependencies: Vec<_> = dependencies .iter() .cloned() From 04b5c0e476744072257c5511eace1f001bbde1b8 Mon Sep 17 00:00:00 2001 From: Blake Mealey Date: Fri, 15 Dec 2023 21:11:22 -0600 Subject: [PATCH 6/8] chore: bump versions (mantle 0.11.12) --- mantle/Cargo.lock | 4 ++-- mantle/mantle/Cargo.toml | 2 +- mantle/rbx_mantle/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mantle/Cargo.lock b/mantle/Cargo.lock index 1f274fb..d1c5dc8 100644 --- a/mantle/Cargo.lock +++ b/mantle/Cargo.lock @@ -1338,7 +1338,7 @@ checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" [[package]] name = "mantle" -version = "0.11.11" +version = "0.11.12" dependencies = [ "clap", "difference", @@ -2141,7 +2141,7 @@ dependencies = [ [[package]] name = "rbx_mantle" -version = "0.11.11" +version = "0.11.12" dependencies = [ "async-trait", "chrono", diff --git a/mantle/mantle/Cargo.toml b/mantle/mantle/Cargo.toml index 0364783..a50ba74 100644 --- a/mantle/mantle/Cargo.toml +++ b/mantle/mantle/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mantle" -version = "0.11.11" +version = "0.11.12" edition = "2021" [dependencies] diff --git a/mantle/rbx_mantle/Cargo.toml b/mantle/rbx_mantle/Cargo.toml index a2cc35f..79e46af 100644 --- a/mantle/rbx_mantle/Cargo.toml +++ b/mantle/rbx_mantle/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rbx_mantle" description = "Infra-as-code for Roblox" -version = "0.11.11" +version = "0.11.12" homepage = "https://mantledeploy.vercel.app" repository = "https://github.com/blake-mealey/mantle" authors = ["Blake Mealey "] From 0f43d4e07eaaa800c8f5b761e5993e812130531d Mon Sep 17 00:00:00 2001 From: Blake Mealey Date: Sat, 16 Dec 2023 11:07:16 -0600 Subject: [PATCH 7/8] fix(rbx_api,mantle): add limit when listing game passes to avoid 500 --- mantle/rbx_api/src/game_passes/mod.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mantle/rbx_api/src/game_passes/mod.rs b/mantle/rbx_api/src/game_passes/mod.rs index ddadf3a..f6c8fef 100644 --- a/mantle/rbx_api/src/game_passes/mod.rs +++ b/mantle/rbx_api/src/game_passes/mod.rs @@ -21,10 +21,13 @@ impl RobloxApi { experience_id: AssetId, page_cursor: Option, ) -> RobloxApiResult { - let mut req = self.client.get(format!( - "https://games.roblox.com/v1/games/{}/game-passes", - experience_id - )); + let mut req = self + .client + .get(format!( + "https://games.roblox.com/v1/games/{}/game-passes", + experience_id + )) + .query(&[("limit", 100.to_string())]); if let Some(page_cursor) = page_cursor { req = req.query(&[("cursor", &page_cursor)]); } From 2ce8b258a1cd86bb1df3ca672f940fc29d0991e2 Mon Sep 17 00:00:00 2001 From: Blake Mealey Date: Sat, 16 Dec 2023 11:11:26 -0600 Subject: [PATCH 8/8] chore: bump versions (rbx_api 0.4.9, mantle 0.11.13) --- mantle/Cargo.lock | 6 +++--- mantle/mantle/Cargo.toml | 2 +- mantle/rbx_api/Cargo.toml | 2 +- mantle/rbx_mantle/Cargo.toml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mantle/Cargo.lock b/mantle/Cargo.lock index d1c5dc8..5711dc2 100644 --- a/mantle/Cargo.lock +++ b/mantle/Cargo.lock @@ -1338,7 +1338,7 @@ checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" [[package]] name = "mantle" -version = "0.11.12" +version = "0.11.13" dependencies = [ "clap", "difference", @@ -2067,7 +2067,7 @@ dependencies = [ [[package]] name = "rbx_api" -version = "0.4.8" +version = "0.4.9" dependencies = [ "base64 0.13.1", "log", @@ -2141,7 +2141,7 @@ dependencies = [ [[package]] name = "rbx_mantle" -version = "0.11.12" +version = "0.11.13" dependencies = [ "async-trait", "chrono", diff --git a/mantle/mantle/Cargo.toml b/mantle/mantle/Cargo.toml index a50ba74..6667533 100644 --- a/mantle/mantle/Cargo.toml +++ b/mantle/mantle/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mantle" -version = "0.11.12" +version = "0.11.13" edition = "2021" [dependencies] diff --git a/mantle/rbx_api/Cargo.toml b/mantle/rbx_api/Cargo.toml index b4e963e..c645f24 100644 --- a/mantle/rbx_api/Cargo.toml +++ b/mantle/rbx_api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rbx_api" description = "Make requests to Roblox's web APIs" -version = "0.4.8" +version = "0.4.9" edition = "2021" homepage = "https://github.com/blake-mealey/mantle/tree/main/rbx_api" repository = "https://github.com/blake-mealey/mantle" diff --git a/mantle/rbx_mantle/Cargo.toml b/mantle/rbx_mantle/Cargo.toml index 79e46af..f442825 100644 --- a/mantle/rbx_mantle/Cargo.toml +++ b/mantle/rbx_mantle/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rbx_mantle" description = "Infra-as-code for Roblox" -version = "0.11.12" +version = "0.11.13" homepage = "https://mantledeploy.vercel.app" repository = "https://github.com/blake-mealey/mantle" authors = ["Blake Mealey "]