diff --git a/api/client/dynamicwindows/dynamicwindows.go b/api/client/dynamicwindows/dynamicwindows.go index 6c158a39e424..32ba1762f1ae 100644 --- a/api/client/dynamicwindows/dynamicwindows.go +++ b/api/client/dynamicwindows/dynamicwindows.go @@ -46,7 +46,7 @@ func (c *Client) GetDynamicWindowsDesktop(ctx context.Context, name string) (typ return desktop, trace.Wrap(err) } -func (c *Client) ListDynamicWindowsDesktop(ctx context.Context, pageSize int, pageToken string) ([]types.DynamicWindowsDesktop, string, error) { +func (c *Client) ListDynamicWindowsDesktops(ctx context.Context, pageSize int, pageToken string) ([]types.DynamicWindowsDesktop, string, error) { resp, err := c.grpcClient.ListDynamicWindowsDesktops(ctx, &dynamicwindows.ListDynamicWindowsDesktopsRequest{ PageSize: int32(pageSize), PageToken: pageToken, diff --git a/lib/auth/authclient/clt.go b/lib/auth/authclient/clt.go index 02c00a7502e2..06ffe731be33 100644 --- a/lib/auth/authclient/clt.go +++ b/lib/auth/authclient/clt.go @@ -22,6 +22,7 @@ import ( "context" "errors" "fmt" + "github.com/gravitational/teleport/api/client/dynamicwindows" "net" "net/url" "time" @@ -1594,6 +1595,8 @@ type ClientI interface { types.WebSessionsGetter types.WebTokensGetter + DynamicDesktopClient() *dynamicwindows.Client + // TrustClient returns a client to the Trust service. TrustClient() trustpb.TrustServiceClient diff --git a/lib/srv/desktop/discovery.go b/lib/srv/desktop/discovery.go index 48bf525273e3..748232b51884 100644 --- a/lib/srv/desktop/discovery.go +++ b/lib/srv/desktop/discovery.go @@ -305,15 +305,17 @@ func (s *WindowsService) ldapEntryToWindowsDesktop(ctx context.Context, entry *l return desktop, nil } -// startDynamicReconciler starts resource watcher and reconciler that registers/unregisters windows desktops -// according to the up-to-date list of dynamic windows desktops resources. +// startDynamicReconciler starts resource watcher and reconciler that registers/unregisters Windows desktops +// according to the up-to-date list of dynamic Windows desktops resources. func (s *WindowsService) startDynamicReconciler(ctx context.Context) (*services.DynamicWindowsDesktopWatcher, error) { if len(s.cfg.ResourceMatchers) == 0 { s.cfg.Logger.DebugContext(ctx, "Not starting dynamic desktop resource watcher.") return nil, nil } s.cfg.Logger.DebugContext(ctx, "Starting dynamic desktop resource watcher.") + dynamicDesktopClient := s.cfg.AuthClient.DynamicDesktopClient() watcher, err := services.NewDynamicWindowsDesktopWatcher(ctx, services.DynamicWindowsDesktopWatcherConfig{ + DynamicWindowsDesktopGetter: dynamicDesktopClient, ResourceWatcherConfig: services.ResourceWatcherConfig{ Component: teleport.ComponentWindowsDesktop, Client: s.cfg.AccessPoint,