Documentation

Overview

Package account manages service account.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account interface {
	// Equals compare account with other.
	Equals(other Account) bool

	// Token generates new oauth2 token for the account.
	Token(ctx context.Context) (*oauth2.Token, error)
}

Account represents service account.

type Empty

type Empty struct{}

Empty doesn't provide any service accounts.

func (Empty) New

func (e Empty) New(name string) (Account, error)

type JSONDir

type JSONDir struct {
	Dir    string
	Scopes []string
}

JSONDir is a Pool with json files. It should be used for experiments only. we need to rotate keys. It uses application default credential, if "default" is requested. https://cloud.google.com/docs/authentication/production

func (JSONDir) New

func (j JSONDir) New(name string) (Account, error)

New creates new account by loading json file in the dir. if name is "default", returns default service account instead.

type Pool

type Pool interface {
	// New creates new account for name.
	New(name string) (Account, error)
}

Pool manages service accounts.

Source Files