Documentation
¶
Overview ¶
Package group synchronises email addresses with a Google Group.
Requirements ¶
In order to synchronise with Google, you'll need to credentials with the Admin SDK enabled on your account, and credentials with the following scopes:
Examples ¶
See [New] and Init.
Index ¶
Examples ¶
Constants ¶
const DeliverySettings gosync.ConfigKey = "delivery_settings"
DeliverySettings sets the delivery settings.
Acceptable values:
- ALL_MAIL
- DAILY
- DIGEST
- DISABLED
- NONE
See `delivery_settings` field in reference for more information.
const Name gosync.ConfigKey = "name"
Name is the name of your Google group.
const Role gosync.ConfigKey = "role"
Role sets the role for new users being added to a group.
Acceptable values:
- MANAGER
- MEMBER
- OWNER
See `role` field in reference for more information.
Variables ¶
This section is empty.
Functions ¶
func WithAdminService ¶ added in v0.14.0
WithAdminService passes a custom Google Admin Service to the adapter.
Example ¶
package main import ( "context" "log" admin "google.golang.org/api/admin/directory/v1" "google.golang.org/api/option" gosync "github.com/ovotech/go-sync" "github.com/ovotech/go-sync/adapters/google/group" ) func main() { ctx := context.Background() client, err := admin.NewService( ctx, option.WithScopes(admin.AdminDirectoryGroupMemberScope), option.WithAPIKey("my-api-key"), ) if err != nil { log.Fatal(err) } adapter, err := group.Init(ctx, map[gosync.ConfigKey]string{ group.Name: "my-group", }, group.WithAdminService(client)) if err != nil { log.Fatal(err) } gosync.New(adapter) }
Output:
func WithLogger ¶
WithLogger passes a custom logger to the adapter.
Example ¶
package main import ( "context" "log" "os" gosync "github.com/ovotech/go-sync" "github.com/ovotech/go-sync/adapters/google/group" ) func main() { ctx := context.Background() logger := log.New(os.Stdout, "", log.LstdFlags) adapter, err := group.Init(ctx, map[gosync.ConfigKey]string{ group.Name: "my-group", }, group.WithLogger(logger)) if err != nil { log.Fatal(err) } gosync.New(adapter) }
Output:
Types ¶
type Group ¶
type Group struct { Logger *log.Logger DeliverySettings string // See [group.DeliverySettings]. Role string // See [group.Role]. // contains filtered or unexported fields }
func Init ¶ added in v0.7.0
func Init( ctx context.Context, config map[gosync.ConfigKey]string, configFns ...gosync.ConfigFn[*Group], ) (*Group, error)
Init a new Google Group gosync.Adapter.
Required config:
Example ¶
package main import ( "context" "log" gosync "github.com/ovotech/go-sync" "github.com/ovotech/go-sync/adapters/google/group" ) func main() { ctx := context.Background() adapter, err := group.Init(ctx, map[gosync.ConfigKey]string{ group.Name: "my-group", }) if err != nil { log.Fatal(err) } gosync.New(adapter) }
Output: