// PutContent stores the []byte content at a location designated by "path".
// This should primarily be used for small objects.
436964
func (d *driver) PutContent(context context.Context, path string, contents []byte) error {
	return retry(func() error {
		wc := storage.NewWriter(d.context(context), d.bucket, d.pathToKey(path))
		wc.ContentType = "application/octet-stream"
		return putContentsClose(wc, contents)
	})
}
48381
func (container *Container) CopyImagePathContent(v volume.Volume, destination string) error {
	rootfs, err := container.GetResourcePath(destination)
	if err != nil {
		return err
	}

	if _, err := os.Stat(rootfs); err != nil {
		if os.IsNotExist(err) {
			return nil
		}
		return err
	}

	id := stringid.GenerateNonCryptoID()
	path, err := v.Mount(id)
	if err != nil {
		return err
	}

	defer func() {
		if err := v.Unmount(id); err != nil {
			logrus.Warnf("error while unmounting volume %s: %v", v.Name(), err)
		}
	}()
	if err := label.Relabel(path, container.MountLabel, true); err != nil && err != unix.ENOTSUP {
		return err
	}
	return copyExistingContents(rootfs, path)
}
121231
func (p *Panel) SetContent(w Widget) {
	index := 0
	if p.title != nil {
		index++
	}
	if p.menu != nil {
		index++
	}
	if p.content != nil {
		p.RemoveWidget(p.content)
	}
	p.InsertWidget(index, w, 1.0)
	p.content = w
}
1372910
func buildWithContent(cs []Content) (*Node, []*Node, error) {
	if len(cs) == 0 {
		return nil, nil, errors.New("error: cannot construct tree with no content")
	}
	var leafs []*Node
	for _, c := range cs {
		hash, err := c.CalculateHash()
		if err != nil {
			return nil, nil, err
		}

		leafs = append(leafs, &Node{
			Hash: hash,
			C:    c,
			leaf: true,
		})
	}
	if len(leafs)%2 == 1 {
		duplicate := &Node{
			Hash: leafs[len(leafs)-1].Hash,
			C:    leafs[len(leafs)-1].C,
			leaf: true,
			dup:  true,
		}
		leafs = append(leafs, duplicate)
	}
	root, err := buildIntermediate(leafs)
	if err != nil {
		return nil, nil, err
	}

	return root, leafs, nil
}
34417
func (d *driver) GetContent(ctx context.Context, path string) ([]byte, error) {
	content, err := d.Conn.ObjectGetBytes(d.Container, d.swiftPath(path))
	if err == swift.ObjectNotFound {
		return nil, storagedriver.PathNotFoundError{Path: path}
	}
	return content, err
}
1228711
func (s *Comment) SetContent(v string) *Comment {
	s.Content = &v
	return s
}
102899
func (a *Attachment) SetContent(content string) *Attachment {
	a.Content = content
	return a
}
1002963
func (s *RawString) SetContent(v string) *RawString {
	s.Content = &v
	return s
}
237073
func (s *PutLexiconInput) SetContent(v string) *PutLexiconInput {
	s.Content = &v
	return s
}
1035740
func (s *ApplicationCodeConfiguration) SetCodeContent(v *CodeContent) *ApplicationCodeConfiguration {
	s.CodeContent = v
	return s
}
23674
func (s *UpdateCustomVerificationEmailTemplateInput) SetTemplateContent(v string) *UpdateCustomVerificationEmailTemplateInput {
	s.TemplateContent = &v
	return s
}
434963
func (d *driver) GetContent(context context.Context, path string) ([]byte, error) {
	gcsContext := d.context(context)
	name := d.pathToKey(path)
	var rc io.ReadCloser
	err := retry(func() error {
		var err error
		rc, err = storage.NewReader(gcsContext, d.bucket, name)
		return err
	})
	if err == storage.ErrObjectNotExist {
		return nil, storagedriver.PathNotFoundError{Path: path}
	}
	if err != nil {
		return nil, err
	}
	defer rc.Close()

	p, err := ioutil.ReadAll(rc)
	if err != nil {
		return nil, err
	}
	return p, nil
}
1360194
func (d *driver) PutContent(ctx context.Context, p string, contents []byte) error {
	d.mutex.Lock()
	defer d.mutex.Unlock()

	normalized := normalize(p)

	f, err := d.root.mkfile(normalized)
	if err != nil {
		// TODO(stevvooe): Again, we need to clarify when this is not a
		// directory in StorageDriver API.
		return fmt.Errorf("not a file")
	}

	f.truncate()
	f.WriteAt(contents, 0)

	return nil
}
528431
func (s *Lexicon) SetContent(v string) *Lexicon {
	s.Content = &v
	return s
}
48860
func (s *GetExportOutput) SetContentDisposition(v string) *GetExportOutput {
	s.ContentDisposition = &v
	return s
}
1109877
func (s *SendEmailInput) SetContent(v *EmailContent) *SendEmailInput {
	s.Content = v
	return s
}
219277
func (d *driver) GetContent(ctx context.Context, path string) ([]byte, error) {
	reader, err := d.Reader(ctx, path, 0)
	if err != nil {
		return nil, err
	}
	return ioutil.ReadAll(reader)
}