aws_sdk_ecs/waiters/
matchers.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// Matcher union: {"output":{"path":"failures[].reason","expected":"MISSING","comparator":"anyStringEquals"}}
4pub(crate) fn match_describe_services_499ce94a3ac316e04(
5    _result: ::std::result::Result<
6        &crate::operation::describe_services::DescribeServicesOutput,
7        &crate::operation::describe_services::DescribeServicesError,
8    >,
9) -> bool {
10    fn path_traversal<'a>(
11        _output: &'a crate::operation::describe_services::DescribeServicesOutput,
12    ) -> ::std::option::Option<::std::vec::Vec<&'a ::std::string::String>> {
13        let _fld_1 = _output.failures.as_ref()?;
14        let _prj_3 = _fld_1
15            .iter()
16            .flat_map(|v| {
17                #[allow(clippy::let_and_return)]
18                fn map(_v: &crate::types::Failure) -> ::std::option::Option<&::std::string::String> {
19                    let _fld_2 = _v.reason.as_ref();
20                    _fld_2
21                }
22                map(v)
23            })
24            .collect::<::std::vec::Vec<_>>();
25        ::std::option::Option::Some(_prj_3)
26    }
27    _result
28        .as_ref()
29        .ok()
30        .and_then(|output| path_traversal(output))
31        .map(|value| {
32            value.iter().any(|value| {
33                let _tmp_2 = value.as_str();
34                let right = "MISSING";
35                let _cmp_1 = _tmp_2 == right;
36                _cmp_1
37            })
38        })
39        .unwrap_or_default()
40}
41
42/// Matcher union: {"output":{"path":"services[].status","expected":"INACTIVE","comparator":"anyStringEquals"}}
43pub(crate) fn match_describe_services_8f2b7a2837e52f740(
44    _result: ::std::result::Result<
45        &crate::operation::describe_services::DescribeServicesOutput,
46        &crate::operation::describe_services::DescribeServicesError,
47    >,
48) -> bool {
49    fn path_traversal<'a>(
50        _output: &'a crate::operation::describe_services::DescribeServicesOutput,
51    ) -> ::std::option::Option<::std::vec::Vec<&'a ::std::string::String>> {
52        let _fld_1 = _output.services.as_ref()?;
53        let _prj_3 = _fld_1
54            .iter()
55            .flat_map(|v| {
56                #[allow(clippy::let_and_return)]
57                fn map(_v: &crate::types::Service) -> ::std::option::Option<&::std::string::String> {
58                    let _fld_2 = _v.status.as_ref();
59                    _fld_2
60                }
61                map(v)
62            })
63            .collect::<::std::vec::Vec<_>>();
64        ::std::option::Option::Some(_prj_3)
65    }
66    _result
67        .as_ref()
68        .ok()
69        .and_then(|output| path_traversal(output))
70        .map(|value| {
71            value.iter().any(|value| {
72                let _tmp_2 = value.as_str();
73                let right = "INACTIVE";
74                let _cmp_1 = _tmp_2 == right;
75                _cmp_1
76            })
77        })
78        .unwrap_or_default()
79}
80
81/// Matcher union: {"output":{"path":"services[].status","expected":"DRAINING","comparator":"anyStringEquals"}}
82pub(crate) fn match_describe_services_3aec8b75baa95f8d0(
83    _result: ::std::result::Result<
84        &crate::operation::describe_services::DescribeServicesOutput,
85        &crate::operation::describe_services::DescribeServicesError,
86    >,
87) -> bool {
88    fn path_traversal<'a>(
89        _output: &'a crate::operation::describe_services::DescribeServicesOutput,
90    ) -> ::std::option::Option<::std::vec::Vec<&'a ::std::string::String>> {
91        let _fld_1 = _output.services.as_ref()?;
92        let _prj_3 = _fld_1
93            .iter()
94            .flat_map(|v| {
95                #[allow(clippy::let_and_return)]
96                fn map(_v: &crate::types::Service) -> ::std::option::Option<&::std::string::String> {
97                    let _fld_2 = _v.status.as_ref();
98                    _fld_2
99                }
100                map(v)
101            })
102            .collect::<::std::vec::Vec<_>>();
103        ::std::option::Option::Some(_prj_3)
104    }
105    _result
106        .as_ref()
107        .ok()
108        .and_then(|output| path_traversal(output))
109        .map(|value| {
110            value.iter().any(|value| {
111                let _tmp_2 = value.as_str();
112                let right = "DRAINING";
113                let _cmp_1 = _tmp_2 == right;
114                _cmp_1
115            })
116        })
117        .unwrap_or_default()
118}
119
120/// Matcher union: {"output":{"path":"length(services[?!(length(deployments) == `1` && runningCount == desiredCount)]) == `0`","expected":"true","comparator":"booleanEquals"}}
121pub(crate) fn match_describe_services_714c843e63d34632d(
122    _result: ::std::result::Result<
123        &crate::operation::describe_services::DescribeServicesOutput,
124        &crate::operation::describe_services::DescribeServicesError,
125    >,
126) -> bool {
127    fn path_traversal<'a>(_output: &'a crate::operation::describe_services::DescribeServicesOutput) -> ::std::option::Option<bool> {
128        let _fld_2 = _output.services.as_ref()?;
129        let _fprj_12 = _fld_2
130            .iter()
131            .filter({
132                fn filter(_v: &crate::types::Service) -> ::std::option::Option<bool> {
133                    let _fld_4 = _v.deployments.as_ref()?;
134                    let _ret_3 = _fld_4.len() as i64;
135                    const _LIT_5: &f64 = &1.0;
136                    let _tmp_15 = *_LIT_5;
137                    let _tmp_16 = _tmp_15 as i64;
138                    let _cmp_6 = _ret_3 == _tmp_16;
139                    let _fld_7 = &_v.running_count;
140                    let _tmp_17 = *_fld_7;
141                    let _fld_8 = &_v.desired_count;
142                    let _tmp_18 = *_fld_8;
143                    let _cmp_9 = _tmp_17 == _tmp_18;
144                    let _bo_10 = _cmp_6 && _cmp_9;
145                    let _not_11 = !_bo_10;
146                    ::std::option::Option::Some(_not_11)
147                }
148                |v| filter(v).unwrap_or_default()
149            })
150            .collect::<::std::vec::Vec<_>>();
151        let _ret_1 = _fprj_12.len() as i64;
152        const _LIT_13: &f64 = &0.0;
153        let _tmp_19 = *_LIT_13;
154        let _tmp_20 = _tmp_19 as i64;
155        let _cmp_14 = _ret_1 == _tmp_20;
156        ::std::option::Option::Some(_cmp_14)
157    }
158    _result
159        .as_ref()
160        .ok()
161        .and_then(|output| path_traversal(output))
162        .map(|value| {
163            let right = true;
164            let _cmp_1 = value == right;
165            _cmp_1
166        })
167        .unwrap_or_default()
168}
169
170/// Matcher union: {"output":{"path":"tasks[].lastStatus","expected":"STOPPED","comparator":"anyStringEquals"}}
171pub(crate) fn match_describe_tasks_78fef02bce63aae64(
172    _result: ::std::result::Result<&crate::operation::describe_tasks::DescribeTasksOutput, &crate::operation::describe_tasks::DescribeTasksError>,
173) -> bool {
174    fn path_traversal<'a>(
175        _output: &'a crate::operation::describe_tasks::DescribeTasksOutput,
176    ) -> ::std::option::Option<::std::vec::Vec<&'a ::std::string::String>> {
177        let _fld_1 = _output.tasks.as_ref()?;
178        let _prj_3 = _fld_1
179            .iter()
180            .flat_map(|v| {
181                #[allow(clippy::let_and_return)]
182                fn map(_v: &crate::types::Task) -> ::std::option::Option<&::std::string::String> {
183                    let _fld_2 = _v.last_status.as_ref();
184                    _fld_2
185                }
186                map(v)
187            })
188            .collect::<::std::vec::Vec<_>>();
189        ::std::option::Option::Some(_prj_3)
190    }
191    _result
192        .as_ref()
193        .ok()
194        .and_then(|output| path_traversal(output))
195        .map(|value| {
196            value.iter().any(|value| {
197                let _tmp_2 = value.as_str();
198                let right = "STOPPED";
199                let _cmp_1 = _tmp_2 == right;
200                _cmp_1
201            })
202        })
203        .unwrap_or_default()
204}
205
206/// Matcher union: {"output":{"path":"failures[].reason","expected":"MISSING","comparator":"anyStringEquals"}}
207pub(crate) fn match_describe_tasks_499ce94a3ac316e04(
208    _result: ::std::result::Result<&crate::operation::describe_tasks::DescribeTasksOutput, &crate::operation::describe_tasks::DescribeTasksError>,
209) -> bool {
210    fn path_traversal<'a>(
211        _output: &'a crate::operation::describe_tasks::DescribeTasksOutput,
212    ) -> ::std::option::Option<::std::vec::Vec<&'a ::std::string::String>> {
213        let _fld_1 = _output.failures.as_ref()?;
214        let _prj_3 = _fld_1
215            .iter()
216            .flat_map(|v| {
217                #[allow(clippy::let_and_return)]
218                fn map(_v: &crate::types::Failure) -> ::std::option::Option<&::std::string::String> {
219                    let _fld_2 = _v.reason.as_ref();
220                    _fld_2
221                }
222                map(v)
223            })
224            .collect::<::std::vec::Vec<_>>();
225        ::std::option::Option::Some(_prj_3)
226    }
227    _result
228        .as_ref()
229        .ok()
230        .and_then(|output| path_traversal(output))
231        .map(|value| {
232            value.iter().any(|value| {
233                let _tmp_2 = value.as_str();
234                let right = "MISSING";
235                let _cmp_1 = _tmp_2 == right;
236                _cmp_1
237            })
238        })
239        .unwrap_or_default()
240}
241
242/// Matcher union: {"output":{"path":"tasks[].lastStatus","expected":"RUNNING","comparator":"allStringEquals"}}
243pub(crate) fn match_describe_tasks_cb151b89a14ade877(
244    _result: ::std::result::Result<&crate::operation::describe_tasks::DescribeTasksOutput, &crate::operation::describe_tasks::DescribeTasksError>,
245) -> bool {
246    fn path_traversal<'a>(
247        _output: &'a crate::operation::describe_tasks::DescribeTasksOutput,
248    ) -> ::std::option::Option<::std::vec::Vec<&'a ::std::string::String>> {
249        let _fld_1 = _output.tasks.as_ref()?;
250        let _prj_3 = _fld_1
251            .iter()
252            .flat_map(|v| {
253                #[allow(clippy::let_and_return)]
254                fn map(_v: &crate::types::Task) -> ::std::option::Option<&::std::string::String> {
255                    let _fld_2 = _v.last_status.as_ref();
256                    _fld_2
257                }
258                map(v)
259            })
260            .collect::<::std::vec::Vec<_>>();
261        ::std::option::Option::Some(_prj_3)
262    }
263    _result
264        .as_ref()
265        .ok()
266        .and_then(|output| path_traversal(output))
267        .map(|value| {
268            !value.is_empty()
269                && value.iter().all(|value| {
270                    let _tmp_2 = value.as_str();
271                    let right = "RUNNING";
272                    let _cmp_1 = _tmp_2 == right;
273                    _cmp_1
274                })
275        })
276        .unwrap_or_default()
277}
278
279/// Matcher union: {"output":{"path":"tasks[].lastStatus","expected":"STOPPED","comparator":"allStringEquals"}}
280pub(crate) fn match_describe_tasks_2f43971f90a3d02d9(
281    _result: ::std::result::Result<&crate::operation::describe_tasks::DescribeTasksOutput, &crate::operation::describe_tasks::DescribeTasksError>,
282) -> bool {
283    fn path_traversal<'a>(
284        _output: &'a crate::operation::describe_tasks::DescribeTasksOutput,
285    ) -> ::std::option::Option<::std::vec::Vec<&'a ::std::string::String>> {
286        let _fld_1 = _output.tasks.as_ref()?;
287        let _prj_3 = _fld_1
288            .iter()
289            .flat_map(|v| {
290                #[allow(clippy::let_and_return)]
291                fn map(_v: &crate::types::Task) -> ::std::option::Option<&::std::string::String> {
292                    let _fld_2 = _v.last_status.as_ref();
293                    _fld_2
294                }
295                map(v)
296            })
297            .collect::<::std::vec::Vec<_>>();
298        ::std::option::Option::Some(_prj_3)
299    }
300    _result
301        .as_ref()
302        .ok()
303        .and_then(|output| path_traversal(output))
304        .map(|value| {
305            !value.is_empty()
306                && value.iter().all(|value| {
307                    let _tmp_2 = value.as_str();
308                    let right = "STOPPED";
309                    let _cmp_1 = _tmp_2 == right;
310                    _cmp_1
311                })
312        })
313        .unwrap_or_default()
314}