// GetPrereqs returns the engine prereqs (none).
339542
func (e *ListTrackersEngine) Prereqs() Prereqs {
	session := false
	if e.uid.IsNil() && len(e.username) == 0 {
		session = true
	}
	return Prereqs{Device: session}
}
370682
func getPreKeys(tel string, deviceID string) (*preKeyResponse, error) {
	resp, err := transport.get(fmt.Sprintf(prekeyDevicePath, tel, deviceID))
	if err != nil {
		return nil, err
	}
	if resp.isError() {
		return nil, resp
	}
	dec := json.NewDecoder(resp.Body)
	k := &preKeyResponse{}
	dec.Decode(k)
	return k, nil
}
648886
func (c *Client) GetPrefilter() (*models.Prefilter, error) {
	resp, err := c.Prefilter.GetPrefilter(nil)
	if err != nil {
		return nil, Hint(err)
	}
	return resp.Payload, nil
}
1085996
func (c *Client) GetConstraints(applications ...string) ([]constraints.Value, error) {
	var allConstraints []constraints.Value
	if c.BestAPIVersion() < 5 {
		for _, application := range applications {
			var result params.GetConstraintsResults
			err := c.facade.FacadeCall(
				"GetConstraints", params.GetApplicationConstraints{ApplicationName: application}, &result)
			if err != nil {
				return nil, errors.Trace(err)
			}
			allConstraints = append(allConstraints, result.Constraints)
		}
		return allConstraints, nil
	}

	// Make a single call to get all the constraints.
	var results params.ApplicationGetConstraintsResults
	var args params.Entities
	for _, application := range applications {
		args.Entities = append(args.Entities,
			params.Entity{Tag: names.NewApplicationTag(application).String()})
	}
	err := c.facade.FacadeCall("GetConstraints", args, &results)
	if err != nil {
		return nil, errors.Trace(err)
	}
	for i, result := range results.Results {
		if result.Error != nil {
			return nil, errors.Annotatef(result.Error, "unable to get constraints for %q", applications[i])
		}
		allConstraints = append(allConstraints, result.Constraints)
	}
	return allConstraints, nil
}
1248289
func (d *DeploymentRequest) GetRequiredContexts() []string {
	if d == nil || d.RequiredContexts == nil {
		return nil
	}
	return *d.RequiredContexts
}
275713
func PreconditionRequired(w http.ResponseWriter, response interface{}) {
	Respond(w, http.StatusPreconditionRequired, response)
}
1053456
func (c *InitCommand) getProviders(earlyConfig *earlyconfig.Config, state *states.State, upgrade bool) (output bool, diags tfdiags.Diagnostics) {
	var available discovery.PluginMetaSet
	if upgrade {
		// If we're in upgrade mode, we ignore any auto-installed plugins
		// in "available", causing us to reinstall and possibly upgrade them.
		available = c.providerPluginManuallyInstalledSet()
	} else {
		available = c.providerPluginSet()
	}

	configDeps, depsDiags := earlyConfig.ProviderDependencies()
	diags = diags.Append(depsDiags)
	if depsDiags.HasErrors() {
		return false, diags
	}

	configReqs := configDeps.AllPluginRequirements()
	// FIXME: This is weird because ConfigTreeDependencies was written before
	// we switched over to using earlyConfig as the main source of dependencies.
	// In future we should clean this up to be a more reasoable API.
	stateReqs := terraform.ConfigTreeDependencies(nil, state).AllPluginRequirements()

	requirements := configReqs.Merge(stateReqs)
	if len(requirements) == 0 {
		// nothing to initialize
		return false, nil
	}

	c.Ui.Output(c.Colorize().Color(
		"\n[reset][bold]Initializing provider plugins...",
	))

	missing := c.missingPlugins(available, requirements)

	if c.getPlugins {
		if len(missing) > 0 {
			c.Ui.Output("- Checking for available provider plugins...")
		}

		for provider, reqd := range missing {
			_, providerDiags, err := c.providerInstaller.Get(provider, reqd.Versions)
			diags = diags.Append(providerDiags)

			if err != nil {
				constraint := reqd.Versions.String()
				if constraint == "" {
					constraint = "(any version)"
				}

				switch {
				case err == discovery.ErrorServiceUnreachable, err == discovery.ErrorPublicRegistryUnreachable:
					c.Ui.Error(errDiscoveryServiceUnreachable)
				case err == discovery.ErrorNoSuchProvider:
					c.Ui.Error(fmt.Sprintf(errProviderNotFound, provider, DefaultPluginVendorDir))
				case err == discovery.ErrorNoSuitableVersion:
					if reqd.Versions.Unconstrained() {
						// This should never happen, but might crop up if we catch
						// the releases server in a weird state where the provider's
						// directory is present but does not yet contain any
						// versions. We'll treat it like ErrorNoSuchProvider, then.
						c.Ui.Error(fmt.Sprintf(errProviderNotFound, provider, DefaultPluginVendorDir))
					} else {
						c.Ui.Error(fmt.Sprintf(errProviderVersionsUnsuitable, provider, reqd.Versions))
					}
				case errwrap.Contains(err, discovery.ErrorVersionIncompatible.Error()):
					// Attempt to fetch nested error to display to the user which versions
					// we considered and which versions might be compatible. Otherwise,
					// we'll just display a generic version incompatible msg
					incompatErr := errwrap.GetType(err, fmt.Errorf(""))
					if incompatErr != nil {
						c.Ui.Error(incompatErr.Error())
					} else {
						// Generic version incompatible msg
						c.Ui.Error(fmt.Sprintf(errProviderIncompatible, provider, constraint))
					}
					// Reset nested errors
					err = discovery.ErrorVersionIncompatible
				case err == discovery.ErrorNoVersionCompatible:
					// Generic version incompatible msg
					c.Ui.Error(fmt.Sprintf(errProviderIncompatible, provider, constraint))
				case err == discovery.ErrorSignatureVerification:
					c.Ui.Error(fmt.Sprintf(errSignatureVerification, provider))
				case err == discovery.ErrorChecksumVerification,
					err == discovery.ErrorMissingChecksumVerification:
					c.Ui.Error(fmt.Sprintf(errChecksumVerification, provider))
				default:
					c.Ui.Error(fmt.Sprintf(errProviderInstallError, provider, err.Error(), DefaultPluginVendorDir))
				}

				diags = diags.Append(err)
			}
		}

		if diags.HasErrors() {
			return true, diags
		}
	} else if len(missing) > 0 {
		// we have missing providers, but aren't going to try and download them
		var lines []string
		for provider, reqd := range missing {
			if reqd.Versions.Unconstrained() {
				lines = append(lines, fmt.Sprintf("* %s (any version)\n", provider))
			} else {
				lines = append(lines, fmt.Sprintf("* %s (%s)\n", provider, reqd.Versions))
			}
			diags = diags.Append(fmt.Errorf("missing provider %q", provider))
		}
		sort.Strings(lines)
		c.Ui.Error(fmt.Sprintf(errMissingProvidersNoInstall, strings.Join(lines, ""), DefaultPluginVendorDir))
		return true, diags
	}

	// With all the providers downloaded, we'll generate our lock file
	// that ensures the provider binaries remain unchanged until we init
	// again. If anything changes, other commands that use providers will
	// fail with an error instructing the user to re-run this command.
	available = c.providerPluginSet() // re-discover to see newly-installed plugins

	// internal providers were already filtered out, since we don't need to get them.
	chosen := choosePlugins(available, nil, requirements)

	digests := map[string][]byte{}
	for name, meta := range chosen {
		digest, err := meta.SHA256()
		if err != nil {
			diags = diags.Append(fmt.Errorf("Failed to read provider plugin %s: %s", meta.Path, err))
			return true, diags
		}
		digests[name] = digest
		if c.ignorePluginChecksum {
			digests[name] = nil
		}
	}
	err := c.providerPluginsLock().Write(digests)
	if err != nil {
		diags = diags.Append(fmt.Errorf("failed to save provider manifest: %s", err))
		return true, diags
	}

	{
		// Purge any auto-installed plugins that aren't being used.
		purged, err := c.providerInstaller.PurgeUnused(chosen)
		if err != nil {
			// Failure to purge old plugins is not a fatal error
			c.Ui.Warn(fmt.Sprintf("failed to purge unused plugins: %s", err))
		}
		if purged != nil {
			for meta := range purged {
				log.Printf("[DEBUG] Purged unused %s plugin %s", meta.Name, meta.Path)
			}
		}
	}

	// If any providers have "floating" versions (completely unconstrained)
	// we'll suggest the user constrain with a pessimistic constraint to
	// avoid implicitly adopting a later major release.
	constraintSuggestions := make(map[string]discovery.ConstraintStr)
	for name, meta := range chosen {
		req := requirements[name]
		if req == nil {
			// should never happen, but we don't want to crash here, so we'll
			// be cautious.
			continue
		}

		if req.Versions.Unconstrained() && meta.Version != discovery.VersionZero {
			// meta.Version.MustParse is safe here because our "chosen" metas
			// were already filtered for validity of versions.
			constraintSuggestions[name] = meta.Version.MustParse().MinorUpgradeConstraintStr()
		}
	}
	if len(constraintSuggestions) != 0 {
		names := make([]string, 0, len(constraintSuggestions))
		for name := range constraintSuggestions {
			names = append(names, name)
		}
		sort.Strings(names)

		c.Ui.Output(outputInitProvidersUnconstrained)
		for _, name := range names {
			c.Ui.Output(fmt.Sprintf("* provider.%s: version = %q", name, constraintSuggestions[name]))
		}
	}

	return true, diags
}
332021
func getRequest(d logrus.Fields, key string) (req *http.Request, ok bool) {
	v, ok := d[key]
	if !ok {
		return nil, false
	}
	req, ok = v.(*http.Request)
	if !ok || req == nil {
		return nil, false
	}
	return req, true
}
922596
func (client *Client) GetServices(filters ...Filter) ([]Service, Warnings, error) {
	opts := requestOptions{
		RequestName: internal.GetServicesRequest,
		Query:       ConvertFilterParameters(filters),
	}

	return client.makeServicesRequest(opts)
}
550585
func (contract *Contract) GetProducts() (*Products, error) {
	req, err := client.NewRequest(
		Config,
		"GET",
		fmt.Sprintf(
			"/papi/v1/products?contractId=%s",
			contract.ContractID,
		),
		nil,
	)
	if err != nil {
		return nil, err
	}

	res, err := client.Do(Config, req)
	if err != nil {
		return nil, err
	}

	if client.IsError(res) {
		return nil, client.NewAPIError(res)
	}

	products := NewProducts()
	if err = client.BodyJSON(res, products); err != nil {
		return nil, err
	}

	return products, nil
}
552401
func (e *CElement) PrevWait() *CElement {
	for {
		e.mtx.RLock()
		prev := e.prev
		prevWg := e.prevWg
		removed := e.removed
		e.mtx.RUnlock()

		if prev != nil || removed {
			return prev
		}

		prevWg.Wait()
	}
}
818157
func (obj *Doc) GetObjects(ctx context.Context, options *NxGetObjectOptions) ([]*NxContainerEntry, error) {
	result := &struct {
		List []*NxContainerEntry	`json:"qList"`
	} {}
	err := obj.rpc(ctx, "GetObjects", result, options)
	return result.List, err 
}
1350038
func (c *PassphraseChange) Prereqs() Prereqs {
	if c.arg.Force {
		return Prereqs{}
	}

	return Prereqs{Device: true}
}
246489
func (p *Preemptor) getNumPreemptions(alloc *structs.Allocation) int {
	c, ok := p.currentPreemptions[structs.NewNamespacedID(alloc.JobID, alloc.Namespace)][alloc.TaskGroup]
	if !ok {
		return 0
	}
	return c
}
714555
func (ev *ChangeResp) GetPrevValue(prevVal proto.Message) (prevExists bool, err error) {
	if prevVal != nil && ev.PrevVal != nil {
		return true, ev.PrevVal.GetValue(prevVal)
	}
	return false, err
}
837554
func getReady(name string, wg *sync.WaitGroup) {
	defer wg.Done()
	fmt.Printf("%s started getting ready\n", name)
	// the time it takes to get ready is at least 60 seconds, plus a random number up to 90 seconds
	sec := rand.Intn(30) + 60
	// this is where they get ready
	time.Sleep(time.Duration(sec) * time.Second)
	fmt.Printf("%s spent %d seconds getting ready\n", name, sec)
}
1270628
func getRequestOptions(req *http.Request, scope *RequestScope, into runtime.Object, subpath bool, subpathKey string, isSubresource bool) error {
	if into == nil {
		return nil
	}

	query := req.URL.Query()
	if subpath {
		newQuery := make(url.Values)
		for k, v := range query {
			newQuery[k] = v
		}

		ctx := req.Context()
		requestInfo, _ := request.RequestInfoFrom(ctx)
		startingIndex := 2
		if isSubresource {
			startingIndex = 3
		}

		p := strings.Join(requestInfo.Parts[startingIndex:], "/")

		// ensure non-empty subpaths correctly reflect a leading slash
		if len(p) > 0 && !strings.HasPrefix(p, "/") {
			p = "/" + p
		}

		// ensure subpaths correctly reflect the presence of a trailing slash on the original request
		if strings.HasSuffix(requestInfo.Path, "/") && !strings.HasSuffix(p, "/") {
			p += "/"
		}

		newQuery[subpathKey] = []string{p}
		query = newQuery
	}
	return scope.ParameterCodec.DecodeParameters(query, scope.Kind.GroupVersion(), into)
}