github.com/kubernetes-incubator/kube-aws@v0.16.4/credential/plaintext_file.go (about)

     1  package credential
     2  
     3  import (
     4  	"fmt"
     5  	"io/ioutil"
     6  )
     7  
     8  func (c *PlaintextFile) Fingerprint() string {
     9  	return calculateFingerprint(c.content)
    10  }
    11  
    12  func (c *PlaintextFile) Persist() error {
    13  	if len(c.content) == 0 {
    14  		return fmt.Errorf("%s is going to be empty. Maybe a bug", c.filePath)
    15  	}
    16  	if err := ioutil.WriteFile(c.filePath, c.content, 0600); err != nil {
    17  		return err
    18  	}
    19  	return nil
    20  }
    21  
    22  func (c *PlaintextFile) String() string {
    23  	return string(c.content)
    24  }
    25  
    26  func (c *PlaintextFile) Bytes() []byte {
    27  	return c.content
    28  }