Documentation
¶
Index ¶
- type Agent
- type AgentBackend
- type AgentClient
- func (c *AgentClient) CancelTransfer(transferID, token string) (status int, err error)
- func (c *AgentClient) ExchangeKeys(userID uint, host, port, secret, token string) (status int, err error)
- func (c *AgentClient) GetRemoteUser(userID uint, user *RemoteUser, token string) (status int, err error)
- func (c *AgentClient) GetResource(agent *Agent, url, token string) (response *GetResourceResponse, status int, err error)
- func (c *AgentClient) GetTokenUser(userID uint, user *TokenUser, accessToken, token string) (status int, err error)
- func (c *AgentClient) GetVersion(token string) GetVersionResponse
- func (c *AgentClient) RemoteCopy(archiveName, srcRoot, token string, items []ResourceItem, compress bool) (response *BeforeCopyResponse, status int, err error)
- type BeforeCopyResponse
- type CancelTransferRequest
- type ExchangeKeysResponse
- type GenerateAccessTokenResponse
- type GetRemoteUserResponse
- type GetResourceResponse
- type GetTokenUserResponse
- type GetVersionResponse
- type RemoteResourceAgentRequest
- type RemoteUser
- type ResourceItem
- type Storage
- type StorageBackend
- type Store
- type TokenUser
- type ViewMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct { ID uint `storm:"id,increment" json:"id"` UserID uint `json:"userID"` Host string `json:"host"` Port string `json:"port"` Secret string `json:"secret,omitempty"` RemoteUser RemoteUser `json:"remote_user"` }
Agent describes an agent.
type AgentBackend ¶
type AgentClient ¶
type AgentClient struct {
Agent *Agent
}
func (*AgentClient) CancelTransfer ¶
func (c *AgentClient) CancelTransfer( transferID, token string, ) (status int, err error)
func (*AgentClient) ExchangeKeys ¶
func (c *AgentClient) ExchangeKeys(userID uint, host, port, secret, token string) (status int, err error)
func (*AgentClient) GetRemoteUser ¶
func (c *AgentClient) GetRemoteUser(userID uint, user *RemoteUser, token string) (status int, err error)
func (*AgentClient) GetResource ¶
func (c *AgentClient) GetResource(agent *Agent, url, token string) (response *GetResourceResponse, status int, err error)
func (*AgentClient) GetTokenUser ¶
func (*AgentClient) GetVersion ¶
func (c *AgentClient) GetVersion(token string) GetVersionResponse
func (*AgentClient) RemoteCopy ¶
func (c *AgentClient) RemoteCopy( archiveName, srcRoot, token string, items []ResourceItem, compress bool, ) (response *BeforeCopyResponse, status int, err error)
type BeforeCopyResponse ¶
type CancelTransferRequest ¶
type CancelTransferRequest struct {
TransferID string `json:"transfer_id"`
}
type ExchangeKeysResponse ¶
type GenerateAccessTokenResponse ¶
type GenerateAccessTokenResponse struct { Code uint `json:"code"` Token string `json:"token"` ValidUntil int64 `json:"valid_until"` Error string `json:"error"` }
func GetTemporaryAccessToken ¶
func GetTemporaryAccessToken(token string, userID uint) (response *GenerateAccessTokenResponse, status int, err error)
type GetRemoteUserResponse ¶
type GetResourceResponse ¶
type GetTokenUserResponse ¶
type GetVersionResponse ¶
type RemoteResourceAgentRequest ¶
type RemoteResourceAgentRequest struct { Items []ResourceItem `json:"items"` Compress bool `json:"compress"` SourceRoot string `json:"source_root"` DestinationRoot string `json:"destination_root"` }
type RemoteUser ¶
type ResourceItem ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is an agents storage.
func NewStorage ¶
func NewStorage(back StorageBackend) *Storage
NewStorage creates a users storage from a backend.
func (*Storage) Delete ¶
Delete allows you to delete an agent by its name or username. The provided id must be a string for username lookup or a uint for id lookup. If id is neither, a ErrInvalidDataType will be returned.
func (*Storage) FindByUserID ¶
FindByUserID wraps a StorageBackend.FindByUserID.
func (*Storage) LastUpdate ¶
LastUpdate gets the timestamp for the last update of an user.
type StorageBackend ¶
type StorageBackend interface { Gets() ([]*Agent, error) GetBy(interface{}) (*Agent, error) FindByUserID(id uint) ([]*Agent, error) Save(a *Agent) error Update(a *Agent, fields ...string) error DeleteByID(uint) error }
StorageBackend is the interface to implement for remote agents storage.
Click to show internal directories.
Click to hide internal directories.