Documentation ¶
Overview ¶
Package client defines the Chef clients. Formerly clients and users were the same kind of object and stored together, but they have now been split apart. They do both implement the Actor interface, though. Clients are the more usual case for the nodes interacting with the server, but users are used for the webui and often for general user (as opposed to node) interactions with the server.
Index ¶
- func ExportAllClients() []interface{}
- func GetList() []string
- func ValidatePublicKey(publicKey interface{}) (bool, util.Gerror)
- type Client
- func (c *Client) CheckPermEdit(clientData map[string]interface{}, perm string) util.Gerror
- func (c *Client) Delete() error
- func (c *Client) DocID() string
- func (c *Client) Flatten() map[string]interface{}
- func (c *Client) GenerateKeys() (string, error)
- func (c *Client) GetName() string
- func (c *Client) GobDecode(b []byte) error
- func (c *Client) GobEncode() ([]byte, error)
- func (c *Client) Index() string
- func (c *Client) IsAdmin() bool
- func (c *Client) IsClient() bool
- func (c *Client) IsSelf(other interface{}) bool
- func (c *Client) IsUser() bool
- func (c *Client) IsValidator() bool
- func (c *Client) PublicKey() string
- func (c *Client) Rename(newName string) util.Gerror
- func (c *Client) Save() util.Gerror
- func (c *Client) SetPublicKey(pk interface{}) error
- func (c *Client) ToJSON() map[string]interface{}
- func (c *Client) URLType() string
- func (c *Client) UpdateFromJSON(jsonActor map[string]interface{}) util.Gerror
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExportAllClients ¶ added in v0.5.2
func ExportAllClients() []interface{}
ExportAllClients returns all clients in a fashion suitable for exporting.
func ValidatePublicKey ¶
ValidatePublicKey checks that the provided public key is valid. Wrapper around chefcrypto.ValidatePublicKey(), but with a different error type.
Types ¶
type Client ¶
type Client struct { Name string `json:"name"` NodeName string `json:"node_name"` JSONClass string `json:"json_class"` ChefType string `json:"chef_type"` Validator bool `json:"validator"` Orgname string `json:"orgname"` Admin bool `json:"admin"` Certificate string `json:"certificate"` // contains filtered or unexported fields }
A Client and a user are very similar, with some small differences - users can never be validators, while clients don't have passwords. Generally nodes and the like will be clients, while people interacting with the goiardi server will be users.
func AllClients ¶ added in v0.5.2
func AllClients() []*Client
AllClients returns a slice of all the clients on this server.
func NewFromJSON ¶ added in v0.6.0
NewFromJSON builds a new client/user from a json object.
func (*Client) CheckPermEdit ¶
CheckPermEdit checks to see if the client is trying to edit admin and validator attributes, and if it has permissions to do so.
func (*Client) Delete ¶
Delete a client, but will refuse to do so if it is the last client that is an adminstrator.
func (*Client) GenerateKeys ¶
GenerateKeys makes a new set of RSA keys for the client. The new private key is saved with the client, the public key is given to the client and not saved on the server at all.
func (*Client) Index ¶
Index tells the indexer which collection of objects to place the client into.
func (*Client) IsAdmin ¶
IsAdmin returns true if the client is an admin. If use-auth is false, this always returns true.
func (*Client) IsValidator ¶
IsValidator returns true if the client is a validator client. If use-auth is false, this always returns false.
func (*Client) Rename ¶
Rename the client. Save() must be called after this method is used. Will not rename the last admin.
func (*Client) Save ¶
Save the client. If a user with the same name as the client exists, returns an error. Additionally, if running with MySQL it will return any DB error.
func (*Client) SetPublicKey ¶
SetPublicKey sets the client's public key.
func (*Client) ToJSON ¶ added in v0.6.0
ToJSON converts the client object into a JSON object, massaging it as needed to make chef-pedant happy.