add network_route schema
Some checks failed
Lint / golangci-lint (push) Failing after 9m57s
Declarative Tests / test (push) Failing after 59s

This commit is contained in:
Matthew Rich 2024-04-09 12:51:56 -07:00
parent 33dd463180
commit fffcb0963e
4 changed files with 71 additions and 10 deletions

View File

@ -108,15 +108,15 @@ const (
// Manage the state of network routes
type NetworkRoute struct {
Id string
To string `json:"to"`
Interface string `json:"interface"`
Gateway string `json:"gateway"`
Metric uint `json:"metric"`
Rtid NetworkRouteTableId `json:"rtid"`
RouteType NetworkRouteType `json:"routetype"`
Scope NetworkRouteScope `json:"scope"`
Proto NetworkRouteProto `json:"proto"`
State string `json:"state"`
To string `json:"to" yaml:"to"`
Interface string `json:"interface" yaml:"interface"`
Gateway string `json:"gateway" yaml:"gateway"`
Metric uint `json:"metric" yaml:"metric"`
Rtid NetworkRouteTableId `json:"rtid" yaml:"rtid"`
RouteType NetworkRouteType `json:"routetype" yaml:"routetype"`
Scope NetworkRouteScope `json:"scope" yaml:"scope"`
Proto NetworkRouteProto `json:"proto" yaml:"proto"`
State string `json:"state" yaml:"state"`
}
func NewNetworkRoute() *NetworkRoute {

View File

@ -13,7 +13,8 @@
{ "$ref": "package-declaration.jsonschema" },
{ "$ref": "file-declaration.jsonschema" },
{ "$ref": "user-declaration.jsonschema" },
{ "$ref": "exec-declaration.jsonschema" }
{ "$ref": "exec-declaration.jsonschema" },
{ "$ref": "network_route-declaration.jsonschema" }
]
}
}

View File

@ -0,0 +1,17 @@
{
"$id": "network_route-declaration.jsonschema",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "network_route-declaration",
"type": "object",
"required": [ "type", "attributes" ],
"properties": {
"type": {
"type": "string",
"description": "Resource type name.",
"enum": [ "network_route" ]
},
"attributes": {
"$ref": "network_route.jsonschema"
}
}
}

View File

@ -0,0 +1,43 @@
{
"$id": "network_route.jsonschema",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "network_route",
"type": "object",
"required": [ "to", "gateway", "interface", "rtid", "metric", "type", "scope" ],
"properties": {
"to": {
"type": "string"
},
"gateway": {
"type": "string"
},
"interface": {
"type": "string"
},
"rtid": {
"type": "string",
"description": "Network route table id",
"pattern": "^(local|main|default|all|[0-9]+)$"
},
"metric": {
"type": "integer",
"description": "Network route metric",
"minimum": 0
},
"type": {
"type": "string",
"description": "Network route type",
"pattern": "^(unicast|local|broadcast|multicast|throw|unreachable|prohibit|blackhole|nat|[0-9]+)$"
},
"scope": {
"type": "string",
"description": "Network route scope",
"pattern": "^(host|link|global|[0-9]+)$"
},
"proto": {
"type": "string",
"description": "Network route scope",
"pattern": "^(kernel|boot|static|[0-9]+)$"
}
}
}