-
|
I'm new to rust so it's possible that I'm missing something but the same functionality works on python. if I use String it compiles and works but only for 1 path or host per condition, which it isn't what I need The documentation (https://docs.rs/aws-sdk-elasticloadbalancingv2/latest/aws_sdk_elasticloadbalancingv2/types/struct.RuleCondition.html ) says it's an The code can't be simplier: use aws_sdk_elasticloadbalancingv2::{Client, Error};
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_elasticloadbalancingv2::types::{RuleCondition,PathPatternConditionConfig};
fn main() {
println!("Hello, world!");
let client = init_client("eu-west-1".to_string());
let mut paths: Vec<String> = Vec::new();
paths.push("/test1*".to_string());
paths.push("/test2*".to_string());
let mut path_conditions: Vec<PathPatternConditionConfig> = Vec::new();
let path_pattern = PathPatternConditionConfig::builder()
.values(paths)
.build();
let condition1 = RuleCondition::builder()
.field("path-pattern")
.values(Some(paths))
.build();And the cargo.toml: [package]
name = "test-rust-lsr"
version = "0.1.0"
edition = "2024"
[dependencies]
aws-sdk-elasticloadbalancingv2 = "1.70.0"
aws-config = "1.5.18"stable-aarch64-apple-darwin - rustc 1.85.0 (4d91de4e4 2025-02-17) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Assuming you're referring to RuleConditionBuilder::values that method appends a single item. If you already have a |
Beta Was this translation helpful? Give feedback.
-
|
Yes, that was it. Thanks for the answer!!! Looking in the impl code it's documented: And the fn for values and set_values are: the main issue is that in the documentation is defined as the following and Amazon Q didn't help either, saying that it must be a string with spaces between the paths and/or hosts... (which didn't work either) |
Beta Was this translation helpful? Give feedback.

Assuming you're referring to RuleConditionBuilder::values that method appends a single item.
If you already have a
Vecof values to set use the set_values function which takesOption<Vec<String>>(.set_values(Some(paths)))