{"modulePath":"github.com/agentshield-dev/agentshield","version":"v0.0.1-rc.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package api\n\nPackage api holds typed subsets of the cilium.io/v2 resources the Cilium projector reads. Types decode only the fields projection interprets; field meaning follows the upstream Cilium API.\n\n## Types\n\n```go\ntype Decoded[T any] struct {\n\tValue T\n}\n```\nDecoded wraps a typed provider object decoded from its unstructured form.\n\n```go\nfunc Decode[T any](object *unstructured.Unstructured) (Decoded[T], error)\n```\nDecode round-trips object through JSON into T. Unknown fields are ignored; a field with the wrong JSON type is an error.\n\n```go\nfunc EndpointObject(object *unstructured.Unstructured) (Decoded[Endpoint], error)\n```\nEndpointObject decodes a CiliumEndpoint.\n\n```go\nfunc NodeObject(object *unstructured.Unstructured) (Decoded[Node], error)\n```\nNodeObject decodes a CiliumNode.\n\n```go\nfunc PolicyObject(object *unstructured.Unstructured) (Decoded[Policy], error)\n```\nPolicyObject decodes a Cilium policy object.\n\n```go\ntype EgressRule struct {\n\tToPorts []PortRule `json:\"toPorts,omitempty\"`\n}\n```\nEgressRule holds the port rules of one egress section.\n\n```go\ntype Endpoint struct {\n\tmetav1.TypeMeta   `json:\",inline\"`\n\tmetav1.ObjectMeta `json:\"metadata,omitempty\"`\n\tStatus            EndpointStatus `json:\"status,omitempty\"`\n}\n```\nEndpoint is a CiliumEndpoint, named after the Pod it represents.\n\n```go\ntype EndpointIdentity struct {\n\tID int64 `json:\"id,omitempty\"`\n}\n```\nEndpointIdentity is the numeric Cilium security identity.\n\n```go\ntype EndpointPolicy struct {\n\tRealized EndpointRealizedPolicy `json:\"realized,omitempty\"`\n}\n```\nEndpointPolicy holds the policy state the agent realized.\n\n```go\ntype EndpointRealizedPolicy struct {\n\tPolicyEnabled string `json:\"policy-enabled,omitempty\"`\n}\n```\nEndpointRealizedPolicy reports the agent's realized policy-enabled mode. It is recorded verbatim, not interpreted as proof of enforcement.\n\n```go\ntype EndpointStatus struct {\n\tID       int64            `json:\"id,omitempty\"`\n\tState    string           `json:\"state,omitempty\"`\n\tIdentity EndpointIdentity `json:\"identity,omitempty\"`\n\tPolicy   EndpointPolicy   `json:\"policy,omitempty\"`\n}\n```\nEndpointStatus is the agent-reported endpoint state.\n\n```go\ntype IngressRule struct {\n\tToPorts []PortRule `json:\"toPorts,omitempty\"`\n}\n```\nIngressRule holds the port rules of one ingress section.\n\n```go\ntype Node struct {\n\tmetav1.TypeMeta   `json:\",inline\"`\n\tmetav1.ObjectMeta `json:\"metadata,omitempty\"`\n\tSpec              NodeSpec `json:\"spec,omitempty\"`\n}\n```\nNode is a CiliumNode, named after the Kubernetes Node it represents.\n\n```go\ntype NodeAddress struct {\n\tType string `json:\"type,omitempty\"`\n\tIP   string `json:\"ip,omitempty\"`\n}\n```\nNodeAddress is one typed node address.\n\n```go\ntype NodeIPAM struct {\n\tPodCIDRs []string `json:\"podCIDRs,omitempty\"`\n}\n```\nNodeIPAM holds the Pod CIDRs allocated to the node.\n\n```go\ntype NodeSpec struct {\n\tAddresses []NodeAddress `json:\"addresses,omitempty\"`\n\tIPAM      NodeIPAM      `json:\"ipam,omitempty\"`\n}\n```\nNodeSpec holds node addresses and IPAM allocation.\n\n```go\ntype Policy struct {\n\tmetav1.TypeMeta   `json:\",inline\"`\n\tmetav1.ObjectMeta `json:\"metadata,omitempty\"`\n\tSpec              *Rule  `json:\"spec,omitempty\"`\n\tSpecs             []Rule `json:\"specs,omitempty\"`\n}\n```\nPolicy is a CiliumNetworkPolicy or CiliumClusterwideNetworkPolicy.\n\n```go\nfunc (policy Policy) Rules() []Rule\n```\nRules returns the specs list followed by the single spec, matching how Cilium combines them.\n\n```go\ntype PortProtocol struct {\n\tPort     string `json:\"port\"`\n\tProtocol string `json:\"protocol,omitempty\"`\n}\n```\nPortProtocol is one port and optional protocol. Port may be a number, range, or name.\n\n```go\ntype PortRule struct {\n\tPorts []PortProtocol  `json:\"ports,omitempty\"`\n\tRules json.RawMessage `json:\"rules,omitempty\"`\n}\n```\nPortRule is one toPorts entry. Rules is kept raw only to detect L7 rules; its contents are never interpreted or copied to the graph.\n\n```go\ntype Rule struct {\n\tEndpointSelector metav1.LabelSelector `json:\"endpointSelector\"`\n\tIngress          []IngressRule        `json:\"ingress,omitempty\"`\n\tEgress           []EgressRule         `json:\"egress,omitempty\"`\n}\n```\nRule is one policy rule. Only selectors and port-level structure are decoded; peer selectors are not interpreted.\n\n```go\nfunc (rule Rule) HasL7Rules() bool\n```\nHasL7Rules reports whether any port rule carries a non-empty L7 section. Such rules are excluded from CNI summaries.\n\n","path":"github.com/agentshield-dev/agentshield/plugins/cilium/api","name":"api","synopsis":"Package api holds typed subsets of the cilium.io/v2 resources the Cilium projector reads.","isRedistributable":true}
