mirror of https://github.com/hashicorp/terraform
vendor: update go-chef, fixes #8382
parent
d32487c335
commit
36b4b1acb2
@ -1,25 +0,0 @@
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
coverage
|
||||
coverage.*
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
@ -0,0 +1,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
|
||||
}
|
||||
Loading…
Reference in new issue