public PathTemplate(string template)
{
GaxPreconditions.CheckNotNull(template, nameof(template));
_segments = template.Split(s_slashSplit).Select(Segment.Parse).ToList();
_parameterSegments = _segments.Where(s => s.Kind != SegmentKind.Literal).ToList();
int pathWildcardCount = _segments.Count(s => s.Kind == SegmentKind.PathWildcard);
if (pathWildcardCount > 1)
{
throw new ArgumentException("Template contains multiple path wildcards", nameof(template));
}
_hasPathWildcard = pathWildcardCount != 0;
_originalTemplate = template;
ParameterNames = _parameterSegments.Select(x => x.Value).ToList().AsReadOnly();
}