refactor: enhance JSON struct tags for various data models in backend and memory store. Update fields in ModulePatch, CDNSource, ASEntry, DomainEntry, IPRangeEntry, DohProfile, Community, and BGPPeer to improve API response formatting and consistency.
CI / changes (push) Successful in 5s
CI / openapi (push) Has been skipped
CI / go (push) Successful in 24s
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, , evobgp-web) (push) Has been skipped
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, evobgp-all, evobgp-web-all) (push) Has been skipped
CI / docker-bird (push) Has been skipped
CI / bird2 (push) Successful in 13s
CI / docker-go (deploy/docker/evobgp-agent/Dockerfile, , evobgp-agent) (push) Successful in 1m2s
CI / docker-go (evobgp-all, 1, deploy/docker/gobinary/Dockerfile, , evobgp-all) (push) Successful in 1m35s
CI / docker-go (evobgp-api, 1, deploy/docker/gobinary/Dockerfile, , evobgp-api) (push) Successful in 1m24s
CI / docker-go (evobgp-deploy, 0, deploy/docker/gobinary/Dockerfile, , evobgp-deploy) (push) Successful in 1m29s
CI / docker-go (evobgp-ingest, 0, deploy/docker/gobinary/Dockerfile, , evobgp-ingest) (push) Successful in 1m25s
CI / docker-go (evobgp-node, 0, deploy/docker/gobinary/Dockerfile, , evobgp-node) (push) Successful in 1m16s
CI / docker-go (evobgp-render, 0, deploy/docker/gobinary/Dockerfile, , evobgp-render) (push) Successful in 1m27s
CI / docker-go (evobgp-scheduler, 0, deploy/docker/gobinary/Dockerfile, , evobgp-scheduler) (push) Successful in 1m25s
CI / changes (push) Successful in 5s
CI / openapi (push) Has been skipped
CI / go (push) Successful in 24s
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, , evobgp-web) (push) Has been skipped
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, evobgp-all, evobgp-web-all) (push) Has been skipped
CI / docker-bird (push) Has been skipped
CI / bird2 (push) Successful in 13s
CI / docker-go (deploy/docker/evobgp-agent/Dockerfile, , evobgp-agent) (push) Successful in 1m2s
CI / docker-go (evobgp-all, 1, deploy/docker/gobinary/Dockerfile, , evobgp-all) (push) Successful in 1m35s
CI / docker-go (evobgp-api, 1, deploy/docker/gobinary/Dockerfile, , evobgp-api) (push) Successful in 1m24s
CI / docker-go (evobgp-deploy, 0, deploy/docker/gobinary/Dockerfile, , evobgp-deploy) (push) Successful in 1m29s
CI / docker-go (evobgp-ingest, 0, deploy/docker/gobinary/Dockerfile, , evobgp-ingest) (push) Successful in 1m25s
CI / docker-go (evobgp-node, 0, deploy/docker/gobinary/Dockerfile, , evobgp-node) (push) Successful in 1m16s
CI / docker-go (evobgp-render, 0, deploy/docker/gobinary/Dockerfile, , evobgp-render) (push) Successful in 1m27s
CI / docker-go (evobgp-scheduler, 0, deploy/docker/gobinary/Dockerfile, , evobgp-scheduler) (push) Successful in 1m25s
This commit is contained in:
+65
-65
@@ -80,44 +80,44 @@ type Backend interface {
|
||||
|
||||
// ModulePatch is a partial update for module.
|
||||
type ModulePatch struct {
|
||||
Name *string
|
||||
Enabled *bool
|
||||
Priority *int
|
||||
RefreshIntervalSec *int
|
||||
CronExpr *string
|
||||
DefaultCommunityID *string
|
||||
DohProfileID *string
|
||||
Name *string `json:"name,omitempty"`
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
Priority *int `json:"priority,omitempty"`
|
||||
RefreshIntervalSec *int `json:"refresh_interval_sec,omitempty"`
|
||||
CronExpr *string `json:"cron_expr,omitempty"`
|
||||
DefaultCommunityID *string `json:"default_community_id,omitempty"`
|
||||
DohProfileID *string `json:"doh_profile_id,omitempty"`
|
||||
}
|
||||
|
||||
// CDNSource is a row under a CDN module.
|
||||
type CDNSource struct {
|
||||
ID string
|
||||
ModuleID string
|
||||
SourceKind string
|
||||
URL string
|
||||
Etag string
|
||||
RefreshIntervalSec *int
|
||||
CommunityID *string
|
||||
ID string `json:"id,omitempty"`
|
||||
ModuleID string `json:"module_id,omitempty"`
|
||||
SourceKind string `json:"source_kind"`
|
||||
URL string `json:"url"`
|
||||
Etag string `json:"etag"`
|
||||
RefreshIntervalSec *int `json:"refresh_interval_sec"`
|
||||
CommunityID *string `json:"community_id"`
|
||||
}
|
||||
|
||||
type CDNSourcePatch struct {
|
||||
SourceKind *string
|
||||
URL *string
|
||||
Etag *string
|
||||
RefreshIntervalSec *int
|
||||
CommunityID *string
|
||||
SourceKind *string `json:"source_kind,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
Etag *string `json:"etag,omitempty"`
|
||||
RefreshIntervalSec *int `json:"refresh_interval_sec,omitempty"`
|
||||
CommunityID *string `json:"community_id,omitempty"`
|
||||
}
|
||||
|
||||
type ASEntry struct {
|
||||
ID string
|
||||
ModuleID string
|
||||
ASN int64
|
||||
CommunityID *string
|
||||
ID string `json:"id,omitempty"`
|
||||
ModuleID string `json:"module_id,omitempty"`
|
||||
ASN int64 `json:"asn"`
|
||||
CommunityID *string `json:"community_id"`
|
||||
}
|
||||
|
||||
type ASEntryPatch struct {
|
||||
ASN *int64
|
||||
CommunityID *string
|
||||
ASN *int64 `json:"asn,omitempty"`
|
||||
CommunityID *string `json:"community_id,omitempty"`
|
||||
}
|
||||
|
||||
// ValidASN reports whether n is a usable BGP ASN (1..4294967295).
|
||||
@@ -126,73 +126,73 @@ func ValidASN(n int64) bool {
|
||||
}
|
||||
|
||||
type DomainEntry struct {
|
||||
ID string
|
||||
ModuleID string
|
||||
FQDN string
|
||||
CommunityID *string
|
||||
ID string `json:"id,omitempty"`
|
||||
ModuleID string `json:"module_id,omitempty"`
|
||||
FQDN string `json:"fqdn"`
|
||||
CommunityID *string `json:"community_id"`
|
||||
}
|
||||
|
||||
type DomainEntryPatch struct {
|
||||
FQDN *string
|
||||
CommunityID *string
|
||||
FQDN *string `json:"fqdn,omitempty"`
|
||||
CommunityID *string `json:"community_id,omitempty"`
|
||||
}
|
||||
|
||||
type IPRangeEntry struct {
|
||||
ID string
|
||||
ModuleID string
|
||||
Prefix string
|
||||
CommunityID *string
|
||||
ID string `json:"id,omitempty"`
|
||||
ModuleID string `json:"module_id,omitempty"`
|
||||
Prefix string `json:"prefix"`
|
||||
CommunityID *string `json:"community_id"`
|
||||
}
|
||||
|
||||
type IPRangePatch struct {
|
||||
Prefix *string
|
||||
CommunityID *string
|
||||
Prefix *string `json:"prefix,omitempty"`
|
||||
CommunityID *string `json:"community_id,omitempty"`
|
||||
}
|
||||
|
||||
type DohProfile struct {
|
||||
ID string
|
||||
TenantID string
|
||||
Name string
|
||||
URL string
|
||||
TimeoutMs *int
|
||||
SecretRef *string
|
||||
ID string `json:"id,omitempty"`
|
||||
TenantID string `json:"tenant_id,omitempty"`
|
||||
Name string `json:"name"`
|
||||
URL string `json:"url"`
|
||||
TimeoutMs *int `json:"timeout_ms"`
|
||||
SecretRef *string `json:"vault_secret_ref"`
|
||||
}
|
||||
|
||||
type DohProfilePatch struct {
|
||||
Name *string
|
||||
URL *string
|
||||
TimeoutMs *int
|
||||
SecretRef *string
|
||||
Name *string `json:"name,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
TimeoutMs *int `json:"timeout_ms,omitempty"`
|
||||
SecretRef *string `json:"vault_secret_ref,omitempty"`
|
||||
}
|
||||
|
||||
type Community struct {
|
||||
ID string
|
||||
TenantID string
|
||||
Name string
|
||||
Kind string
|
||||
ValueJSON string
|
||||
ID string `json:"id,omitempty"`
|
||||
TenantID string `json:"tenant_id,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Kind string `json:"kind"`
|
||||
ValueJSON string `json:"value_json"`
|
||||
}
|
||||
|
||||
type CommunityPatch struct {
|
||||
Name *string
|
||||
Kind *string
|
||||
ValueJSON *string
|
||||
Name *string `json:"name,omitempty"`
|
||||
Kind *string `json:"kind,omitempty"`
|
||||
ValueJSON *string `json:"value_json,omitempty"`
|
||||
}
|
||||
|
||||
type PeerPatch struct {
|
||||
Neighbor *string
|
||||
RemoteASN *int64
|
||||
SpeakerID *string
|
||||
Enabled *bool
|
||||
Name *string
|
||||
SessionState *string
|
||||
PoliciesJSON *string
|
||||
Neighbor *string `json:"neighbor,omitempty"`
|
||||
RemoteASN *int64 `json:"remote_asn,omitempty"`
|
||||
SpeakerID *string `json:"bgp_speaker_id,omitempty"`
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
SessionState *string `json:"session_state,omitempty"`
|
||||
PoliciesJSON *string `json:"policies_json,omitempty"`
|
||||
}
|
||||
|
||||
type SpeakerPatch struct {
|
||||
Role *string
|
||||
Endpoint *string
|
||||
MetaJSON *string
|
||||
Role *string `json:"role,omitempty"`
|
||||
Endpoint *string `json:"endpoint,omitempty"`
|
||||
MetaJSON *string `json:"meta_json,omitempty"`
|
||||
}
|
||||
|
||||
// PrefixRow is one materialized prefix for GET /revisions/.../prefixes.
|
||||
|
||||
+15
-15
@@ -89,24 +89,24 @@ type Revision struct {
|
||||
|
||||
// BGPPeer maps to bgp_peer (+ display fields in meta).
|
||||
type BGPPeer struct {
|
||||
ID string
|
||||
TenantID string
|
||||
SpeakerID *string
|
||||
Name string
|
||||
Neighbor string
|
||||
RemoteASN int64
|
||||
Enabled bool
|
||||
SessionState string
|
||||
PoliciesJSON string
|
||||
ID string `json:"id,omitempty"`
|
||||
TenantID string `json:"tenant_id,omitempty"`
|
||||
SpeakerID *string `json:"bgp_speaker_id"`
|
||||
Name string `json:"name"`
|
||||
Neighbor string `json:"neighbor"`
|
||||
RemoteASN int64 `json:"remote_asn"`
|
||||
Enabled bool `json:"enabled"`
|
||||
SessionState string `json:"session_state"`
|
||||
PoliciesJSON string `json:"policies_json"`
|
||||
}
|
||||
|
||||
type Speaker struct {
|
||||
ID string
|
||||
TenantID string
|
||||
Role string
|
||||
Endpoint string
|
||||
LastAppliedRevisionID *string
|
||||
MetaJSON string
|
||||
ID string `json:"id,omitempty"`
|
||||
TenantID string `json:"tenant_id,omitempty"`
|
||||
Role string `json:"role"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
LastAppliedRevisionID *string `json:"last_applied_revision_id"`
|
||||
MetaJSON string `json:"meta_json"`
|
||||
}
|
||||
|
||||
func NewMemory() *Memory {
|
||||
|
||||
Reference in New Issue
Block a user