// TODO(ericsnow) Need a lockfile around create/write?
// WriteContent writes the resource file to the target provided
// by the deps.
962599
func WriteContent(target io.Writer, content Content, deps WriteContentDeps) error {
	checker := deps.NewChecker(content)
	source := checker.WrapReader(content.Data)

	if err := deps.Copy(target, source); err != nil {
		return errors.Annotate(err, "could not write resource to file")
	}

	if err := checker.Verify(); err != nil {
		return errors.Trace(err)
	}

	return nil
}
1371923
func (s *SendAnnouncementInput) SetContent(v *Content) *SendAnnouncementInput {
	s.Content = v
	return s
}
392777
func WriteToFile(filename, content string) {
	f, err := os.Create(filename)
	MustCheck(err)
	defer CloseFile(f)
	_, err = f.WriteString(content)
	MustCheck(err)
}
135312
func (s *InventoryResultItem) SetContent(v []map[string]*string) *InventoryResultItem {
	s.Content = v
	return s
}
75763
func indentContent(indent int, content string) string {
	var b bytes.Buffer
	length := len(strings.Split(content, "\n")) - 1
	for i, x := range strings.Split(content, "\n") {
		// @check if the length of the line is zero and set spacer
		spacer := indent
		if i == 0 || len(x) <= 0 {
			spacer = 0
		}
		// @step: write the line to the buffer
		line := fmt.Sprintf("%"+fmt.Sprintf("%d", spacer)+"s%s", "", x)
		b.WriteString(line)

		// @check if we need a newline
		if i < length {
			b.WriteString("\n")
		}
	}

	return b.String()
}
1009684
func (s *GetLayerVersionOutput) SetContent(v *LayerVersionContentOutput) *GetLayerVersionOutput {
	s.Content = v
	return s
}
615674
func (s *CreateDocumentInput) SetContent(v string) *CreateDocumentInput {
	s.Content = &v
	return s
}
1103895
func (obj *Variable) SetContent(ctx context.Context, content string, updateMRU bool) (bool, error) {
	result := &struct {
		Return bool	`json:"qReturn"`
	} {}
	err := obj.rpc(ctx, "SetContent", result, content, updateMRU)
	return result.Return, err 
}
1353718
func (h *Client) ReleaseContent(rlsName string, opts ...ContentOption) (*rls.GetReleaseContentResponse, error) {
	reqOpts := h.opts
	for _, opt := range opts {
		opt(&reqOpts)
	}
	req := &reqOpts.contentReq
	req.Name = rlsName
	ctx := NewContext()

	if reqOpts.before != nil {
		if err := reqOpts.before(ctx, req); err != nil {
			return nil, err
		}
	}
	return h.content(ctx, req)
}
828805
func (s *SGMailV3) AddContent(c ...*Content) *SGMailV3 {
	s.Content = append(s.Content, c...)
	return s
}
1035740
func (s *ApplicationCodeConfiguration) SetCodeContent(v *CodeContent) *ApplicationCodeConfiguration {
	s.CodeContent = v
	return s
}
319241
func (builder *StoreValueCommandBuilder) WithContent(object *Object) *StoreValueCommandBuilder {
	setProtobufFromValue(builder.protobuf, object)
	builder.value = object
	return builder
}
958331
func (e *Entry) GetContent(key string) string {
	val := e.Get(key)
	if val == nil {
		return ""
	}
	return val.Value.Content
}
1217722
func (g *GistFile) GetContent() string {
	if g == nil || g.Content == nil {
		return ""
	}
	return *g.Content
}
266826
func NoContent(w http.ResponseWriter) error {
	w.WriteHeader(http.StatusNoContent)
	return nil
}
196051
func (c *chunkedContentCoder) Write() (int, error) {
	var tw int

	if c.final != nil {
		// write out the data section first
		nw, err := c.w.Write(c.final)
		tw += nw
		if err != nil {
			return tw, err
		}
	}

	chunkOffsetsStart := uint64(tw)

	if cap(c.final) < binary.MaxVarintLen64 {
		c.final = make([]byte, binary.MaxVarintLen64)
	} else {
		c.final = c.final[0:binary.MaxVarintLen64]
	}
	chunkOffsets := modifyLengthsToEndOffsets(c.chunkLens)
	// write out the chunk offsets
	for _, chunkOffset := range chunkOffsets {
		n := binary.PutUvarint(c.final, chunkOffset)
		nw, err := c.w.Write(c.final[:n])
		tw += nw
		if err != nil {
			return tw, err
		}
	}

	chunkOffsetsLen := uint64(tw) - chunkOffsetsStart

	c.final = c.final[0:8]
	// write out the length of chunk offsets
	binary.BigEndian.PutUint64(c.final, chunkOffsetsLen)
	nw, err := c.w.Write(c.final)
	tw += nw
	if err != nil {
		return tw, err
	}

	// write out the number of chunks
	binary.BigEndian.PutUint64(c.final, uint64(len(c.chunkLens)))
	nw, err = c.w.Write(c.final)
	tw += nw
	if err != nil {
		return tw, err
	}

	c.final = c.final[:0]

	return tw, nil
}
736963
func (s *NotebookInstanceLifecycleHook) SetContent(v string) *NotebookInstanceLifecycleHook {
	s.Content = &v
	return s
}