// NewWriterWithContext create writer with provided context and metadata.
190775
func (f *FS) NewWriterWithContext(ctx context.Context, objectName string, metadata map[string]string) (io.WriteCloser, error) {

	// Create an uploader with the session and default options
	uploader := s3manager.NewUploader(f.sess)

	pr, pw := io.Pipe()
	bw := csbufio.NewWriter(pw)

	go func() {
		// TODO:  this needs to be managed, ie shutdown signals, close, handler err etc.

		// Upload the file to S3.
		_, err := uploader.UploadWithContext(ctx, &s3manager.UploadInput{
			Bucket: aws.String(f.bucket),
			Key:    aws.String(objectName),
			Body:   pr,
		})
		if err != nil {
			gou.Warnf("could not upload %v", err)
		}
	}()

	return bw, nil
}
164567
func NewReaderWithContext(r io.Reader, ctx context.Context) *Reader {
	return &Reader{
		r:   r,
		ctx: ctx,
	}
}
449321
func (builder *UpdateSetCommandBuilder) WithContext(context []byte) *UpdateSetCommandBuilder {
	builder.protobuf.Context = context
	return builder
}
387979
func NewContextWithHeaders(ctx context.Context, header http.Header) context.Context {
	if ctx == nil {
		ctx = context.Background()
	}
	return context.WithValue(ctx, requestHeaderKey, header)
}
561957
func newContext(ctx context.Context, s *Session) context.Context {
	return context.WithValue(ctx, sessionKey{}, s)
}
13116
func NewContext(req *Request, res *Response, f *Fibre) *Context {
	return &Context{
		fibre:    f,
		request:  req,
		response: res,
	}
}
637991
func NewContextWith(res http.ResponseWriter, req *http.Request, loga *log.Logger) *Context {
	if loga == nil {
		loga = log.New(os.Stdout, "[Relay] ", 0)
	}

	cx := Context{
		SyncCollector: NewSyncCollector(),
		Req:           req,
		Res:           NewResponseWriter(res),
		Log:           loga,
	}
	return &cx
}
254356
func NewContext(ctx context.Context, cfg Etc) context.Context {
	return context.WithValue(ctx, etcKey, cfg)
}
298871
func NewContext(ctx context.Context, msg *sqs.Message) context.Context {
	return context.WithValue(ctx, sqsMessageKey, msg)
}
216815
func NewContext(ctx context.Context, s Service) context.Context {
	return context.WithValue(ctx, serviceKey{}, s)
}
1266359
func NewNestedContextReadWriter(readers []expr.ContextReader, writer expr.ContextWriter, ts time.Time) expr.ContextReadWriter {
	if rw, ok := writer.(expr.ContextReader); ok {
		readers = append(readers, rw)
	}
	return &NestedContextReader{readers, writer, ts}
}
1128362
func NewWriterContext(wp WriterProcessor, w io.Writer, pretty bool, indentStr string) *WriterContext {
	ctx := &WriterContext{
		plugins:     WriterProcessors{"": wp},
		writer:      w,
		prettyPrint: pretty,
		indentStr:   indentStr,
	}
	wp.SetContext(ctx)
	return ctx
}
284630
func NewContext(ctx context.Context, logger Logger) context.Context {
	return context.WithValue(ctx, "termlog", logger)
}
715217
func (o *ListOAuth2ClientsParams) WithContext(ctx context.Context) *ListOAuth2ClientsParams {
	o.SetContext(ctx)
	return o
}
107220
func NewContext(ctx context.Context, t *Tracer) context.Context {
	return context.WithValue(ctx, tracerKey, t)
}
296331
func newContext() *context {
	return &context{
		vars:   make(map[string]*variable),
		mixins: make(map[string]*mixinDeclaration),
	}
}
918554
func NewWithContext(name string, newContext func(*echo.Echo) echo.Context) (s *Application) {
	s = &Application{
		Name:          name,
		moduleHosts:   make(map[string]*Module),
		moduleNames:   make(map[string]*Module),
		TemplateDir:   `template`,
		URL:           `/`,
		MaxUploadSize: 10 * 1024 * 1024,
		Resource: &Resource{
			Dir: `assets`,
		},
		RootModuleName: `base`,
		RouteTagName:   `webx`,
		URLConvert:     LowerCaseFirst,
		URLRecovery:    UpperCaseFirst,
		MapperCheck:    DefaultMapperCheck,
		SessionOptions: &echo.SessionOptions{
			Engine: `cookie`,
			Name:   `GOSID`,
			CookieOptions: &echo.CookieOptions{
				Prefix:   name + `_`,
				HttpOnly: true,
				Path:     `/`,
			},
		},
		ContextInitial: func(ctx echo.Context, wrp *Wrapper, controller interface{}, actionName string) (err error, exit bool) {
			return ctx.(*Context).Init(wrp, controller, actionName)
		}, //[1]
	}
	s.URLBuilder = NewURLBuilder(name, s)
	if newContext == nil {
		newContext = func(e *echo.Echo) echo.Context {
			return NewContext(s, echo.NewContext(nil, nil, e))
		}
	}
	s.ContextCreator = newContext //[1]
	s.Core = echo.NewWithContext(s.ContextCreator)
	s.Core.SetHandlerWrapper(HandlerWrapper) //[1]

	//Core middleware
	s.FuncMap = s.DefaultFuncMap()
	s.DefaultMiddlewares = []interface{}{
		mw.Log(),
		mw.Recover(),
		mw.FuncMap(s.FuncMap, func(ctx echo.Context) bool {
			return ctx.Format() != `html`
		}),
	}
	s.Core.Use(s.DefaultMiddlewares...)

	s.SetHTTPErrorOptions(nil)
	return
}