directory

package
v0.0.0-...-c42bc8f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServiceAccountEmailNotSet = errors.New("service account email must be set")
	ErrServiceAccountFileNotSet  = errors.New("service account pem file must be set")
	ErrRoleNotSet                = errors.New("role not set on the user")
)

Functions

This section is empty.

Types

type Attributes

type Attributes struct {
	IAMRole         []IAMRole
	SessionDuration string
}

Attributes wraps the custom attributes for a directory user

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the GSuite client

func NewClient

func NewClient(setOpts ...Option) (*Client, error)

NewClient creates a new version of Client.

func (*Client) GetUser

func (c *Client) GetUser(email string) (*directory.User, error)

GetUser find a user by email

type IAMRole

type IAMRole struct {
	// Type is just "work"
	Type string
	// Value is a comma delimited list of the IAM role and the provider
	Value string
}

IAMRole wraps the IAM role info set in the custom attributes of a user

type Option

type Option func(o *Options)

Option ...

func WithImpersonationEmail

func WithImpersonationEmail(email string) Option

WithImpersonationEmail sets the impersonation email on the Option

func WithLogger

func WithLogger(l *zap.Logger) Option

WithLogger sets the logger on the Option

func WithServiceAccountBase64EncodedFile

func WithServiceAccountBase64EncodedFile(file string) Option

WithServiceAccountBase64EncodedFile takes in the SA PEM file as a Base64 encoded string. Either this or the WithServiceAcountFile function must be used. If the base64 string is NOT valid, this WILL panic.

func WithServiceAccountEmail

func WithServiceAccountEmail(email string) Option

WithServiceAccountEmail sets the email on the Option

func WithServiceAccountFile

func WithServiceAccountFile(f []byte) Option

WithServiceAccountFile takes in a file as bytes. Either this or the WithServiceAccountBase64EncodedFile will be used, depending on which one is run last.

type Options

type Options struct {
	ClientID            string
	Logger              *zap.Logger
	ImpersonationEmail  string
	ServiceAccountEmail string
	ServiceAccountPEM   []byte
	Scopes              []string
}

Options ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL