Documentation ¶
Index ¶
- Variables
- func NewService(ctx context.Context, userEmail string, serviceAccount []byte, scope ...string) (*admin.Service, error)
- type DirectoryService
- func (ds *DirectoryService) GetGroup(ctx context.Context, groupID string) (*admin.Group, error)
- func (ds *DirectoryService) GetUser(ctx context.Context, userID string) (*admin.User, error)
- func (ds *DirectoryService) ListGroupMembers(ctx context.Context, groupID string, queries ...GetGroupMembersOption) ([]*admin.Member, error)
- func (ds *DirectoryService) ListGroups(ctx context.Context, query []string) ([]*admin.Group, error)
- func (ds *DirectoryService) ListUsers(ctx context.Context, query []string) ([]*admin.User, error)
- type GetGroupMembersOption
Constants ¶
This section is empty.
Variables ¶
var ( // ErrGoogleClientScopeNil is returned when the scope is nil. ErrGoogleClientScopeNil = fmt.Errorf("google: google client scope is required") // ErrUserIDNil is returned when the user ID is nil. ErrUserIDNil = fmt.Errorf("google: user id is required") // ErrGroupIDNil is returned when the group ID is nil. ErrGroupIDNil = fmt.Errorf("google: group id is required") )
Functions ¶
func NewService ¶
func NewService(ctx context.Context, userEmail string, serviceAccount []byte, scope ...string) (*admin.Service, error)
NewService create a Google Directory Service. References: - https://pkg.go.dev/google.golang.org/api/admin/directory/v1 Examples of scope: - "https://www.googleapis.com/auth/admin.directory.group.readonly" - "https://www.googleapis.com/auth/admin.directory.group.member.readonly" - "https://www.googleapis.com/auth/admin.directory.user.readonly"
Types ¶
type DirectoryService ¶
type DirectoryService struct {
// contains filtered or unexported fields
}
DirectoryService represent the Google Directory API client.
func NewDirectoryService ¶
func NewDirectoryService(svc *admin.Service) (*DirectoryService, error)
NewDirectoryService create a Google Directory API client. References: - https://developers.google.com/admin-sdk/directory/v1/guides/delegation?utm_source=pocket_mylist#go
func (*DirectoryService) GetUser ¶
GetUser return a user given a user ID. userID: the user's primary email address, alias email address, or unique user ID.
func (*DirectoryService) ListGroupMembers ¶
func (ds *DirectoryService) ListGroupMembers(ctx context.Context, groupID string, queries ...GetGroupMembersOption) ([]*admin.Member, error)
ListGroupMembers return a list of all members given a group ID. references: - https://developers.google.com/admin-sdk/directory/reference/rest/v1/members/list - https://developers.google.com/admin-sdk/directory/v1/guides/manage-group-members - https://cloud.google.com/identity/docs/how-to/query-memberships
func (*DirectoryService) ListGroups ¶
ListGroups list all groups in a Google Directory filtered by query. References: - https://developers.google.com/admin-sdk/directory/reference/rest/v1/groups
type GetGroupMembersOption ¶ added in v0.0.5
type GetGroupMembersOption func(*getGroupMembersOptions)
GetGroupMembersOption is a function that can be used to configure the Google provider following the Option pattern.
func WithIncludeDerivedMembership ¶ added in v0.0.5
func WithIncludeDerivedMembership(include bool) GetGroupMembersOption
WithIncludeDerivedMembership is a GetGroupMembersOption that can be used to provide a filter for members by include derived membership. includeDerivedMembership Whether to list indirect memberships. Default: false.
func WithMaxResults ¶ added in v0.0.5
func WithMaxResults(maxResults int64) GetGroupMembersOption
WithMaxResults is a GetGroupMembersOption that can be used to provide a filter for members by max results. maxResults Maximum number of results to return. Max allowed value is 200.
func WithPageToken ¶ added in v0.0.5
func WithPageToken(pageToken string) GetGroupMembersOption
WithPageToken is a GetGroupMembersOption that can be used to provide a filter for members by page token. pageToken to specify next page in the list.
func WithRoles ¶ added in v0.0.5
func WithRoles(role string) GetGroupMembersOption
WithRoles is a GetGroupMembersOption that can be used to provide a filter for members by roles. roles=one or more of OWNER,MANAGER,MEMBER separated by a comma