// NewYamlSourceFromFlagFunc creates a new Yaml InputSourceContext from a provided flag name and source context.
199257
func NewYamlSourceFromFlagFunc(flagFileName string) func(context *cli.Context) (InputSourceContext, error) {
	return func(context *cli.Context) (InputSourceContext, error) {
		filePath := context.String(flagFileName)
		return NewYamlSourceFromFile(filePath)
	}
}
555222
func parseSourceFlag(sourceFlag string) (importPath, variableName string, err error) {
	// Parse sourceFlag as a Go expression, albeit a strange one:
	//
	// 	"import/path".VariableName
	//
	e, err := parser.ParseExpr(sourceFlag)
	if err != nil {
		return "", "", fmt.Errorf("invalid format, failed to parse %q as a Go expression", sourceFlag)
	}
	se, ok := e.(*ast.SelectorExpr)
	if !ok {
		return "", "", fmt.Errorf("invalid format, expression %v is not a selector expression but %T", sourceFlag, e)
	}
	importPath, err = stringValue(se.X)
	if err != nil {
		return "", "", fmt.Errorf("invalid format, expression %v is not a properly quoted Go string: %v", stringifyAST(se.X), err)
	}
	if build.IsLocalImport(importPath) {
		// Generated code is executed in a temporary directory,
		// and can't use relative import paths. So disallow them.
		return "", "", fmt.Errorf("relative import paths are not supported")
	}
	variableName = se.Sel.Name
	return importPath, variableName, nil
}
1273894
func NewMapperTagFunc(tagName string, mapFunc, tagMapFunc func(string) string) *Mapper {
	return &Mapper{
		cache:      make(map[reflect.Type]*StructMap),
		tagName:    tagName,
		mapFunc:    mapFunc,
		tagMapFunc: tagMapFunc,
	}
}
1249192
func (a *Application) AddToFlagSet(fs *flag.FlagSet) {
	flag.StringVar(&a.servicePath, "service", ".",
		"Path to the AppEngine service to generate from.")
	flag.StringVar(&a.serviceAPIRoot, "service-api-root", "/_ah/api/",
		"The service's API root path.")
	flag.StringVar(&a.genPath, "generator", "google-api-go-generator",
		"Path to the `google-api-go-generator` binary to use.")
	flag.StringVar(&a.apiPackage, "api-package", defaultPackageBase,
		"Name of the root API package on GOPATH.")
	flag.StringVar(&a.apiSubproject, "api-subproject", "",
		"If supplied, place APIs in an additional subdirectory under -api-package.")
	flag.Var(&a.apiWhitelist, "api",
		"If supplied, limit the emitted APIs to those named. Can be specified "+
			"multiple times.")
	flag.StringVar(&a.baseURL, "base-url", "http://localhost:8080",
		"Use this as the default base service client URL.")
}
267632
func appEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource {
	logOnce.Do(func() {
		log.Print("google: AppEngineTokenSource is deprecated on App Engine standard second generation runtimes (>= Go 1.11) and App Engine flexible. Please use DefaultTokenSource or ComputeTokenSource.")
	})
	return ComputeTokenSource("")
}
636813
func (o *AggregatorOptions) AddFlags(fs *pflag.FlagSet) {
	o.RecommendedOptions.AddFlags(fs)
	o.APIEnablement.AddFlags(fs)
	fs.StringVar(&o.ProxyClientCertFile, "proxy-client-cert-file", o.ProxyClientCertFile, "client certificate used identify the proxy to the API server")
	fs.StringVar(&o.ProxyClientKeyFile, "proxy-client-key-file", o.ProxyClientKeyFile, "client certificate key used identify the proxy to the API server")
}
247433
func (c *Config) TokenSource(ctx context.Context) oauth2.TokenSource {
	source := &tokenSource{
		ctx:  ctx,
		conf: c,
	}
	return oauth2.ReuseTokenSource(nil, source)
}
467538
func (cmd *CLI) DefineDurationFlag(name string, value time.Duration, usage string) *time.Duration {
	p := new(time.Duration)
	cmd.DefineDurationFlagVar(p, name, value, usage)
	return p
}
881557
func NewFlagSetWithEnvPrefix(name string, prefix string, errorHandling ErrorHandling) *FlagSet {
	f := NewFlagSet(name, errorHandling)
	f.envPrefix = prefix
	return f
}
962549
func NewJSONSource(data []byte) (InputSourceContext, error) {
	var deserialized map[string]interface{}
	if err := json.Unmarshal(data, &deserialized); err != nil {
		return nil, err
	}
	return &jsonSource{deserialized: deserialized}, nil
}
821756
func NewOptionsWithFlagSet(set *flag.FlagSet) *Options {
	toolbox.Dump(set)

	var result = &Options{}
	result.Dest = set.Lookup(optionKeyDest).Value.String()
	result.Source = set.Lookup(optionKeySource).Value.String()
	result.PoolObjects = toolbox.AsBoolean(set.Lookup(optionKeyPoolObjects).Value.String())
	result.TagName = set.Lookup(optionKeyTagName).Value.String()
	result.Types = strings.Split(set.Lookup(optionKeyTypes).Value.String(), ",")
	result.Pkg = set.Lookup(optionKeyPkg).Value.String()
	if result.Source == "" {
		result.Source = url.NewResource(".").ParsedURL.Path
	}
	return result
}
401893
func (t *Store) UserTokenAndSource() (string, TokenSource) {
	t.l.RLock()
	defer t.l.RUnlock()

	return t.userToken, t.userTokenSource
}
177828
func NewAPIClientFromFlags(opts *cliflags.CommonOptions, configFile *configfile.ConfigFile) (client.APIClient, error) {
	store := &ContextStoreWithDefault{
		Store: store.New(cliconfig.ContextStoreDir(), defaultContextStoreConfig()),
		Resolver: func() (*DefaultContext, error) {
			return resolveDefaultContext(opts, configFile, ioutil.Discard)
		},
	}
	contextName, err := resolveContextName(opts, configFile, store)
	if err != nil {
		return nil, err
	}
	endpoint, err := resolveDockerEndpoint(store, contextName)
	if err != nil {
		return nil, errors.Wrap(err, "unable to resolve docker endpoint")
	}
	return newAPIClientFromEndpoint(endpoint, configFile)
}
1059517
func (sm *SourceMgr) SyncSourceFor(id ProjectIdentifier) error {
	if atomic.CompareAndSwapInt32(&sm.releasing, 1, 1) {
		return smIsReleased{}
	}

	srcg, err := sm.srcCoord.getSourceGatewayFor(context.TODO(), id)
	if err != nil {
		return err
	}

	return srcg.syncLocal(context.TODO())
}
773119
func NewJSONSourceFromFlagFunc(flag string) func(c *cli.Context) (InputSourceContext, error) {
	return func(context *cli.Context) (InputSourceContext, error) {
		return NewJSONSourceFromFile(context.String(flag))
	}
}
446457
func NewGenericFlag(fl cli.GenericFlag) *GenericFlag {
	return &GenericFlag{GenericFlag: fl, set: nil}
}
922494
func NamespaceKeyRootFunc(ctx context.Context, prefix string) string {
	key := prefix
	ns, ok := genericapirequest.NamespaceFrom(ctx)
	if ok && len(ns) > 0 {
		key = key + "/" + ns
	}
	return key
}