forked from awslabs/ssosync
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
big refactor, removed the originals methods
- Loading branch information
1 parent
612f2a4
commit 8236de5
Showing
2 changed files
with
63 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,11 +25,9 @@ import ( | |
|
||
// Client is the Interface for the Client | ||
type Client interface { | ||
GetUsers() ([]*admin.User, error) | ||
GetUsersMatch(string) ([]*admin.User, error) | ||
GetUsers(string) ([]*admin.User, error) | ||
GetDeletedUsers() ([]*admin.User, error) | ||
GetGroups() ([]*admin.Group, error) | ||
GetGroupsMatch(string) ([]*admin.Group, error) | ||
GetGroups(string) ([]*admin.Group, error) | ||
GetGroupMembers(*admin.Group) ([]*admin.Member, error) | ||
} | ||
|
||
|
@@ -74,28 +72,6 @@ func (c *client) GetDeletedUsers() ([]*admin.User, error) { | |
return u, err | ||
} | ||
|
||
// GetUsers will get the users from Google's Admin API | ||
func (c *client) GetUsers() ([]*admin.User, error) { | ||
u := make([]*admin.User, 0) | ||
err := c.service.Users.List().Customer("my_customer").Pages(c.ctx, func(users *admin.Users) error { | ||
u = append(u, users.Users...) | ||
return nil | ||
}) | ||
|
||
return u, err | ||
} | ||
|
||
// GetGroups will get the groups from Google's Admin API | ||
func (c *client) GetGroups() ([]*admin.Group, error) { | ||
g := make([]*admin.Group, 0) | ||
err := c.service.Groups.List().Customer("my_customer").Pages(context.TODO(), func(groups *admin.Groups) error { | ||
g = append(g, groups.Groups...) | ||
return nil | ||
}) | ||
|
||
return g, err | ||
} | ||
|
||
// GetGroupMembers will get the members of the group specified | ||
func (c *client) GetGroupMembers(g *admin.Group) ([]*admin.Member, error) { | ||
m := make([]*admin.Member, 0) | ||
|
@@ -107,7 +83,7 @@ func (c *client) GetGroupMembers(g *admin.Group) ([]*admin.Member, error) { | |
return m, err | ||
} | ||
|
||
// GetUsersMatch will get the users from Google's Admin API | ||
// GetUsers will get the users from Google's Admin API | ||
// using the Method: users.list with parameter "query" | ||
// References: | ||
// * https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/list | ||
|
@@ -119,7 +95,7 @@ func (c *client) GetGroupMembers(g *admin.Group) ([]*admin.Member, error) { | |
// manager='[email protected]' | ||
// orgName=Engineering orgTitle:Manager | ||
// EmploymentData.projects:'GeneGnomes' | ||
func (c *client) GetUsersMatch(query string) ([]*admin.User, error) { | ||
func (c *client) GetUsers(query string) ([]*admin.User, error) { | ||
u := make([]*admin.User, 0) | ||
err := c.service.Users.List().Query(query).Customer("my_customer").Pages(c.ctx, func(users *admin.Users) error { | ||
u = append(u, users.Users...) | ||
|
@@ -129,7 +105,7 @@ func (c *client) GetUsersMatch(query string) ([]*admin.User, error) { | |
return u, err | ||
} | ||
|
||
// GetGroupsMatch will get the groups from Google's Admin API | ||
// GetGroups will get the groups from Google's Admin API | ||
// using the Method: groups.list with parameter "query" | ||
// References: | ||
// * https://developers.google.com/admin-sdk/directory/reference/rest/v1/groups/list | ||
|
@@ -141,7 +117,7 @@ func (c *client) GetUsersMatch(query string) ([]*admin.User, error) { | |
// name:contact* email:contact* | ||
// name:Admin* email:aws-* | ||
// email:aws-* | ||
func (c *client) GetGroupsMatch(query string) ([]*admin.Group, error) { | ||
func (c *client) GetGroups(query string) ([]*admin.Group, error) { | ||
g := make([]*admin.Group, 0) | ||
err := c.service.Groups.List().Customer("my_customer").Query(query).Pages(context.TODO(), func(groups *admin.Groups) error { | ||
g = append(g, groups.Groups...) | ||
|
Oops, something went wrong.