text
stringlengths
0
601k
let ( + ) = add
let ( / ) = div
let of_char c = int_of_char c |> of_int
let initial_n = 0x80l end
module Bootstring sig struct let adapt delta numpoints ( firsttime : bool ) = let open Parameters in let delta = if firsttime then delta / Parameters . damp else delta / ( of_int 2 ) in let delta = delta + ( delta / numpoints ) in let k = zero in let rec loop delta k = begin match delta > ( ( base - tmin ) * tmax ) / (...
module Punycode2 = Bootstring ( Punycode_bootstring ) ) *
type illegal_ascii_label = | Illegal_label_size of string | Label_contains_illegal_character of string | Label_starts_with_illegal_character of char | Label_ends_with_hyphen of string
let pp_illegal_label fmt err = Format . fprintf fmt " Illegal label : % s " ( match err with | Illegal_label_size str -> strf " Invalid size : % S " str | Label_contains_illegal_character str -> strf " Contains invalid char : % S " str | Label_starts_with_illegal_character char -> strf " Starts with invalid char : % C ...
type punycode_decode_error = | Overflow_error | Invalid_domain_name of string | Illegal_label of illegal_ascii_label
let msg_of_decode_error = function | Overflow_error -> R . msg " Unspecified overflow error " | Invalid_domain_name str -> R . msgf " Invalid domain name : % S " str | Illegal_label label_error -> R . msgf " % a " pp_illegal_label label_error
type punycode_encode_error = | Malformed_utf8_input of string | Overflow | Invalid_domain_name of string | Illegal_label of illegal_ascii_label
let msg_of_encode_error = function | Malformed_utf8_input str -> R . msgf " Malformed UTF - 8 input : % S " str | Overflow -> R . msg " Unexpected overflow " | Invalid_domain_name str -> R . msgf " Invalid domain name : % S " str | Illegal_label label_error -> R . msgf " Illegal ascii label : % a " pp_illegal_label lab...
let is_valid_ascii_label label : ( string , illegal_ascii_label ) Rresult . result = begin if String . ( length label > 0 && length label <= 63 ) then R . ok ( ) else R . error @@ Illegal_label_size label end >>= fun ( ) -> begin match label . [ 0 ] , label . [ pred @@ String . length label ] with | _ , ' ' - -> R . er...
let lst_to_string lst = let b = Pervasives_Buffer . create 64 in let ( ) = List . iter ( Uutf . Buffer . add_utf_8 b ) lst in Pervasives_Buffer . contents b
let decode_digit cp = let cp_int = int_of_char cp in match cp with | ' \ x00 ' . . ' \ x39 ' -> cp_int - 22 | ' \ x3a ' . . ' \ x5a ' -> cp_int - 65 | ' \ x5b ' . . ' \ x7a ' -> cp_int - 97 | ' \ x7b ' . . ' \ xFF ' -> base
let encode_digit d uppercase_flag = match uppercase_flag , char_of_int d with | false , ' \ x00 ' . . ' \ x19 ' -> d + 0x61 | true , ' \ x00 ' . . ' \ x19 ' -> d + 0x41 | false , ' \ x1a ' . . ' \ x23 ' -> ( d - 26 ) + 0x30 | _ , ch -> failwith ( __LOC__ ^ " : trying to decode invalid digit : " ^ ( Char . Ascii . escap...
let adapt delta numpoints firsttime = let delta = match firsttime with | true -> ( delta / damp ) | false -> ( delta lsr 1 ) in let delta = delta + ( delta / numpoints ) in let delta , k = let rec foo ~ delta ~ k = if delta > ( ( ( base - tmin ) * tmax ) / 2 ) then let delta = delta / ( base - tmin ) in let k = k + bas...
module ImmutArray : sig type backing = Uchar . t type ' a t constraint ' a = backing val get : backing t -> int -> backing val len : backing t -> int val fold_left : ( int -> backing -> int ) -> int -> backing t -> int val of_utf8 : ( string -> ' malformed_error ) -> string -> ( ' acc -> Uchar . t -> ' acc ) -> ' acc -...
let decode input : ( Uchar . t ImmutArray . t , punycode_decode_error ) Rresult . result = let basic_codepoints , complex_codepoints = match String . cut ~ rev : true ~ sep " " :- input with | None -> input , " " | Some basic_complex_pair -> basic_complex_pair in let initial_value_output_len , initial_value_output = Im...
let encode input_utf8 : ( string , punycode_encode_error ) Rresult . result = ImmutArray . of_utf8_save_basic_codepoints ( fun s -> Malformed_utf8_input s ) input_utf8 >>= fun ( input , ( basic_codepoints , basic_codepoints_len ) ) -> let initial_value_output : Uchar . t list = if basic_codepoints <> [ ] then Uchar . o...
let internal_to_domain_name domain : ( bool * [ ` raw ] Domain_name . t , punycode_encode_error ) Rresult . result = let for_each_label acc label = match acc , label with | Error _ , _ -> acc | Ok ( 0 , acc ) , " " -> Ok ( 0 , " " :: acc ) | Ok _ , " " -> Error ( Illegal_label ( Illegal_label_size " contains empty labe...
let to_encoded_domain_name string = internal_to_domain_name string >>| snd
let to_ascii string : ( string , punycode_encode_error ) result = internal_to_domain_name string >>| fun ( has_dot , domain ) -> match Domain_name . to_string domain with | encoded_str when has_dot -> encoded_str ^ " . " | encoded_str -> encoded_str
let of_domain_labels ( labels : string list ) = let for_each_label acc label = acc >>= fun acc -> if String . is_prefix ~ affix " : xn " -- label then begin ( is_valid_ascii_label label |> R . reword_error ( function e -> ( Illegal_label e : punycode_decode_error ) ) >>| String . drop ~ max : 4 >>| fun stripped -> if n...
let of_domain_name ( domain : _ Domain_name . t ) = ( Domain_name . ( to_strings ( raw domain ) ) |> of_domain_labels ) >>| fun x -> List . map ImmutArray . to_list x
let to_utf8_list domain = ( Domain_name . of_string domain |> R . reword_error ( fun ( ` Msg x ) -> ( Invalid_domain_name x : punycode_decode_error ) ) ) >>| Domain_name . to_strings >>= of_domain_labels >>| List . map ImmutArray . to_utf8
let to_utf8 domain = let domain , is_fqdn = match String . head ~ rev : true domain with | Some ' . ' -> String . span ~ rev : true ~ max : 1 domain |> fst , true | _ -> domain , false in to_utf8_list domain >>| ( fun lst -> if is_fqdn then lst [ " " ] @ else lst ) >>| String . concat ~ sep " . " :
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2016 - 11 - 15 " ] ) ; ( " Action " , [ " PurchaseHostReservation " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query ...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " PurchaseHostReservationResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp PurchaseHostReservationResult . parse ) ( let open Error in BadResponse { body ; message = " Could not find well formed PurchaseHostReser...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | None -> None
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2015 - 02 - 02 " ] ) ; ( " Action " , [ " PurchaseReservedCacheNodesOffering " ] ) ] ( Util . drop_empty ( Uri . query_of_encod...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " PurchaseReservedCacheNodesOfferingResponse " ( snd xml ) ) ( Xml . member " PurchaseReservedCacheNodesOfferingResult " ) in try Util . or_error ( Util . option_bind resp PurchaseReservedCacheNodesOfferingResult ...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | None -> None
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2014 - 10 - 31 " ] ) ; ( " Action " , [ " PurchaseReservedDBInstancesOffering " ] ) ] ( Util . drop_empty ( Uri . query_of_enco...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " PurchaseReservedDBInstancesOfferingResponse " ( snd xml ) ) ( Xml . member " PurchaseReservedDBInstancesOfferingResult " ) in try Util . or_error ( Util . option_bind resp PurchaseReservedDBInstancesOfferingResu...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | None -> None
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2016 - 11 - 15 " ] ) ; ( " Action " , [ " PurchaseReservedInstancesOffering " ] ) ] ( Util . drop_empty ( Uri . query_of_encode...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " PurchaseReservedInstancesOfferingResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp PurchaseReservedInstancesOfferingResult . parse ) ( let open Error in BadResponse { body ; message = " Could not find well form...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | None -> None
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2016 - 11 - 15 " ] ) ; ( " Action " , [ " PurchaseScheduledInstances " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Que...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " PurchaseScheduledInstancesResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp PurchaseScheduledInstancesResult . parse ) ( let open Error in BadResponse { body ; message = " Could not find well formed PurchaseSch...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | None -> None
let read file = let open Unix in let size = Int64 . to_int_exn ( stat file ) . st_size in let buf = Bytes . create size in let rec loop pos len fd = let n = read ~ pos ~ len ~ buf fd in if n > 0 then loop ( pos + n ) ( len - n ) fd in with_file ~ mode [ : O_RDONLY ] file ~ f ( : fun fd -> loop 0 size fd ) ; Bigstring ....
let zero = let len = 65_536 in Bigstring . of_string ( String . make len ' \ x00 ' ) ; ;
let make_bench name parser contents = Bench . Test . create ~ name ( fun ( ) -> match Angstrom . ( parse_bigstring ~ consume : Consume . Prefix parser contents ) with | Ok _ -> ( ) | Error err -> failwith err ) ; ;
let make_endian name p = make_bench name ( Angstrom . skip_many p ) zero
let make_json name contents = make_bench name RFC7159 . json contents
let make_http name contents = make_bench name ( Angstrom . skip_many RFC2616 . request ) contents
let main ( ) = let twitter1 = read " benchmarks / data / twitter1 . json " in let twitter10 = read " benchmarks / data / twitter10 . json " in let twitter20 = read " benchmarks / data / twitter20 . json " in let twitter_big = read " benchmarks / data / twitter . json " in let http_get = read " benchmarks / data / http ...
let ( ) = main ( )
let pure_expr pure_funs e = match e with | Block _ | Field _ | Closure _ | Constant _ -> true | Apply ( f , _l , exact ) -> exact && Var . Set . mem f pure_funs | Prim ( p , _l ) -> ( match p with | Extern f -> Primitive . is_pure f | _ -> true )
let pure_instr pure_funs i = match i with | Let ( _ , e ) -> pure_expr pure_funs e | Set_field _ | Offset_ref _ | Array_set _ -> false
let rec traverse blocks pc visited funs = try Addr . Map . find pc visited , visited , funs with Not_found -> let visited = Addr . Map . add pc false visited in let pure , visited , funs = fold_children blocks pc ( fun pc ( pure , visited , funs ) -> let pure ' , visited , funs = traverse blocks pc visited funs in pure...
let f p = let _ , _ , funs = traverse p . blocks p . start Addr . Map . empty Var . Set . empty in funs
module Type = struct module HTypes = CCHashtbl . Make ( Type ) let to_body = HTypes . create 10 let to_var = HTypes . create 10 let reset ( ) = HTypes . reset to_body ; HTypes . reset to_var let get_body = HTypes . find to_body let get_var = HTypes . find to_var let var t = Type . new_uninterpreted ~ name ( : Format . ...
module Term = struct let to_body = HTerms . create 1000 let to_var = HTerms . create 1000 let reset ( ) = HTerms . reset to_body ; HTerms . reset to_var let get_body = HTerms . find to_body let get_var = HTerms . find to_var let var t = Term . new_uninterpreted ~ name ( : Format . sprintf " pure_ % i " ( Term . hash t ...
let reset ( ) = Type . reset ( ) ; Term . reset ( )
type configuration = { stateless : bool }
let configuration ( ? stateless = false ) ( ) = { stateless }
module Make ( Scheduler : S . SCHED ) ( IO : S . IO with type ' a t = ' a Scheduler . s ) ( Flow : S . FLOW with type ' a fiber = ' a Scheduler . s ) ( Uid : S . UID ) ( Ref : S . REF ) = struct let src = Logs . Src . create " push " module Log = ( val Logs . src_log src : Logs . LOG ) open Scheduler let ( >>= ) x f = ...
module Pusher = struct module Pusher_data = struct type t = { url : string option ; format : string option } [ @@ deriving accessor ] let encoding = let to_tuple t = t . url , t . format in let of_tuple v = let url , format = v in { url ; format } in let with_tuple = obj2 ( opt " url " string ) ( opt " format " string ...
module Get = struct module Query = Empty . Query module Response = struct type t = { pushers : Pusher . t list option } [ @@ deriving accessor ] let encoding = let to_tuple t = t . pushers in let of_tuple v = let pushers = v in { pushers } in let with_tuple = obj1 ( opt " pushers " ( list Pusher . encoding ) ) in conv ...
module Set = struct module Query = Empty . Query module Request = struct type t = { pusher : Pusher . t ; append : bool option } [ @@ deriving accessor ] let encoding = let to_tuple t = t . pusher , t . append in let of_tuple v = let pusher , append = v in { pusher ; append } in let with_tuple = merge_objs Pusher . enc...
module Action = struct module Tweak = struct type t = { tweak : string ; value : Ezjsonm . value option } [ @@ deriving accessor ] let encoding = let to_tuple t = t . tweak , t . value in let of_tuple v = let tweak , value = v in { tweak ; value } in let with_tuple = obj2 ( req " set_tweak " string ) ( opt " value " an...
module Push_condition = struct type t = { kind : string ; key : string option ; pattern : string option ; is : string option ; } [ @@ deriving accessor ] let encoding = let to_tuple t = t . kind , t . key , t . pattern , t . is in let of_tuple v = let kind , key , pattern , is = v in { kind ; key ; pattern ; is } in le...
type t = { actions : Action . t list ; default : bool ; enabled : bool ; rule_id : string ; conditions : Push_condition . t list option ; pattern : string option ; }
let encoding = let to_tuple t = t . actions , t . default , t . enabled , t . rule_id , t . conditions , t . pattern in let of_tuple v = let actions , default , enabled , rule_id , conditions , pattern = v in { actions ; default ; enabled ; rule_id ; conditions ; pattern } in let with_tuple = obj6 ( req " actions " ( l...
module Kind = struct type t = Override | Underride | Sender | Room | Content let to_string = function | Override -> " override " | Underride -> " underride " | Sender -> " sender " | Room -> " room " | Content -> " content " end
module Get_all = struct module Query = Empty . Query module Response = struct type t = { content : Push_rule . t list option ; override : Push_rule . t list option ; room : Push_rule . t list option ; sender : Push_rule . t list option ; underride : Push_rule . t list option ; } [ @@ deriving accessor ] let encoding = ...
module Get = struct module Query = Empty . Query module Response = struct type t = { push_rules : Push_rule . t } [ @@ deriving accessor ] let encoding = let to_tuple t = t . push_rules in let of_tuple v = let push_rules = v in { push_rules } in let with_tuple = Push_rule . encoding in conv to_tuple of_tuple with_tuple...
module Delete = struct module Query = Empty . Query module Request = Empty . Json module Response = Empty . Json end
module Put = struct module Query = struct type t = { before : string option ; after : string option } [ @@ deriving accessor ] let args t = let l = [ ] in let l = match t . before with | None -> l | Some before -> ( " before " , [ before ] ) :: l in let l = match t . after with None -> l | Some after -> ( " after " , [...
module Get_enabled = struct module Query = Empty . Query module Response = struct type t = { enabled : bool } [ @@ deriving accessor ] let encoding = let to_tuple t = t . enabled in let of_tuple v = let enabled = v in { enabled } in let with_tuple = obj1 ( req " enabled " bool ) in conv to_tuple of_tuple with_tuple end...
module Set_enabled = struct module Query = Empty . Query module Request = struct type t = { enabled : bool } [ @@ deriving accessor ] let encoding = let to_tuple t = t . enabled in let of_tuple v = let enabled = v in { enabled } in let with_tuple = obj1 ( req " enabled " bool ) in conv to_tuple of_tuple with_tuple end ...
module Get_actions = struct module Query = Empty . Query module Response = struct type t = { actions : string list } [ @@ deriving accessor ] let encoding = let to_tuple t = t . actions in let of_tuple v = let actions = v in { actions } in let with_tuple = obj1 ( req " actions " ( list string ) ) in conv to_tuple of_tu...
module Set_actions = struct module Query = Empty . Query module Request = struct type t = { actions : string list } [ @@ deriving accessor ] let encoding = let to_tuple t = t . actions in let of_tuple v = let actions = v in { actions } in let with_tuple = obj1 ( req " actions " ( list string ) ) in conv to_tuple of_tup...
let option_to_string = Option . value ~ default " :< none " >
let hex_of_string = String . concat_map ~ f ( : fun c -> sprintf " % X " ( Char . to_int c ) )
let print_usermeta content = let module U = Riakc . Robj . Usermeta in List . iter ~ f ( : fun u -> printf " USERMETA : % s = % s \ n " ( U . key u ) ( option_to_string ( U . value u ) ) ) ( Riakc . Robj . Content . usermeta content )
let print_indices content = let module I = Riakc . Robj . Index in let index_value_to_string = function | I . String s -> " String " ^ s | I . Integer i -> " Integer " ^ ( Int . to_string i ) | I . Bad_int s -> " Bad_int " ^ s | I . Unknown s -> " Unknown " ^ s in List . iter ~ f ( : fun i -> printf " INDEX : % s = % s...
let print_value content = let value = Riakc . Robj . Content . value content in List . iter ~ f ( : printf " CONTENT : % s \ n " ) ( String . split ~ on ' :\ n ' value )
let print_contents = List . iter ~ f ( : fun content -> let module C = Riakc . Robj . Content in printf " CONTENT_TYPE : % s \ n " ( option_to_string ( C . content_type content ) ) ; printf " CHARSET : % s \ n " ( option_to_string ( C . charset content ) ) ; printf " CONTENT_ENCODING : % s \ n " ( option_to_string ( C ...
let fail s = printf " % s \ n " s ; shutdown 1
let parse_index s = let module R = Riakc . Robj in match String . lsplit2 ~ on ' ' :: s with | Some ( " bin " , kv ) -> begin match String . lsplit2 ~ on ' ' :: kv with end | Some ( " int " , kv ) -> begin match String . lsplit2 ~ on ' ' :: kv with end | _ -> failwith ( " Bad index : " ^ s )
let rec add_2i r idx = if idx < Array . length Sys . argv then let module R = Riakc . Robj in let content = List . hd_exn ( R . contents r ) in let indices = R . Content . indices content in add_2i ( R . set_content ( idx + 1 ) else r
let exec ( ) = let host = Sys . argv . ( 1 ) in let port = Int . of_string Sys . argv . ( 2 ) in let b = Sys . argv . ( 3 ) in let k = Sys . argv . ( 4 ) in let v = Sys . argv . ( 5 ) in Riakc . Conn . with_conn ~ host ~ port ( fun c -> let module R = Riakc . Robj in let robj = R . create ( R . Content . create v ) in ...
let eval ( ) = exec ( ) >>| function | Ok ( robj , _ ) -> begin let module R = Riakc . Robj in let vclock = in printf " VCLOCK : % s \ n " vclock ; print_contents ( R . contents robj ) ; shutdown 0 end | Error ` Bad_conn -> fail " Bad_conn " | Error ` Bad_payload -> fail " Bad_payload " | Error ` Incomplete_payload -> ...
let ( ) = ignore ( eval ( ) ) ; never_returns ( Scheduler . go ( ) )
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2010 - 08 - 01 " ] ) ; ( " Action " , [ " PutDashboard " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query . render ( ...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " PutDashboardResponse " ( snd xml ) ) ( Xml . member " PutDashboardResult " ) in try Util . or_error ( Util . option_bind resp PutDashboardOutput . parse ) ( let open Error in BadResponse { body ; message = " Cou...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | None -> None
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2013 - 11 - 01 " ] ) ; ( " Action " , [ " PutEventSelectors " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query . rend...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " PutEventSelectorsResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp PutEventSelectorsResponse . parse ) ( let open Error in BadResponse { body ; message = " Could not find well formed PutEventSelectorsResponse ....
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | None -> None
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2013 - 11 - 01 " ] ) ; ( " Action " , [ " PutInsightSelectors " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query . re...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " PutInsightSelectorsResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp PutInsightSelectorsResponse . parse ) ( let open Error in BadResponse { body ; message = " Could not find well formed PutInsightSelectorsResp...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | None -> None
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2011 - 01 - 01 " ] ) ; ( " Action " , [ " PutScalingPolicy " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query . rende...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " PutScalingPolicyResponse " ( snd xml ) ) ( Xml . member " PutScalingPolicyResult " ) in try Util . or_error ( Util . option_bind resp PolicyARNType . parse ) ( let open Error in BadResponse { body ; message = " ...
let parse_error code err = let errors = [ Errors_internal . ResourceContention ; Errors_internal . LimitExceeded ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> t...