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(client_data map[string]interface{}, perm string) util.Gerror
- func (c *Client) Delete() error
- func (c *Client) DocId() string
- func (c *Client) Flatten() []string
- func (c *Client) GenerateKeys() (string, error)
- func (a *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(new_name string) util.Gerror
- func (c *Client) Save() error
- func (c *Client) SetPublicKey(pk interface{}) error
- func (c *Client) ToJson() map[string]interface{}
- func (a *Client) URLType() string
- func (c *Client) UpdateFromJson(json_actor 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{}
Return all clients in a fashion suitable for exporting.
func ValidatePublicKey ¶
Checks that the provided public key is valid. Wrapper around chef_crypto.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
Return all the clients on this server.
func NewFromJson ¶
Build a new client/user from a json object.
func (*Client) CheckPermEdit ¶
A check to see if the client is trying to edit admin and validator attributes.
func (*Client) Delete ¶
Deletes a client, but will refuse to do so if it is the last client that is an adminstrator.
func (*Client) GenerateKeys ¶
Generate 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) IsValidator ¶
Is the client a validator client? If use-auth is false, this always returns false.
func (*Client) Rename ¶
Renames 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 ¶
Set the client's public key.