Documentation
¶
Index ¶
- 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) 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 Profile
- type ProfileDefaults
- type ProfileEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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) 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 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.