/usr/share/gocode/src/github.com/go-chef/chef/acl.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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | package chef
import "fmt"
type ACLService struct {
client *Client
}
// ACL represents the native Go version of the deserialized ACL type
type ACL map[string]ACLitems
// ACLitems
type ACLitems struct {
Groups ACLitem `json:"groups"`
Actors ACLitem `json:"actors"`
}
// ACLitem
type ACLitem []string
func NewACL(acltype string, actors, groups ACLitem) (acl *ACL) {
acl = &ACL{
acltype: ACLitems{
Actors: actors,
Groups: groups,
},
}
return
}
// Get gets an ACL from the Chef server.
//
// Chef API docs: lol
func (a *ACLService) Get(subkind string, name string) (acl ACL, err error) {
url := fmt.Sprintf("%s/%s/_acl", subkind, name)
err = a.client.magicRequestDecoder("GET", url, nil, &acl)
return
}
// Put updates an ACL on the Chef server.
//
// Chef API docs: rofl
func (a *ACLService) Put(subkind, name string, acltype string, item *ACL) (err error) {
url := fmt.Sprintf("%s/%s/_acl/%s", subkind, name, acltype)
body, err := JSONReader(item)
if err != nil {
return
}
err = a.client.magicRequestDecoder("PUT", url, body, nil)
return
}
|