package awso-async

  1. Overview
  2. Docs
AWS client for Async (400+ services, auto-generated from botocore)

Install

dune-project
 Dependency

Authors

Maintainers

Sources

awso-0.9.0.tbz
sha256=47224890900b1f5d2bd717000a02fa8918f92eafa99f702f7d59a1b053ff8e95
sha512=e187288f7c8fccb221f5417671732c8c8de95cdbacba1514db592b5700df2293468bde07956539bd44f3d460f6c75d38bd66ca161d0eae68a8b1b4e081882367

doc/src/awso-async.sso/util.ml.html

Source file util.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
open! Core
open! Async

module Cfg = struct
  let get ?profile ?region ?output () =
    match%bind Awso_async.Cfg.get ?profile ?region ?output () with
    | Error e -> return (Error (Failure e))
    | Ok cfg -> (
      let cached_sso_token_file = Awso_sso.Util.get_cached_sso_token_file_path ~cfg in
      let%bind jsonstr = Reader.file_contents cached_sso_token_file in
      match
        Awso_sso.Util.get_sso_role_request_and_cfg ~cfg ~cached_sso_token_file jsonstr
      with
      | Error e -> return (Error e)
      | Ok (role_request, sso_cfg) ->
        let%map roleCredentials =
          let%map res = Io.get_role_credentials ~cfg:sso_cfg role_request in
          Awso_sso.Util.parse_role_credentials_response_exn res
        in
        Awso_sso.Util.update_cfg_with_role_credentials ~cfg roleCredentials)
  ;;

  let get_exn ?profile ?region ?output () =
    match%map get ?profile ?region ?output () with
    | Ok x -> x
    | Error e -> raise e
  ;;
end