package aws-config

  1. Overview
  2. Docs
Read AWS configuration in OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

0.0.1.tar.gz
md5=d37e3ccde64a11912f075ffb15ab2b73
sha512=d9e0eedcc8e3d14431871b059a06e314063bdd4ca1c45e7af7308588c5836e2104a3f51a8043331b24701f15ba6d80274c2d64f93be3737d41bcd983ea09ac9f

doc/src/aws-config/json.ml.html

Source file json.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
exception Invalid_json of Yojson.Safe.t

let get key j =
  match j with
  | `Assoc l ->
    List.assoc_opt key l
    |> Option.map (function
           | `String v -> v
           | _ -> raise @@ Invalid_json j)
  | _ -> raise @@ Invalid_json j
;;

let ( #. ) l k = get k l

let get_exn key j =
  match j with
  | `Assoc l ->
    List.assoc key l
    |> (function
    | `String v -> v
    | _ -> raise @@ Invalid_json j)
  | _ -> raise @@ Invalid_json j
;;

let ( #.! ) l k = get_exn k l
let s3 = "s3"

let get_s3 key = function
  | `Assoc l -> List.assoc_opt s3 l |> Fun.flip Option.bind (get key)
;;

let get_s3_exn key = function
  | `Assoc l -> List.assoc s3 l |> get_exn key
;;
OCaml

Innovation. Community. Security.