/usr/share/gocode/src/github.com/go-chef/chef/principal.go is in golang-github-go-chef-chef-dev 0.0.1+git20161023.60.deb8c38-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | package chef
import "fmt"
type PrincipalService struct {
client *Client
}
// Principal represents the native Go version of the deserialized Principal type
type Principal struct {
Name string `json:"name"`
Type string `json:"type"`
PublicKey string `json:"public_key"`
AuthzId string `json:"authz_id"`
OrgMember bool `json:"org_member"`
}
func NewPrincipal(name, typ, publicKey string) Principal {
return Principal{
Name: name,
Type: typ,
PublicKey: publicKey,
}
}
// Get gets a principal from the Chef server.
//
// Chef API docs: https://docs.chef.io/api_chef_server.html#id64
func (e *PrincipalService) Get(name string) (principal Principal, err error) {
url := fmt.Sprintf("principals/%s", name)
err = e.client.magicRequestDecoder("GET", url, nil, &principal)
return
}
|