mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-24 07:50:40 -04:00
Document exported funcs,types,interfaces and enable check. (#475)
* Include EXC0014 and fix issues. * Include EXC0012 and fix issues. Signed-off-by: Fabian Kammel <fk@edgeless.systems> Co-authored-by: Otto Bittner <cobittner@posteo.net>
This commit is contained in:
parent
c9873f2bfb
commit
0d12e37c96
74 changed files with 337 additions and 78 deletions
|
@ -8,6 +8,7 @@ package debugd
|
|||
|
||||
import "time"
|
||||
|
||||
// Debugd internal constants.
|
||||
const (
|
||||
DebugdMetadataFlag = "constellation-debugd"
|
||||
GRPCTimeout = 5 * time.Minute
|
||||
|
|
|
@ -21,14 +21,21 @@ const (
|
|||
systemdUnitFolder = "/run/systemd/system"
|
||||
)
|
||||
|
||||
// SystemdAction encodes the available actions.
|
||||
//
|
||||
//go:generate stringer -type=SystemdAction
|
||||
type SystemdAction uint32
|
||||
|
||||
const (
|
||||
// Unknown is the default SystemdAction and does nothing.
|
||||
Unknown SystemdAction = iota
|
||||
// Start a systemd service.
|
||||
Start
|
||||
// Stop a systemd service.
|
||||
Stop
|
||||
// Restart a systemd service.
|
||||
Restart
|
||||
// Reload a systemd service.
|
||||
Reload
|
||||
)
|
||||
|
||||
|
|
|
@ -30,12 +30,14 @@ type Fetcher struct {
|
|||
metaAPI providerMetadata
|
||||
}
|
||||
|
||||
// New creates a new Fetcher.
|
||||
func New(cloud providerMetadata) *Fetcher {
|
||||
return &Fetcher{
|
||||
metaAPI: cloud,
|
||||
}
|
||||
}
|
||||
|
||||
// Role returns node role via meta data API.
|
||||
func (f *Fetcher) Role(ctx context.Context) (role.Role, error) {
|
||||
self, err := f.metaAPI.Self(ctx)
|
||||
if err != nil {
|
||||
|
@ -71,6 +73,7 @@ func (f *Fetcher) DiscoverDebugdIPs(ctx context.Context) ([]string, error) {
|
|||
return ips, nil
|
||||
}
|
||||
|
||||
// DiscoverLoadbalancerIP gets load balancer IP from metadata API.
|
||||
func (f *Fetcher) DiscoverLoadbalancerIP(ctx context.Context) (string, error) {
|
||||
lbEndpoint, err := f.metaAPI.GetLoadBalancerEndpoint(ctx)
|
||||
if err != nil {
|
||||
|
|
|
@ -16,22 +16,22 @@ import (
|
|||
// Fetcher implements metadata.Fetcher interface but does not actually fetch cloud provider metadata.
|
||||
type Fetcher struct{}
|
||||
|
||||
// Role for fallback fetcher does not try to fetch role.
|
||||
func (f Fetcher) Role(_ context.Context) (role.Role, error) {
|
||||
// Fallback fetcher does not try to fetch role
|
||||
return role.Unknown, nil
|
||||
}
|
||||
|
||||
// DiscoverDebugdIPs for fallback fetcher does not try to discover debugd IPs.
|
||||
func (f Fetcher) DiscoverDebugdIPs(ctx context.Context) ([]string, error) {
|
||||
// Fallback fetcher does not try to discover debugd IPs
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// DiscoverLoadbalancerIP for fallback fetcher does not try to discover loadbalancer IP.
|
||||
func (f Fetcher) DiscoverLoadbalancerIP(ctx context.Context) (string, error) {
|
||||
// Fallback fetcher does not try to discover loadbalancer IP
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// FetchSSHKeys for fallback fetcher does not try to fetch ssh keys.
|
||||
func (f Fetcher) FetchSSHKeys(ctx context.Context) ([]ssh.UserKey, error) {
|
||||
// Fallback fetcher does not try to fetch ssh keys
|
||||
return nil, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue