From a58bb6b16258687295e75e46899ee8901d21e82e Mon Sep 17 00:00:00 2001 From: Chris Pates Date: Mon, 4 Mar 2024 15:13:50 +0000 Subject: [PATCH 1/2] Improve connection testing for each connection: - Perform simple test - improve error message per connection --- internal/sync.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/internal/sync.go b/internal/sync.go index 7df5fede..8516fd96 100644 --- a/internal/sync.go +++ b/internal/sync.go @@ -721,6 +721,7 @@ func DoSync(ctx context.Context, cfg *config.Config) error { googleClient, err := google.NewClient(ctx, cfg.GoogleAdmin, creds) if err != nil { + log.WithField("error", err).Warn("Problem establising a connection to Google directory") return err } @@ -731,6 +732,7 @@ func DoSync(ctx context.Context, cfg *config.Config) error { Token: cfg.SCIMAccessToken, }) if err != nil { + log.WithField("error", err).Warn("Problem establising a SCIM connection to AWS IAM Identity Center") return err } @@ -741,12 +743,23 @@ func DoSync(ctx context.Context, cfg *config.Config) error { }) if err != nil { + log.WithField("error", err).Warn("Problem establising a session for Identity Store") return err } // Initialize AWS Identity Store Public API Client with session identityStoreClient := identitystore.New(sess) + err := identityStoreClient.ListGroupsPages( + &identitystore.ListGroupsInput{IdentityStoreId: &s.cfg.IdentityStoreID}, + ListGroupsPagesCallbackFn, + ) + + if err != nil { + log.WithField("error", err).Warn("Problem performing test query against Identity Store") + return nil, err + } + // Initialize sync client with // 1. SCIM API client // 2. Google Directory API client From 66301a94e5afd61df5d4cef307575fcab66ba038 Mon Sep 17 00:00:00 2001 From: Chris Pates Date: Mon, 4 Mar 2024 17:21:33 +0000 Subject: [PATCH 2/2] Update sync.go --- internal/sync.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/internal/sync.go b/internal/sync.go index 8516fd96..ce422c21 100644 --- a/internal/sync.go +++ b/internal/sync.go @@ -750,14 +750,15 @@ func DoSync(ctx context.Context, cfg *config.Config) error { // Initialize AWS Identity Store Public API Client with session identityStoreClient := identitystore.New(sess) - err := identityStoreClient.ListGroupsPages( - &identitystore.ListGroupsInput{IdentityStoreId: &s.cfg.IdentityStoreID}, - ListGroupsPagesCallbackFn, - ) + response, err := identityStoreClient.ListGroups( + &identitystore.ListGroupsInput{IdentityStoreId: &cfg.IdentityStoreID}) - if err != nil { + if err != nil { log.WithField("error", err).Warn("Problem performing test query against Identity Store") - return nil, err + return err + } else { + log.WithField("Groups", response).Info("Test call for groups successful") + } // Initialize sync client with