Documentation
¶
Index ¶
- Variables
- type CogClient
- func (c *CogClient) Authenticate() (rest.Token, error)
- func (c *CogClient) Authenticated() (bool, error)
- func (c *CogClient) Bootstrap(user rest.User) (rest.User, error)
- func (c *CogClient) BundleDisable(bundlename string, version string) error
- func (c *CogClient) BundleEnable(bundlename string, version string) error
- func (c *CogClient) BundleExists(bundlename string, version string) (bool, error)
- func (c *CogClient) BundleGet(bundlename string, version string) (data.Bundle, error)
- func (c *CogClient) BundleInstall(bundle data.Bundle) error
- func (c *CogClient) BundleList() ([]data.Bundle, error)
- func (c *CogClient) BundleListVersions(bundlename string) ([]data.Bundle, error)
- func (c *CogClient) BundleUninstall(bundlename string, version string) error
- func (c *CogClient) GroupDelete(groupname string) error
- func (c *CogClient) GroupExists(groupname string) (bool, error)
- func (c *CogClient) GroupGet(groupname string) (rest.Group, error)
- func (c *CogClient) GroupList() ([]rest.Group, error)
- func (c *CogClient) GroupMemberAdd(groupname string, username string) error
- func (c *CogClient) GroupMemberDelete(groupname string, username string) error
- func (c *CogClient) GroupMemberList(groupname string) ([]rest.User, error)
- func (c *CogClient) GroupSave(group rest.Group) error
- func (c *CogClient) Token() (rest.Token, error)
- func (c *CogClient) UserDelete(username string) error
- func (c *CogClient) UserExists(username string) (bool, error)
- func (c *CogClient) UserGet(username string) (rest.User, error)
- func (c *CogClient) UserGroupList(username string) ([]rest.Group, error)
- func (c *CogClient) UserList() ([]rest.User, error)
- func (c *CogClient) UserSave(user rest.User) error
- type Error
- type Profile
- type ProfileDefaults
- type ProfileEntry
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBadProfile indicates an invalid or missing client profile. ErrBadProfile = errors.New("invalid or missing client profile") // ErrBadRequest indicates that a request could not be constructed. ErrBadRequest = errors.New("request could not be constructed") // ErrConnectionFailed is a failure for a client to connect to the Cog service. ErrConnectionFailed = errors.New("failure to connect to the Cog service") // ErrResourceExists is returned if a client tries to put a resource that // already exists. ErrResourceExists = errors.New("resource already exists") // ErrResourceNotFound is returned if a client tries to get or update a // resource that doesn't exist. ErrResourceNotFound = errors.New("resource doesn't exist") // ErrResponseReadFailure indicates an error in reading a server response. ErrResponseReadFailure = errors.New("error reading a server response") // ErrURLFormat indicates badly formatted URL. ErrURLFormat = errors.New("invalid URL format") )
Functions ¶
This section is empty.
Types ¶
type CogClient ¶
type CogClient struct {
// contains filtered or unexported fields
}
CogClient comments to be written...
func Connect ¶
Connect creates and returns a configured instance of the client for the specified host. An empty string will use the default profile. If the requested profile doesn't exist, an empty ProfileEntry is returned.
func ConnectWithNewProfile ¶
func ConnectWithNewProfile(entry ProfileEntry) (*CogClient, error)
ConnectWithNewProfile generates a connection using the supplied profile entry data.
func (*CogClient) Authenticate ¶
Authenticate requests a new authentication token from the Cog service. If a valid token already exists it will be automatically invalidated if this call is successful.
func (*CogClient) Authenticated ¶
Authenticated looks for any cached tokens associated with the current server. Returns false if no tokens exist or tokens are expired.
func (*CogClient) BundleDisable ¶
BundleDisable comments to be written...
func (*CogClient) BundleEnable ¶
BundleEnable comments to be written...
func (*CogClient) BundleExists ¶
BundleExists simply returns true if a bundle exists with the specified bundlename; false otherwise.
func (*CogClient) BundleInstall ¶
BundleInstall comments to be written...
func (*CogClient) BundleList ¶
BundleList comments to be written...
func (*CogClient) BundleListVersions ¶
BundleListVersions comments to be written...
func (*CogClient) BundleUninstall ¶
BundleUninstall comments to be written...
func (*CogClient) GroupDelete ¶
GroupDelete comments to be written...
func (*CogClient) GroupExists ¶
GroupExists simply returns true if a group exists with the specified groupname; false otherwise.
func (*CogClient) GroupMemberAdd ¶
GroupMemberAdd comments to be written...
func (*CogClient) GroupMemberDelete ¶
GroupMemberDelete comments to be written...
func (*CogClient) GroupMemberList ¶
GroupMemberList comments to be written...
func (*CogClient) Token ¶
Token is just a wrapper around a call to Authenticated() followed by a call to Authenticate() if false.
func (*CogClient) UserDelete ¶
UserDelete comments to be written...
func (*CogClient) UserExists ¶
UserExists simply returns true if a user exists with the specified username; false otherwise.
func (*CogClient) UserGroupList ¶
UserGroupList comments to be written...
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is an error implementation that represents either a a non-2XX response from the server, or a failure to connect to the server (in which case Status() will return 0).
func (Error) Profile ¶
func (c Error) Profile() ProfileEntry
Profile returns the active profile entry for the client that returned this error.
type Profile ¶
type Profile struct {
Defaults ProfileDefaults
Profiles map[string]ProfileEntry `yaml:",inline"`
}
Profile represents a set of user profiles from a $HOME/.cog/profiles file
func (Profile) Default ¶
func (p Profile) Default() ProfileEntry
Default returns this Profile's default entry. If there's no default, or if the default doesn't exist, an empty ProfileEntry is returned.
type ProfileDefaults ¶
type ProfileDefaults struct {
Profile string
}
ProfileDefaults is used to store default values for a cog client profile.
type ProfileEntry ¶
type ProfileEntry struct {
Name string `yaml:"-"`
URLString string `yaml:"url"`
Password string `yaml:"password"`
URL *url.URL `yaml:"-"`
Username string `yaml:"user"`
}
ProfileEntry represents a single profile entry.
func (ProfileEntry) User ¶
func (pe ProfileEntry) User() rest.User
User is a convenience method that returns a rest.User pre-set with the entry's username and password.