From 6a72a0bc2d2a3298be21703ecef198eb91a0ca11 Mon Sep 17 00:00:00 2001 From: Chris Harris Date: Thu, 15 Jan 2026 21:27:04 +0000 Subject: [PATCH] Allow a custom HTTP client to be used with ServiceReservation Signed-off-by: Chris Harris --- pkg/service-reservations/interface.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/service-reservations/interface.go b/pkg/service-reservations/interface.go index 8a031bef..b3fc1933 100644 --- a/pkg/service-reservations/interface.go +++ b/pkg/service-reservations/interface.go @@ -97,6 +97,9 @@ type ServiceReservation interface { InitInstance(stateManagerServer string, reservationPath string, defaultTermMinutes int, logger *logrus.Logger, svcName string) + //Initialize with a custom http client (for example with OAuth2 transport) + InitWithHTTPClient(stateManagerServer string, reservationPath string, defaultTermMinutes int, logger *logrus.Logger, svcName string, httpClient *retryablehttp.Client) + //Try to aquire locks for a list of xnames, renewing them within 30 seconds of expiration. Aquire(xnames []string) error @@ -179,6 +182,12 @@ func (i *Production) InitInstance(stateManagerServer string, reservationPath str i.Init(stateManagerServer, reservationPath, defaultTermMinutes, logger) } +// Initialize with a custom http client (for example with OAuth2 transport) +func (i *Production) InitWithHTTPClient(stateManagerServer string, reservationPath string, defaultTermMinutes int, logger *logrus.Logger, svcName string, httpClient *retryablehttp.Client) { + i.InitInstance(stateManagerServer, reservationPath, defaultTermMinutes, logger, svcName) + i.httpClient = httpClient +} + // Lets make this really simple; Im going to wake up and see what expires in the next 30 seconds; // then I will renew those things func (i *Production) doRenewal() {