Documentation
¶
Overview ¶
Package cloudaccess serves the calls Dagu Cloud carries to this server over a relay connection the server opens, within the role the server's administrator allows.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrConfigured means configuration fixes the setting. ErrConfigured = errors.New("configuration sets this, so it cannot be changed here") // ErrUnknownLevel means a level other than off, viewer, operator, or // developer. ErrUnknownLevel = errors.New("unknown remote access level") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Credentials returns the server's Dagu Cloud credentials, and false
// while it is not connected.
Credentials func() (license.CloudCredentials, bool)
Settings *Settings
// Key verifies the assertions Dagu Cloud signs for calls.
Key ed25519.PublicKey
// HTTPClient reaches Dagu Cloud; nil means a client with a 30-second
// timeout.
HTTPClient *http.Client
// Hello introduces the server to the relay; the service names its
// process.
Hello cloudrelay.Hello
}
Config is what the service works with.
type Service ¶
type Service struct {
*Settings
// contains filtered or unexported fields
}
Service holds this process's relay connection for calls from Dagu Cloud while the server is connected to Dagu Cloud and remote access is on, as its Settings decide.
type Settings ¶
type Settings struct {
// contains filtered or unexported fields
}
Settings decides how far calls from Dagu Cloud may go on this server: as configuration fixes, or else as an administrator chooses. Remote access stays off and approvals stay refused until either says otherwise.
func NewSettings ¶
func NewSettings(cloud config.CloudConfig, store StateStore) *Settings
NewSettings returns the remote access settings of a server: those cloud configures, and the choices store keeps for the rest.
func (*Settings) Set ¶
Set chooses the highest role calls get, whether they may decide steps waiting for a person, or both, in one change; nil leaves either as it is. It fails, changing nothing, with ErrConfigured when configuration fixes a setting it was given, and with ErrUnknownLevel for an unknown level.
type State ¶
type State struct {
// Connected means calls from Dagu Cloud reach this process.
Connected bool
// Error says why the last connection failed or was refused.
Error string
}
State is how this process's connection for calls stands.
type StateStore ¶
type StateStore interface {
Load(ctx context.Context) (data []byte, found bool, err error)
Save(ctx context.Context, data []byte) error
}
StateStore keeps the choices an administrator made.
type Status ¶
type Status struct {
// Level is the highest role a call gets.
Level config.RemoteAccessLevel
// LevelConfigured means configuration fixes Level.
LevelConfigured bool
// Approvals lets calls decide steps waiting for a person.
Approvals bool
// ApprovalsConfigured means configuration fixes Approvals.
ApprovalsConfigured bool
}
Status is how far calls from Dagu Cloud may go, and how it was decided.