package datakit-github

  1. Overview
  2. Docs

API capabilities, used to restrict the scope of an API.token.

type t

The type for API capabilities.

val pp : t Fmt.t

pp is the pretty-printer for capabilities.

val equal : t -> t -> bool

equal equalizes capabilities.

val parse : string -> [ `Error of string | `Ok of t ]

parse is the parses capabilites, such that parse (Fmt.to_to_string pp x) = `Ok x.

type op = [
  1. | `Read
  2. | `Write
  3. | `Excl
]

The type for API operations.

  • `Read allows the bridge to read the corresponding kind of GitHub resources
  • `Write allows the bridge to update the corresponding kind of resource.
  • `Excl means that the bridge has exclusive write access to the corresponding GitHub resource. In particular, this means that when the bridge is disconnect/reconnect it will always try to update GitHub to match with the current state of its local resources and it will revert any changes made by other GitHub users on this kind of resources.
val pp_op : op Fmt.t

pp_op is the pretty-printer for resource operations.

type resource = [
  1. | `Repo of string list
  2. | `PR
  3. | `Commit
  4. | `Status of string list
  5. | `Ref
  6. | `Webhook
]

The type for API resources.

val pp_resource : resource Fmt.t

pp_resource is the pretty-printer for resources.

val none : t

none is the capability to do nothing.

val all : t

all is the capability to do everything.

val allow : t -> op -> [ `Default | resource ] -> t

allow t o r is t with the capability to do API calls of type o to the kind of resource r.

val disallow : t -> op -> [ `Default | resource ] -> t

disallow t o r is t without the capability to do API calls of type o to the kind of resource r.

val check : t -> op -> resource -> bool

check t o r is true if t is allowed to to o on the kind of resource r.

val filter_diff : t -> op -> Snapshot.diff -> Snapshot.diff

filter_diff t op d filters the diff d to only apply the subset of operations op over the capabilities defined by t.

val filter_elt : t -> op -> Elt.t -> bool
OCaml

Innovation. Community. Security.