~/bend-docscommunity

src/admission.bend checks

raw source on the hub · import bend-kube-runtime@0.8.0.0/src/admission.bend as Admission

5 imports
import Base
import ./json.bend as J
import ./http.bend as H
import ./utf8.bend as U
import ./base64.bend as B

Types

type Verdict source · line 20 · raw

Data

allowed; code and message when denied (code 0: 403); patch: JSON-patch operations to apply (a mutating webhook; Nil for none); warnings shown to the client (kubectl prints them).

type Rq source · line 58 · raw

Data

A request so far: its first line's bytes (reversed), then the line and the decoder; size counts every byte read.

type Cut source · line 66 · raw

Data

The bytes before the first LF, and those after it.

type Got source · line 155 · raw

Data

A finished request: its method, path and body.

type Review source · line 287 · raw

Data

Definitions

def Verdict.allow source · line 23 · raw

Verdict

def Verdict.deny source · line 27 · raw

@msg:String -> Verdict

Denied with a message (403 Forbidden).

def Verdict.deny_with source · line 31 · raw

@code:U32 -> @msg:String -> Verdict

Denied with an HTTP-style code (400 for a bad request, 422 invalid).

def Verdict.patch source · line 35 · raw

@ops:List<&2, 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json> -> Verdict

Allowed, applying JSON-patch operations ({"op": "add", "path": .., "value": ..}).

def Verdict.warn source · line 39 · raw

@v:Verdict -> @w:String -> Verdict

The verdict with a warning added.

def Patch.op source · line 45 · raw

@op:String -> @path:String -> @value:0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json -> 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json

A JSON-patch operation: op ("add", "replace", "remove"), path, value.

def Rq.init source · line 62 · raw

Rq

def Cut.put source · line 69 · raw

@+b:U32 -> @c:Cut -> Cut

def Cut.is_lf source · line 74 · raw

@bs:List<&2, U32> -> Bool

def Cut.at source · line 82 · raw

@bs:List<&2, U32> -> @lf:Bool -> Cut

lf: whether bs starts with LF.

def Cut.of source · line 91 · raw

@+bs:List<&2, U32> -> Cut

def Rq.status source · line 94 · raw

List<&2, U32>

def Rq.lined source · line 97 · raw

@acc:List<&2, U32> -> @+n:U32 -> @c:Cut -> Rq

def Rq.feed source · line 106 · raw

@st:Rq -> @+bs:List<&2, U32> -> Rq

Feeds bytes read from the connection.

def Rq.size source · line 113 · raw

@st:Rq -> U32

def Rq.done source · line 122 · raw

@st:Rq -> Bool

A request without Content-Length or chunked framing has no body (the response decoder would read one to the end of the stream).

def Rq.broken source · line 131 · raw

@st:Rq -> Bool

def Rq.path.go source · line 140 · raw

@ps:List<&2, String> -> String

The path of a request line ("POST /validate?timeout=10s HTTP/1.1"), without its query.

def Rq.method.go source · line 147 · raw

@ps:List<&2, String> -> String

def Rq.got.fin source · line 158 · raw

@+line:String -> @rb:Pair(0xe0e77c5abbdb8584a571cae3ec9b86cc/src/http.Resp, List<&2, U32>) -> Got

def Rq.got source · line 163 · raw

@st:Rq -> Got

def Wh.reason.go source · line 173 · raw

@ok:Bool -> @bad:Bool -> @missing:Bool -> @big:Bool -> String

def Wh.reason source · line 186 · raw

@+code:U32 -> String

def Wh.reply source · line 189 · raw

@+code:U32 -> @+body:String -> String

def Wh.error source · line 193 · raw

@+code:U32 -> @+msg:String -> String

def Wh.strs source · line 196 · raw

@ws:List<&2, String> -> List<&2, 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json>

def Wh.code.go source · line 203 · raw

@+c:U32 -> @zero:Bool -> U32

def Wh.code source · line 210 · raw

@+c:U32 -> U32

def Wh.patch_kvs source · line 213 · raw

@ops:List<&2, 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json> -> List<&2, 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.KV>

def Wh.status_kvs source · line 221 · raw

@allowed:Bool -> @+code:U32 -> @+msg:String -> List<&2, 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.KV>

def Wh.warn_kvs source · line 228 · raw

@ws:List<&2, String> -> List<&2, 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.KV>

def Wh.admission_review source · line 237 · raw

@+av:String -> @+uid:String -> @v:Verdict -> 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json

The AdmissionReview that answers request uid with the verdict, in the review's own apiVersion.

def Wh.conv.put source · line 245 · raw

@r:Result<&2, &2, String, 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json> -> @rest:Result<&2, &2, String, List<&2, 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json>> -> Result<&2, &2, String, List<&2, 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json>>

def Wh.conv.result source · line 264 · raw

@+av:String -> @+uid:String -> @r:Result<&2, &2, String, List<&2, 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json>> -> 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json

def Review.of.go source · line 292 · raw

@+j:0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json -> @+kind:String -> @adm:Bool -> @conv:Bool -> Review

def Review.of.json source · line 301 · raw

@+j:0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json -> @+kind:String -> Review

def Review.of.parsed source · line 304 · raw

@r:Result<&2, &2, String, 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json> -> Review

def Review.of source · line 312 · raw

@body:String -> Review

The review a request body carries.

Templates

template Wh.converted source · line 256 · raw

@-convert:(@_:0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json -> @_:String -> Result<&2, &2, String, 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json>) -> @xs:List<&2, 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json> -> @+to:String -> Result<&2, &2, String, List<&2, 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json>>

Every object converted, or the first failure.

template Wh.conversion_review source · line 277 · raw

@-convert:(@_:0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json -> @_:String -> Result<&2, &2, String, 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json>) -> @+review:0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json -> 0xe0e77c5abbdb8584a571cae3ec9b86cc/src/json.Json

The ConversionReview that answers a request: every object in the desired apiVersion, or the first failure.