Summary
(*Client).GetTemplates() issues a single GET /Templates request with no query parameters. Command's /Templates endpoint returns a default page of 50 results (CommonName ascending) when no paging parameters are supplied, so the client silently truncates the result set at 50 templates and never pages through the remainder.
Impact
Any caller that resolves a template by name against the returned list will fail to find templates that sort beyond the first 50. On instances with more than 50 templates this manifests as a spurious "template not found" error even though the template exists and is returned by GET /Templates/{id} and by GET /Templates when a sufficient ReturnLimit is supplied.
Downstream, this blocks the Terraform provider's keyfactor_template_role_binding resource (it resolves template_short_names by case-insensitive CommonName match against GetTemplates()).
Root cause
v3/api/template.go — GetTemplates() builds the request with Query: nil:
keyfactorAPIStruct := &request{
Method: "GET",
Endpoint: "Templates/",
Headers: headers,
Query: nil, // no PageReturned / ReturnLimit
Payload: nil,
}
Fix
Paginate automatically, mirroring the existing ListApplications() pattern in this library (PageReturned/ReturnLimit, accumulate pages, stop when a page returns fewer than the page size). Add a regression test that serves more than one page and asserts a late-sorting template is returned.
Summary
(*Client).GetTemplates()issues a singleGET /Templatesrequest with no query parameters. Command's/Templatesendpoint returns a default page of 50 results (CommonName ascending) when no paging parameters are supplied, so the client silently truncates the result set at 50 templates and never pages through the remainder.Impact
Any caller that resolves a template by name against the returned list will fail to find templates that sort beyond the first 50. On instances with more than 50 templates this manifests as a spurious "template not found" error even though the template exists and is returned by
GET /Templates/{id}and byGET /Templateswhen a sufficientReturnLimitis supplied.Downstream, this blocks the Terraform provider's
keyfactor_template_role_bindingresource (it resolvestemplate_short_namesby case-insensitive CommonName match againstGetTemplates()).Root cause
v3/api/template.go—GetTemplates()builds the request withQuery: nil:Fix
Paginate automatically, mirroring the existing
ListApplications()pattern in this library (PageReturned/ReturnLimit, accumulate pages, stop when a page returns fewer than the page size). Add a regression test that serves more than one page and asserts a late-sorting template is returned.