Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitGSUtil ¶
InitGSUtil instantiates a workDir to be authenticated with gsutil This is primarily used for local testing, and should not be relied upon for production usage.
func InitLUCIAuth ¶
InitLUCIAuth instantiates a workDir to be authenticated with LUCI credentials on this machine.
func InitNoAuth ¶
InitNoAuth instantiates a workDir to use an unauthenticated HTTP client.
func InitServiceAccountAuth ¶
InitServiceAccountAuth instantiates a workDir to be authenticated with the given serviceAccountFile.
func LoadAuthOpt ¶
LoadAuthOpt will load a serialized *authOpt from disk and return it. If there is not one, it will return nil.
Types ¶
type AuthOpt ¶
type AuthOpt interface { // Validate returns an error if this is not a valid authenticated interface nil, otherwise. Validate() error // GetHTTPClient returns an authenticated goldclient.HTTPClient (which for non-mocked // implementations will be an http.Client) GetHTTPClient() (httpclient.HTTPClient, error) // SetDryRun will toggle actually uploading to GCS or not. This should be set before // any calls to GetGCSUploader SetDryRun(isDryRun bool) // GetGCSUploader returns an authenticated goldclient.GCSUploader, the interface for // uploading to GCS. GetGCSUploader(context.Context) (gcsuploader.GCSUploader, error) // GetImageDownloader returns an authenticated goldclient.ImageDownloader, the interface for // downloading from GCS. GetImageDownloader() (imagedownloader.ImageDownloader, error) }
The AuthOpt interface adds a layer of abstraction around getting authenticated clients that can make certain requests over the wire. This being an interface makes for easier mocking than just the raw struct.