type.inbound
// two distinct paths
and length(distinct(map(filter(body.links,
.href_url.domain.domain == "storage.googleapis.com"
),
.href_url.path
)
)
) == 2
// split each distinct path into bucket and trailer once
and any(map(distinct(filter(body.links,
.href_url.domain.domain == "storage.googleapis.com"
),
.href_url.path
),
// return just the bucket/trailer for the path
regex.extract(.href_url.path,
'^/(?P<bucket>[^/]+)/(?P<trailer>.+)$'
)[0]
),
// loop the links that aren't the current .href_url.path (from the outer loop)
any(map(distinct(filter(body.links,
.href_url.domain.domain == "storage.googleapis.com"
and .href_url.path != ..full_match
),
// return just the .href_url.path
.href_url.path
),
// create the bucket/trailer for the path
regex.extract(.href_url.path,
'^/(?P<bucket>[^/]+)/(?P<trailer>.+)$'
)[0]
),
// this bucket is the outer bucket plus a suffix, serving the same trailer
strings.starts_with(.named_groups['bucket'],
..named_groups['bucket']
)
and .named_groups['trailer'] == ..named_groups['trailer']
)
)
Playground
Test against your own EMLs or sample data.