diff --git a/internal/resource/network_route.go b/internal/resource/network_route.go index 1e5da23..dc019cd 100644 --- a/internal/resource/network_route.go +++ b/internal/resource/network_route.go @@ -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 { diff --git a/internal/resource/schemas/document.jsonschema b/internal/resource/schemas/document.jsonschema index 2fb8da4..eb25e40 100644 --- a/internal/resource/schemas/document.jsonschema +++ b/internal/resource/schemas/document.jsonschema @@ -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" } ] } } diff --git a/internal/resource/schemas/network_route-declaration.jsonschema b/internal/resource/schemas/network_route-declaration.jsonschema new file mode 100644 index 0000000..1e2a81b --- /dev/null +++ b/internal/resource/schemas/network_route-declaration.jsonschema @@ -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" + } + } +} diff --git a/internal/resource/schemas/network_route.jsonschema b/internal/resource/schemas/network_route.jsonschema new file mode 100644 index 0000000..828389d --- /dev/null +++ b/internal/resource/schemas/network_route.jsonschema @@ -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]+)$" + } + } +}