// Context adds a context to the request. Contexts are only used for
// timeouts, deadlines, and cancellations.
971029
func (r *Request) Context(ctx context.Context) *Request {
	r.ctx = ctx
	return r
}
841098
func (a *APIDefinition) Context() string {
	if a.Name != "" {
		return fmt.Sprintf("API %#v", a.Name)
	}
	return "unnamed API"
}
474517
func (c *PutBatchCall) Context(ctx context.Context) *PutBatchCall {
	c.ctx_ = ctx
	return c
}
123129
func (c *GetRefConfigsCall) Context(ctx context.Context) *GetRefConfigsCall {
	c.ctx_ = ctx
	return c
}
895125
func Context(ctx context.Context) RequestOption {
	return func(req *http.Request) (*http.Request, error) {
		return req.WithContext(ctx), nil
	}
}
1340159
func (c *ValidateConfigCall) Context(ctx context.Context) *ValidateConfigCall {
	c.ctx_ = ctx
	return c
}
100765
func (c *ClientHistoryCall) Context(ctx context.Context) *ClientHistoryCall {
	c.ctx_ = ctx
	return c
}
869726
func (app *App) context(w http.ResponseWriter, r *http.Request) *Context {
	ctx := r.Context()
	ctx = dcontext.WithVars(ctx, r)
	ctx = dcontext.WithLogger(ctx, dcontext.GetLogger(ctx,
		"vars.name",
		"vars.reference",
		"vars.digest",
		"vars.uuid"))

	context := &Context{
		App:     app,
		Context: ctx,
	}

	if app.httpHost.Scheme != "" && app.httpHost.Host != "" {
		// A "host" item in the configuration takes precedence over
		// X-Forwarded-Proto and X-Forwarded-Host headers, and the
		// hostname in the request.
		context.urlBuilder = v2.NewURLBuilder(&app.httpHost, false)
	} else {
		context.urlBuilder = v2.NewURLBuilderFromRequest(r, app.Config.HTTP.RelativeURLs)
	}

	return context
}
967112
func (c *SucceedCall) Context(ctx context.Context) *SucceedCall {
	c.ctx_ = ctx
	return c
}
780351
func (c *ClientupdateListCall) Context(ctx context.Context) *ClientupdateListCall {
	c.ctx_ = ctx
	return c
}
47582
func (r *Request) Context() aws.Context {
	if r.context != nil {
		return r.context
	}
	return aws.BackgroundContext()
}
1061097
func (c *ResetCall) Context(ctx context.Context) *ResetCall {
	c.ctx_ = ctx
	return c
}
746285
func (c *TasksRequestsCall) Context(ctx context.Context) *TasksRequestsCall {
	c.ctx_ = ctx
	return c
}
1002802
func (c *TasksCancelCall) Context(ctx context.Context) *TasksCancelCall {
	c.ctx_ = ctx
	return c
}
460822
func (c *SearchCall) Context(ctx context.Context) *SearchCall {
	c.ctx_ = ctx
	return c
}
681151
func (c *GroupPatchCall) Context(ctx context.Context) *GroupPatchCall {
	c.ctx_ = ctx
	return c
}
1143860
func (c *protectedContext) context() context.Context {
	c.mu.RLock()
	defer c.mu.RUnlock()
	return c.ctx
}