Skip to content

Commit

Permalink
Remove yaml tags from struct and api.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
cvaroqui committed Sep 15, 2023
1 parent 05c127d commit 3993f49
Show file tree
Hide file tree
Showing 63 changed files with 608 additions and 654 deletions.
12 changes: 6 additions & 6 deletions core/actionrouter/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ type (

// Result is a predictible type of actions return value, for reflect.
Result struct {
Nodename string `json:"nodename" yaml:"nodename"`
Path path.T `json:"path,omitempty" yaml:"path,omitempty`
Data interface{} `json:"data" yaml:"data"`
Error error `json:"error,omitempty" yaml:"error,omitempty"`
Panic interface{} `json:"panic,omitempty" yaml:"panic,omitempty"`
HumanRenderer func() string `json:"-" yaml:"-"`
Nodename string `json:"nodename"`
Path path.T `json:"path,omitempty"`
Data interface{} `json:"data"`
Error error `json:"error,omitempty"`
Panic interface{} `json:"panic,omitempty"`
HumanRenderer func() string `json:"-"`
}

// renderer is implemented by data type stored in ActionResults.Data.
Expand Down
12 changes: 6 additions & 6 deletions core/check/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ type (

// Result is the structure eventually collected for aggregation.
Result struct {
DriverGroup string `json:"type" yaml:"type"`
DriverName string `json:"driver" yaml:"driver"`
Path string `json:"path" yaml:"path"`
Instance string `json:"instance" yaml:"instance"`
Unit string `json:"unit" yaml:"unit"`
Value int64 `json:"value" yaml:"value"`
DriverGroup string `json:"type"`
DriverName string `json:"driver"`
Path string `json:"path"`
Instance string `json:"instance"`
Unit string `json:"unit"`
Value int64 `json:"value"`
}

header interface {
Expand Down
10 changes: 5 additions & 5 deletions core/client/request/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
type (
// T is a api request abstracting the protocol differences
T struct {
Method string `json:"method,omitempty" yaml:"method,omitempty"`
Action string `json:"action,omitempty" yaml:"action,omitempty"`
Node string `json:"node,omitempty" yaml:"node,omitempty"`
Options map[string]interface{} `json:"options,omitempty" yaml:"options,omitempty"`
Values url.Values `json:"query_args,omitempty" yaml:"query_args,omitempty"`
Method string `json:"method,omitempty"`
Action string `json:"action,omitempty"`
Node string `json:"node,omitempty"`
Options map[string]interface{} `json:"options,omitempty"`
Values url.Values `json:"query_args,omitempty"`
}
)

Expand Down
6 changes: 3 additions & 3 deletions core/client/requester/h2/h2.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ type (
Certificate string
Key string
Username string
Password string `json:"-" yaml:"-"`
URL string `json:"url" yaml:"url"`
Bearer string `json:"-" yaml:"-"`
Password string `json:"-"`
URL string `json:"url"`
Bearer string `json:"-"`
Timeout time.Duration
InsecureSkipVerify bool
RootCA string
Expand Down
28 changes: 14 additions & 14 deletions core/clientcontext/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,38 @@ type (
// It contains the credentials and endpoint information to connect to
// remote clusters.
config struct {
Contexts map[string]relation `json:"contexts" yaml:"contexts"`
Clusters map[string]cluster `json:"clusters" yaml:"clusters"`
Users map[string]user `json:"users" yaml:"users"`
Contexts map[string]relation `json:"contexts"`
Clusters map[string]cluster `json:"clusters"`
Users map[string]user `json:"users"`
}

// T is a dereferenced Cluster-User relation.
T struct {
Cluster cluster `json:"cluster" yaml:"cluster"`
User user `json:"user" yaml:"user"`
Namespace string `json:"namespace" yaml:"namespace"`
Cluster cluster `json:"cluster"`
User user `json:"user"`
Namespace string `json:"namespace"`
}

// relation is a Cluster-User relation.
relation struct {
ClusterRefName string `json:"cluster" yaml:"cluster"`
UserRefName string `json:"user" yaml:"user"`
Namespace string `json:"namespace" yaml:"namespace"`
ClusterRefName string `json:"cluster"`
UserRefName string `json:"user"`
Namespace string `json:"namespace"`
}

// cluster host the endpoint address or name, and the certificate authority
// to trust.
cluster struct {
CertificateAuthority string `json:"certificate_authority,omitempty" yaml:"certificate_authority,omitempty"`
Server string `json:"server" yaml:"server"`
InsecureSkipVerify bool `json:"insecure" yaml:"insecure"`
CertificateAuthority string `json:"certificate_authority,omitempty"`
Server string `json:"server"`
InsecureSkipVerify bool `json:"insecure"`
}

// user hosts the certificate and private to use to connect to the remote
// cluster.
user struct {
ClientCertificate string `json:"client_certificate" yaml:"client_certificate"`
ClientKey string `json:"client_key" yaml:"client_key"`
ClientCertificate string `json:"client_certificate"`
ClientKey string `json:"client_key"`
}
)

Expand Down
42 changes: 21 additions & 21 deletions core/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,47 @@ import (
type (
// Data describes the full Cluster state.
Data struct {
Cluster Cluster `json:"cluster" yaml:"cluster"`
Daemon Deamon `json:"daemon" yaml:"daemon"`
Cluster Cluster `json:"cluster"`
Daemon Deamon `json:"daemon"`
}

Cluster struct {
Config Config `json:"config" yaml:"config"`
Status Status `json:"status" yaml:"status"`
Object map[string]object.Status `json:"object" yaml:"object"`
Config Config `json:"config"`
Status Status `json:"status"`
Object map[string]object.Status `json:"object"`

Node map[string]node.Node `json:"node" yaml:"node"`
Node map[string]node.Node `json:"node"`
}

Status struct {
IsCompat bool `json:"is_compat" yaml:"is_compat"`
IsFrozen bool `json:"is_frozen" yaml:"is_frozen"`
IsCompat bool `json:"is_compat"`
IsFrozen bool `json:"is_frozen"`
}

Deamon struct {
Collector DaemonCollector `json:"collector" yaml:"collector"`
DNS DaemonDNS `json:"dns" yaml:"dns"`
Hb DaemonHb `json:"hb" yaml:"hb"`
Listener DaemonListener `json:"listener" yaml:"listener"`
Monitor DaemonMonitor `json:"monitor" yaml:"monitor"`
Nodename string `json:"nodename" yaml:"nodename"`
Routines int `json:"routines" yaml:"routines"`
Scheduler DaemonScheduler `json:"scheduler" yaml:"scheduler"`
Collector DaemonCollector `json:"collector"`
DNS DaemonDNS `json:"dns"`
Hb DaemonHb `json:"hb"`
Listener DaemonListener `json:"listener"`
Monitor DaemonMonitor `json:"monitor"`
Nodename string `json:"nodename"`
Routines int `json:"routines"`
Scheduler DaemonScheduler `json:"scheduler"`
}

DaemonHb struct {
Streams []HeartbeatStream `json:"streams" yaml:"streams"`
LastMessages []HbLastMessage `json:"last_messages" yaml:"last_messages"`
Streams []HeartbeatStream `json:"streams"`
LastMessages []HbLastMessage `json:"last_messages"`
}

HbLastMessage struct {
From string `json:"from" yaml:"from"`
From string `json:"from"`

// PatchLength is the type of hb message except when Type is patch where it is the patch queue length
PatchLength int `json:"patch_length" yaml:"patch_length"`
PatchLength int `json:"patch_length"`

// Type is the hb message type (unset/ping/full/patch)
Type string `json:"type" yaml:"type"`
Type string `json:"type"`
}
)

Expand Down
26 changes: 13 additions & 13 deletions core/cluster/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ type (
// The cluster name is used as the right most part of cluster dns
// names.
Config struct {
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"`
Nodes Nodes `json:"nodes" yaml:"nodes"`
DNS []string `json:"dns" yaml:"dns"`
CASecPaths []string `json:"ca_sec_paths" yaml:"ca_sec_path"`
Listener ConfigListener `json:"listener" yaml:"listener"`
Quorum bool `json:"quorum" yaml:"quorum"`
ID string `json:"id"`
Name string `json:"name"`
Nodes Nodes `json:"nodes"`
DNS []string `json:"dns"`
CASecPaths []string `json:"ca_sec_paths"`
Listener ConfigListener `json:"listener"`
Quorum bool `json:"quorum"`

// fields private, no exposed in daemon data
// json nor events
secret string
}
ConfigListener struct {
CRL string `json:"crl" yaml:"crl"`
Addr string `json:"addr" yaml:"addr"`
Port int `json:"port" yaml:"port"`
OpenIdWellKnown string `json:"openid_well_known" yaml:"openid_well_known"`
DNSSockGID string `json:"dns_sock_gid" yaml:"dns_sock_gid"`
DNSSockUID string `json:"dns_sock_uid" yaml:"dns_sock_uid"`
CRL string `json:"crl"`
Addr string `json:"addr"`
Port int `json:"port"`
OpenIdWellKnown string `json:"openid_well_known"`
DNSSockGID string `json:"dns_sock_gid"`
DNSSockUID string `json:"dns_sock_uid"`
}
)

Expand Down
28 changes: 14 additions & 14 deletions core/cluster/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,50 @@ type (
// was last configured, when it was created, its current state and its
// id.
DaemonSubsystemStatus struct {
Id string `json:"id" yaml:"id"`
ConfiguredAt time.Time `json:"configured_at" yaml:"configured_at"`
CreatedAt time.Time `json:"created_at" yaml:"created_at"`
State string `json:"state" yaml:"state"`
Alerts []ThreadAlert `json:"alerts,omitempty" yaml:"alerts,omitempty"`
Id string `json:"id"`
ConfiguredAt time.Time `json:"configured_at"`
CreatedAt time.Time `json:"created_at"`
State string `json:"state"`
Alerts []ThreadAlert `json:"alerts,omitempty"`
}

// ThreadAlert describes a message with a severity. Embedded in DaemonSubsystemStatus
ThreadAlert struct {
Message string `json:"message" yaml:"message"`
Severity string `json:"severity" yaml:"severity"`
Message string `json:"message"`
Severity string `json:"severity"`
}

// DaemonCollector describes the OpenSVC daemon collector thread,
// which is responsible for communicating with the collector on behalf
// of the cluster. Only one node runs a collector thread.
DaemonCollector struct {
DaemonSubsystemStatus `yaml:",inline"`
DaemonSubsystemStatus
}

// DaemonDNS describes the OpenSVC daemon dns thread, which is
// responsible for janitoring and serving the cluster DNS zone. This
// zone is dynamically populated by ip address allocated for the
// services (frontend and backend).
DaemonDNS struct {
DaemonSubsystemStatus `yaml:",inline"`
DaemonSubsystemStatus
}

// HeartbeatStream describes one OpenSVC daemon heartbeat thread,
// which is responsible for sending or receiving the node DataSet
// changes to or from peer nodes.
HeartbeatStream struct {
DaemonSubsystemStatus `yaml:",inline"`
DaemonSubsystemStatus

// Type is the heartbeat type example: unicast, ...
Type string `json:"type" yaml:"type"`
Type string `json:"type"`

Peers map[string]HeartbeatPeerStatus `json:"peers" yaml:"peers"`
Peers map[string]HeartbeatPeerStatus `json:"peers"`
}

// HeartbeatPeerStatus describes the status of the communication
// with a specific peer node.
HeartbeatPeerStatus struct {
IsBeating bool `json:"is_beating" yaml:"is_beating"`
LastAt time.Time `json:"last_at" yaml:"last_at"`
IsBeating bool `json:"is_beating"`
LastAt time.Time `json:"last_at"`
}
)
42 changes: 21 additions & 21 deletions core/cluster/daemon_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,47 @@ import (
type (
// ListenerThreadSession describes statistics of a session of the api listener.
ListenerThreadSession struct {
Addr string `json:"addr" yaml:"addr"`
CreatedAt time.Time `json:"created_at" yaml:"created_at"`
Encrypted bool `json:"encrypted" yaml:"encrypted"`
Progress string `json:"progress" yaml:"progress"`
TID uint64 `json:"tid" yaml:"tid"`
Addr string `json:"addr"`
CreatedAt time.Time `json:"created_at"`
Encrypted bool `json:"encrypted"`
Progress string `json:"progress"`
TID uint64 `json:"tid"`
}

// ListenerThreadClient describes the statistics of all session of a single client the api listener.
ListenerThreadClient struct {
Accepted uint64 `json:"accepted" yaml:"accepted"`
AuthValidated uint64 `json:"auth_validated" yaml:"auth_validated"`
RX uint64 `json:"rx" yaml:"rx"`
TX uint64 `json:"tx" yaml:"tx"`
Accepted uint64 `json:"accepted"`
AuthValidated uint64 `json:"auth_validated"`
RX uint64 `json:"rx"`
TX uint64 `json:"tx"`
}

// ListenerThreadSessions describes the sessions statistics of the api listener.
ListenerThreadSessions struct {
Accepted uint64 `json:"accepted" yaml:"accepted"`
AuthValidated uint64 `json:"auth_validated" yaml:"auth_validated"`
RX uint64 `json:"rx" yaml:"rx"`
TX uint64 `json:"tx" yaml:"tx"`
Alive map[string]ListenerThreadSession `json:"alive" yaml:"alive"`
Clients map[string]ListenerThreadClient `json:"clients" yaml:"clients"`
Accepted uint64 `json:"accepted"`
AuthValidated uint64 `json:"auth_validated"`
RX uint64 `json:"rx"`
TX uint64 `json:"tx"`
Alive map[string]ListenerThreadSession `json:"alive"`
Clients map[string]ListenerThreadClient `json:"clients"`
}

// ListenerThreadStats describes the statistics of the api listener.
ListenerThreadStats struct {
Sessions ListenerThreadSessions `json:"sessions" yaml:"sessions"`
Sessions ListenerThreadSessions `json:"sessions"`
}

// DaemonListener describes the OpenSVC daemon listener thread,
// which is responsible for serving the API.
DaemonListener struct {
DaemonSubsystemStatus `yaml:",inline"`
Config ListenerThreadStatusConfig `json:"config" yaml:"config"`
Stats ListenerThreadStats `json:"stats" yaml:"stats"`
DaemonSubsystemStatus
Config ListenerThreadStatusConfig `json:"config"`
Stats ListenerThreadStats `json:"stats"`
}

// ListenerThreadStatusConfig holds a summary of the listener configuration
ListenerThreadStatusConfig struct {
Addr net.IP `json:"addr" yaml:"addr"`
Port int `json:"port" yaml:"port"`
Addr net.IP `json:"addr"`
Port int `json:"port"`
}
)
2 changes: 1 addition & 1 deletion core/cluster/daemon_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ type (
// which is responsible for the node DataSets aggregation and
// decision-making.
DaemonMonitor struct {
DaemonSubsystemStatus `yaml:",inline"`
DaemonSubsystemStatus
}
)
16 changes: 8 additions & 8 deletions core/cluster/daemon_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ type (
// SchedulerThreadEntry describes a task queued for execution by the
// opensvc scheduler thread.
SchedulerThreadEntry struct {
Action string `json:"action" yaml:"action"`
Csum string `json:"csum" yaml:"csum"`
Path string `json:"path" yaml:"path"`
ExpireAt time.Time `json:"expire_at" yaml:"expire_at"`
QueuedAt time.Time `json:"queued_at" yaml:"queued_at"`
Rid string `json:"rid" yaml:"rid"`
Action string `json:"action"`
Csum string `json:"csum"`
Path string `json:"path"`
ExpireAt time.Time `json:"expire_at"`
QueuedAt time.Time `json:"queued_at"`
Rid string `json:"rid"`
}

// DaemonScheduler describes the OpenSVC daemon scheduler thread
// state, which is responsible for executing node and objects scheduled
// jobs.
DaemonScheduler struct {
DaemonSubsystemStatus `yaml:",inline"`
Delayed []SchedulerThreadEntry `json:"delayed" yaml:"delayed"`
DaemonSubsystemStatus
Delayed []SchedulerThreadEntry `json:"delayed"`
}
)
Loading

0 comments on commit 3993f49

Please sign in to comment.