func GoogleComputeCredentials(serviceAccount string) Option {
	return func(sh *StackdriverHook) error {
		var err error

		// get compute metadata scopes associated with the service account
		scopes, err := metadata.Scopes(serviceAccount)
		if err != nil {
			return err
		}

		// check if all the necessary scopes are provided
		for _, s := range requiredScopes {
			if !sliceContains(scopes, s) {
				// NOTE: if you are seeing this error, you probably need to
				// recreate your compute instance with the correct scope
				//
				// as of August 2016, there is not a way to add a scope to an
				// existing compute instance
				return fmt.Errorf("missing required scope %s in compute metadata", s)
			}
		}

		return HTTPClient(&http.Client{
			Transport: &oauth2.Transport{
				Source: google.ComputeTokenSource(serviceAccount),
			},
		})(sh)
	}
}
func GoogleComputeCredentials(serviceAccount string) Option {
	return func(sh *StackdriverHook) error {
		var err error

		
		scopes, err := metadata.Scopes(serviceAccount)
		if err != nil {
			return err
		}

		
		for _, s := range requiredScopes {
			if !sliceContains(scopes, s) {
				
				
				
				
				
				return fmt.Errorf("missing required scope %s in compute metadata", s)
			}
		}

		return HTTPClient(&http.Client{
			Transport: &oauth2.Transport{
				Source: google.ComputeTokenSource(serviceAccount),
			},
		})(sh)
	}
}
func GoogleComputeCredentials ( serviceAccount string ) Option { return func ( sh * StackdriverHook ) error { var err error // get compute metadata scopes associated with the service account scopes , err := metadata . Scopes ( serviceAccount ) if err != nil { return err } // check if all the necessary scopes are provided for _ , s := range requiredScopes { if ! sliceContains ( scopes , s ) { // NOTE: if you are seeing this error, you probably need to // recreate your compute instance with the correct scope // // as of August 2016, there is not a way to add a scope to an // existing compute instance return fmt . Errorf ( " " , s ) } } return HTTPClient ( & http . Client { Transport : & oauth2 . Transport { Source : google . ComputeTokenSource ( serviceAccount ) , } , } ) ( sh ) } }
// GoogleComputeCredentials is an option that loads the Google Service Account
// credentials from the GCE metadata associated with the GCE compute instance.
// If serviceAccount is empty, then the default service account credentials
// associated with the GCE instance will be used.
GoogleComputeCredentials is an option that loads the Google Service Account credentials from the GCE metadata associated with the GCE compute instance . If serviceAccount is empty then the default service account credentials associated with the GCE instance will be used .