Copyright 2017 Google LLC. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Package internal supports the options and transport packages.
package internal

import (
	
	
	

	
	
	
	
)
Google API system parameters. For more information please read: https://cloud.google.com/apis/docs/system-parameters
Validate reports an error if ds is invalid.
func ( *DialSettings) () error {
	if .SkipValidation {
		return nil
	}
	 := .APIKey != "" || .TokenSource != nil || .CredentialsFile != "" || .Credentials != nil
	if .NoAuth &&  {
		return errors.New("options.WithoutAuthentication is incompatible with any option that provides credentials")
Credentials should not appear with other options. We currently allow TokenSource and CredentialsFile to coexist. TODO(jba): make TokenSource & CredentialsFile an error (breaking change).
	 := 0
	if .Credentials != nil {
		++
	}
	if .CredentialsJSON != nil {
		++
	}
	if .CredentialsFile != "" {
		++
	}
	if .APIKey != "" {
		++
	}
	if .TokenSource != nil {
		++
	}
	if len(.Scopes) > 0 && len(.Audiences) > 0 {
		return errors.New("WithScopes is incompatible with WithAudience")
Accept only one form of credentials, except we allow TokenSource and CredentialsFile for backwards compatibility.
	if  > 1 && !( == 2 && .TokenSource != nil && .CredentialsFile != "") {
		return errors.New("multiple credential options provided")
	}
	if .GRPCConn != nil && .GRPCConnPool != nil {
		return errors.New("WithGRPCConn is incompatible with WithConnPool")
	}
	if .HTTPClient != nil && .GRPCConnPool != nil {
		return errors.New("WithHTTPClient is incompatible with WithConnPool")
	}
	if .HTTPClient != nil && .GRPCConn != nil {
		return errors.New("WithHTTPClient is incompatible with WithGRPCConn")
	}
	if .HTTPClient != nil && .GRPCDialOpts != nil {
		return errors.New("WithHTTPClient is incompatible with gRPC dial options")
	}
	if .HTTPClient != nil && .QuotaProject != "" {
		return errors.New("WithHTTPClient is incompatible with QuotaProject")
	}
	if .HTTPClient != nil && .RequestReason != "" {
		return errors.New("WithHTTPClient is incompatible with RequestReason")
	}
	if .HTTPClient != nil && .ClientCertSource != nil {
		return errors.New("WithHTTPClient is incompatible with WithClientCertSource")
	}
	if .ClientCertSource != nil && (.GRPCConn != nil || .GRPCConnPool != nil || .GRPCConnPoolSize != 0 || .GRPCDialOpts != nil) {
		return errors.New("WithClientCertSource is currently only supported for HTTP. gRPC settings are incompatible")
	}
	if .ImpersonationConfig != nil && len(.ImpersonationConfig.Scopes) == 0 && len(.Scopes) == 0 {
		return errors.New("WithImpersonatedCredentials requires scopes being provided")
	}
	return nil