Documentation ¶
Index ¶
- Constants
- func Base64BlockEncode(content []byte, limit int) []string
- func CheckResponse(r *http.Response) error
- func GenerateSignature(priv *rsa.PrivateKey, data string) (enc []byte, err error)
- func HashStr(toHash string) string
- func PrivateKeyFromString(key []byte) (*rsa.PrivateKey, error)
- type AuthConfig
- type Body
- type Client
- type Config
- type ErrorResponse
- Bugs
Constants ¶
const ChefVersion = "11.12.0"
ChefVersion that we pretend to emulate
Variables ¶
This section is empty.
Functions ¶
func Base64BlockEncode ¶
Base64BlockEncode takes a byte slice and breaks it up into a slice of base64 encoded strings
func CheckResponse ¶
CheckResponse receives a pointer to a http.Response and generates an Error via unmarshalling
func GenerateSignature ¶
func GenerateSignature(priv *rsa.PrivateKey, data string) (enc []byte, err error)
GenerateSignature will generate a signature ( sign ) the given data
func PrivateKeyFromString ¶
func PrivateKeyFromString(key []byte) (*rsa.PrivateKey, error)
PrivateKeyFromString parses an RSA private key from a string
Types ¶
type AuthConfig ¶
type AuthConfig struct { PrivateKey *rsa.PrivateKey ClientName string }
AuthConfig representing a client and a private key used for encryption
This is embedded in the Client type
func (AuthConfig) SignRequest ¶
func (ac AuthConfig) SignRequest(request *http.Request) error
SignRequest modifies headers of an http.Request
type Body ¶
Body wraps io.Reader and adds methods for calculating hashes and detecting content
func (*Body) Buffer ¶
Buffer creates a byte.Buffer copy from a io.Reader resets read on reader to 0,0
func (*Body) ContentType ¶
ContentType returns the content-type string of Body as detected by http.DetectContentType()
type Client ¶
type Client struct { Auth *AuthConfig BaseURL *url.URL // contains filtered or unexported fields }
Client is vessel for public methods used against the chef-server
func NewClient ¶
NewClient is the client generator used to instantiate a client for talking to a chef-server It is a simple constructor for the Client struct intended as a easy interface for issuing signed requests
type Config ¶
type Config struct { // This should be the user ID on the chef server Name string // This is the plain text private Key for the user Key string // BaseURL is the chef server URL used to connect too. Is using orgs you should include your org in the url BaseURL string // When set to false (default) this will enable SSL Cert Verification. If you need to disable Cert Verification set to true SkipSSL bool // Time to wait in seconds before giving up on a request to the server Timeout time.Duration }
Config contains the configuration options for a chef client. This is Used primarily in the NewClient() constructor in order to setup a proper client object
type ErrorResponse ¶
An ErrorResponse reports one or more errors caused by an API request. Thanks to https://github.com/google/go-github
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
Notes ¶
Bugs ¶
tightly coupled