// Show the content of a secret file
321362
func (s *Action) Show(ctx context.Context, c *cli.Context) error {
	name := c.Args().First()
	key := c.Args().Get(1)

	ctx = s.Store.WithConfig(ctx, name)
	ctx = WithClip(ctx, c.Bool("clip"))
	ctx = WithForce(ctx, c.Bool("force"))
	ctx = WithPrintQR(ctx, c.Bool("qr"))
	ctx = WithPasswordOnly(ctx, c.Bool("password"))
	ctx = WithRevision(ctx, c.String("revision"))

	if c.Bool("sync") {
		if err := s.sync(out.WithHidden(ctx, true), c, s.Store.MountPoint(name)); err != nil {
			out.Error(ctx, "Failed to sync %s: %s", name, err)
		}
	}

	if err := s.show(ctx, c, name, key, true); err != nil {
		return ExitError(ctx, ExitDecrypt, err, "%s", err)
	}
	return nil
}
463684
func (api *Client) ShareFilePublicURLContext(ctx context.Context, fileID string) (*File, []Comment, *Paging, error) {
	values := url.Values{
		"token": {api.token},
		"file":  {fileID},
	}

	response, err := api.fileRequest(ctx, "files.sharedPublicURL", values)
	if err != nil {
		return nil, nil, nil, err
	}
	return &response.File, response.Comments, &response.Paging, nil
}
975430
func ParseFile(path string) (config Config, err error) {
	var file *os.File
	file, err = os.Open(path) //nolint:gosec
	if err != nil {
		return
	}
	defer file.Close() // nolint: errcheck
	return Parse(file)
}
861280
func (c *clusterClient) SecretGet(secretID string) (interface{}, error) {
	var secResp interface{}
	path := clusterPath + secretPath
	request := c.c.Get().Resource(path)
	request.QueryOption(secrets.SecretKey, secretID)
	if err := request.Do().Unmarshal(&secResp); err != nil {
		return secResp, err
	}
	return secResp, nil
}
243387
func (c *CommitFile) GetContentsURL() string {
	if c == nil || c.ContentsURL == nil {
		return ""
	}
	return *c.ContentsURL
}
762864
func (s *Secret) String() string {
	var buf strings.Builder
	if sv, ok := s.d[passwordKey].(string); ok {
		_, _ = buf.WriteString(sv)
	}
	keys := make([]string, 0, len(s.d))
	for k := range s.d {
		keys = append(keys, k)
	}
	sort.Strings(keys)
	for _, key := range keys {
		value := s.d[key]
		if key == passwordKey {
			continue
		}
		_, _ = buf.WriteString(key)
		_, _ = buf.WriteString(": ")
		if sv, ok := value.(string); ok {
			_, _ = buf.WriteString(sv)
		}
		_, _ = buf.WriteString("\n")
	}
	return buf.String()
}
972455
func (s *SecretService) loadSecrets(ctx context.Context, orgID platform.ID) (map[string]string, int, error) {
	// TODO(desa): update url construction
	sec, err := s.Client.Logical().Read(fmt.Sprintf("/secret/data/%s", orgID))
	if err != nil {
		return nil, -1, err
	}

	m := map[string]string{}
	if sec == nil {
		return m, 0, nil
	}

	data, ok := sec.Data["data"].(map[string]interface{})
	if !ok {
		return nil, -1, fmt.Errorf("value found in secret data is not map[string]interface{}")
	}

	for k, v := range data {
		val, ok := v.(string)
		if !ok {
			continue
		}
		m[k] = val
	}

	metadata, ok := sec.Data["metadata"].(map[string]interface{})
	if !ok {
		return nil, -1, fmt.Errorf("value found in secret metadata is not map[string]interface{}")
	}

	var version int
	switch v := metadata["version"].(type) {
	case json.Number:
		ver, err := v.Int64()
		if err != nil {
			return nil, -1, err
		}
		version = int(ver)
	case string:
		ver, err := strconv.Atoi(v)
		if err != nil {
			return nil, -1, fmt.Errorf("version provided is not a valid integer: %v", err)
		}
		version = ver
	case int:
		version = v
	default:
		return nil, -1, fmt.Errorf("version provided is %T not a string or int", v)
	}

	return m, version, nil
}
832979
func (i *InstallationPermissions) GetContents() string {
	if i == nil || i.Contents == nil {
		return ""
	}
	return *i.Contents
}
99015
func (b *Blob) GetContent() string {
	if b == nil || b.Content == nil {
		return ""
	}
	return *b.Content
}
261855
func (s *Secret) String() string {
	var buf strings.Builder
	_, _ = buf.WriteString(s.password)

	if s.body != "" {
		_, _ = buf.WriteString("\n")
		_, _ = buf.WriteString(s.body)
	}

	return buf.String()
}
977620
func (b *Backend) Secret(k string) *Secret {
	for _, s := range b.Secrets {
		if s.Type == k {
			return s
		}
	}

	return nil
}
9099
func (c *imageStreams) Secrets(imageStreamName string, options v1.GetOptions) (result *corev1.SecretList, err error) {
	result = &corev1.SecretList{}
	err = c.client.Get().
		Namespace(c.ns).
		Resource("imagestreams").
		Name(imageStreamName).
		SubResource("secrets").
		VersionedParams(&options, scheme.ParameterCodec).
		Do().
		Into(result)
	return
}
834261
func (c *Client) GetContentSummary(name string) (*ContentSummary, error) {
	cs, err := c.getContentSummary(name)
	if err != nil {
		err = &os.PathError{"content summary", name, interpretException(err)}
	}

	return cs, err
}
920850
func isHidden(path string) bool {
	p, e := syscall.UTF16PtrFromString(path)
	if e != nil {
		return false
	}
	attrs, e := syscall.GetFileAttributes(p)
	if e != nil {
		return false
	}
	return attrs&syscall.FILE_ATTRIBUTE_HIDDEN != 0
}
1294065
func parseContent(c *clientContent) contentMessage {
	content := contentMessage{}
	content.Time = c.Time.Local()

	// guess file type.
	content.Filetype = func() string {
		if c.Type.IsDir() {
			return "folder"
		}
		return "file"
	}()

	content.Size = c.Size
	md5sum := strings.TrimPrefix(c.ETag, "\"")
	md5sum = strings.TrimSuffix(md5sum, "\"")
	content.ETag = md5sum
	// Convert OS Type to match console file printing style.
	content.Key = getKey(c)
	return content
}
959143
func (f *File) Contents() (content string, err error) {
	reader, err := f.Reader()
	if err != nil {
		return "", err
	}
	defer ioutil.CheckClose(reader, &err)

	buf := new(bytes.Buffer)
	if _, err := buf.ReadFrom(reader); err != nil {
		return "", err
	}

	return buf.String(), nil
}
441055
func (k *Key) Secret() string {
	q := k.url.Query()

	return q.Get("secret")
}