From 51b0067cbf870a034dd9a2ae10567b8ae27fac37 Mon Sep 17 00:00:00 2001 From: Peter Mondlock Date: Fri, 22 Feb 2019 17:55:57 -0600 Subject: [PATCH 01/12] update aws mli to support transforming hashtbl keys; add sqs support; fix bug in generator for mapping enums --- Makefile | 1 + aws_sqs.opam | 18 ++++++++++++++++++ input/sqs/latest | 1 + lib/aws.ml | 27 +++++++++++++++++++++++---- src/generate.ml | 24 ++++++++++++++++++------ 5 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 aws_sqs.opam create mode 120000 input/sqs/latest diff --git a/Makefile b/Makefile index a6c0c2dc6..520a826d4 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ LIBRARIES := \ aws-s3 \ aws-ec2 \ aws-route53 \ + aws-sqs \ .PHONY: $(LIBRARIES) $(LIBRARIES): aws-%: diff --git a/aws_sqs.opam b/aws_sqs.opam new file mode 100644 index 000000000..38e60b304 --- /dev/null +++ b/aws_sqs.opam @@ -0,0 +1,18 @@ +opam-version: "2.0" +maintainer: "Spiros Eliopoulos " +authors: [ "Spiros Eliopoulos " + "Daniel Patterson " ] +synopsis: "Amazon Web Services SDK bindings to SQS" +description: "Amazon Web Services SDK bindings to SQS" +license: "BSD-3-clause" +homepage: "https://github.com/inhabitedtype/ocaml-aws" +dev-repo: "git+https://github.com/inhabitedtype/ocaml-aws.git" +bug-reports: "https://github.com/inhabitedtype/ocaml-aws/issues" +build: [ + ["dune" "subst"] {pinned} + ["dune" "build" "-p" name "-j" jobs] +] +depends: [ + "aws" {>= "0.1.0"} + "dune" {build} +] diff --git a/input/sqs/latest b/input/sqs/latest new file mode 120000 index 000000000..0f3e2a3d2 --- /dev/null +++ b/input/sqs/latest @@ -0,0 +1 @@ +2012-11-05/ \ No newline at end of file diff --git a/lib/aws.ml b/lib/aws.ml index 583d4eaf4..82525e79e 100644 --- a/lib/aws.ml +++ b/lib/aws.ml @@ -232,9 +232,9 @@ module Query = struct let i = ref 0 in List (List.map (fun v -> i := !i + 1; Pair (string_of_int !i, to_query v)) vals) - let to_query_hashtbl to_query tbl = + let to_query_hashtbl key_to_str to_query tbl = List (Hashtbl.fold - (fun k v acc -> (Pair (k, to_query v)) :: acc) tbl []) + (fun k v acc -> (Pair (key_to_str k, to_query v)) :: acc) tbl []) end @@ -254,10 +254,10 @@ module Json = struct | `List l -> List.map f l | t -> raise (Casting_error("list", t)) - let to_hashtbl f = function + let to_hashtbl key_f f = function | `Assoc m -> List.fold_left - (fun acc (k,v) -> Hashtbl.add acc k (f v); acc) + (fun acc (k,v) -> Hashtbl.add acc (key_f k) (f v); acc) (Hashtbl.create (List.length m)) m | t -> raise (Casting_error("map", t)) @@ -279,6 +279,8 @@ module BaseTypes = struct val of_json : Json.t -> t val to_query : t -> Query.t val parse : Ezxmlm.nodes -> t option + val to_string : t -> string + val of_string : string -> t end module Unit = struct @@ -291,6 +293,8 @@ module BaseTypes = struct let to_query () = List [] let parse _ = Some () (* XXX(seliopou): Should never be used, maybe assert that? *) + let to_string _ = raise (Failure("unit")) + let of_string _ = raise (Failure("unit")) end module String = struct @@ -302,6 +306,8 @@ module BaseTypes = struct | t -> raise (Json.Casting_error("string", t)) let to_query s = Value (Some s) let parse s = Some (data_to_string s) + let to_string s = s + let of_string s = s end (* NOTE(dbp 2015-01-15): In EC2, Blobs seem to be used for Base64 @@ -328,6 +334,13 @@ module BaseTypes = struct | "true" -> Some true | _ -> None end + let to_string b = + if b then "true" else "false" + let of_string s = + match String.lowercase_ascii s with + | "false" -> false + | "true" -> true + | _ -> raise (Failure("Bad boolean string " ^ s)) end module Integer = struct @@ -342,6 +355,8 @@ module BaseTypes = struct match String.parse i with | None -> None | Some s -> try Some(int_of_string s) with Failure _ -> None + let to_string i = string_of_int i + let of_string s = int_of_string s end module Long = Integer @@ -358,6 +373,8 @@ module BaseTypes = struct match String.parse f with | None -> None | Some s -> try Some(float_of_string s) with Failure _ -> None + let to_string f = string_of_float f + let of_string s = float_of_string s end module Double = Float @@ -371,6 +388,8 @@ module BaseTypes = struct match String.parse c with | None -> None | Some s -> try Some(Time.parse s) with Invalid_argument _ -> None + let to_string c = Time.format c + let of_string s = Time.parse s end end diff --git a/src/generate.ml b/src/generate.ml index 65a2d396f..e658fa57f 100644 --- a/src/generate.ml +++ b/src/generate.ml @@ -123,7 +123,19 @@ let types is_ec2 shapes = | Shape.Enum opts -> [let_ "str_to_t" (list (List.map (fun o -> pair (str o) (ident (Util.to_variant_name o))) opts)); let_ "t_to_str" - (list (List.map (fun o -> pair (ident (Util.to_variant_name o)) (str o)) opts)) + (list (List.map (fun o -> pair (ident (Util.to_variant_name o)) (str o)) opts)); + let_ "to_string" + (fun_ "e" + (app1 "Util.of_option_exn" + (app2 "Util.list_find" + (ident "t_to_str") + (ident "e")))); + let_ "of_string" + (fun_ "s" + (app1 "Util.of_option_exn" + (app2 "Util.list_find" + (ident "str_to_t") + (ident "s")))) ] | _ -> [] in @@ -203,8 +215,8 @@ let types is_ec2 shapes = (fun_ "f" (q (ident "f"))))) s)))) | Shape.List (shp,_) -> (app2 "Query.to_query_list" (ident (shp ^ ".to_query")) (ident "v")) - | Shape.Map ((shp,_),_) -> - (app2 "Query.to_query_hashtbl" (ident (shp ^ ".to_query")) (ident "v")) + | Shape.Map ((key_shp,_),(val_shp,_)) -> + (app3 "Query.to_query_hashtbl" (ident (key_shp ^ ".to_string")) (ident (val_shp ^ ".to_query")) (ident "v")) | Shape.Enum _ -> (app1 "Query.Value" (app1 "Some" @@ -237,11 +249,11 @@ let types is_ec2 shapes = (app2 "List.map" (ident (shp ^ ".to_json")) (ident "v"))) - | Shape.Map ((_,_),_) -> + | Shape.Map ((key_shp,_),(val_shp,_)) -> (variant1 "Assoc" (app3 "Hashtbl.fold" (fun3 "k" "v" "acc" - (list_expr (pair (ident "k") (app1 "String.to_json" (ident "v"))) (ident "acc"))) + (list_expr (pair (app1 (key_shp ^ ".to_string") (ident "k")) (app1 (val_shp ^ ".to_json") (ident "v"))) (ident "acc"))) (ident "v") (list []))) | Shape.Enum _ -> @@ -269,7 +281,7 @@ let types is_ec2 shapes = (app2 "Json.lookup" (ident "j") (str mem.Structure.field_name)))) s) | Shape.List (shp,_) -> app2 "Json.to_list" (ident (shp ^ ".of_json")) (ident "j") - | Shape.Map ((_kshp,_),(vshp,_)) -> app2 "Json.to_hashtbl" (ident (vshp ^ ".of_json")) (ident "j") + | Shape.Map ((key_shp,_),(val_shp,_)) -> app3 "Json.to_hashtbl" (ident (key_shp ^ ".of_string")) (ident (val_shp ^ ".of_json")) (ident "j") | Shape.Enum _ -> (app1 "Util.of_option_exn" (app2 "Util.list_find" From 0b484901e6c0773e04125d44b2457b0631429202 Mon Sep 17 00:00:00 2001 From: Peter Mondlock Date: Wed, 27 Feb 2019 19:54:53 -0600 Subject: [PATCH 02/12] wip: endpoint generator --- .gitignore | 1 + Makefile | 5 + endpoint-gen.opam | 25 ++ lib/aws.ml | 1 + lib/aws.mli | 7 +- src/aws_gen.ml | 4 +- src/constraint_adapter.ml | 12 + src/dune | 8 +- src/endpoint_gen.ml | 47 +++ src/endpoints.atd | 23 ++ src/endpoints_j.ml | 636 ++++++++++++++++++++++++++++++++++++++ src/endpoints_j.mli | 162 ++++++++++ src/endpoints_t.ml | 18 ++ src/endpoints_t.mli | 18 ++ src/reading.ml | 2 +- src/reading.mli | 6 +- 16 files changed, 963 insertions(+), 12 deletions(-) create mode 100644 endpoint-gen.opam create mode 100644 src/constraint_adapter.ml create mode 100644 src/endpoint_gen.ml create mode 100644 src/endpoints.atd create mode 100644 src/endpoints_j.ml create mode 100644 src/endpoints_j.mli create mode 100644 src/endpoints_t.ml create mode 100644 src/endpoints_t.mli diff --git a/.gitignore b/.gitignore index 2e95a1aa0..ea4f85a97 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ libraries/**/*.install lib/**/.merlin .envrc **/.merlin +.idea diff --git a/Makefile b/Makefile index 520a826d4..abb2aa89a 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,11 @@ uninstall: clean: rm -rf _build *.install +.PHONY: endpoints + +endpoints: + dune exec endpoint-gen -- -i input/_endpoints.json -o libraries + aws-ec2: dune exec aws-gen -- --is-ec2 -i input/ec2/latest/service-2.json -r input/ec2/overrides.json -e input/errors.json -o libraries diff --git a/endpoint-gen.opam b/endpoint-gen.opam new file mode 100644 index 000000000..473de6e08 --- /dev/null +++ b/endpoint-gen.opam @@ -0,0 +1,25 @@ +opam-version: "2.0" +maintainer: "Spiros Eliopoulos " +authors: [ "Spiros Eliopoulos " + "Daniel Patterson " ] +synopsis: "Amazon Web Services code generator" +description: "Amazon Web Services code generator - Builds OCaml bindings for AWS using botocore API definition" +license: "BSD-3-clause" +homepage: "https://github.com/inhabitedtype/ocaml-aws" +dev-repo: "git+https://github.com/inhabitedtype/ocaml-aws.git" +bug-reports: "https://github.com/inhabitedtype/ocaml-aws/issues" +build: [ + # ["dune" "subst"] {pinned} + ["dune" "build" "-p" name "-j" jobs] +] +depends: [ + "atdgen" + "yojson" + "base-unix" + "cmdliner" + "ppx_tools_versioned" + "yojson" + "ocaml-migrate-parsetree" + "ocamlgraph" + "dune" {build} +] diff --git a/lib/aws.ml b/lib/aws.ml index 82525e79e..5760d3fc2 100644 --- a/lib/aws.ml +++ b/lib/aws.ml @@ -186,6 +186,7 @@ module type Call = sig type error val service : string + (*val region : string*) val to_http : input -> Request.t val of_http : string -> [`Ok of output | `Error of error Error.error_response] val parse_error : int -> string -> error option diff --git a/lib/aws.mli b/lib/aws.mli index 873c1d5d6..59483d7b3 100644 --- a/lib/aws.mli +++ b/lib/aws.mli @@ -125,6 +125,9 @@ module type Call = sig signing, and to determine the endpoint to send the request. *) val service : string + (** The AWS region for the call. *) + (*val region : string*) + (** This function converts the native input into the HTTP request type. In particular, it is responsible for properly encoding the request type into query format. It also sets the Action and @@ -217,9 +220,9 @@ module Xml : sig end (** This module contains a Json type (compatible with - Yojson.Basic.json) and helpers. *) + Yojson.Basic.t) and helpers. *) module Json : sig - (** Json type. This is compatible with Yojson.Basic.json *) + (** Json type. This is compatible with Yojson.Basic.t *) type t = [ `Assoc of (string * t) list | `Bool of bool diff --git a/src/aws_gen.ml b/src/aws_gen.ml index bfe8ef75c..aee2c7ace 100644 --- a/src/aws_gen.ml +++ b/src/aws_gen.ml @@ -54,7 +54,7 @@ module Json = struct let lookup_list field assoc = try to_list (List.assoc field assoc) with _ -> [] - let rec merge (orig:Yojson.Basic.json) (extra:Yojson.Basic.json) : Yojson.Basic.json = + let rec merge (orig:Yojson.Basic.t) (extra:Yojson.Basic.t) : Yojson.Basic.t = match orig, extra with | `Assoc os, `Assoc es -> let upd_ = List.map (fun (ok, ov) -> @@ -75,7 +75,7 @@ module Json = struct then (key, default) :: assoc else result - let override_shapes original overrides : (string * Yojson.Basic.json) list = + let override_shapes original overrides : (string * Yojson.Basic.t) list = let open Yojson.Basic.Util in List.map (fun (key, val_) -> try diff --git a/src/constraint_adapter.ml b/src/constraint_adapter.ml new file mode 100644 index 000000000..2210a1333 --- /dev/null +++ b/src/constraint_adapter.ml @@ -0,0 +1,12 @@ +module StringList = struct + open Yojson.Safe + + let normalize (src: json) = match src with + | `Null -> `Assoc [("data", `List [])] + | `String s -> `Assoc [("data", `List [ `String s ])] + | `List l -> `Assoc [("data", `List l)] + | _ -> src (* malformed *) + + let restore (src: json) = Obj.magic src +end + diff --git a/src/dune b/src/dune index 60043f1de..3bc191d45 100644 --- a/src/dune +++ b/src/dune @@ -1,8 +1,8 @@ -(executable - (name aws_gen) - (public_name aws-gen) +(executables + (names aws_gen endpoint_gen) + (public_names aws-gen endpoint-gen) (package aws-gen) (preprocess (pps ppx_tools_versioned.metaquot_404)) (libraries yojson cmdliner unix ppx_tools_versioned - ocaml-migrate-parsetree ocamlgraph)) + ocaml-migrate-parsetree ocamlgraph atdgen)) diff --git a/src/endpoint_gen.ml b/src/endpoint_gen.ml new file mode 100644 index 000000000..6fe6bb265 --- /dev/null +++ b/src/endpoint_gen.ml @@ -0,0 +1,47 @@ +open Cmdliner +open Util + +let () a b = Filename.concat a b +let log s = Printf.eprintf (s ^^ "\n%!") + +let write_endpoints (_endpoints: Endpoints_t.endpoint list) = [Syntax.( + let_ "endpoint_of" + (fun_ "q" + (app1 "print_endline" (ident "q"))))] + + +let main input outdir = + log "Start processing endpoints"; + let inc = open_in input in + let n = in_channel_length inc in + let endpoint_data = really_input_string inc n in + let endpoints = Endpoints_j.endpoints_of_string endpoint_data in + endpoints |> List.iter (fun (name, (endpoints: Endpoints_t.endpoint list)) -> + print_endline ("service: " ^ name); + let outfile = outdir (name ^ "_endpoints.ml") in + let syntax = write_endpoints endpoints in + Printing.write_structure outfile syntax; + ); + close_in inc; + () + +module CommandLine = struct + let input = + let doc = "JSON file specifying AWS endpoints to generate" in + Arg.(required & opt (some non_dir_file) None & info ["i"; "input-file"] ~docv:"Filename" ~doc) + + let outdir = + let doc = "directory where generated library should be put" in + Arg.(required & opt (some dir) None & info ["o"; "output-directory"] ~docv:"Directory" ~doc) + + let gen_t = Term.(pure main $ input $ outdir) + + let info = + let doc = "Generate the endpoints mapping for AWS resources." in + Term.info "endpoint-gen" ~version:"0.0.1" ~doc +end + +let () = + match Term.eval CommandLine.(gen_t, info) with + | `Error _ -> exit 1 + | _ -> exit 0 diff --git a/src/endpoints.atd b/src/endpoints.atd new file mode 100644 index 000000000..959cc7def --- /dev/null +++ b/src/endpoints.atd @@ -0,0 +1,23 @@ +type raw_json = abstract + +type constraint_on = [ | REGION ] + +type constraint_op = [ + | STARTS_WITH + | NOT_EQUALS + | EQUALS + | ONE_OF + | NOT_STARTS_WITH ] + +type constraint_data = { + data : string nullable list +} + +type constraint_ = (constraint_on * constraint_op * constraint_data) + +type endpoint = { + uri: string; + ?constraints: constraint_ list option +} + +type endpoints = (string * endpoint list) list \ No newline at end of file diff --git a/src/endpoints_j.ml b/src/endpoints_j.ml new file mode 100644 index 000000000..cfdd1b1ec --- /dev/null +++ b/src/endpoints_j.ml @@ -0,0 +1,636 @@ +(* Auto-generated from "endpoints.atd" *) +[@@@ocaml.warning "-27-32-35-39"] + +type raw_json = Yojson.Safe.json + +type constraint_op = Endpoints_t.constraint_op + +type constraint_on = Endpoints_t.constraint_on + +type constraint_data = Endpoints_t.constraint_data = { + data: string option list +} + +type constraint_ = Endpoints_t.constraint_ + +type endpoint = Endpoints_t.endpoint = { + uri: string; + constraints: constraint_ list option +} + +type endpoints = Endpoints_t.endpoints + +let write_raw_json = ( + Yojson.Safe.write_json +) +let string_of_raw_json ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write_raw_json ob x; + Bi_outbuf.contents ob +let read_raw_json = ( + Yojson.Safe.read_json +) +let raw_json_of_string s = + read_raw_json (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_constraint_op = ( + fun ob x -> + match x with + | `STARTS_WITH -> Bi_outbuf.add_string ob "\"startsWith\"" + | `NOT_EQUALS -> Bi_outbuf.add_string ob "\"notEquals\"" + | `EQUALS -> Bi_outbuf.add_string ob "\"equals\"" + | `ONE_OF -> Bi_outbuf.add_string ob "\"oneOf\"" + | `NOT_STARTS_WITH -> Bi_outbuf.add_string ob "\"notStartsWith\"" +) +let string_of_constraint_op ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write_constraint_op ob x; + Bi_outbuf.contents ob +let read_constraint_op = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "startsWith" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `STARTS_WITH + | "notEquals" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `NOT_EQUALS + | "equals" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `EQUALS + | "oneOf" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `ONE_OF + | "notStartsWith" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `NOT_STARTS_WITH + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "startsWith" -> + `STARTS_WITH + | "notEquals" -> + `NOT_EQUALS + | "equals" -> + `EQUALS + | "oneOf" -> + `ONE_OF + | "notStartsWith" -> + `NOT_STARTS_WITH + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let constraint_op_of_string s = + read_constraint_op (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_constraint_on = ( + fun ob x -> + match x with + | `REGION -> Bi_outbuf.add_string ob "\"region\"" +) +let string_of_constraint_on ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write_constraint_on ob x; + Bi_outbuf.contents ob +let read_constraint_on = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "region" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `REGION + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "region" -> + `REGION + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let constraint_on_of_string s = + read_constraint_on (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__1 = ( + Atdgen_runtime.Oj_run.write_nullable ( + Yojson.Safe.write_string + ) +) +let string_of__1 ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write__1 ob x; + Bi_outbuf.contents ob +let read__1 = ( + fun p lb -> + Yojson.Safe.read_space p lb; + (if Yojson.Safe.read_null_if_possible p lb then None + else Some (( + Atdgen_runtime.Oj_run.read_string + ) p lb) : _ option) +) +let _1_of_string s = + read__1 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__2 = ( + Atdgen_runtime.Oj_run.write_list ( + write__1 + ) +) +let string_of__2 ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write__2 ob x; + Bi_outbuf.contents ob +let read__2 = ( + Atdgen_runtime.Oj_run.read_list ( + read__1 + ) +) +let _2_of_string s = + read__2 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_constraint_data : _ -> constraint_data -> _ = ( + Atdgen_runtime.Oj_run.write_with_adapter Constraint_adapter.StringList.restore ( + fun ob x -> + Bi_outbuf.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"data\":"; + ( + write__2 + ) + ob x.data; + Bi_outbuf.add_char ob '}'; + ) +) +let string_of_constraint_data ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write_constraint_data ob x; + Bi_outbuf.contents ob +let read_constraint_data = ( + Atdgen_runtime.Oj_run.read_with_adapter Constraint_adapter.StringList.normalize ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_data = ref (Obj.magic (Sys.opaque_identity 0.0)) in + let bits0 = ref 0 in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + if len = 4 && String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( + 0 + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_data := ( + ( + read__2 + ) p lb + ); + bits0 := !bits0 lor 0x1; + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + if len = 4 && String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( + 0 + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_data := ( + ( + read__2 + ) p lb + ); + bits0 := !bits0 lor 0x1; + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + if !bits0 <> 0x1 then Atdgen_runtime.Oj_run.missing_fields p [| !bits0 |] [| "data" |]; + ( + { + data = !field_data; + } + : constraint_data) + ) + ) +) +let constraint_data_of_string s = + read_constraint_data (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_constraint_ = ( + fun ob x -> + Bi_outbuf.add_char ob '['; + (let x, _, _ = x in + ( + write_constraint_on + ) ob x + ); + Bi_outbuf.add_char ob ','; + (let _, x, _ = x in + ( + write_constraint_op + ) ob x + ); + Bi_outbuf.add_char ob ','; + (let _, _, x = x in + ( + write_constraint_data + ) ob x + ); + Bi_outbuf.add_char ob ']'; +) +let string_of_constraint_ ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write_constraint_ ob x; + Bi_outbuf.contents ob +let read_constraint_ = ( + fun p lb -> + Yojson.Safe.read_space p lb; + let std_tuple = Yojson.Safe.start_any_tuple p lb in + let len = ref 0 in + let end_of_tuple = ref false in + (try + let x0 = + let x = + ( + read_constraint_on + ) p lb + in + incr len; + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + x + in + let x1 = + let x = + ( + read_constraint_op + ) p lb + in + incr len; + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + x + in + let x2 = + let x = + ( + read_constraint_data + ) p lb + in + incr len; + (try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + with Yojson.End_of_tuple -> end_of_tuple := true); + x + in + if not !end_of_tuple then ( + try + while true do + Yojson.Safe.skip_json p lb; + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + done + with Yojson.End_of_tuple -> () + ); + (x0, x1, x2) + with Yojson.End_of_tuple -> + Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); +) +let constraint__of_string s = + read_constraint_ (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__3 = ( + Atdgen_runtime.Oj_run.write_list ( + write_constraint_ + ) +) +let string_of__3 ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write__3 ob x; + Bi_outbuf.contents ob +let read__3 = ( + Atdgen_runtime.Oj_run.read_list ( + read_constraint_ + ) +) +let _3_of_string s = + read__3 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__4 = ( + Atdgen_runtime.Oj_run.write_std_option ( + write__3 + ) +) +let string_of__4 ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write__4 ob x; + Bi_outbuf.contents ob +let read__4 = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read__3 + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read__3 + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _4_of_string s = + read__4 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_endpoint : _ -> endpoint -> _ = ( + fun ob x -> + Bi_outbuf.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"uri\":"; + ( + Yojson.Safe.write_string + ) + ob x.uri; + (match x.constraints with None -> () | Some x -> + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"constraints\":"; + ( + write__3 + ) + ob x; + ); + Bi_outbuf.add_char ob '}'; +) +let string_of_endpoint ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write_endpoint ob x; + Bi_outbuf.contents ob +let read_endpoint = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_uri = ref (Obj.magic (Sys.opaque_identity 0.0)) in + let field_constraints = ref (None) in + let bits0 = ref 0 in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + match len with + | 3 -> ( + if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' then ( + 0 + ) + else ( + -1 + ) + ) + | 11 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 's' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_uri := ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ); + bits0 := !bits0 lor 0x1; + | 1 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_constraints := ( + Some ( + ( + read__3 + ) p lb + ) + ); + ) + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + match len with + | 3 -> ( + if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' then ( + 0 + ) + else ( + -1 + ) + ) + | 11 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 's' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_uri := ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ); + bits0 := !bits0 lor 0x1; + | 1 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_constraints := ( + Some ( + ( + read__3 + ) p lb + ) + ); + ) + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + if !bits0 <> 0x1 then Atdgen_runtime.Oj_run.missing_fields p [| !bits0 |] [| "uri" |]; + ( + { + uri = !field_uri; + constraints = !field_constraints; + } + : endpoint) + ) +) +let endpoint_of_string s = + read_endpoint (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__5 = ( + Atdgen_runtime.Oj_run.write_list ( + write_endpoint + ) +) +let string_of__5 ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write__5 ob x; + Bi_outbuf.contents ob +let read__5 = ( + Atdgen_runtime.Oj_run.read_list ( + read_endpoint + ) +) +let _5_of_string s = + read__5 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__6 = ( + Atdgen_runtime.Oj_run.write_assoc_list ( + Yojson.Safe.write_string + ) ( + write__5 + ) +) +let string_of__6 ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write__6 ob x; + Bi_outbuf.contents ob +let read__6 = ( + Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_runtime.Oj_run.read_string + ) ( + read__5 + ) +) +let _6_of_string s = + read__6 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_endpoints = ( + write__6 +) +let string_of_endpoints ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write_endpoints ob x; + Bi_outbuf.contents ob +let read_endpoints = ( + read__6 +) +let endpoints_of_string s = + read_endpoints (Yojson.Safe.init_lexer ()) (Lexing.from_string s) diff --git a/src/endpoints_j.mli b/src/endpoints_j.mli new file mode 100644 index 000000000..632de867f --- /dev/null +++ b/src/endpoints_j.mli @@ -0,0 +1,162 @@ +(* Auto-generated from "endpoints.atd" *) +[@@@ocaml.warning "-27-32-35-39"] + +type raw_json = Yojson.Safe.json + +type constraint_op = Endpoints_t.constraint_op + +type constraint_on = Endpoints_t.constraint_on + +type constraint_data = Endpoints_t.constraint_data = { + data: string option list +} + +type constraint_ = Endpoints_t.constraint_ + +type endpoint = Endpoints_t.endpoint = { + uri: string; + constraints: constraint_ list option +} + +type endpoints = Endpoints_t.endpoints + +val write_raw_json : + Bi_outbuf.t -> raw_json -> unit + (** Output a JSON value of type {!raw_json}. *) + +val string_of_raw_json : + ?len:int -> raw_json -> string + (** Serialize a value of type {!raw_json} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_raw_json : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> raw_json + (** Input JSON data of type {!raw_json}. *) + +val raw_json_of_string : + string -> raw_json + (** Deserialize JSON data of type {!raw_json}. *) + +val write_constraint_op : + Bi_outbuf.t -> constraint_op -> unit + (** Output a JSON value of type {!constraint_op}. *) + +val string_of_constraint_op : + ?len:int -> constraint_op -> string + (** Serialize a value of type {!constraint_op} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_constraint_op : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> constraint_op + (** Input JSON data of type {!constraint_op}. *) + +val constraint_op_of_string : + string -> constraint_op + (** Deserialize JSON data of type {!constraint_op}. *) + +val write_constraint_on : + Bi_outbuf.t -> constraint_on -> unit + (** Output a JSON value of type {!constraint_on}. *) + +val string_of_constraint_on : + ?len:int -> constraint_on -> string + (** Serialize a value of type {!constraint_on} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_constraint_on : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> constraint_on + (** Input JSON data of type {!constraint_on}. *) + +val constraint_on_of_string : + string -> constraint_on + (** Deserialize JSON data of type {!constraint_on}. *) + +val write_constraint_data : + Bi_outbuf.t -> constraint_data -> unit + (** Output a JSON value of type {!constraint_data}. *) + +val string_of_constraint_data : + ?len:int -> constraint_data -> string + (** Serialize a value of type {!constraint_data} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_constraint_data : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> constraint_data + (** Input JSON data of type {!constraint_data}. *) + +val constraint_data_of_string : + string -> constraint_data + (** Deserialize JSON data of type {!constraint_data}. *) + +val write_constraint_ : + Bi_outbuf.t -> constraint_ -> unit + (** Output a JSON value of type {!constraint_}. *) + +val string_of_constraint_ : + ?len:int -> constraint_ -> string + (** Serialize a value of type {!constraint_} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_constraint_ : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> constraint_ + (** Input JSON data of type {!constraint_}. *) + +val constraint__of_string : + string -> constraint_ + (** Deserialize JSON data of type {!constraint_}. *) + +val write_endpoint : + Bi_outbuf.t -> endpoint -> unit + (** Output a JSON value of type {!endpoint}. *) + +val string_of_endpoint : + ?len:int -> endpoint -> string + (** Serialize a value of type {!endpoint} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_endpoint : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> endpoint + (** Input JSON data of type {!endpoint}. *) + +val endpoint_of_string : + string -> endpoint + (** Deserialize JSON data of type {!endpoint}. *) + +val write_endpoints : + Bi_outbuf.t -> endpoints -> unit + (** Output a JSON value of type {!endpoints}. *) + +val string_of_endpoints : + ?len:int -> endpoints -> string + (** Serialize a value of type {!endpoints} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_endpoints : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> endpoints + (** Input JSON data of type {!endpoints}. *) + +val endpoints_of_string : + string -> endpoints + (** Deserialize JSON data of type {!endpoints}. *) + diff --git a/src/endpoints_t.ml b/src/endpoints_t.ml new file mode 100644 index 000000000..6cd611aa7 --- /dev/null +++ b/src/endpoints_t.ml @@ -0,0 +1,18 @@ +(* Auto-generated from "endpoints.atd" *) + [@@@ocaml.warning "-27-32-35-39"] + +type raw_json = Yojson.Safe.json + +type constraint_op = [ + `STARTS_WITH | `NOT_EQUALS | `EQUALS | `ONE_OF | `NOT_STARTS_WITH +] + +type constraint_on = [ `REGION ] + +type constraint_data = { data: string option list } + +type constraint_ = (constraint_on * constraint_op * constraint_data) + +type endpoint = { uri: string; constraints: constraint_ list option } + +type endpoints = (string * endpoint list) list diff --git a/src/endpoints_t.mli b/src/endpoints_t.mli new file mode 100644 index 000000000..6cd611aa7 --- /dev/null +++ b/src/endpoints_t.mli @@ -0,0 +1,18 @@ +(* Auto-generated from "endpoints.atd" *) + [@@@ocaml.warning "-27-32-35-39"] + +type raw_json = Yojson.Safe.json + +type constraint_op = [ + `STARTS_WITH | `NOT_EQUALS | `EQUALS | `ONE_OF | `NOT_STARTS_WITH +] + +type constraint_on = [ `REGION ] + +type constraint_data = { data: string option list } + +type constraint_ = (constraint_on * constraint_op * constraint_data) + +type endpoint = { uri: string; constraints: constraint_ list option } + +type endpoints = (string * endpoint list) list diff --git a/src/reading.ml b/src/reading.ml index ff82240c4..eaeab6209 100644 --- a/src/reading.ml +++ b/src/reading.ml @@ -62,7 +62,7 @@ let parse_member rq (mnm, mj) = ; field_name = unreserve (Util.to_field_name mnm) } -let shape ((nm, j) : (string * Yojson.Basic.json)) : Shape.parsed = +let shape ((nm, j) : (string * Yojson.Basic.t)) : Shape.parsed = match Json.member "type" j with | `String "structure" -> let required = diff --git a/src/reading.mli b/src/reading.mli index 9903803f7..dd8662220 100644 --- a/src/reading.mli +++ b/src/reading.mli @@ -31,8 +31,8 @@ POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------*) -val shape : string * Yojson.Basic.json -> Structures.Shape.parsed +val shape : string * Yojson.Basic.t -> Structures.Shape.parsed -val op : string * Yojson.Basic.json -> Structures.Operation.t +val op : string * Yojson.Basic.t -> Structures.Operation.t -val error : string -> Yojson.Basic.json -> Structures.Error.t +val error : string -> Yojson.Basic.t -> Structures.Error.t From d7c3a3dbd332919740ad4112c018b592ced1b7ec Mon Sep 17 00:00:00 2001 From: Peter Mondlock Date: Fri, 1 Mar 2019 06:55:57 -0600 Subject: [PATCH 03/12] wip: endpoint generator --- lib/aws.ml | 3 ++ lib/aws.mli | 2 ++ src/constraint_adapter.ml | 2 +- src/dune | 2 +- src/endpoint_gen.ml | 74 ++++++++++++++++++++++++++++++++------- src/endpoints.atd | 2 -- 6 files changed, 69 insertions(+), 16 deletions(-) diff --git a/lib/aws.ml b/lib/aws.ml index 5760d3fc2..e21593503 100644 --- a/lib/aws.ml +++ b/lib/aws.ml @@ -61,6 +61,9 @@ module Util = struct | [] -> Some [] | (Some v) :: xs -> option_bind (option_all xs) (fun rest -> Some (v :: rest)) | None :: _ -> None + let str_starts_with prefix s = + let re = Str.regexp_case_fold ("^" ^ (prefix ^ ".*")) in + Str.string_partial_match re s 0 end module Xml = struct diff --git a/lib/aws.mli b/lib/aws.mli index 59483d7b3..aa0e60c9a 100644 --- a/lib/aws.mli +++ b/lib/aws.mli @@ -281,6 +281,8 @@ module Util : sig (** If all values in list are Some v, produce Some (list_filter_opt list), else produce None. *) val option_all : 'a option list -> 'a list option + + val str_starts_with : string -> string -> bool end (** This module contains the V4 Authorization header AWS signature diff --git a/src/constraint_adapter.ml b/src/constraint_adapter.ml index 2210a1333..f38caf053 100644 --- a/src/constraint_adapter.ml +++ b/src/constraint_adapter.ml @@ -2,7 +2,7 @@ module StringList = struct open Yojson.Safe let normalize (src: json) = match src with - | `Null -> `Assoc [("data", `List [])] + | `Null -> `Assoc [("data", `List [`Null])] | `String s -> `Assoc [("data", `List [ `String s ])] | `List l -> `Assoc [("data", `List l)] | _ -> src (* malformed *) diff --git a/src/dune b/src/dune index 3bc191d45..ce8c476a4 100644 --- a/src/dune +++ b/src/dune @@ -5,4 +5,4 @@ (preprocess (pps ppx_tools_versioned.metaquot_404)) (libraries yojson cmdliner unix ppx_tools_versioned - ocaml-migrate-parsetree ocamlgraph atdgen)) + ocaml-migrate-parsetree ocamlgraph atdgen str)) diff --git a/src/endpoint_gen.ml b/src/endpoint_gen.ml index 6fe6bb265..c9975960d 100644 --- a/src/endpoint_gen.ml +++ b/src/endpoint_gen.ml @@ -4,26 +4,76 @@ open Util let () a b = Filename.concat a b let log s = Printf.eprintf (s ^^ "\n%!") -let write_endpoints (_endpoints: Endpoints_t.endpoint list) = [Syntax.( - let_ "endpoint_of" - (fun_ "q" - (app1 "print_endline" (ident "q"))))] +let filter_missing = + List.fold_left + (fun a -> function | None -> a | Some s -> List.append [s] a) [] +let endpoint_str_matches uri ss = + let open Syntax in + let ds = ss |> filter_missing in + ds |> (List.map (fun s -> (s, (app1 "Some" (str uri))))) + +let endpoint_str_not_matches uri ss els = Syntax.( + let m = app1 "Some" (str uri) in + let matches = ss |> List.map (function + | None -> ("region", m) + | Some s -> (("Some " ^ s), m)) in + matchvar (ident "region") (List.append matches [("_", els)]) +) + +let endpoint_starts_with uri ss els = + let open Syntax in + let ds = ss |> filter_missing in + ds |> + (List.fold_left + (fun a -> + fun s -> + ifthen (app2 "Aws.Util.str_starts_with" (ident "region") (str s)) + (app1 "Some" (str uri)) a) els) + +let write_constraints uri (cs : Endpoints_t.constraint_ list) els = + let open Syntax in + List.fold_left + (fun a -> + function + | (_on,`NOT_EQUALS,d) -> + endpoint_str_not_matches uri Endpoints_t.(d.data) a + | (_on,`EQUALS,d) -> + matchstrs (ident "region") + (endpoint_str_matches uri Endpoints_t.(d.data)) a + | (_on,`STARTS_WITH,d) -> + endpoint_starts_with uri Endpoints_t.(d.data) a + | _ -> a) els cs + +let write_endpoints (endpoints : Endpoints_t.endpoint list) = + [let open Syntax in + let_ "endpoint_of" + (fun_ "region" + (endpoints |> + (List.fold_left (fun a -> + (fun (e : Endpoints_t.endpoint) -> + match e.constraints with + | None -> ident e.uri + | Some cs -> write_constraints e.uri cs a)) (ident "None"))) + )] let main input outdir = log "Start processing endpoints"; + let inc = open_in input in let n = in_channel_length inc in let endpoint_data = really_input_string inc n in let endpoints = Endpoints_j.endpoints_of_string endpoint_data in - endpoints |> List.iter (fun (name, (endpoints: Endpoints_t.endpoint list)) -> - print_endline ("service: " ^ name); - let outfile = outdir (name ^ "_endpoints.ml") in - let syntax = write_endpoints endpoints in - Printing.write_structure outfile syntax; - ); - close_in inc; - () + endpoints |> List.iter + (fun (name,(endpoints : Endpoints_t.endpoint list)) -> + print_endline ("service: " ^ name); + (match name with + | "sqs" -> + let outfile = (outdir name) "endpoints.ml" in + let syntax = write_endpoints endpoints in + Printing.write_structure outfile syntax + | _ -> print_endline "not writing temporarily")); + close_in inc; module CommandLine = struct let input = diff --git a/src/endpoints.atd b/src/endpoints.atd index 959cc7def..d0764faca 100644 --- a/src/endpoints.atd +++ b/src/endpoints.atd @@ -1,5 +1,3 @@ -type raw_json = abstract - type constraint_on = [ | REGION ] type constraint_op = [ From df36a337300759dac4256beeb12c7217ab7202ef Mon Sep 17 00:00:00 2001 From: Peter Mondlock Date: Fri, 1 Mar 2019 14:10:22 -0600 Subject: [PATCH 04/12] wip: endpoint generator, add docs --- src/endpoint_gen.ml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/endpoint_gen.ml b/src/endpoint_gen.ml index c9975960d..b43c6d0b4 100644 --- a/src/endpoint_gen.ml +++ b/src/endpoint_gen.ml @@ -4,15 +4,22 @@ open Util let () a b = Filename.concat a b let log s = Printf.eprintf (s ^^ "\n%!") +(** [filter_missing] removes any [None] elements from the provided list. *) let filter_missing = List.fold_left (fun a -> function | None -> a | Some s -> List.append [s] a) [] +(** [endpoint_str_matches uri ss] creates the match structure for regions that + match particular strings, since matchstr already has an [els] clause, this doesn't + require it. *) let endpoint_str_matches uri ss = let open Syntax in let ds = ss |> filter_missing in ds |> (List.map (fun s -> (s, (app1 "Some" (str uri))))) +(** [endpoint_str_not_matches uri ss els] creates the match structure for regions that + do NOT match particular strings, including null. This is somewhat tricky and generates + naive code that can never be reached *) let endpoint_str_not_matches uri ss els = Syntax.( let m = app1 "Some" (str uri) in let matches = ss |> List.map (function @@ -21,6 +28,8 @@ let endpoint_str_not_matches uri ss els = Syntax.( matchvar (ident "region") (List.append matches [("_", els)]) ) +(** [endpoint_starts_with uri ss] creates the match structure for regions that + match particular string *) let endpoint_starts_with uri ss els = let open Syntax in let ds = ss |> filter_missing in @@ -31,6 +40,9 @@ let endpoint_starts_with uri ss els = ifthen (app2 "Aws.Util.str_starts_with" (ident "region") (str s)) (app1 "Some" (str uri)) a) els) +(** [write_constraints uri cs els] emits the syntax for constraints provided + by the _endpoints.json file for a given uri. Currently, the only kind of + constraints are against [`REGION] so we ignore that for now. *) let write_constraints uri (cs : Endpoints_t.constraint_ list) els = let open Syntax in List.fold_left @@ -45,11 +57,15 @@ let write_constraints uri (cs : Endpoints_t.constraint_ list) els = endpoint_starts_with uri Endpoints_t.(d.data) a | _ -> a) els cs +(** [write_endpoints endpoints] takes a list of [Endpoint_t.endpoint] and + generates the syntax for the service endpoint matching defined by the + _endpoints.json file +*) let write_endpoints (endpoints : Endpoints_t.endpoint list) = [let open Syntax in let_ "endpoint_of" (fun_ "region" - (endpoints |> + (endpoints |> List.rev |> (List.fold_left (fun a -> (fun (e : Endpoints_t.endpoint) -> match e.constraints with From 07daeb5936927ec7bcad96635ba3d511f33f4e22 Mon Sep 17 00:00:00 2001 From: Peter Mondlock Date: Tue, 5 Mar 2019 19:29:17 -0600 Subject: [PATCH 05/12] update to add region for to_http call --- async/runtime.ml | 2 +- lib/aws.ml | 5 ++--- lib/aws.mli | 7 ++----- lwt/runtime.ml | 2 +- src/aws_gen.ml | 4 ++-- src/endpoint_gen.ml | 3 ++- src/generate.ml | 4 ++-- src/reading.ml | 2 +- src/reading.mli | 6 +++--- 9 files changed, 16 insertions(+), 19 deletions(-) diff --git a/async/runtime.ml b/async/runtime.ml index b6cf00f17..498bded8c 100644 --- a/async/runtime.ml +++ b/async/runtime.ml @@ -49,7 +49,7 @@ let run_request (inp : M.input) = let meth, uri, headers = - Aws.Signing.sign_request ~access_key ~secret_key ~service:M.service ~region (M.to_http inp) + Aws.Signing.sign_request ~access_key ~secret_key ~service:M.service ~region (M.to_http region inp) in let headers = Header.of_list headers in try_with begin fun () -> diff --git a/lib/aws.ml b/lib/aws.ml index e21593503..cb00dd10d 100644 --- a/lib/aws.ml +++ b/lib/aws.ml @@ -189,8 +189,7 @@ module type Call = sig type error val service : string - (*val region : string*) - val to_http : input -> Request.t + val to_http : string -> input -> Request.t val of_http : string -> [`Ok of output | `Error of error Error.error_response] val parse_error : int -> string -> error option end @@ -265,7 +264,7 @@ module Json = struct (Hashtbl.create (List.length m)) m | t -> raise (Casting_error("map", t)) - + let lookup t s = try match t with | `Assoc l -> Some (List.assoc s l) diff --git a/lib/aws.mli b/lib/aws.mli index aa0e60c9a..c741d3107 100644 --- a/lib/aws.mli +++ b/lib/aws.mli @@ -125,14 +125,11 @@ module type Call = sig signing, and to determine the endpoint to send the request. *) val service : string - (** The AWS region for the call. *) - (*val region : string*) - (** This function converts the native input into the HTTP request type. In particular, it is responsible for properly encoding the request type into query format. It also sets the Action and Version query parameters. *) - val to_http : input -> Request.t + val to_http : string -> input -> Request.t (** This function converts from a HTTP response body to an output or an error if the response could not be decoded. *) @@ -243,7 +240,7 @@ module Json : sig (** This converts an `Assoc (string * t list) to ('a, 'b) Hashtbl.t, or throws a Casting_error in the case that the input is not an `Assoc. *) val to_hashtbl: (t -> 'b) -> t -> (string, 'b) Hashtbl.t - + (** If t is an `Assoc, this looks up the field specified. If it isn't found, or if the input is not an `Assoc, returns None. *) val lookup : t -> string -> t option diff --git a/lwt/runtime.ml b/lwt/runtime.ml index 4e7aa3114..fdaa9c91b 100644 --- a/lwt/runtime.ml +++ b/lwt/runtime.ml @@ -46,7 +46,7 @@ let run_request (inp : M.input) = let meth, uri, headers = - Aws.Signing.sign_request ~access_key ~secret_key ~service:M.service ~region (M.to_http inp) + Aws.Signing.sign_request ~access_key ~secret_key ~service:M.service ~region (M.to_http region inp) in let open Cohttp in let headers = Header.of_list headers in diff --git a/src/aws_gen.ml b/src/aws_gen.ml index aee2c7ace..bfe8ef75c 100644 --- a/src/aws_gen.ml +++ b/src/aws_gen.ml @@ -54,7 +54,7 @@ module Json = struct let lookup_list field assoc = try to_list (List.assoc field assoc) with _ -> [] - let rec merge (orig:Yojson.Basic.t) (extra:Yojson.Basic.t) : Yojson.Basic.t = + let rec merge (orig:Yojson.Basic.json) (extra:Yojson.Basic.json) : Yojson.Basic.json = match orig, extra with | `Assoc os, `Assoc es -> let upd_ = List.map (fun (ok, ov) -> @@ -75,7 +75,7 @@ module Json = struct then (key, default) :: assoc else result - let override_shapes original overrides : (string * Yojson.Basic.t) list = + let override_shapes original overrides : (string * Yojson.Basic.json) list = let open Yojson.Basic.Util in List.map (fun (key, val_) -> try diff --git a/src/endpoint_gen.ml b/src/endpoint_gen.ml index b43c6d0b4..d4fd0f922 100644 --- a/src/endpoint_gen.ml +++ b/src/endpoint_gen.ml @@ -85,7 +85,7 @@ let main input outdir = print_endline ("service: " ^ name); (match name with | "sqs" -> - let outfile = (outdir name) "endpoints.ml" in + let outfile = (outdir name) (name ^ "_endpoints.ml") in let syntax = write_endpoints endpoints in Printing.write_structure outfile syntax | _ -> print_endline "not writing temporarily")); @@ -107,6 +107,7 @@ module CommandLine = struct Term.info "endpoint-gen" ~version:"0.0.1" ~doc end +(** entrypoint *) let () = match Term.eval CommandLine.(gen_t, info) with | `Error _ -> exit 1 diff --git a/src/generate.ml b/src/generate.ml index e658fa57f..1e8d51a94 100644 --- a/src/generate.ml +++ b/src/generate.ml @@ -314,7 +314,7 @@ let op service version _shapes op = letin "uri" (app2 "Uri.add_query_params" - (app1 "Uri.of_string" (str ("https://" ^ service ^ ".amazonaws.com"))) + (app1 "Uri.of_string" (app1 ((String.capitalize_ascii service) ^ "_endpoints.endpoint_of") (ident "region"))) (match op.Operation.input_shape with | None -> defaults | Some input_shape -> @@ -388,7 +388,7 @@ let op service version _shapes op = ; tylet "output" (mkty op.Operation.output_shape) ; tylet "error" (ty0 "Errors_internal.t") ; let_ "service" (str service) - ; let_ "to_http" (fun_ "req" to_body) + ; let_ "to_http" (fun2 "region" "req" to_body) ; let_ "of_http" (fun_ "body" of_body) ; let_ "parse_error" (fun2 "code" "err" op_error_parse) ]) diff --git a/src/reading.ml b/src/reading.ml index eaeab6209..ff82240c4 100644 --- a/src/reading.ml +++ b/src/reading.ml @@ -62,7 +62,7 @@ let parse_member rq (mnm, mj) = ; field_name = unreserve (Util.to_field_name mnm) } -let shape ((nm, j) : (string * Yojson.Basic.t)) : Shape.parsed = +let shape ((nm, j) : (string * Yojson.Basic.json)) : Shape.parsed = match Json.member "type" j with | `String "structure" -> let required = diff --git a/src/reading.mli b/src/reading.mli index dd8662220..9903803f7 100644 --- a/src/reading.mli +++ b/src/reading.mli @@ -31,8 +31,8 @@ POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------*) -val shape : string * Yojson.Basic.t -> Structures.Shape.parsed +val shape : string * Yojson.Basic.json -> Structures.Shape.parsed -val op : string * Yojson.Basic.t -> Structures.Operation.t +val op : string * Yojson.Basic.json -> Structures.Operation.t -val error : string -> Yojson.Basic.t -> Structures.Error.t +val error : string -> Yojson.Basic.json -> Structures.Error.t From 52a7e640e696bb577fb05f6b010ee80735ed47b5 Mon Sep 17 00:00:00 2001 From: Peter Mondlock Date: Thu, 7 Mar 2019 17:49:48 -0600 Subject: [PATCH 06/12] wip --- Makefile | 2 +- input/endpoints.json | 3797 ++++++++++++++++++++++++++++++++++++++++++ src/endpoint_gen.ml | 82 +- src/endpoints.atd | 46 +- src/endpoints_j.ml | 1686 ++++++++++++++----- src/endpoints_j.mli | 179 +- src/endpoints_t.ml | 34 +- src/endpoints_t.mli | 34 +- 8 files changed, 5277 insertions(+), 583 deletions(-) create mode 100644 input/endpoints.json diff --git a/Makefile b/Makefile index abb2aa89a..4747e69f3 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ clean: .PHONY: endpoints endpoints: - dune exec endpoint-gen -- -i input/_endpoints.json -o libraries + dune exec endpoint-gen -- -i input/endpoints.json -o libraries aws-ec2: dune exec aws-gen -- --is-ec2 -i input/ec2/latest/service-2.json -r input/ec2/overrides.json -e input/errors.json -o libraries diff --git a/input/endpoints.json b/input/endpoints.json new file mode 100644 index 000000000..ead5f1bc1 --- /dev/null +++ b/input/endpoints.json @@ -0,0 +1,3797 @@ +{ + "partitions" : [ { + "defaults" : { + "hostname" : "{service}.{region}.{dnsSuffix}", + "protocols" : [ "https" ], + "signatureVersions" : [ "v4" ] + }, + "dnsSuffix" : "amazonaws.com", + "partition" : "aws", + "partitionName" : "AWS Standard", + "regionRegex" : "^(us|eu|ap|sa|ca)\\-\\w+\\-\\d+$", + "regions" : { + "ap-northeast-1" : { + "description" : "Asia Pacific (Tokyo)" + }, + "ap-northeast-2" : { + "description" : "Asia Pacific (Seoul)" + }, + "ap-south-1" : { + "description" : "Asia Pacific (Mumbai)" + }, + "ap-southeast-1" : { + "description" : "Asia Pacific (Singapore)" + }, + "ap-southeast-2" : { + "description" : "Asia Pacific (Sydney)" + }, + "ca-central-1" : { + "description" : "Canada (Central)" + }, + "eu-central-1" : { + "description" : "EU (Frankfurt)" + }, + "eu-north-1" : { + "description" : "EU (Stockholm)" + }, + "eu-west-1" : { + "description" : "EU (Ireland)" + }, + "eu-west-2" : { + "description" : "EU (London)" + }, + "eu-west-3" : { + "description" : "EU (Paris)" + }, + "sa-east-1" : { + "description" : "South America (Sao Paulo)" + }, + "us-east-1" : { + "description" : "US East (N. Virginia)" + }, + "us-east-2" : { + "description" : "US East (Ohio)" + }, + "us-west-1" : { + "description" : "US West (N. California)" + }, + "us-west-2" : { + "description" : "US West (Oregon)" + } + }, + "services" : { + "a4b" : { + "endpoints" : { + "us-east-1" : { } + } + }, + "acm" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "acm-pca" : { + "defaults" : { + "protocols" : [ "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "api.ecr" : { + "endpoints" : { + "ap-northeast-1" : { + "credentialScope" : { + "region" : "ap-northeast-1" + }, + "hostname" : "api.ecr.ap-northeast-1.amazonaws.com" + }, + "ap-northeast-2" : { + "credentialScope" : { + "region" : "ap-northeast-2" + }, + "hostname" : "api.ecr.ap-northeast-2.amazonaws.com" + }, + "ap-south-1" : { + "credentialScope" : { + "region" : "ap-south-1" + }, + "hostname" : "api.ecr.ap-south-1.amazonaws.com" + }, + "ap-southeast-1" : { + "credentialScope" : { + "region" : "ap-southeast-1" + }, + "hostname" : "api.ecr.ap-southeast-1.amazonaws.com" + }, + "ap-southeast-2" : { + "credentialScope" : { + "region" : "ap-southeast-2" + }, + "hostname" : "api.ecr.ap-southeast-2.amazonaws.com" + }, + "ca-central-1" : { + "credentialScope" : { + "region" : "ca-central-1" + }, + "hostname" : "api.ecr.ca-central-1.amazonaws.com" + }, + "eu-central-1" : { + "credentialScope" : { + "region" : "eu-central-1" + }, + "hostname" : "api.ecr.eu-central-1.amazonaws.com" + }, + "eu-north-1" : { + "credentialScope" : { + "region" : "eu-north-1" + }, + "hostname" : "api.ecr.eu-north-1.amazonaws.com" + }, + "eu-west-1" : { + "credentialScope" : { + "region" : "eu-west-1" + }, + "hostname" : "api.ecr.eu-west-1.amazonaws.com" + }, + "eu-west-2" : { + "credentialScope" : { + "region" : "eu-west-2" + }, + "hostname" : "api.ecr.eu-west-2.amazonaws.com" + }, + "eu-west-3" : { + "credentialScope" : { + "region" : "eu-west-3" + }, + "hostname" : "api.ecr.eu-west-3.amazonaws.com" + }, + "sa-east-1" : { + "credentialScope" : { + "region" : "sa-east-1" + }, + "hostname" : "api.ecr.sa-east-1.amazonaws.com" + }, + "us-east-1" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "api.ecr.us-east-1.amazonaws.com" + }, + "us-east-2" : { + "credentialScope" : { + "region" : "us-east-2" + }, + "hostname" : "api.ecr.us-east-2.amazonaws.com" + }, + "us-west-1" : { + "credentialScope" : { + "region" : "us-west-1" + }, + "hostname" : "api.ecr.us-west-1.amazonaws.com" + }, + "us-west-2" : { + "credentialScope" : { + "region" : "us-west-2" + }, + "hostname" : "api.ecr.us-west-2.amazonaws.com" + } + } + }, + "api.mediatailor" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "api.pricing" : { + "defaults" : { + "credentialScope" : { + "service" : "pricing" + } + }, + "endpoints" : { + "ap-south-1" : { }, + "us-east-1" : { } + } + }, + "api.sagemaker" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-1-fips" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "api-fips.sagemaker.us-east-1.amazonaws.com" + }, + "us-east-2" : { }, + "us-east-2-fips" : { + "credentialScope" : { + "region" : "us-east-2" + }, + "hostname" : "api-fips.sagemaker.us-east-2.amazonaws.com" + }, + "us-west-1" : { }, + "us-west-1-fips" : { + "credentialScope" : { + "region" : "us-west-1" + }, + "hostname" : "api-fips.sagemaker.us-west-1.amazonaws.com" + }, + "us-west-2" : { }, + "us-west-2-fips" : { + "credentialScope" : { + "region" : "us-west-2" + }, + "hostname" : "api-fips.sagemaker.us-west-2.amazonaws.com" + } + } + }, + "apigateway" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "application-autoscaling" : { + "defaults" : { + "credentialScope" : { + "service" : "application-autoscaling" + }, + "hostname" : "autoscaling.{region}.amazonaws.com", + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "appstream2" : { + "defaults" : { + "credentialScope" : { + "service" : "appstream" + }, + "protocols" : [ "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "appsync" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "athena" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "autoscaling" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "autoscaling-plans" : { + "defaults" : { + "credentialScope" : { + "service" : "autoscaling-plans" + }, + "hostname" : "autoscaling.{region}.amazonaws.com", + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "batch" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "budgets" : { + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "budgets.amazonaws.com" + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" + }, + "ce" : { + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "ce.us-east-1.amazonaws.com" + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" + }, + "chime" : { + "defaults" : { + "protocols" : [ "https" ], + "sslCommonName" : "service.chime.aws.amazon.com" + }, + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "service.chime.aws.amazon.com", + "protocols" : [ "https" ] + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" + }, + "cloud9" : { + "endpoints" : { + "ap-southeast-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "clouddirectory" : { + "endpoints" : { + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "cloudformation" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "cloudfront" : { + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "cloudfront.amazonaws.com", + "protocols" : [ "http", "https" ] + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" + }, + "cloudhsm" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "cloudhsmv2" : { + "defaults" : { + "credentialScope" : { + "service" : "cloudhsm" + } + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "cloudsearch" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "cloudtrail" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "codebuild" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-1-fips" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "codebuild-fips.us-east-1.amazonaws.com" + }, + "us-east-2" : { }, + "us-east-2-fips" : { + "credentialScope" : { + "region" : "us-east-2" + }, + "hostname" : "codebuild-fips.us-east-2.amazonaws.com" + }, + "us-west-1" : { }, + "us-west-1-fips" : { + "credentialScope" : { + "region" : "us-west-1" + }, + "hostname" : "codebuild-fips.us-west-1.amazonaws.com" + }, + "us-west-2" : { }, + "us-west-2-fips" : { + "credentialScope" : { + "region" : "us-west-2" + }, + "hostname" : "codebuild-fips.us-west-2.amazonaws.com" + } + } + }, + "codecommit" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "fips" : { + "credentialScope" : { + "region" : "ca-central-1" + }, + "hostname" : "codecommit-fips.ca-central-1.amazonaws.com" + }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "codedeploy" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-1-fips" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "codedeploy-fips.us-east-1.amazonaws.com" + }, + "us-east-2" : { }, + "us-east-2-fips" : { + "credentialScope" : { + "region" : "us-east-2" + }, + "hostname" : "codedeploy-fips.us-east-2.amazonaws.com" + }, + "us-west-1" : { }, + "us-west-1-fips" : { + "credentialScope" : { + "region" : "us-west-1" + }, + "hostname" : "codedeploy-fips.us-west-1.amazonaws.com" + }, + "us-west-2" : { }, + "us-west-2-fips" : { + "credentialScope" : { + "region" : "us-west-2" + }, + "hostname" : "codedeploy-fips.us-west-2.amazonaws.com" + } + } + }, + "codepipeline" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "codestar" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "cognito-identity" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "cognito-idp" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "cognito-sync" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "comprehend" : { + "defaults" : { + "protocols" : [ "https" ] + }, + "endpoints" : { + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "config" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "cur" : { + "endpoints" : { + "us-east-1" : { } + } + }, + "data.iot" : { + "defaults" : { + "credentialScope" : { + "service" : "iotdata" + }, + "protocols" : [ "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "datapipeline" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-2" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "datasync" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "dax" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "devicefarm" : { + "endpoints" : { + "us-west-2" : { } + } + }, + "directconnect" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "discovery" : { + "endpoints" : { + "us-west-2" : { } + } + }, + "dms" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "docdb" : { + "endpoints" : { + "eu-west-1" : { + "credentialScope" : { + "region" : "eu-west-1" + }, + "hostname" : "rds.eu-west-1.amazonaws.com" + }, + "us-east-1" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "rds.us-east-1.amazonaws.com" + }, + "us-east-2" : { + "credentialScope" : { + "region" : "us-east-2" + }, + "hostname" : "rds.us-east-2.amazonaws.com" + }, + "us-west-2" : { + "credentialScope" : { + "region" : "us-west-2" + }, + "hostname" : "rds.us-west-2.amazonaws.com" + } + } + }, + "ds" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "dynamodb" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "local" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "localhost:8000", + "protocols" : [ "http" ] + }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "ec2" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "ecs" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "elasticache" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "fips" : { + "credentialScope" : { + "region" : "us-west-1" + }, + "hostname" : "elasticache-fips.us-west-1.amazonaws.com" + }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "elasticbeanstalk" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "elasticfilesystem" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "elasticloadbalancing" : { + "defaults" : { + "protocols" : [ "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "elasticmapreduce" : { + "defaults" : { + "protocols" : [ "https" ], + "sslCommonName" : "{region}.{service}.{dnsSuffix}" + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { + "sslCommonName" : "{service}.{region}.{dnsSuffix}" + }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { + "sslCommonName" : "{service}.{region}.{dnsSuffix}" + }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "elastictranscoder" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "email" : { + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "entitlement.marketplace" : { + "defaults" : { + "credentialScope" : { + "service" : "aws-marketplace" + } + }, + "endpoints" : { + "us-east-1" : { } + } + }, + "es" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "fips" : { + "credentialScope" : { + "region" : "us-west-1" + }, + "hostname" : "es-fips.us-west-1.amazonaws.com" + }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "events" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "firehose" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "fms" : { + "defaults" : { + "protocols" : [ "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "fsx" : { + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "gamelift" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "glacier" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "glue" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "greengrass" : { + "defaults" : { + "protocols" : [ "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + }, + "isRegionalized" : true + }, + "guardduty" : { + "defaults" : { + "protocols" : [ "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + }, + "isRegionalized" : true + }, + "health" : { + "endpoints" : { + "us-east-1" : { } + } + }, + "iam" : { + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "iam.amazonaws.com" + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" + }, + "importexport" : { + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1", + "service" : "IngestionService" + }, + "hostname" : "importexport.amazonaws.com", + "signatureVersions" : [ "v2", "v4" ] + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" + }, + "inspector" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "iot" : { + "defaults" : { + "credentialScope" : { + "service" : "execute-api" + } + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "iotanalytics" : { + "endpoints" : { + "ap-northeast-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "kinesis" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "kinesisanalytics" : { + "endpoints" : { + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "kinesisvideo" : { + "endpoints" : { + "ap-northeast-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "kms" : { + "endpoints" : { + "ProdFips" : { + "credentialScope" : { + "region" : "ca-central-1" + }, + "hostname" : "kms-fips.ca-central-1.amazonaws.com" + }, + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "lambda" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "license-manager" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "lightsail" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "logs" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "machinelearning" : { + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { } + } + }, + "marketplacecommerceanalytics" : { + "endpoints" : { + "us-east-1" : { } + } + }, + "mediaconvert" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "medialive" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "mediapackage" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "mediastore" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "metering.marketplace" : { + "defaults" : { + "credentialScope" : { + "service" : "aws-marketplace" + } + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "mgh" : { + "endpoints" : { + "us-west-2" : { } + } + }, + "mobileanalytics" : { + "endpoints" : { + "us-east-1" : { } + } + }, + "models.lex" : { + "defaults" : { + "credentialScope" : { + "service" : "lex" + } + }, + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "monitoring" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "mq" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "mturk-requester" : { + "endpoints" : { + "sandbox" : { + "hostname" : "mturk-requester-sandbox.us-east-1.amazonaws.com" + }, + "us-east-1" : { } + }, + "isRegionalized" : false + }, + "neptune" : { + "endpoints" : { + "ap-northeast-1" : { + "credentialScope" : { + "region" : "ap-northeast-1" + }, + "hostname" : "rds.ap-northeast-1.amazonaws.com" + }, + "ap-southeast-1" : { + "credentialScope" : { + "region" : "ap-southeast-1" + }, + "hostname" : "rds.ap-southeast-1.amazonaws.com" + }, + "ap-southeast-2" : { + "credentialScope" : { + "region" : "ap-southeast-2" + }, + "hostname" : "rds.ap-southeast-2.amazonaws.com" + }, + "eu-central-1" : { + "credentialScope" : { + "region" : "eu-central-1" + }, + "hostname" : "rds.eu-central-1.amazonaws.com" + }, + "eu-west-1" : { + "credentialScope" : { + "region" : "eu-west-1" + }, + "hostname" : "rds.eu-west-1.amazonaws.com" + }, + "eu-west-2" : { + "credentialScope" : { + "region" : "eu-west-2" + }, + "hostname" : "rds.eu-west-2.amazonaws.com" + }, + "us-east-1" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "rds.us-east-1.amazonaws.com" + }, + "us-east-2" : { + "credentialScope" : { + "region" : "us-east-2" + }, + "hostname" : "rds.us-east-2.amazonaws.com" + }, + "us-west-2" : { + "credentialScope" : { + "region" : "us-west-2" + }, + "hostname" : "rds.us-west-2.amazonaws.com" + } + } + }, + "opsworks" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "opsworks-cm" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "organizations" : { + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "organizations.us-east-1.amazonaws.com" + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" + }, + "pinpoint" : { + "defaults" : { + "credentialScope" : { + "service" : "mobiletargeting" + } + }, + "endpoints" : { + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "polly" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "rds" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { + "sslCommonName" : "{service}.{dnsSuffix}" + }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "redshift" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "rekognition" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-2" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "resource-groups" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "robomaker" : { + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "route53" : { + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "route53.amazonaws.com" + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" + }, + "route53domains" : { + "endpoints" : { + "us-east-1" : { } + } + }, + "route53resolver" : { + "defaults" : { + "protocols" : [ "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "runtime.lex" : { + "defaults" : { + "credentialScope" : { + "service" : "lex" + } + }, + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "runtime.sagemaker" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "s3" : { + "defaults" : { + "protocols" : [ "http", "https" ], + "signatureVersions" : [ "s3v4" ] + }, + "endpoints" : { + "ap-northeast-1" : { + "hostname" : "s3.ap-northeast-1.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { + "hostname" : "s3.ap-southeast-1.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "ap-southeast-2" : { + "hostname" : "s3.ap-southeast-2.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { + "hostname" : "s3.eu-west-1.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "s3-external-1" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "s3-external-1.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "sa-east-1" : { + "hostname" : "s3.sa-east-1.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "us-east-1" : { + "hostname" : "s3.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "us-east-2" : { }, + "us-west-1" : { + "hostname" : "s3.us-west-1.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "us-west-2" : { + "hostname" : "s3.us-west-2.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + } + }, + "isRegionalized" : true, + "partitionEndpoint" : "us-east-1" + }, + "s3-control" : { + "defaults" : { + "protocols" : [ "https" ], + "signatureVersions" : [ "s3v4" ] + }, + "endpoints" : { + "ap-northeast-1" : { + "credentialScope" : { + "region" : "ap-northeast-1" + }, + "hostname" : "s3-control.ap-northeast-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "ap-northeast-2" : { + "credentialScope" : { + "region" : "ap-northeast-2" + }, + "hostname" : "s3-control.ap-northeast-2.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "ap-south-1" : { + "credentialScope" : { + "region" : "ap-south-1" + }, + "hostname" : "s3-control.ap-south-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "ap-southeast-1" : { + "credentialScope" : { + "region" : "ap-southeast-1" + }, + "hostname" : "s3-control.ap-southeast-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "ap-southeast-2" : { + "credentialScope" : { + "region" : "ap-southeast-2" + }, + "hostname" : "s3-control.ap-southeast-2.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "ca-central-1" : { + "credentialScope" : { + "region" : "ca-central-1" + }, + "hostname" : "s3-control.ca-central-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "eu-central-1" : { + "credentialScope" : { + "region" : "eu-central-1" + }, + "hostname" : "s3-control.eu-central-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "eu-north-1" : { + "credentialScope" : { + "region" : "eu-north-1" + }, + "hostname" : "s3-control.eu-north-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "eu-west-1" : { + "credentialScope" : { + "region" : "eu-west-1" + }, + "hostname" : "s3-control.eu-west-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "eu-west-2" : { + "credentialScope" : { + "region" : "eu-west-2" + }, + "hostname" : "s3-control.eu-west-2.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "eu-west-3" : { + "credentialScope" : { + "region" : "eu-west-3" + }, + "hostname" : "s3-control.eu-west-3.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "sa-east-1" : { + "credentialScope" : { + "region" : "sa-east-1" + }, + "hostname" : "s3-control.sa-east-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "us-east-1" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "s3-control.us-east-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "us-east-1-fips" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "s3-control-fips.us-east-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "us-east-2" : { + "credentialScope" : { + "region" : "us-east-2" + }, + "hostname" : "s3-control.us-east-2.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "us-east-2-fips" : { + "credentialScope" : { + "region" : "us-east-2" + }, + "hostname" : "s3-control-fips.us-east-2.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "us-west-1" : { + "credentialScope" : { + "region" : "us-west-1" + }, + "hostname" : "s3-control.us-west-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "us-west-1-fips" : { + "credentialScope" : { + "region" : "us-west-1" + }, + "hostname" : "s3-control-fips.us-west-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "us-west-2" : { + "credentialScope" : { + "region" : "us-west-2" + }, + "hostname" : "s3-control.us-west-2.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "us-west-2-fips" : { + "credentialScope" : { + "region" : "us-west-2" + }, + "hostname" : "s3-control-fips.us-west-2.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + } + } + }, + "sdb" : { + "defaults" : { + "protocols" : [ "http", "https" ], + "signatureVersions" : [ "v2" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-west-1" : { }, + "sa-east-1" : { }, + "us-east-1" : { + "hostname" : "sdb.amazonaws.com" + }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "secretsmanager" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-1-fips" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "secretsmanager-fips.us-east-1.amazonaws.com" + }, + "us-east-2" : { }, + "us-east-2-fips" : { + "credentialScope" : { + "region" : "us-east-2" + }, + "hostname" : "secretsmanager-fips.us-east-2.amazonaws.com" + }, + "us-west-1" : { }, + "us-west-1-fips" : { + "credentialScope" : { + "region" : "us-west-1" + }, + "hostname" : "secretsmanager-fips.us-west-1.amazonaws.com" + }, + "us-west-2" : { }, + "us-west-2-fips" : { + "credentialScope" : { + "region" : "us-west-2" + }, + "hostname" : "secretsmanager-fips.us-west-2.amazonaws.com" + } + } + }, + "securityhub" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "serverlessrepo" : { + "defaults" : { + "protocols" : [ "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { + "protocols" : [ "https" ] + }, + "ap-northeast-2" : { + "protocols" : [ "https" ] + }, + "ap-south-1" : { + "protocols" : [ "https" ] + }, + "ap-southeast-1" : { + "protocols" : [ "https" ] + }, + "ap-southeast-2" : { + "protocols" : [ "https" ] + }, + "ca-central-1" : { + "protocols" : [ "https" ] + }, + "eu-central-1" : { + "protocols" : [ "https" ] + }, + "eu-west-1" : { + "protocols" : [ "https" ] + }, + "eu-west-2" : { + "protocols" : [ "https" ] + }, + "sa-east-1" : { + "protocols" : [ "https" ] + }, + "us-east-1" : { + "protocols" : [ "https" ] + }, + "us-east-2" : { + "protocols" : [ "https" ] + }, + "us-west-1" : { + "protocols" : [ "https" ] + }, + "us-west-2" : { + "protocols" : [ "https" ] + } + } + }, + "servicecatalog" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-1-fips" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "servicecatalog-fips.us-east-1.amazonaws.com" + }, + "us-east-2" : { }, + "us-east-2-fips" : { + "credentialScope" : { + "region" : "us-east-2" + }, + "hostname" : "servicecatalog-fips.us-east-2.amazonaws.com" + }, + "us-west-1" : { }, + "us-west-1-fips" : { + "credentialScope" : { + "region" : "us-west-1" + }, + "hostname" : "servicecatalog-fips.us-west-1.amazonaws.com" + }, + "us-west-2" : { }, + "us-west-2-fips" : { + "credentialScope" : { + "region" : "us-west-2" + }, + "hostname" : "servicecatalog-fips.us-west-2.amazonaws.com" + } + } + }, + "servicediscovery" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "shield" : { + "defaults" : { + "protocols" : [ "https" ], + "sslCommonName" : "shield.us-east-1.amazonaws.com" + }, + "endpoints" : { + "us-east-1" : { } + }, + "isRegionalized" : false + }, + "sms" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "snowball" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "sns" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "sqs" : { + "defaults" : { + "protocols" : [ "http", "https" ], + "sslCommonName" : "{region}.queue.{dnsSuffix}" + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "fips-us-east-1" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "sqs-fips.us-east-1.amazonaws.com" + }, + "fips-us-east-2" : { + "credentialScope" : { + "region" : "us-east-2" + }, + "hostname" : "sqs-fips.us-east-2.amazonaws.com" + }, + "fips-us-west-1" : { + "credentialScope" : { + "region" : "us-west-1" + }, + "hostname" : "sqs-fips.us-west-1.amazonaws.com" + }, + "fips-us-west-2" : { + "credentialScope" : { + "region" : "us-west-2" + }, + "hostname" : "sqs-fips.us-west-2.amazonaws.com" + }, + "sa-east-1" : { }, + "us-east-1" : { + "sslCommonName" : "queue.{dnsSuffix}" + }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "ssm" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "states" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "storagegateway" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "streams.dynamodb" : { + "defaults" : { + "credentialScope" : { + "service" : "dynamodb" + }, + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "local" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "localhost:8000", + "protocols" : [ "http" ] + }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "sts" : { + "defaults" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "sts.amazonaws.com" + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { + "credentialScope" : { + "region" : "ap-northeast-2" + }, + "hostname" : "sts.ap-northeast-2.amazonaws.com" + }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "aws-global" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-1-fips" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "sts-fips.us-east-1.amazonaws.com" + }, + "us-east-2" : { }, + "us-east-2-fips" : { + "credentialScope" : { + "region" : "us-east-2" + }, + "hostname" : "sts-fips.us-east-2.amazonaws.com" + }, + "us-west-1" : { }, + "us-west-1-fips" : { + "credentialScope" : { + "region" : "us-west-1" + }, + "hostname" : "sts-fips.us-west-1.amazonaws.com" + }, + "us-west-2" : { }, + "us-west-2-fips" : { + "credentialScope" : { + "region" : "us-west-2" + }, + "hostname" : "sts-fips.us-west-2.amazonaws.com" + } + }, + "partitionEndpoint" : "aws-global" + }, + "support" : { + "endpoints" : { + "us-east-1" : { } + } + }, + "swf" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "tagging" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "transfer" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "translate" : { + "defaults" : { + "protocols" : [ "https" ] + }, + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-1-fips" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "translate-fips.us-east-1.amazonaws.com" + }, + "us-east-2" : { }, + "us-east-2-fips" : { + "credentialScope" : { + "region" : "us-east-2" + }, + "hostname" : "translate-fips.us-east-2.amazonaws.com" + }, + "us-west-2" : { }, + "us-west-2-fips" : { + "credentialScope" : { + "region" : "us-west-2" + }, + "hostname" : "translate-fips.us-west-2.amazonaws.com" + } + } + }, + "waf" : { + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "waf.amazonaws.com" + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" + }, + "waf-regional" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "workdocs" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "workmail" : { + "defaults" : { + "protocols" : [ "https" ] + }, + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "workspaces" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "xray" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-north-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "eu-west-3" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + } + } + }, { + "defaults" : { + "hostname" : "{service}.{region}.{dnsSuffix}", + "protocols" : [ "https" ], + "signatureVersions" : [ "v4" ] + }, + "dnsSuffix" : "amazonaws.com.cn", + "partition" : "aws-cn", + "partitionName" : "AWS China", + "regionRegex" : "^cn\\-\\w+\\-\\d+$", + "regions" : { + "cn-north-1" : { + "description" : "China (Beijing)" + }, + "cn-northwest-1" : { + "description" : "China (Ningxia)" + } + }, + "services" : { + "api.ecr" : { + "endpoints" : { + "cn-north-1" : { + "credentialScope" : { + "region" : "cn-north-1" + }, + "hostname" : "api.ecr.cn-north-1.amazonaws.com.cn" + }, + "cn-northwest-1" : { + "credentialScope" : { + "region" : "cn-northwest-1" + }, + "hostname" : "api.ecr.cn-northwest-1.amazonaws.com.cn" + } + } + }, + "apigateway" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "application-autoscaling" : { + "defaults" : { + "credentialScope" : { + "service" : "application-autoscaling" + }, + "hostname" : "autoscaling.{region}.amazonaws.com", + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "autoscaling" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "cloudformation" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "cloudtrail" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "codebuild" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "codedeploy" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "cognito-identity" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "config" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "data.iot" : { + "defaults" : { + "credentialScope" : { + "service" : "iotdata" + }, + "protocols" : [ "https" ] + }, + "endpoints" : { + "cn-north-1" : { } + } + }, + "directconnect" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "dms" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "ds" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "dynamodb" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "ec2" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "ecs" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "elasticache" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "elasticbeanstalk" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "elasticloadbalancing" : { + "defaults" : { + "protocols" : [ "https" ] + }, + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "elasticmapreduce" : { + "defaults" : { + "protocols" : [ "https" ] + }, + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "es" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "events" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "firehose" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "gamelift" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "glacier" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "iam" : { + "endpoints" : { + "aws-cn-global" : { + "credentialScope" : { + "region" : "cn-north-1" + }, + "hostname" : "iam.cn-north-1.amazonaws.com.cn" + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-cn-global" + }, + "iot" : { + "defaults" : { + "credentialScope" : { + "service" : "execute-api" + } + }, + "endpoints" : { + "cn-north-1" : { } + } + }, + "kinesis" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "lambda" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "logs" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "monitoring" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "polly" : { + "endpoints" : { + "cn-northwest-1" : { } + } + }, + "rds" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "redshift" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "s3" : { + "defaults" : { + "protocols" : [ "http", "https" ], + "signatureVersions" : [ "s3v4" ] + }, + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "s3-control" : { + "defaults" : { + "protocols" : [ "https" ], + "signatureVersions" : [ "s3v4" ] + }, + "endpoints" : { + "cn-north-1" : { + "credentialScope" : { + "region" : "cn-north-1" + }, + "hostname" : "s3-control.cn-north-1.amazonaws.com.cn", + "signatureVersions" : [ "s3v4" ] + }, + "cn-northwest-1" : { + "credentialScope" : { + "region" : "cn-northwest-1" + }, + "hostname" : "s3-control.cn-northwest-1.amazonaws.com.cn", + "signatureVersions" : [ "s3v4" ] + } + } + }, + "sms" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "snowball" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "sns" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "sqs" : { + "defaults" : { + "protocols" : [ "http", "https" ], + "sslCommonName" : "{region}.queue.{dnsSuffix}" + }, + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "ssm" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "states" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "storagegateway" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "streams.dynamodb" : { + "defaults" : { + "credentialScope" : { + "service" : "dynamodb" + }, + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "sts" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "swf" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + }, + "tagging" : { + "endpoints" : { + "cn-north-1" : { }, + "cn-northwest-1" : { } + } + } + } + }, { + "defaults" : { + "hostname" : "{service}.{region}.{dnsSuffix}", + "protocols" : [ "https" ], + "signatureVersions" : [ "v4" ] + }, + "dnsSuffix" : "amazonaws.com", + "partition" : "aws-us-gov", + "partitionName" : "AWS GovCloud (US)", + "regionRegex" : "^us\\-gov\\-\\w+\\-\\d+$", + "regions" : { + "us-gov-east-1" : { + "description" : "AWS GovCloud (US-East)" + }, + "us-gov-west-1" : { + "description" : "AWS GovCloud (US)" + } + }, + "services" : { + "acm" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "api.ecr" : { + "endpoints" : { + "us-gov-east-1" : { + "credentialScope" : { + "region" : "us-gov-east-1" + }, + "hostname" : "api.ecr.us-gov-east-1.amazonaws.com" + }, + "us-gov-west-1" : { + "credentialScope" : { + "region" : "us-gov-west-1" + }, + "hostname" : "api.ecr.us-gov-west-1.amazonaws.com" + } + } + }, + "api.sagemaker" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "apigateway" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "application-autoscaling" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "athena" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "autoscaling" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { + "protocols" : [ "http", "https" ] + } + } + }, + "clouddirectory" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "cloudformation" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "cloudhsm" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "cloudhsmv2" : { + "defaults" : { + "credentialScope" : { + "service" : "cloudhsm" + } + }, + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "cloudtrail" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "codedeploy" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-east-1-fips" : { + "credentialScope" : { + "region" : "us-gov-east-1" + }, + "hostname" : "codedeploy-fips.us-gov-east-1.amazonaws.com" + }, + "us-gov-west-1" : { }, + "us-gov-west-1-fips" : { + "credentialScope" : { + "region" : "us-gov-west-1" + }, + "hostname" : "codedeploy-fips.us-gov-west-1.amazonaws.com" + } + } + }, + "config" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "data.iot" : { + "defaults" : { + "credentialScope" : { + "service" : "iotdata" + }, + "protocols" : [ "https" ] + }, + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "directconnect" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "dms" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "ds" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "dynamodb" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { }, + "us-gov-west-1-fips" : { + "credentialScope" : { + "region" : "us-gov-west-1" + }, + "hostname" : "dynamodb.us-gov-west-1.amazonaws.com" + } + } + }, + "ec2" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "ecs" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "elasticache" : { + "endpoints" : { + "fips" : { + "credentialScope" : { + "region" : "us-gov-west-1" + }, + "hostname" : "elasticache-fips.us-gov-west-1.amazonaws.com" + }, + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "elasticbeanstalk" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "elasticfilesystem" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "elasticloadbalancing" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { + "protocols" : [ "http", "https" ] + } + } + }, + "elasticmapreduce" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { + "protocols" : [ "https" ] + } + } + }, + "es" : { + "endpoints" : { + "fips" : { + "credentialScope" : { + "region" : "us-gov-west-1" + }, + "hostname" : "es-fips.us-gov-west-1.amazonaws.com" + }, + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "events" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "firehose" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "glacier" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { + "protocols" : [ "http", "https" ] + } + } + }, + "glue" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "guardduty" : { + "defaults" : { + "protocols" : [ "https" ] + }, + "endpoints" : { + "us-gov-west-1" : { } + }, + "isRegionalized" : true + }, + "iam" : { + "endpoints" : { + "aws-us-gov-global" : { + "credentialScope" : { + "region" : "us-gov-west-1" + }, + "hostname" : "iam.us-gov.amazonaws.com" + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-us-gov-global" + }, + "inspector" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "iot" : { + "defaults" : { + "credentialScope" : { + "service" : "execute-api" + } + }, + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "kinesis" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "kms" : { + "endpoints" : { + "ProdFips" : { + "credentialScope" : { + "region" : "us-gov-west-1" + }, + "hostname" : "kms-fips.us-gov-west-1.amazonaws.com" + }, + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "lambda" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "logs" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "mediaconvert" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "metering.marketplace" : { + "defaults" : { + "credentialScope" : { + "service" : "aws-marketplace" + } + }, + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "monitoring" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "polly" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "rds" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "redshift" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "rekognition" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "runtime.sagemaker" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "s3" : { + "defaults" : { + "signatureVersions" : [ "s3", "s3v4" ] + }, + "endpoints" : { + "fips-us-gov-west-1" : { + "credentialScope" : { + "region" : "us-gov-west-1" + }, + "hostname" : "s3-fips-us-gov-west-1.amazonaws.com" + }, + "us-gov-east-1" : { + "hostname" : "s3.us-gov-east-1.amazonaws.com", + "protocols" : [ "http", "https" ] + }, + "us-gov-west-1" : { + "hostname" : "s3.us-gov-west-1.amazonaws.com", + "protocols" : [ "http", "https" ] + } + } + }, + "s3-control" : { + "defaults" : { + "protocols" : [ "https" ], + "signatureVersions" : [ "s3v4" ] + }, + "endpoints" : { + "us-gov-east-1" : { + "credentialScope" : { + "region" : "us-gov-east-1" + }, + "hostname" : "s3-control.us-gov-east-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "us-gov-east-1-fips" : { + "credentialScope" : { + "region" : "us-gov-east-1" + }, + "hostname" : "s3-control-fips.us-gov-east-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "us-gov-west-1" : { + "credentialScope" : { + "region" : "us-gov-west-1" + }, + "hostname" : "s3-control.us-gov-west-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + }, + "us-gov-west-1-fips" : { + "credentialScope" : { + "region" : "us-gov-west-1" + }, + "hostname" : "s3-control-fips.us-gov-west-1.amazonaws.com", + "signatureVersions" : [ "s3v4" ] + } + } + }, + "sms" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "snowball" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "sns" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { + "protocols" : [ "http", "https" ] + } + } + }, + "sqs" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { + "protocols" : [ "http", "https" ], + "sslCommonName" : "{region}.queue.{dnsSuffix}" + } + } + }, + "ssm" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "states" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "storagegateway" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "streams.dynamodb" : { + "defaults" : { + "credentialScope" : { + "service" : "dynamodb" + } + }, + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { }, + "us-gov-west-1-fips" : { + "credentialScope" : { + "region" : "us-gov-west-1" + }, + "hostname" : "dynamodb.us-gov-west-1.amazonaws.com" + } + } + }, + "sts" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "swf" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "tagging" : { + "endpoints" : { + "us-gov-east-1" : { }, + "us-gov-west-1" : { } + } + }, + "translate" : { + "defaults" : { + "protocols" : [ "https" ] + }, + "endpoints" : { + "us-gov-west-1" : { }, + "us-gov-west-1-fips" : { + "credentialScope" : { + "region" : "us-gov-west-1" + }, + "hostname" : "translate-fips.us-gov-west-1.amazonaws.com" + } + } + }, + "workspaces" : { + "endpoints" : { + "us-gov-west-1" : { } + } + } + } + } ], + "version" : 3 +} diff --git a/src/endpoint_gen.ml b/src/endpoint_gen.ml index d4fd0f922..701bb894d 100644 --- a/src/endpoint_gen.ml +++ b/src/endpoint_gen.ml @@ -1,5 +1,5 @@ open Cmdliner -open Util +(*open Util*) let () a b = Filename.concat a b let log s = Printf.eprintf (s ^^ "\n%!") @@ -43,53 +43,61 @@ let endpoint_starts_with uri ss els = (** [write_constraints uri cs els] emits the syntax for constraints provided by the _endpoints.json file for a given uri. Currently, the only kind of constraints are against [`REGION] so we ignore that for now. *) -let write_constraints uri (cs : Endpoints_t.constraint_ list) els = - let open Syntax in - List.fold_left - (fun a -> - function - | (_on,`NOT_EQUALS,d) -> - endpoint_str_not_matches uri Endpoints_t.(d.data) a - | (_on,`EQUALS,d) -> - matchstrs (ident "region") - (endpoint_str_matches uri Endpoints_t.(d.data)) a - | (_on,`STARTS_WITH,d) -> - endpoint_starts_with uri Endpoints_t.(d.data) a - | _ -> a) els cs +(*let write_constraints uri (cs : Endpoints_t.constraint_ list) els =*) + (*let open Syntax in*) + (*List.fold_left*) + (*(fun a ->*) + (*function*) + (*| (_on,`NOT_EQUALS,d) ->*) + (*endpoint_str_not_matches uri Endpoints_t.(d.data) a*) + (*| (_on,`EQUALS,d) ->*) + (*matchstrs (ident "region")*) + (*(endpoint_str_matches uri Endpoints_t.(d.data)) a*) + (*| (_on,`STARTS_WITH,d) ->*) + (*endpoint_starts_with uri Endpoints_t.(d.data) a*) + (*| _ -> a) els cs*) (** [write_endpoints endpoints] takes a list of [Endpoint_t.endpoint] and generates the syntax for the service endpoint matching defined by the _endpoints.json file *) -let write_endpoints (endpoints : Endpoints_t.endpoint list) = - [let open Syntax in - let_ "endpoint_of" - (fun_ "region" - (endpoints |> List.rev |> - (List.fold_left (fun a -> - (fun (e : Endpoints_t.endpoint) -> - match e.constraints with - | None -> ident e.uri - | Some cs -> write_constraints e.uri cs a)) (ident "None"))) - )] - -let main input outdir = +(*let write_endpoints (endpoints : Endpoints_t.endpoint list) =*) + (*[let open Syntax in*) + (*let_ "endpoint_of"*) + (*(fun_ "region"*) + (*(endpoints |> List.rev |>*) + (*(List.fold_left (fun a ->*) + (*(fun (e : Endpoints_t.endpoint) ->*) + (*match e.constraints with*) + (*| None -> ident e.uri*) + (*| Some cs -> write_constraints e.uri cs a)) (ident "None")))*) + (* )] *) + +(**) + (*endpoints |> List.iter*) + (*(fun (name,(endpoints : Endpoints_t.endpoint list)) ->*) + (*print_endline ("service: " ^ name);*) + (*(match name with*) + (*| "sqs" ->*) + (*let outfile = (outdir name) (name ^ "_endpoints.ml") in*) + (*let syntax = write_endpoints endpoints in*) + (*Printing.write_structure outfile syntax*) + (*| _ -> print_endline "not writing temporarily"));*) + +let print_partition (p : Endpoints_t.partition) = + print_endline ("dns_suffix: " ^ p.dns_suffix); + print_endline ("partition: " ^ p.partition); + print_endline ("partition_name: " ^ p.partition_name);; + +let main input _outdir = log "Start processing endpoints"; let inc = open_in input in let n = in_channel_length inc in let endpoint_data = really_input_string inc n in let endpoints = Endpoints_j.endpoints_of_string endpoint_data in - endpoints |> List.iter - (fun (name,(endpoints : Endpoints_t.endpoint list)) -> - print_endline ("service: " ^ name); - (match name with - | "sqs" -> - let outfile = (outdir name) (name ^ "_endpoints.ml") in - let syntax = write_endpoints endpoints in - Printing.write_structure outfile syntax - | _ -> print_endline "not writing temporarily")); - close_in inc; + endpoints.partitions |> List.iter print_partition; + close_in inc; module CommandLine = struct let input = diff --git a/src/endpoints.atd b/src/endpoints.atd index d0764faca..2a5d2f0c3 100644 --- a/src/endpoints.atd +++ b/src/endpoints.atd @@ -1,21 +1,37 @@ -type constraint_on = [ | REGION ] - -type constraint_op = [ - | STARTS_WITH - | NOT_EQUALS - | EQUALS - | ONE_OF - | NOT_STARTS_WITH ] +type region = { + description: string; +} -type constraint_data = { - data : string nullable list -} +type partition_defaults = { + ?hostname: string nullable; + protocols: string list; + signature_versions : string list; +} -type constraint_ = (constraint_on * constraint_op * constraint_data) +type service_defaults = { + ?protocols: string list option; + ?ssl_common_name: string nullable; +} type endpoint = { - uri: string; - ?constraints: constraint_ list option + ?hostname: string nullable; } -type endpoints = (string * endpoint list) list \ No newline at end of file +type service = { + ?defaults: service_defaults option; + endpoints: (string * endpoint) list ; +} + +type partition = { + defaults: partition_defaults; + dns_suffix : string; + partition: string; + partition_name : string; + region_regex : string; + regions: (string * region) list ; + services: (string * service) list ; +} + +type endpoints = { + partitions: partition list; +} diff --git a/src/endpoints_j.ml b/src/endpoints_j.ml index cfdd1b1ec..4686b0c8a 100644 --- a/src/endpoints_j.ml +++ b/src/endpoints_j.ml @@ -1,161 +1,41 @@ (* Auto-generated from "endpoints.atd" *) [@@@ocaml.warning "-27-32-35-39"] -type raw_json = Yojson.Safe.json - -type constraint_op = Endpoints_t.constraint_op +type service_defaults = Endpoints_t.service_defaults = { + protocols: string list option; + ssl_common_name: string option +} -type constraint_on = Endpoints_t.constraint_on +type endpoint = Endpoints_t.endpoint = { hostname: string option } -type constraint_data = Endpoints_t.constraint_data = { - data: string option list +type service = Endpoints_t.service = { + defaults: service_defaults option; + endpoints: (string * endpoint) list } -type constraint_ = Endpoints_t.constraint_ +type region = Endpoints_t.region = { description: string } -type endpoint = Endpoints_t.endpoint = { - uri: string; - constraints: constraint_ list option +type partition_defaults = Endpoints_t.partition_defaults = { + hostname: string option; + protocols: string list; + signature_versions: string list } -type endpoints = Endpoints_t.endpoints +type partition = Endpoints_t.partition = { + defaults: partition_defaults; + dns_suffix: string; + partition: string; + partition_name: string; + region_regex: string; + regions: (string * region) list; + services: (string * service) list +} + +type endpoints = Endpoints_t.endpoints = { partitions: partition list } -let write_raw_json = ( - Yojson.Safe.write_json -) -let string_of_raw_json ?(len = 1024) x = - let ob = Bi_outbuf.create len in - write_raw_json ob x; - Bi_outbuf.contents ob -let read_raw_json = ( - Yojson.Safe.read_json -) -let raw_json_of_string s = - read_raw_json (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_constraint_op = ( - fun ob x -> - match x with - | `STARTS_WITH -> Bi_outbuf.add_string ob "\"startsWith\"" - | `NOT_EQUALS -> Bi_outbuf.add_string ob "\"notEquals\"" - | `EQUALS -> Bi_outbuf.add_string ob "\"equals\"" - | `ONE_OF -> Bi_outbuf.add_string ob "\"oneOf\"" - | `NOT_STARTS_WITH -> Bi_outbuf.add_string ob "\"notStartsWith\"" -) -let string_of_constraint_op ?(len = 1024) x = - let ob = Bi_outbuf.create len in - write_constraint_op ob x; - Bi_outbuf.contents ob -let read_constraint_op = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "startsWith" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `STARTS_WITH - | "notEquals" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `NOT_EQUALS - | "equals" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `EQUALS - | "oneOf" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ONE_OF - | "notStartsWith" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `NOT_STARTS_WITH - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "startsWith" -> - `STARTS_WITH - | "notEquals" -> - `NOT_EQUALS - | "equals" -> - `EQUALS - | "oneOf" -> - `ONE_OF - | "notStartsWith" -> - `NOT_STARTS_WITH - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let constraint_op_of_string s = - read_constraint_op (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_constraint_on = ( - fun ob x -> - match x with - | `REGION -> Bi_outbuf.add_string ob "\"region\"" -) -let string_of_constraint_on ?(len = 1024) x = - let ob = Bi_outbuf.create len in - write_constraint_on ob x; - Bi_outbuf.contents ob -let read_constraint_on = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "region" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `REGION - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "region" -> - `REGION - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let constraint_on_of_string s = - read_constraint_on (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__1 = ( - Atdgen_runtime.Oj_run.write_nullable ( - Yojson.Safe.write_string - ) -) -let string_of__1 ?(len = 1024) x = - let ob = Bi_outbuf.create len in - write__1 ob x; - Bi_outbuf.contents ob -let read__1 = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - Atdgen_runtime.Oj_run.read_string - ) p lb) : _ option) -) -let _1_of_string s = - read__1 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__2 = ( Atdgen_runtime.Oj_run.write_list ( - write__1 + Yojson.Safe.write_string ) ) let string_of__2 ?(len = 1024) x = @@ -164,199 +44,14 @@ let string_of__2 ?(len = 1024) x = Bi_outbuf.contents ob let read__2 = ( Atdgen_runtime.Oj_run.read_list ( - read__1 + Atdgen_runtime.Oj_run.read_string ) ) let _2_of_string s = read__2 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_constraint_data : _ -> constraint_data -> _ = ( - Atdgen_runtime.Oj_run.write_with_adapter Constraint_adapter.StringList.restore ( - fun ob x -> - Bi_outbuf.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"data\":"; - ( - write__2 - ) - ob x.data; - Bi_outbuf.add_char ob '}'; - ) -) -let string_of_constraint_data ?(len = 1024) x = - let ob = Bi_outbuf.create len in - write_constraint_data ob x; - Bi_outbuf.contents ob -let read_constraint_data = ( - Atdgen_runtime.Oj_run.read_with_adapter Constraint_adapter.StringList.normalize ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_data = ref (Obj.magic (Sys.opaque_identity 0.0)) in - let bits0 = ref 0 in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg "out-of-bounds substring position or length"; - if len = 4 && String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( - 0 - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_data := ( - ( - read__2 - ) p lb - ); - bits0 := !bits0 lor 0x1; - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg "out-of-bounds substring position or length"; - if len = 4 && String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( - 0 - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_data := ( - ( - read__2 - ) p lb - ); - bits0 := !bits0 lor 0x1; - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - if !bits0 <> 0x1 then Atdgen_runtime.Oj_run.missing_fields p [| !bits0 |] [| "data" |]; - ( - { - data = !field_data; - } - : constraint_data) - ) - ) -) -let constraint_data_of_string s = - read_constraint_data (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_constraint_ = ( - fun ob x -> - Bi_outbuf.add_char ob '['; - (let x, _, _ = x in - ( - write_constraint_on - ) ob x - ); - Bi_outbuf.add_char ob ','; - (let _, x, _ = x in - ( - write_constraint_op - ) ob x - ); - Bi_outbuf.add_char ob ','; - (let _, _, x = x in - ( - write_constraint_data - ) ob x - ); - Bi_outbuf.add_char ob ']'; -) -let string_of_constraint_ ?(len = 1024) x = - let ob = Bi_outbuf.create len in - write_constraint_ ob x; - Bi_outbuf.contents ob -let read_constraint_ = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_constraint_on - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_constraint_op - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_constraint_data - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -let constraint__of_string s = - read_constraint_ (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__3 = ( - Atdgen_runtime.Oj_run.write_list ( - write_constraint_ + Atdgen_runtime.Oj_run.write_std_option ( + write__2 ) ) let string_of__3 ?(len = 1024) x = @@ -364,22 +59,6 @@ let string_of__3 ?(len = 1024) x = write__3 ob x; Bi_outbuf.contents ob let read__3 = ( - Atdgen_runtime.Oj_run.read_list ( - read_constraint_ - ) -) -let _3_of_string s = - read__3 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__4 = ( - Atdgen_runtime.Oj_run.write_std_option ( - write__3 - ) -) -let string_of__4 ?(len = 1024) x = - let ob = Bi_outbuf.create len in - write__4 ob x; - Bi_outbuf.contents ob -let read__4 = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -392,7 +71,7 @@ let read__4 = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read__3 + read__2 ) p lb in Yojson.Safe.read_space p lb; @@ -415,7 +94,7 @@ let read__4 = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read__3 + read__2 ) p lb in Yojson.Safe.read_space p lb; @@ -425,45 +104,65 @@ let read__4 = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _4_of_string s = - read__4 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_endpoint : _ -> endpoint -> _ = ( +let _3_of_string s = + read__3 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__1 = ( + Atdgen_runtime.Oj_run.write_nullable ( + Yojson.Safe.write_string + ) +) +let string_of__1 ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write__1 ob x; + Bi_outbuf.contents ob +let read__1 = ( + fun p lb -> + Yojson.Safe.read_space p lb; + (if Yojson.Safe.read_null_if_possible p lb then None + else Some (( + Atdgen_runtime.Oj_run.read_string + ) p lb) : _ option) +) +let _1_of_string s = + read__1 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_service_defaults : _ -> service_defaults -> _ = ( fun ob x -> Bi_outbuf.add_char ob '{'; let is_first = ref true in - if !is_first then - is_first := false - else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"uri\":"; - ( - Yojson.Safe.write_string - ) - ob x.uri; - (match x.constraints with None -> () | Some x -> + (match x.protocols with None -> () | Some x -> + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"protocols\":"; + ( + write__2 + ) + ob x; + ); + (match x.ssl_common_name with None -> () | Some x -> if !is_first then is_first := false else Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"constraints\":"; + Bi_outbuf.add_string ob "\"ssl_common_name\":"; ( - write__3 + Yojson.Safe.write_string ) ob x; ); Bi_outbuf.add_char ob '}'; ) -let string_of_endpoint ?(len = 1024) x = +let string_of_service_defaults ?(len = 1024) x = let ob = Bi_outbuf.create len in - write_endpoint ob x; + write_service_defaults ob x; Bi_outbuf.contents ob -let read_endpoint = ( +let read_service_defaults = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_uri = ref (Obj.magic (Sys.opaque_identity 0.0)) in - let field_constraints = ref (None) in - let bits0 = ref 0 in + let field_protocols = ref (None) in + let field_ssl_common_name = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -473,16 +172,16 @@ let read_endpoint = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg "out-of-bounds substring position or length"; match len with - | 3 -> ( - if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' then ( + | 9 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = 's' then ( 0 ) else ( -1 ) ) - | 11 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 's' then ( + | 15 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 'm' && String.unsafe_get s (pos+14) = 'e' then ( 1 ) else ( @@ -498,18 +197,21 @@ let read_endpoint = ( ( match i with | 0 -> - field_uri := ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ); - bits0 := !bits0 lor 0x1; + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_protocols := ( + Some ( + ( + read__2 + ) p lb + ) + ); + ) | 1 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_constraints := ( + field_ssl_common_name := ( Some ( ( - read__3 + Atdgen_runtime.Oj_run.read_string ) p lb ) ); @@ -527,16 +229,16 @@ let read_endpoint = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg "out-of-bounds substring position or length"; match len with - | 3 -> ( - if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' then ( + | 9 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = 's' then ( 0 ) else ( -1 ) ) - | 11 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 's' then ( + | 15 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 'm' && String.unsafe_get s (pos+14) = 'e' then ( 1 ) else ( @@ -552,18 +254,21 @@ let read_endpoint = ( ( match i with | 0 -> - field_uri := ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ); - bits0 := !bits0 lor 0x1; + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_protocols := ( + Some ( + ( + read__2 + ) p lb + ) + ); + ) | 1 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_constraints := ( + field_ssl_common_name := ( Some ( ( - read__3 + Atdgen_runtime.Oj_run.read_string ) p lb ) ); @@ -575,62 +280,1185 @@ let read_endpoint = ( done; assert false; with Yojson.End_of_object -> ( - if !bits0 <> 0x1 then Atdgen_runtime.Oj_run.missing_fields p [| !bits0 |] [| "uri" |]; ( { - uri = !field_uri; - constraints = !field_constraints; + protocols = !field_protocols; + ssl_common_name = !field_ssl_common_name; } - : endpoint) + : service_defaults) ) ) -let endpoint_of_string s = - read_endpoint (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__5 = ( - Atdgen_runtime.Oj_run.write_list ( - write_endpoint - ) -) -let string_of__5 ?(len = 1024) x = +let service_defaults_of_string s = + read_service_defaults (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_endpoint : _ -> endpoint -> _ = ( + fun ob x -> + Bi_outbuf.add_char ob '{'; + let is_first = ref true in + (match x.hostname with None -> () | Some x -> + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"hostname\":"; + ( + Yojson.Safe.write_string + ) + ob x; + ); + Bi_outbuf.add_char ob '}'; +) +let string_of_endpoint ?(len = 1024) x = let ob = Bi_outbuf.create len in - write__5 ob x; + write_endpoint ob x; Bi_outbuf.contents ob -let read__5 = ( - Atdgen_runtime.Oj_run.read_list ( - read_endpoint - ) +let read_endpoint = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_hostname = ref (None) in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + if len = 8 && String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' then ( + 0 + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_hostname := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + if len = 8 && String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' then ( + 0 + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_hostname := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + hostname = !field_hostname; + } + : endpoint) + ) ) -let _5_of_string s = - read__5 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__6 = ( +let endpoint_of_string s = + read_endpoint (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__5 = ( Atdgen_runtime.Oj_run.write_assoc_list ( Yojson.Safe.write_string ) ( - write__5 + write_endpoint ) ) -let string_of__6 ?(len = 1024) x = +let string_of__5 ?(len = 1024) x = let ob = Bi_outbuf.create len in - write__6 ob x; + write__5 ob x; Bi_outbuf.contents ob -let read__6 = ( +let read__5 = ( Atdgen_runtime.Oj_run.read_assoc_list ( Atdgen_runtime.Oj_run.read_string ) ( - read__5 + read_endpoint ) ) -let _6_of_string s = - read__6 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_endpoints = ( - write__6 +let _5_of_string s = + read__5 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__4 = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_service_defaults + ) ) -let string_of_endpoints ?(len = 1024) x = +let string_of__4 ?(len = 1024) x = let ob = Bi_outbuf.create len in - write_endpoints ob x; + write__4 ob x; Bi_outbuf.contents ob -let read_endpoints = ( - read__6 +let read__4 = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_service_defaults + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_service_defaults + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _4_of_string s = + read__4 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_service : _ -> service -> _ = ( + fun ob x -> + Bi_outbuf.add_char ob '{'; + let is_first = ref true in + (match x.defaults with None -> () | Some x -> + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"defaults\":"; + ( + write_service_defaults + ) + ob x; + ); + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"endpoints\":"; + ( + write__5 + ) + ob x.endpoints; + Bi_outbuf.add_char ob '}'; +) +let string_of_service ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write_service ob x; + Bi_outbuf.contents ob +let read_service = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_defaults = ref (None) in + let field_endpoints = ref (Obj.magic (Sys.opaque_identity 0.0)) in + let bits0 = ref 0 in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + match len with + | 8 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 's' then ( + 0 + ) + else ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 's' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_defaults := ( + Some ( + ( + read_service_defaults + ) p lb + ) + ); + ) + | 1 -> + field_endpoints := ( + ( + read__5 + ) p lb + ); + bits0 := !bits0 lor 0x1; + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + match len with + | 8 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 's' then ( + 0 + ) + else ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 's' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_defaults := ( + Some ( + ( + read_service_defaults + ) p lb + ) + ); + ) + | 1 -> + field_endpoints := ( + ( + read__5 + ) p lb + ); + bits0 := !bits0 lor 0x1; + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + if !bits0 <> 0x1 then Atdgen_runtime.Oj_run.missing_fields p [| !bits0 |] [| "endpoints" |]; + ( + { + defaults = !field_defaults; + endpoints = !field_endpoints; + } + : service) + ) +) +let service_of_string s = + read_service (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_region : _ -> region -> _ = ( + fun ob x -> + Bi_outbuf.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"description\":"; + ( + Yojson.Safe.write_string + ) + ob x.description; + Bi_outbuf.add_char ob '}'; +) +let string_of_region ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write_region ob x; + Bi_outbuf.contents ob +let read_region = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_description = ref (Obj.magic (Sys.opaque_identity 0.0)) in + let bits0 = ref 0 in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + if len = 11 && String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' then ( + 0 + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_description := ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ); + bits0 := !bits0 lor 0x1; + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + if len = 11 && String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' then ( + 0 + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_description := ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ); + bits0 := !bits0 lor 0x1; + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + if !bits0 <> 0x1 then Atdgen_runtime.Oj_run.missing_fields p [| !bits0 |] [| "description" |]; + ( + { + description = !field_description; + } + : region) + ) +) +let region_of_string s = + read_region (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_partition_defaults : _ -> partition_defaults -> _ = ( + fun ob x -> + Bi_outbuf.add_char ob '{'; + let is_first = ref true in + (match x.hostname with None -> () | Some x -> + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"hostname\":"; + ( + Yojson.Safe.write_string + ) + ob x; + ); + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"protocols\":"; + ( + write__2 + ) + ob x.protocols; + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"signatureVersions\":"; + ( + write__2 + ) + ob x.signature_versions; + Bi_outbuf.add_char ob '}'; +) +let string_of_partition_defaults ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write_partition_defaults ob x; + Bi_outbuf.contents ob +let read_partition_defaults = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_hostname = ref (None) in + let field_protocols = ref (Obj.magic (Sys.opaque_identity 0.0)) in + let field_signature_versions = ref (Obj.magic (Sys.opaque_identity 0.0)) in + let bits0 = ref 0 in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + match len with + | 8 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' then ( + 0 + ) + else ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = 's' then ( + 1 + ) + else ( + -1 + ) + ) + | 17 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'u' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'V' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'n' && String.unsafe_get s (pos+16) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_hostname := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 1 -> + field_protocols := ( + ( + read__2 + ) p lb + ); + bits0 := !bits0 lor 0x1; + | 2 -> + field_signature_versions := ( + ( + read__2 + ) p lb + ); + bits0 := !bits0 lor 0x2; + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + match len with + | 8 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' then ( + 0 + ) + else ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = 's' then ( + 1 + ) + else ( + -1 + ) + ) + | 17 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'u' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'V' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'n' && String.unsafe_get s (pos+16) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_hostname := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 1 -> + field_protocols := ( + ( + read__2 + ) p lb + ); + bits0 := !bits0 lor 0x1; + | 2 -> + field_signature_versions := ( + ( + read__2 + ) p lb + ); + bits0 := !bits0 lor 0x2; + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + if !bits0 <> 0x3 then Atdgen_runtime.Oj_run.missing_fields p [| !bits0 |] [| "protocols"; "signature_versions" |]; + ( + { + hostname = !field_hostname; + protocols = !field_protocols; + signature_versions = !field_signature_versions; + } + : partition_defaults) + ) +) +let partition_defaults_of_string s = + read_partition_defaults (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__7 = ( + Atdgen_runtime.Oj_run.write_assoc_list ( + Yojson.Safe.write_string + ) ( + write_service + ) +) +let string_of__7 ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write__7 ob x; + Bi_outbuf.contents ob +let read__7 = ( + Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_runtime.Oj_run.read_string + ) ( + read_service + ) +) +let _7_of_string s = + read__7 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__6 = ( + Atdgen_runtime.Oj_run.write_assoc_list ( + Yojson.Safe.write_string + ) ( + write_region + ) +) +let string_of__6 ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write__6 ob x; + Bi_outbuf.contents ob +let read__6 = ( + Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_runtime.Oj_run.read_string + ) ( + read_region + ) +) +let _6_of_string s = + read__6 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_partition : _ -> partition -> _ = ( + fun ob x -> + Bi_outbuf.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"defaults\":"; + ( + write_partition_defaults + ) + ob x.defaults; + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"dnsSuffix\":"; + ( + Yojson.Safe.write_string + ) + ob x.dns_suffix; + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"partition\":"; + ( + Yojson.Safe.write_string + ) + ob x.partition; + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"partitionName\":"; + ( + Yojson.Safe.write_string + ) + ob x.partition_name; + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"regionRegex\":"; + ( + Yojson.Safe.write_string + ) + ob x.region_regex; + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"regions\":"; + ( + write__6 + ) + ob x.regions; + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"services\":"; + ( + write__7 + ) + ob x.services; + Bi_outbuf.add_char ob '}'; +) +let string_of_partition ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write_partition ob x; + Bi_outbuf.contents ob +let read_partition = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_defaults = ref (Obj.magic (Sys.opaque_identity 0.0)) in + let field_dns_suffix = ref (Obj.magic (Sys.opaque_identity 0.0)) in + let field_partition = ref (Obj.magic (Sys.opaque_identity 0.0)) in + let field_partition_name = ref (Obj.magic (Sys.opaque_identity 0.0)) in + let field_region_regex = ref (Obj.magic (Sys.opaque_identity 0.0)) in + let field_regions = ref (Obj.magic (Sys.opaque_identity 0.0)) in + let field_services = ref (Obj.magic (Sys.opaque_identity 0.0)) in + let bits0 = ref 0 in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + match len with + | 7 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 's' then ( + 5 + ) + else ( + -1 + ) + ) + | 8 -> ( + match String.unsafe_get s pos with + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 's' then ( + 0 + ) + else ( + -1 + ) + ) + | 's' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'v' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 's' then ( + 6 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 9 -> ( + match String.unsafe_get s pos with + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'S' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'f' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'x' then ( + 1 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'n' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 11 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'R' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'x' then ( + 4 + ) + else ( + -1 + ) + ) + | 13 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'N' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'e' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_defaults := ( + ( + read_partition_defaults + ) p lb + ); + bits0 := !bits0 lor 0x1; + | 1 -> + field_dns_suffix := ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ); + bits0 := !bits0 lor 0x2; + | 2 -> + field_partition := ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ); + bits0 := !bits0 lor 0x4; + | 3 -> + field_partition_name := ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ); + bits0 := !bits0 lor 0x8; + | 4 -> + field_region_regex := ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ); + bits0 := !bits0 lor 0x10; + | 5 -> + field_regions := ( + ( + read__6 + ) p lb + ); + bits0 := !bits0 lor 0x20; + | 6 -> + field_services := ( + ( + read__7 + ) p lb + ); + bits0 := !bits0 lor 0x40; + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + match len with + | 7 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 's' then ( + 5 + ) + else ( + -1 + ) + ) + | 8 -> ( + match String.unsafe_get s pos with + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 's' then ( + 0 + ) + else ( + -1 + ) + ) + | 's' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'v' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 's' then ( + 6 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 9 -> ( + match String.unsafe_get s pos with + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'S' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'f' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'x' then ( + 1 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'n' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 11 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'R' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'x' then ( + 4 + ) + else ( + -1 + ) + ) + | 13 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'N' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'e' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_defaults := ( + ( + read_partition_defaults + ) p lb + ); + bits0 := !bits0 lor 0x1; + | 1 -> + field_dns_suffix := ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ); + bits0 := !bits0 lor 0x2; + | 2 -> + field_partition := ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ); + bits0 := !bits0 lor 0x4; + | 3 -> + field_partition_name := ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ); + bits0 := !bits0 lor 0x8; + | 4 -> + field_region_regex := ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ); + bits0 := !bits0 lor 0x10; + | 5 -> + field_regions := ( + ( + read__6 + ) p lb + ); + bits0 := !bits0 lor 0x20; + | 6 -> + field_services := ( + ( + read__7 + ) p lb + ); + bits0 := !bits0 lor 0x40; + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + if !bits0 <> 0x7f then Atdgen_runtime.Oj_run.missing_fields p [| !bits0 |] [| "defaults"; "dns_suffix"; "partition"; "partition_name"; "region_regex"; "regions"; "services" |]; + ( + { + defaults = !field_defaults; + dns_suffix = !field_dns_suffix; + partition = !field_partition; + partition_name = !field_partition_name; + region_regex = !field_region_regex; + regions = !field_regions; + services = !field_services; + } + : partition) + ) +) +let partition_of_string s = + read_partition (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__8 = ( + Atdgen_runtime.Oj_run.write_list ( + write_partition + ) +) +let string_of__8 ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write__8 ob x; + Bi_outbuf.contents ob +let read__8 = ( + Atdgen_runtime.Oj_run.read_list ( + read_partition + ) +) +let _8_of_string s = + read__8 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_endpoints : _ -> endpoints -> _ = ( + fun ob x -> + Bi_outbuf.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Bi_outbuf.add_char ob ','; + Bi_outbuf.add_string ob "\"partitions\":"; + ( + write__8 + ) + ob x.partitions; + Bi_outbuf.add_char ob '}'; +) +let string_of_endpoints ?(len = 1024) x = + let ob = Bi_outbuf.create len in + write_endpoints ob x; + Bi_outbuf.contents ob +let read_endpoints = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_partitions = ref (Obj.magic (Sys.opaque_identity 0.0)) in + let bits0 = ref 0 in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + if len = 10 && String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 's' then ( + 0 + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_partitions := ( + ( + read__8 + ) p lb + ); + bits0 := !bits0 lor 0x1; + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg "out-of-bounds substring position or length"; + if len = 10 && String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 's' then ( + 0 + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_partitions := ( + ( + read__8 + ) p lb + ); + bits0 := !bits0 lor 0x1; + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + if !bits0 <> 0x1 then Atdgen_runtime.Oj_run.missing_fields p [| !bits0 |] [| "partitions" |]; + ( + { + partitions = !field_partitions; + } + : endpoints) + ) ) let endpoints_of_string s = read_endpoints (Yojson.Safe.init_lexer ()) (Lexing.from_string s) diff --git a/src/endpoints_j.mli b/src/endpoints_j.mli index 632de867f..e5be5f999 100644 --- a/src/endpoints_j.mli +++ b/src/endpoints_j.mli @@ -1,144 +1,157 @@ (* Auto-generated from "endpoints.atd" *) [@@@ocaml.warning "-27-32-35-39"] -type raw_json = Yojson.Safe.json - -type constraint_op = Endpoints_t.constraint_op +type service_defaults = Endpoints_t.service_defaults = { + protocols: string list option; + ssl_common_name: string option +} -type constraint_on = Endpoints_t.constraint_on +type endpoint = Endpoints_t.endpoint = { hostname: string option } -type constraint_data = Endpoints_t.constraint_data = { - data: string option list +type service = Endpoints_t.service = { + defaults: service_defaults option; + endpoints: (string * endpoint) list } -type constraint_ = Endpoints_t.constraint_ +type region = Endpoints_t.region = { description: string } + +type partition_defaults = Endpoints_t.partition_defaults = { + hostname: string option; + protocols: string list; + signature_versions: string list +} -type endpoint = Endpoints_t.endpoint = { - uri: string; - constraints: constraint_ list option +type partition = Endpoints_t.partition = { + defaults: partition_defaults; + dns_suffix: string; + partition: string; + partition_name: string; + region_regex: string; + regions: (string * region) list; + services: (string * service) list } -type endpoints = Endpoints_t.endpoints +type endpoints = Endpoints_t.endpoints = { partitions: partition list } -val write_raw_json : - Bi_outbuf.t -> raw_json -> unit - (** Output a JSON value of type {!raw_json}. *) +val write_service_defaults : + Bi_outbuf.t -> service_defaults -> unit + (** Output a JSON value of type {!service_defaults}. *) -val string_of_raw_json : - ?len:int -> raw_json -> string - (** Serialize a value of type {!raw_json} +val string_of_service_defaults : + ?len:int -> service_defaults -> string + (** Serialize a value of type {!service_defaults} into a JSON string. @param len specifies the initial length of the buffer used internally. Default: 1024. *) -val read_raw_json : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> raw_json - (** Input JSON data of type {!raw_json}. *) +val read_service_defaults : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> service_defaults + (** Input JSON data of type {!service_defaults}. *) -val raw_json_of_string : - string -> raw_json - (** Deserialize JSON data of type {!raw_json}. *) +val service_defaults_of_string : + string -> service_defaults + (** Deserialize JSON data of type {!service_defaults}. *) -val write_constraint_op : - Bi_outbuf.t -> constraint_op -> unit - (** Output a JSON value of type {!constraint_op}. *) +val write_endpoint : + Bi_outbuf.t -> endpoint -> unit + (** Output a JSON value of type {!endpoint}. *) -val string_of_constraint_op : - ?len:int -> constraint_op -> string - (** Serialize a value of type {!constraint_op} +val string_of_endpoint : + ?len:int -> endpoint -> string + (** Serialize a value of type {!endpoint} into a JSON string. @param len specifies the initial length of the buffer used internally. Default: 1024. *) -val read_constraint_op : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> constraint_op - (** Input JSON data of type {!constraint_op}. *) +val read_endpoint : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> endpoint + (** Input JSON data of type {!endpoint}. *) -val constraint_op_of_string : - string -> constraint_op - (** Deserialize JSON data of type {!constraint_op}. *) +val endpoint_of_string : + string -> endpoint + (** Deserialize JSON data of type {!endpoint}. *) -val write_constraint_on : - Bi_outbuf.t -> constraint_on -> unit - (** Output a JSON value of type {!constraint_on}. *) +val write_service : + Bi_outbuf.t -> service -> unit + (** Output a JSON value of type {!service}. *) -val string_of_constraint_on : - ?len:int -> constraint_on -> string - (** Serialize a value of type {!constraint_on} +val string_of_service : + ?len:int -> service -> string + (** Serialize a value of type {!service} into a JSON string. @param len specifies the initial length of the buffer used internally. Default: 1024. *) -val read_constraint_on : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> constraint_on - (** Input JSON data of type {!constraint_on}. *) +val read_service : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> service + (** Input JSON data of type {!service}. *) -val constraint_on_of_string : - string -> constraint_on - (** Deserialize JSON data of type {!constraint_on}. *) +val service_of_string : + string -> service + (** Deserialize JSON data of type {!service}. *) -val write_constraint_data : - Bi_outbuf.t -> constraint_data -> unit - (** Output a JSON value of type {!constraint_data}. *) +val write_region : + Bi_outbuf.t -> region -> unit + (** Output a JSON value of type {!region}. *) -val string_of_constraint_data : - ?len:int -> constraint_data -> string - (** Serialize a value of type {!constraint_data} +val string_of_region : + ?len:int -> region -> string + (** Serialize a value of type {!region} into a JSON string. @param len specifies the initial length of the buffer used internally. Default: 1024. *) -val read_constraint_data : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> constraint_data - (** Input JSON data of type {!constraint_data}. *) +val read_region : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> region + (** Input JSON data of type {!region}. *) -val constraint_data_of_string : - string -> constraint_data - (** Deserialize JSON data of type {!constraint_data}. *) +val region_of_string : + string -> region + (** Deserialize JSON data of type {!region}. *) -val write_constraint_ : - Bi_outbuf.t -> constraint_ -> unit - (** Output a JSON value of type {!constraint_}. *) +val write_partition_defaults : + Bi_outbuf.t -> partition_defaults -> unit + (** Output a JSON value of type {!partition_defaults}. *) -val string_of_constraint_ : - ?len:int -> constraint_ -> string - (** Serialize a value of type {!constraint_} +val string_of_partition_defaults : + ?len:int -> partition_defaults -> string + (** Serialize a value of type {!partition_defaults} into a JSON string. @param len specifies the initial length of the buffer used internally. Default: 1024. *) -val read_constraint_ : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> constraint_ - (** Input JSON data of type {!constraint_}. *) +val read_partition_defaults : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> partition_defaults + (** Input JSON data of type {!partition_defaults}. *) -val constraint__of_string : - string -> constraint_ - (** Deserialize JSON data of type {!constraint_}. *) +val partition_defaults_of_string : + string -> partition_defaults + (** Deserialize JSON data of type {!partition_defaults}. *) -val write_endpoint : - Bi_outbuf.t -> endpoint -> unit - (** Output a JSON value of type {!endpoint}. *) +val write_partition : + Bi_outbuf.t -> partition -> unit + (** Output a JSON value of type {!partition}. *) -val string_of_endpoint : - ?len:int -> endpoint -> string - (** Serialize a value of type {!endpoint} +val string_of_partition : + ?len:int -> partition -> string + (** Serialize a value of type {!partition} into a JSON string. @param len specifies the initial length of the buffer used internally. Default: 1024. *) -val read_endpoint : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> endpoint - (** Input JSON data of type {!endpoint}. *) +val read_partition : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> partition + (** Input JSON data of type {!partition}. *) -val endpoint_of_string : - string -> endpoint - (** Deserialize JSON data of type {!endpoint}. *) +val partition_of_string : + string -> partition + (** Deserialize JSON data of type {!partition}. *) val write_endpoints : Bi_outbuf.t -> endpoints -> unit diff --git a/src/endpoints_t.ml b/src/endpoints_t.ml index 6cd611aa7..2dd861dcb 100644 --- a/src/endpoints_t.ml +++ b/src/endpoints_t.ml @@ -1,18 +1,34 @@ (* Auto-generated from "endpoints.atd" *) [@@@ocaml.warning "-27-32-35-39"] -type raw_json = Yojson.Safe.json +type service_defaults = { + protocols: string list option; + ssl_common_name: string option +} -type constraint_op = [ - `STARTS_WITH | `NOT_EQUALS | `EQUALS | `ONE_OF | `NOT_STARTS_WITH -] +type endpoint = { hostname: string option } -type constraint_on = [ `REGION ] +type service = { + defaults: service_defaults option; + endpoints: (string * endpoint) list +} -type constraint_data = { data: string option list } +type region = { description: string } -type constraint_ = (constraint_on * constraint_op * constraint_data) +type partition_defaults = { + hostname: string option; + protocols: string list; + signature_versions: string list +} -type endpoint = { uri: string; constraints: constraint_ list option } +type partition = { + defaults: partition_defaults; + dns_suffix: string; + partition: string; + partition_name: string; + region_regex: string; + regions: (string * region) list; + services: (string * service) list +} -type endpoints = (string * endpoint list) list +type endpoints = { partitions: partition list } diff --git a/src/endpoints_t.mli b/src/endpoints_t.mli index 6cd611aa7..2dd861dcb 100644 --- a/src/endpoints_t.mli +++ b/src/endpoints_t.mli @@ -1,18 +1,34 @@ (* Auto-generated from "endpoints.atd" *) [@@@ocaml.warning "-27-32-35-39"] -type raw_json = Yojson.Safe.json +type service_defaults = { + protocols: string list option; + ssl_common_name: string option +} -type constraint_op = [ - `STARTS_WITH | `NOT_EQUALS | `EQUALS | `ONE_OF | `NOT_STARTS_WITH -] +type endpoint = { hostname: string option } -type constraint_on = [ `REGION ] +type service = { + defaults: service_defaults option; + endpoints: (string * endpoint) list +} -type constraint_data = { data: string option list } +type region = { description: string } -type constraint_ = (constraint_on * constraint_op * constraint_data) +type partition_defaults = { + hostname: string option; + protocols: string list; + signature_versions: string list +} -type endpoint = { uri: string; constraints: constraint_ list option } +type partition = { + defaults: partition_defaults; + dns_suffix: string; + partition: string; + partition_name: string; + region_regex: string; + regions: (string * region) list; + services: (string * service) list +} -type endpoints = (string * endpoint list) list +type endpoints = { partitions: partition list } From 340a91a80d7a0bab5ec6c97840a90fd0801cd55e Mon Sep 17 00:00:00 2001 From: Peter Mondlock Date: Fri, 8 Mar 2019 18:03:45 -0600 Subject: [PATCH 07/12] wip --- async/runtime.ml | 2 +- lib/aws.ml | 2 +- lib/aws.mli | 2 +- lwt/runtime.ml | 2 +- src/constraint_adapter.ml | 12 ---- src/endpoint_gen.ml | 125 +++++++++++++------------------------- src/generate.ml | 4 +- 7 files changed, 48 insertions(+), 101 deletions(-) delete mode 100644 src/constraint_adapter.ml diff --git a/async/runtime.ml b/async/runtime.ml index 498bded8c..ea2c19a2d 100644 --- a/async/runtime.ml +++ b/async/runtime.ml @@ -49,7 +49,7 @@ let run_request (inp : M.input) = let meth, uri, headers = - Aws.Signing.sign_request ~access_key ~secret_key ~service:M.service ~region (M.to_http region inp) + Aws.Signing.sign_request ~access_key ~secret_key ~service:M.service ~region (M.to_http M.service region inp) in let headers = Header.of_list headers in try_with begin fun () -> diff --git a/lib/aws.ml b/lib/aws.ml index cb00dd10d..7970cd0e0 100644 --- a/lib/aws.ml +++ b/lib/aws.ml @@ -190,7 +190,7 @@ module type Call = sig val service : string val to_http : string -> input -> Request.t - val of_http : string -> [`Ok of output | `Error of error Error.error_response] + val of_http : string -> string -> [`Ok of output | `Error of error Error.error_response] val parse_error : int -> string -> error option end diff --git a/lib/aws.mli b/lib/aws.mli index c741d3107..79318456f 100644 --- a/lib/aws.mli +++ b/lib/aws.mli @@ -129,7 +129,7 @@ module type Call = sig type. In particular, it is responsible for properly encoding the request type into query format. It also sets the Action and Version query parameters. *) - val to_http : string -> input -> Request.t + val to_http : string -> string -> input -> Request.t (** This function converts from a HTTP response body to an output or an error if the response could not be decoded. *) diff --git a/lwt/runtime.ml b/lwt/runtime.ml index fdaa9c91b..1dfa75d18 100644 --- a/lwt/runtime.ml +++ b/lwt/runtime.ml @@ -46,7 +46,7 @@ let run_request (inp : M.input) = let meth, uri, headers = - Aws.Signing.sign_request ~access_key ~secret_key ~service:M.service ~region (M.to_http region inp) + Aws.Signing.sign_request ~access_key ~secret_key ~service:M.service ~region (M.to_http M.service region inp) in let open Cohttp in let headers = Header.of_list headers in diff --git a/src/constraint_adapter.ml b/src/constraint_adapter.ml deleted file mode 100644 index f38caf053..000000000 --- a/src/constraint_adapter.ml +++ /dev/null @@ -1,12 +0,0 @@ -module StringList = struct - open Yojson.Safe - - let normalize (src: json) = match src with - | `Null -> `Assoc [("data", `List [`Null])] - | `String s -> `Assoc [("data", `List [ `String s ])] - | `List l -> `Assoc [("data", `List l)] - | _ -> src (* malformed *) - - let restore (src: json) = Obj.magic src -end - diff --git a/src/endpoint_gen.ml b/src/endpoint_gen.ml index 701bb894d..e3bf91130 100644 --- a/src/endpoint_gen.ml +++ b/src/endpoint_gen.ml @@ -1,102 +1,61 @@ open Cmdliner -(*open Util*) let () a b = Filename.concat a b let log s = Printf.eprintf (s ^^ "\n%!") -(** [filter_missing] removes any [None] elements from the provided list. *) -let filter_missing = - List.fold_left - (fun a -> function | None -> a | Some s -> List.append [s] a) [] - -(** [endpoint_str_matches uri ss] creates the match structure for regions that - match particular strings, since matchstr already has an [els] clause, this doesn't - require it. *) -let endpoint_str_matches uri ss = - let open Syntax in - let ds = ss |> filter_missing in - ds |> (List.map (fun s -> (s, (app1 "Some" (str uri))))) - -(** [endpoint_str_not_matches uri ss els] creates the match structure for regions that - do NOT match particular strings, including null. This is somewhat tricky and generates - naive code that can never be reached *) -let endpoint_str_not_matches uri ss els = Syntax.( - let m = app1 "Some" (str uri) in - let matches = ss |> List.map (function - | None -> ("region", m) - | Some s -> (("Some " ^ s), m)) in - matchvar (ident "region") (List.append matches [("_", els)]) -) - -(** [endpoint_starts_with uri ss] creates the match structure for regions that - match particular string *) -let endpoint_starts_with uri ss els = - let open Syntax in - let ds = ss |> filter_missing in - ds |> - (List.fold_left - (fun a -> - fun s -> - ifthen (app2 "Aws.Util.str_starts_with" (ident "region") (str s)) - (app1 "Some" (str uri)) a) els) - -(** [write_constraints uri cs els] emits the syntax for constraints provided - by the _endpoints.json file for a given uri. Currently, the only kind of - constraints are against [`REGION] so we ignore that for now. *) -(*let write_constraints uri (cs : Endpoints_t.constraint_ list) els =*) - (*let open Syntax in*) - (*List.fold_left*) - (*(fun a ->*) - (*function*) - (*| (_on,`NOT_EQUALS,d) ->*) - (*endpoint_str_not_matches uri Endpoints_t.(d.data) a*) - (*| (_on,`EQUALS,d) ->*) - (*matchstrs (ident "region")*) - (*(endpoint_str_matches uri Endpoints_t.(d.data)) a*) - (*| (_on,`STARTS_WITH,d) ->*) - (*endpoint_starts_with uri Endpoints_t.(d.data) a*) - (*| _ -> a) els cs*) - -(** [write_endpoints endpoints] takes a list of [Endpoint_t.endpoint] and - generates the syntax for the service endpoint matching defined by the - _endpoints.json file -*) -(*let write_endpoints (endpoints : Endpoints_t.endpoint list) =*) - (*[let open Syntax in*) - (*let_ "endpoint_of"*) - (*(fun_ "region"*) - (*(endpoints |> List.rev |>*) - (*(List.fold_left (fun a ->*) - (*(fun (e : Endpoints_t.endpoint) ->*) - (*match e.constraints with*) - (*| None -> ident e.uri*) - (*| Some cs -> write_constraints e.uri cs a)) (ident "None")))*) - (* )] *) - -(**) - (*endpoints |> List.iter*) - (*(fun (name,(endpoints : Endpoints_t.endpoint list)) ->*) - (*print_endline ("service: " ^ name);*) - (*(match name with*) - (*| "sqs" ->*) - (*let outfile = (outdir name) (name ^ "_endpoints.ml") in*) - (*let syntax = write_endpoints endpoints in*) - (*Printing.write_structure outfile syntax*) - (*| _ -> print_endline "not writing temporarily"));*) - let print_partition (p : Endpoints_t.partition) = print_endline ("dns_suffix: " ^ p.dns_suffix); print_endline ("partition: " ^ p.partition); print_endline ("partition_name: " ^ p.partition_name);; -let main input _outdir = +let var_replace hostname service_name region dns_suffix = + let hostname = Str.replace_first (Str.regexp_string {|{region}|}) region hostname in + let hostname = Str.replace_first (Str.regexp_string {|{service}|}) service_name hostname in + Str.replace_first (Str.regexp_string {|{dnsSuffix}|}) dns_suffix hostname + +let write_endpoint + region + dns_suffix + (default_hostname : string option) + ((service_name, endpoint) : (string * Endpoints_t.endpoint)) = Syntax.( + let host = match (endpoint.hostname, default_hostname) with + | (None, None) -> (ident "None") + | (None, Some(h)) + | (Some(h), _) -> (app1 "Some" (str (var_replace h service_name region dns_suffix))) in + (service_name, host) +) + +let write_service + dns_suffix + (partition_defaults : Endpoints_t.partition_defaults) + ((region, svc) : (string * Endpoints_t.service)) = Syntax.( + (region, (matchstrs + (ident "region") + (svc.endpoints |> List.map (write_endpoint region dns_suffix partition_defaults.hostname)) + (ident "None"))) +) + +let write_partition (p : Endpoints_t.partition) = Syntax.( + let_ "endpoint_of" + (fun2 "svc_name" "region" + (matchstrs + (ident "svc_name") + (p.services |> List.map (write_service p.dns_suffix p.defaults)) + (ident "None"))) +) + +let main input outdir = log "Start processing endpoints"; let inc = open_in input in let n = in_channel_length inc in let endpoint_data = really_input_string inc n in let endpoints = Endpoints_j.endpoints_of_string endpoint_data in - endpoints.partitions |> List.iter print_partition; + let aws = endpoints.partitions + |> List.find (fun p -> String.equal Endpoints_t.(p.partition) "aws") in + let outfile = (outdir "Aws_endpoints.ml") in + let syntax = write_partition aws in + Util.Printing.write_structure outfile [syntax]; close_in inc; module CommandLine = struct diff --git a/src/generate.ml b/src/generate.ml index 1e8d51a94..505dde590 100644 --- a/src/generate.ml +++ b/src/generate.ml @@ -314,7 +314,7 @@ let op service version _shapes op = letin "uri" (app2 "Uri.add_query_params" - (app1 "Uri.of_string" (app1 ((String.capitalize_ascii service) ^ "_endpoints.endpoint_of") (ident "region"))) + (app1 "Uri.of_string" (app1 "Aws.of_option_exn" (app1 "Aws_endpoints.endpoint_of") (ident "service") (ident "region"))) (match op.Operation.input_shape with | None -> defaults | Some input_shape -> @@ -388,7 +388,7 @@ let op service version _shapes op = ; tylet "output" (mkty op.Operation.output_shape) ; tylet "error" (ty0 "Errors_internal.t") ; let_ "service" (str service) - ; let_ "to_http" (fun2 "region" "req" to_body) + ; let_ "to_http" (fun3 "service" "region" "req" to_body) ; let_ "of_http" (fun_ "body" of_body) ; let_ "parse_error" (fun2 "code" "err" op_error_parse) ]) From e10d4eec234f9e2b4c07aa8bf3001caa402a4aa9 Mon Sep 17 00:00:00 2001 From: Peter Mondlock Date: Fri, 8 Mar 2019 18:38:51 -0600 Subject: [PATCH 08/12] wip --- lib/aws.ml | 4 ++-- src/aws_gen.ml | 4 ++-- src/generate.ml | 3 ++- src/reading.ml | 2 +- src/reading.mli | 6 +++--- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/aws.ml b/lib/aws.ml index 7970cd0e0..bdc6784bb 100644 --- a/lib/aws.ml +++ b/lib/aws.ml @@ -189,8 +189,8 @@ module type Call = sig type error val service : string - val to_http : string -> input -> Request.t - val of_http : string -> string -> [`Ok of output | `Error of error Error.error_response] + val to_http : string -> string -> input -> Request.t + val of_http : string -> [`Ok of output | `Error of error Error.error_response] val parse_error : int -> string -> error option end diff --git a/src/aws_gen.ml b/src/aws_gen.ml index bfe8ef75c..aee2c7ace 100644 --- a/src/aws_gen.ml +++ b/src/aws_gen.ml @@ -54,7 +54,7 @@ module Json = struct let lookup_list field assoc = try to_list (List.assoc field assoc) with _ -> [] - let rec merge (orig:Yojson.Basic.json) (extra:Yojson.Basic.json) : Yojson.Basic.json = + let rec merge (orig:Yojson.Basic.t) (extra:Yojson.Basic.t) : Yojson.Basic.t = match orig, extra with | `Assoc os, `Assoc es -> let upd_ = List.map (fun (ok, ov) -> @@ -75,7 +75,7 @@ module Json = struct then (key, default) :: assoc else result - let override_shapes original overrides : (string * Yojson.Basic.json) list = + let override_shapes original overrides : (string * Yojson.Basic.t) list = let open Yojson.Basic.Util in List.map (fun (key, val_) -> try diff --git a/src/generate.ml b/src/generate.ml index 505dde590..7359d9f05 100644 --- a/src/generate.ml +++ b/src/generate.ml @@ -314,7 +314,8 @@ let op service version _shapes op = letin "uri" (app2 "Uri.add_query_params" - (app1 "Uri.of_string" (app1 "Aws.of_option_exn" (app1 "Aws_endpoints.endpoint_of") (ident "service") (ident "region"))) + (app1 "Uri.of_string" + (app1 "Aws.Util.of_option_exn" (app2 "Aws_endpoints.endpoint_of" (ident "service") (ident "region")))) (match op.Operation.input_shape with | None -> defaults | Some input_shape -> diff --git a/src/reading.ml b/src/reading.ml index ff82240c4..eaeab6209 100644 --- a/src/reading.ml +++ b/src/reading.ml @@ -62,7 +62,7 @@ let parse_member rq (mnm, mj) = ; field_name = unreserve (Util.to_field_name mnm) } -let shape ((nm, j) : (string * Yojson.Basic.json)) : Shape.parsed = +let shape ((nm, j) : (string * Yojson.Basic.t)) : Shape.parsed = match Json.member "type" j with | `String "structure" -> let required = diff --git a/src/reading.mli b/src/reading.mli index 9903803f7..dd8662220 100644 --- a/src/reading.mli +++ b/src/reading.mli @@ -31,8 +31,8 @@ POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------*) -val shape : string * Yojson.Basic.json -> Structures.Shape.parsed +val shape : string * Yojson.Basic.t -> Structures.Shape.parsed -val op : string * Yojson.Basic.json -> Structures.Operation.t +val op : string * Yojson.Basic.t -> Structures.Operation.t -val error : string -> Yojson.Basic.json -> Structures.Error.t +val error : string -> Yojson.Basic.t -> Structures.Error.t From b3db9c29da091e7055a88ec44e9c6719b76aa362 Mon Sep 17 00:00:00 2001 From: Peter Mondlock Date: Sat, 9 Mar 2019 16:37:28 -0600 Subject: [PATCH 09/12] backport changes made ad hoc --- Makefile | 2 +- lib/aws.ml | 17 +- lib/aws.mli | 8 +- lib/endpoints.ml | 2053 +++++++++++++++++++++++++++++++++++++++++++ src/endpoint_gen.ml | 39 +- src/generate.ml | 47 +- src/reading.ml | 5 +- src/structures.ml | 2 +- src/structures.mli | 2 +- src/util.ml | 5 +- 10 files changed, 2132 insertions(+), 48 deletions(-) create mode 100644 lib/endpoints.ml diff --git a/Makefile b/Makefile index 4747e69f3..f3ea479be 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ clean: .PHONY: endpoints endpoints: - dune exec endpoint-gen -- -i input/endpoints.json -o libraries + dune exec endpoint-gen -- -i input/endpoints.json -o lib aws-ec2: dune exec aws-gen -- --is-ec2 -i input/ec2/latest/service-2.json -r input/ec2/overrides.json -e input/errors.json -o libraries diff --git a/lib/aws.ml b/lib/aws.ml index bdc6784bb..fee55e046 100644 --- a/lib/aws.ml +++ b/lib/aws.ml @@ -61,9 +61,6 @@ module Util = struct | [] -> Some [] | (Some v) :: xs -> option_bind (option_all xs) (fun rest -> Some (v :: rest)) | None :: _ -> None - let str_starts_with prefix s = - let re = Str.regexp_case_fold ("^" ^ (prefix ^ ".*")) in - Str.string_partial_match re s 0 end module Xml = struct @@ -397,6 +394,8 @@ module BaseTypes = struct end +module Endpoints = Endpoints + module Signing = struct module Hash = struct @@ -439,7 +438,7 @@ module Signing = struct * http://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html *) let sign_request ~access_key ~secret_key ~service ~region (meth, uri, headers) = - let host = service ^ ".amazonaws.com" in + let host = Util.of_option_exn (Endpoints.endpoint_of service region) in let params = encode_query (Uri.query uri) in let sign key msg = Hash.sha256 ~key msg in let get_signature_key key date region service = @@ -449,16 +448,20 @@ module Signing = struct let datestamp = Time.date_yymmdd now in let canonical_uri = "/" in let canonical_querystring = params in - let canonical_headers = "host:" ^ host ^ "\n" ^ "x-amz-date:" ^ amzdate ^ "\n" in - let signed_headers = "host;x-amz-date" in let payload_hash = Hash.sha256_hex "" in + let canonical_headers = "host:" ^ host ^ "\n" ^ "x-amz-content-sha256:" ^ payload_hash ^ "\nx-amz-date:" ^ amzdate ^ "\n" in + let signed_headers = "host;x-amz-content-sha256;x-amz-date" in let canonical_request = Request.string_of_meth meth ^ "\n" ^ canonical_uri ^ "\n" ^ canonical_querystring ^ "\n" ^ canonical_headers ^ "\n" ^ signed_headers ^ "\n" ^ payload_hash in let algorithm = "AWS4-HMAC-SHA256" in let credential_scope = datestamp ^ "/" ^ region ^ "/" ^ service ^ "/" ^ "aws4_request" in let string_to_sign = algorithm ^ "\n" ^ amzdate ^ "\n" ^ credential_scope ^ "\n" ^ Hash.sha256_hex canonical_request in let signing_key = get_signature_key secret_key datestamp region service in + print_endline ("\nstring_to_sign:\n" ^ string_to_sign); + print_endline ("\ncanonical string:\n" ^ canonical_request); let signature = Hash.sha256_hex ~key:signing_key string_to_sign in let authorization_header = String.concat "" [algorithm; " "; "Credential="; access_key; "/"; credential_scope; ", "; "SignedHeaders="; signed_headers; ", "; "Signature="; signature] in - let headers = ("x-amz-date",amzdate) :: ("Authorization", authorization_header) :: headers in + let headers = ("x-amz-date", amzdate) :: ("x-amz-content-sha256", payload_hash) :: ("Authorization", authorization_header) :: headers in (meth, uri, headers) end + + diff --git a/lib/aws.mli b/lib/aws.mli index 79318456f..cb2a12061 100644 --- a/lib/aws.mli +++ b/lib/aws.mli @@ -189,7 +189,7 @@ module Query : sig as [(0, val); (1, val)...]. *) val to_query_list : ('a -> t) -> 'a list -> t - val to_query_hashtbl : ('a -> t) -> (string, 'a) Hashtbl.t -> t + val to_query_hashtbl : ('a -> string) -> ('b -> t) -> ('a, 'b) Hashtbl.t -> t end (** This module contains helpers used for XML parsing. It wraps Ezxmlm @@ -239,7 +239,7 @@ module Json : sig (** This converts an `Assoc (string * t list) to ('a, 'b) Hashtbl.t, or throws a Casting_error in the case that the input is not an `Assoc. *) - val to_hashtbl: (t -> 'b) -> t -> (string, 'b) Hashtbl.t + val to_hashtbl: (string -> 'a) -> (t -> 'b) -> t -> ('a, 'b) Hashtbl.t (** If t is an `Assoc, this looks up the field specified. If it isn't found, or if the input is not an `Assoc, returns None. *) @@ -316,6 +316,8 @@ module BaseTypes : sig val of_json : Json.t -> t val to_query : t -> Query.t val parse : Ezxmlm.nodes -> t option + val to_string : t -> string + val of_string : string -> t end module Unit : Base with type t = unit @@ -328,3 +330,5 @@ module BaseTypes : sig module Float : Base with type t = float module DateTime : Base with type t = CalendarLib.Calendar.t end + +module Endpoints = Endpoints diff --git a/lib/endpoints.ml b/lib/endpoints.ml new file mode 100644 index 000000000..b28c0d4d9 --- /dev/null +++ b/lib/endpoints.ml @@ -0,0 +1,2053 @@ +let endpoint_of svc_name region = + match svc_name with + | "a4b" -> + (match region with + | "us-east-1" -> Some "a4b.us-east-1.amazonaws.com" + | _ -> None) + | "acm" -> + (match region with + | "ap-northeast-1" -> Some "acm.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "acm.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "acm.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "acm.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "acm.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "acm.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "acm.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "acm.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "acm.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "acm.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "acm.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "acm.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "acm.us-east-1.amazonaws.com" + | "us-east-2" -> Some "acm.us-east-2.amazonaws.com" + | "us-west-1" -> Some "acm.us-west-1.amazonaws.com" + | "us-west-2" -> Some "acm.us-west-2.amazonaws.com" + | _ -> None) + | "acm-pca" -> + (match region with + | "ap-northeast-1" -> Some "acm-pca.ap-northeast-1.amazonaws.com" + | "ap-southeast-1" -> Some "acm-pca.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "acm-pca.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "acm-pca.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "acm-pca.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "acm-pca.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "acm-pca.eu-west-2.amazonaws.com" + | "us-east-1" -> Some "acm-pca.us-east-1.amazonaws.com" + | "us-east-2" -> Some "acm-pca.us-east-2.amazonaws.com" + | "us-west-2" -> Some "acm-pca.us-west-2.amazonaws.com" + | _ -> None) + | "api.ecr" -> + (match region with + | "ap-northeast-1" -> Some "api.ecr.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "api.ecr.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "api.ecr.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "api.ecr.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "api.ecr.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "api.ecr.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "api.ecr.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "api.ecr.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "api.ecr.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "api.ecr.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "api.ecr.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "api.ecr.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "api.ecr.us-east-1.amazonaws.com" + | "us-east-2" -> Some "api.ecr.us-east-2.amazonaws.com" + | "us-west-1" -> Some "api.ecr.us-west-1.amazonaws.com" + | "us-west-2" -> Some "api.ecr.us-west-2.amazonaws.com" + | _ -> None) + | "api.mediatailor" -> + (match region with + | "ap-northeast-1" -> + Some "api.mediatailor.ap-northeast-1.amazonaws.com" + | "ap-southeast-1" -> + Some "api.mediatailor.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "api.mediatailor.ap-southeast-2.amazonaws.com" + | "eu-west-1" -> Some "api.mediatailor.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "api.mediatailor.us-east-1.amazonaws.com" + | "us-west-2" -> Some "api.mediatailor.us-west-2.amazonaws.com" + | _ -> None) + | "api.pricing" -> + (match region with + | "ap-south-1" -> Some "api.pricing.ap-south-1.amazonaws.com" + | "us-east-1" -> Some "api.pricing.us-east-1.amazonaws.com" + | _ -> None) + | "api.sagemaker" -> + (match region with + | "ap-northeast-1" -> + Some "api.sagemaker.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "api.sagemaker.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "api.sagemaker.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "api.sagemaker.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "api.sagemaker.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "api.sagemaker.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "api.sagemaker.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "api.sagemaker.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "api.sagemaker.eu-west-2.amazonaws.com" + | "us-east-1" -> Some "api.sagemaker.us-east-1.amazonaws.com" + | "us-east-1-fips" -> + Some "api-fips.sagemaker.us-east-1.amazonaws.com" + | "us-east-2" -> Some "api.sagemaker.us-east-2.amazonaws.com" + | "us-east-2-fips" -> + Some "api-fips.sagemaker.us-east-2.amazonaws.com" + | "us-west-1" -> Some "api.sagemaker.us-west-1.amazonaws.com" + | "us-west-1-fips" -> + Some "api-fips.sagemaker.us-west-1.amazonaws.com" + | "us-west-2" -> Some "api.sagemaker.us-west-2.amazonaws.com" + | "us-west-2-fips" -> + Some "api-fips.sagemaker.us-west-2.amazonaws.com" + | _ -> None) + | "apigateway" -> + (match region with + | "ap-northeast-1" -> Some "apigateway.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "apigateway.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "apigateway.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "apigateway.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "apigateway.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "apigateway.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "apigateway.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "apigateway.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "apigateway.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "apigateway.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "apigateway.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "apigateway.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "apigateway.us-east-1.amazonaws.com" + | "us-east-2" -> Some "apigateway.us-east-2.amazonaws.com" + | "us-west-1" -> Some "apigateway.us-west-1.amazonaws.com" + | "us-west-2" -> Some "apigateway.us-west-2.amazonaws.com" + | _ -> None) + | "application-autoscaling" -> + (match region with + | "ap-northeast-1" -> + Some "application-autoscaling.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "application-autoscaling.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> + Some "application-autoscaling.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "application-autoscaling.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "application-autoscaling.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> + Some "application-autoscaling.ca-central-1.amazonaws.com" + | "eu-central-1" -> + Some "application-autoscaling.eu-central-1.amazonaws.com" + | "eu-north-1" -> + Some "application-autoscaling.eu-north-1.amazonaws.com" + | "eu-west-1" -> + Some "application-autoscaling.eu-west-1.amazonaws.com" + | "eu-west-2" -> + Some "application-autoscaling.eu-west-2.amazonaws.com" + | "eu-west-3" -> + Some "application-autoscaling.eu-west-3.amazonaws.com" + | "sa-east-1" -> + Some "application-autoscaling.sa-east-1.amazonaws.com" + | "us-east-1" -> + Some "application-autoscaling.us-east-1.amazonaws.com" + | "us-east-2" -> + Some "application-autoscaling.us-east-2.amazonaws.com" + | "us-west-1" -> + Some "application-autoscaling.us-west-1.amazonaws.com" + | "us-west-2" -> + Some "application-autoscaling.us-west-2.amazonaws.com" + | _ -> None) + | "appstream2" -> + (match region with + | "ap-northeast-1" -> Some "appstream2.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "appstream2.ap-northeast-2.amazonaws.com" + | "ap-southeast-1" -> Some "appstream2.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "appstream2.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "appstream2.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "appstream2.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "appstream2.us-east-1.amazonaws.com" + | "us-west-2" -> Some "appstream2.us-west-2.amazonaws.com" + | _ -> None) + | "appsync" -> + (match region with + | "ap-northeast-1" -> Some "appsync.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "appsync.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "appsync.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "appsync.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "appsync.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "appsync.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "appsync.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "appsync.us-east-1.amazonaws.com" + | "us-east-2" -> Some "appsync.us-east-2.amazonaws.com" + | "us-west-2" -> Some "appsync.us-west-2.amazonaws.com" + | _ -> None) + | "athena" -> + (match region with + | "ap-northeast-1" -> Some "athena.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "athena.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "athena.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "athena.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "athena.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "athena.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "athena.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "athena.eu-west-2.amazonaws.com" + | "us-east-1" -> Some "athena.us-east-1.amazonaws.com" + | "us-east-2" -> Some "athena.us-east-2.amazonaws.com" + | "us-west-2" -> Some "athena.us-west-2.amazonaws.com" + | _ -> None) + | "autoscaling" -> + (match region with + | "ap-northeast-1" -> Some "autoscaling.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "autoscaling.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "autoscaling.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "autoscaling.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "autoscaling.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "autoscaling.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "autoscaling.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "autoscaling.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "autoscaling.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "autoscaling.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "autoscaling.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "autoscaling.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "autoscaling.us-east-1.amazonaws.com" + | "us-east-2" -> Some "autoscaling.us-east-2.amazonaws.com" + | "us-west-1" -> Some "autoscaling.us-west-1.amazonaws.com" + | "us-west-2" -> Some "autoscaling.us-west-2.amazonaws.com" + | _ -> None) + | "autoscaling-plans" -> + (match region with + | "ap-northeast-1" -> + Some "autoscaling-plans.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "autoscaling-plans.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "autoscaling-plans.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "autoscaling-plans.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "autoscaling-plans.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> + Some "autoscaling-plans.ca-central-1.amazonaws.com" + | "eu-central-1" -> + Some "autoscaling-plans.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "autoscaling-plans.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "autoscaling-plans.eu-west-2.amazonaws.com" + | "us-east-1" -> Some "autoscaling-plans.us-east-1.amazonaws.com" + | "us-east-2" -> Some "autoscaling-plans.us-east-2.amazonaws.com" + | "us-west-1" -> Some "autoscaling-plans.us-west-1.amazonaws.com" + | "us-west-2" -> Some "autoscaling-plans.us-west-2.amazonaws.com" + | _ -> None) + | "batch" -> + (match region with + | "ap-northeast-1" -> Some "batch.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "batch.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "batch.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "batch.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "batch.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "batch.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "batch.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "batch.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "batch.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "batch.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "batch.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "batch.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "batch.us-east-1.amazonaws.com" + | "us-east-2" -> Some "batch.us-east-2.amazonaws.com" + | "us-west-1" -> Some "batch.us-west-1.amazonaws.com" + | "us-west-2" -> Some "batch.us-west-2.amazonaws.com" + | _ -> None) + | "budgets" -> + (match region with + | "aws-global" -> Some "budgets.amazonaws.com" + | _ -> None) + | "ce" -> + (match region with + | "aws-global" -> Some "ce.us-east-1.amazonaws.com" + | _ -> None) + | "chime" -> + (match region with + | "aws-global" -> Some "service.chime.aws.amazon.com" + | _ -> None) + | "cloud9" -> + (match region with + | "ap-southeast-1" -> Some "cloud9.ap-southeast-1.amazonaws.com" + | "eu-west-1" -> Some "cloud9.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "cloud9.us-east-1.amazonaws.com" + | "us-east-2" -> Some "cloud9.us-east-2.amazonaws.com" + | "us-west-2" -> Some "cloud9.us-west-2.amazonaws.com" + | _ -> None) + | "clouddirectory" -> + (match region with + | "ap-southeast-1" -> + Some "clouddirectory.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "clouddirectory.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "clouddirectory.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "clouddirectory.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "clouddirectory.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "clouddirectory.eu-west-2.amazonaws.com" + | "us-east-1" -> Some "clouddirectory.us-east-1.amazonaws.com" + | "us-east-2" -> Some "clouddirectory.us-east-2.amazonaws.com" + | "us-west-2" -> Some "clouddirectory.us-west-2.amazonaws.com" + | _ -> None) + | "cloudformation" -> + (match region with + | "ap-northeast-1" -> + Some "cloudformation.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "cloudformation.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "cloudformation.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "cloudformation.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "cloudformation.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "cloudformation.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "cloudformation.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "cloudformation.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "cloudformation.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "cloudformation.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "cloudformation.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "cloudformation.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "cloudformation.us-east-1.amazonaws.com" + | "us-east-2" -> Some "cloudformation.us-east-2.amazonaws.com" + | "us-west-1" -> Some "cloudformation.us-west-1.amazonaws.com" + | "us-west-2" -> Some "cloudformation.us-west-2.amazonaws.com" + | _ -> None) + | "cloudfront" -> + (match region with + | "aws-global" -> Some "cloudfront.amazonaws.com" + | _ -> None) + | "cloudhsm" -> + (match region with + | "ap-northeast-1" -> Some "cloudhsm.ap-northeast-1.amazonaws.com" + | "ap-southeast-1" -> Some "cloudhsm.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "cloudhsm.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "cloudhsm.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "cloudhsm.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "cloudhsm.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "cloudhsm.us-east-1.amazonaws.com" + | "us-east-2" -> Some "cloudhsm.us-east-2.amazonaws.com" + | "us-west-1" -> Some "cloudhsm.us-west-1.amazonaws.com" + | "us-west-2" -> Some "cloudhsm.us-west-2.amazonaws.com" + | _ -> None) + | "cloudhsmv2" -> + (match region with + | "ap-northeast-1" -> Some "cloudhsmv2.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "cloudhsmv2.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "cloudhsmv2.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "cloudhsmv2.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "cloudhsmv2.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "cloudhsmv2.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "cloudhsmv2.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "cloudhsmv2.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "cloudhsmv2.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "cloudhsmv2.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "cloudhsmv2.eu-west-3.amazonaws.com" + | "us-east-1" -> Some "cloudhsmv2.us-east-1.amazonaws.com" + | "us-east-2" -> Some "cloudhsmv2.us-east-2.amazonaws.com" + | "us-west-1" -> Some "cloudhsmv2.us-west-1.amazonaws.com" + | "us-west-2" -> Some "cloudhsmv2.us-west-2.amazonaws.com" + | _ -> None) + | "cloudsearch" -> + (match region with + | "ap-northeast-1" -> Some "cloudsearch.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "cloudsearch.ap-northeast-2.amazonaws.com" + | "ap-southeast-1" -> Some "cloudsearch.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "cloudsearch.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "cloudsearch.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "cloudsearch.eu-west-1.amazonaws.com" + | "sa-east-1" -> Some "cloudsearch.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "cloudsearch.us-east-1.amazonaws.com" + | "us-west-1" -> Some "cloudsearch.us-west-1.amazonaws.com" + | "us-west-2" -> Some "cloudsearch.us-west-2.amazonaws.com" + | _ -> None) + | "cloudtrail" -> + (match region with + | "ap-northeast-1" -> Some "cloudtrail.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "cloudtrail.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "cloudtrail.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "cloudtrail.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "cloudtrail.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "cloudtrail.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "cloudtrail.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "cloudtrail.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "cloudtrail.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "cloudtrail.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "cloudtrail.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "cloudtrail.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "cloudtrail.us-east-1.amazonaws.com" + | "us-east-2" -> Some "cloudtrail.us-east-2.amazonaws.com" + | "us-west-1" -> Some "cloudtrail.us-west-1.amazonaws.com" + | "us-west-2" -> Some "cloudtrail.us-west-2.amazonaws.com" + | _ -> None) + | "codebuild" -> + (match region with + | "ap-northeast-1" -> Some "codebuild.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "codebuild.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "codebuild.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "codebuild.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "codebuild.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "codebuild.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "codebuild.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "codebuild.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "codebuild.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "codebuild.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "codebuild.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "codebuild.us-east-1.amazonaws.com" + | "us-east-1-fips" -> Some "codebuild-fips.us-east-1.amazonaws.com" + | "us-east-2" -> Some "codebuild.us-east-2.amazonaws.com" + | "us-east-2-fips" -> Some "codebuild-fips.us-east-2.amazonaws.com" + | "us-west-1" -> Some "codebuild.us-west-1.amazonaws.com" + | "us-west-1-fips" -> Some "codebuild-fips.us-west-1.amazonaws.com" + | "us-west-2" -> Some "codebuild.us-west-2.amazonaws.com" + | "us-west-2-fips" -> Some "codebuild-fips.us-west-2.amazonaws.com" + | _ -> None) + | "codecommit" -> + (match region with + | "ap-northeast-1" -> Some "codecommit.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "codecommit.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "codecommit.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "codecommit.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "codecommit.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "codecommit.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "codecommit.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "codecommit.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "codecommit.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "codecommit.eu-west-3.amazonaws.com" + | "fips" -> Some "codecommit-fips.ca-central-1.amazonaws.com" + | "sa-east-1" -> Some "codecommit.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "codecommit.us-east-1.amazonaws.com" + | "us-east-2" -> Some "codecommit.us-east-2.amazonaws.com" + | "us-west-1" -> Some "codecommit.us-west-1.amazonaws.com" + | "us-west-2" -> Some "codecommit.us-west-2.amazonaws.com" + | _ -> None) + | "codedeploy" -> + (match region with + | "ap-northeast-1" -> Some "codedeploy.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "codedeploy.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "codedeploy.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "codedeploy.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "codedeploy.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "codedeploy.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "codedeploy.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "codedeploy.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "codedeploy.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "codedeploy.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "codedeploy.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "codedeploy.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "codedeploy.us-east-1.amazonaws.com" + | "us-east-1-fips" -> Some "codedeploy-fips.us-east-1.amazonaws.com" + | "us-east-2" -> Some "codedeploy.us-east-2.amazonaws.com" + | "us-east-2-fips" -> Some "codedeploy-fips.us-east-2.amazonaws.com" + | "us-west-1" -> Some "codedeploy.us-west-1.amazonaws.com" + | "us-west-1-fips" -> Some "codedeploy-fips.us-west-1.amazonaws.com" + | "us-west-2" -> Some "codedeploy.us-west-2.amazonaws.com" + | "us-west-2-fips" -> Some "codedeploy-fips.us-west-2.amazonaws.com" + | _ -> None) + | "codepipeline" -> + (match region with + | "ap-northeast-1" -> Some "codepipeline.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "codepipeline.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "codepipeline.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "codepipeline.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "codepipeline.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "codepipeline.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "codepipeline.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "codepipeline.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "codepipeline.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "codepipeline.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "codepipeline.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "codepipeline.us-east-1.amazonaws.com" + | "us-east-2" -> Some "codepipeline.us-east-2.amazonaws.com" + | "us-west-1" -> Some "codepipeline.us-west-1.amazonaws.com" + | "us-west-2" -> Some "codepipeline.us-west-2.amazonaws.com" + | _ -> None) + | "codestar" -> + (match region with + | "ap-northeast-1" -> Some "codestar.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "codestar.ap-northeast-2.amazonaws.com" + | "ap-southeast-1" -> Some "codestar.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "codestar.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "codestar.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "codestar.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "codestar.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "codestar.eu-west-2.amazonaws.com" + | "us-east-1" -> Some "codestar.us-east-1.amazonaws.com" + | "us-east-2" -> Some "codestar.us-east-2.amazonaws.com" + | "us-west-1" -> Some "codestar.us-west-1.amazonaws.com" + | "us-west-2" -> Some "codestar.us-west-2.amazonaws.com" + | _ -> None) + | "cognito-identity" -> + (match region with + | "ap-northeast-1" -> + Some "cognito-identity.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "cognito-identity.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "cognito-identity.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "cognito-identity.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "cognito-identity.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "cognito-identity.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "cognito-identity.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "cognito-identity.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "cognito-identity.eu-west-2.amazonaws.com" + | "us-east-1" -> Some "cognito-identity.us-east-1.amazonaws.com" + | "us-east-2" -> Some "cognito-identity.us-east-2.amazonaws.com" + | "us-west-2" -> Some "cognito-identity.us-west-2.amazonaws.com" + | _ -> None) + | "cognito-idp" -> + (match region with + | "ap-northeast-1" -> Some "cognito-idp.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "cognito-idp.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "cognito-idp.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "cognito-idp.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "cognito-idp.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "cognito-idp.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "cognito-idp.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "cognito-idp.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "cognito-idp.eu-west-2.amazonaws.com" + | "us-east-1" -> Some "cognito-idp.us-east-1.amazonaws.com" + | "us-east-2" -> Some "cognito-idp.us-east-2.amazonaws.com" + | "us-west-2" -> Some "cognito-idp.us-west-2.amazonaws.com" + | _ -> None) + | "cognito-sync" -> + (match region with + | "ap-northeast-1" -> Some "cognito-sync.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "cognito-sync.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "cognito-sync.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "cognito-sync.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "cognito-sync.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "cognito-sync.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "cognito-sync.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "cognito-sync.eu-west-2.amazonaws.com" + | "us-east-1" -> Some "cognito-sync.us-east-1.amazonaws.com" + | "us-east-2" -> Some "cognito-sync.us-east-2.amazonaws.com" + | "us-west-2" -> Some "cognito-sync.us-west-2.amazonaws.com" + | _ -> None) + | "comprehend" -> + (match region with + | "ap-southeast-1" -> Some "comprehend.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "comprehend.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "comprehend.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "comprehend.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "comprehend.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "comprehend.us-east-1.amazonaws.com" + | "us-east-2" -> Some "comprehend.us-east-2.amazonaws.com" + | "us-west-2" -> Some "comprehend.us-west-2.amazonaws.com" + | _ -> None) + | "config" -> + (match region with + | "ap-northeast-1" -> Some "config.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "config.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "config.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "config.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "config.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "config.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "config.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "config.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "config.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "config.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "config.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "config.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "config.us-east-1.amazonaws.com" + | "us-east-2" -> Some "config.us-east-2.amazonaws.com" + | "us-west-1" -> Some "config.us-west-1.amazonaws.com" + | "us-west-2" -> Some "config.us-west-2.amazonaws.com" + | _ -> None) + | "cur" -> + (match region with + | "us-east-1" -> Some "cur.us-east-1.amazonaws.com" + | _ -> None) + | "data.iot" -> + (match region with + | "ap-northeast-1" -> Some "data.iot.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "data.iot.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "data.iot.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "data.iot.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "data.iot.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "data.iot.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "data.iot.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "data.iot.eu-west-2.amazonaws.com" + | "us-east-1" -> Some "data.iot.us-east-1.amazonaws.com" + | "us-east-2" -> Some "data.iot.us-east-2.amazonaws.com" + | "us-west-2" -> Some "data.iot.us-west-2.amazonaws.com" + | _ -> None) + | "datapipeline" -> + (match region with + | "ap-northeast-1" -> Some "datapipeline.ap-northeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "datapipeline.ap-southeast-2.amazonaws.com" + | "eu-west-1" -> Some "datapipeline.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "datapipeline.us-east-1.amazonaws.com" + | "us-west-2" -> Some "datapipeline.us-west-2.amazonaws.com" + | _ -> None) + | "datasync" -> + (match region with + | "ap-northeast-1" -> Some "datasync.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "datasync.ap-northeast-2.amazonaws.com" + | "ap-southeast-1" -> Some "datasync.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "datasync.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "datasync.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "datasync.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "datasync.us-east-1.amazonaws.com" + | "us-east-2" -> Some "datasync.us-east-2.amazonaws.com" + | "us-west-1" -> Some "datasync.us-west-1.amazonaws.com" + | "us-west-2" -> Some "datasync.us-west-2.amazonaws.com" + | _ -> None) + | "dax" -> + (match region with + | "ap-northeast-1" -> Some "dax.ap-northeast-1.amazonaws.com" + | "ap-south-1" -> Some "dax.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "dax.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "dax.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "dax.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "dax.eu-west-1.amazonaws.com" + | "sa-east-1" -> Some "dax.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "dax.us-east-1.amazonaws.com" + | "us-east-2" -> Some "dax.us-east-2.amazonaws.com" + | "us-west-1" -> Some "dax.us-west-1.amazonaws.com" + | "us-west-2" -> Some "dax.us-west-2.amazonaws.com" + | _ -> None) + | "devicefarm" -> + (match region with + | "us-west-2" -> Some "devicefarm.us-west-2.amazonaws.com" + | _ -> None) + | "directconnect" -> + (match region with + | "ap-northeast-1" -> + Some "directconnect.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "directconnect.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "directconnect.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "directconnect.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "directconnect.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "directconnect.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "directconnect.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "directconnect.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "directconnect.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "directconnect.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "directconnect.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "directconnect.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "directconnect.us-east-1.amazonaws.com" + | "us-east-2" -> Some "directconnect.us-east-2.amazonaws.com" + | "us-west-1" -> Some "directconnect.us-west-1.amazonaws.com" + | "us-west-2" -> Some "directconnect.us-west-2.amazonaws.com" + | _ -> None) + | "discovery" -> + (match region with + | "us-west-2" -> Some "discovery.us-west-2.amazonaws.com" + | _ -> None) + | "dms" -> + (match region with + | "ap-northeast-1" -> Some "dms.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "dms.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "dms.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "dms.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "dms.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "dms.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "dms.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "dms.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "dms.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "dms.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "dms.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "dms.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "dms.us-east-1.amazonaws.com" + | "us-east-2" -> Some "dms.us-east-2.amazonaws.com" + | "us-west-1" -> Some "dms.us-west-1.amazonaws.com" + | "us-west-2" -> Some "dms.us-west-2.amazonaws.com" + | _ -> None) + | "docdb" -> + (match region with + | "eu-west-1" -> Some "rds.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "rds.us-east-1.amazonaws.com" + | "us-east-2" -> Some "rds.us-east-2.amazonaws.com" + | "us-west-2" -> Some "rds.us-west-2.amazonaws.com" + | _ -> None) + | "ds" -> + (match region with + | "ap-northeast-1" -> Some "ds.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "ds.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "ds.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "ds.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "ds.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "ds.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "ds.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "ds.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "ds.eu-west-2.amazonaws.com" + | "sa-east-1" -> Some "ds.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "ds.us-east-1.amazonaws.com" + | "us-east-2" -> Some "ds.us-east-2.amazonaws.com" + | "us-west-1" -> Some "ds.us-west-1.amazonaws.com" + | "us-west-2" -> Some "ds.us-west-2.amazonaws.com" + | _ -> None) + | "dynamodb" -> + (match region with + | "ap-northeast-1" -> Some "dynamodb.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "dynamodb.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "dynamodb.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "dynamodb.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "dynamodb.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "dynamodb.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "dynamodb.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "dynamodb.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "dynamodb.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "dynamodb.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "dynamodb.eu-west-3.amazonaws.com" + | "local" -> Some "localhost:8000" + | "sa-east-1" -> Some "dynamodb.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "dynamodb.us-east-1.amazonaws.com" + | "us-east-2" -> Some "dynamodb.us-east-2.amazonaws.com" + | "us-west-1" -> Some "dynamodb.us-west-1.amazonaws.com" + | "us-west-2" -> Some "dynamodb.us-west-2.amazonaws.com" + | _ -> None) + | "ec2" -> + (match region with + | "ap-northeast-1" -> Some "ec2.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "ec2.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "ec2.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "ec2.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "ec2.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "ec2.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "ec2.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "ec2.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "ec2.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "ec2.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "ec2.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "ec2.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "ec2.us-east-1.amazonaws.com" + | "us-east-2" -> Some "ec2.us-east-2.amazonaws.com" + | "us-west-1" -> Some "ec2.us-west-1.amazonaws.com" + | "us-west-2" -> Some "ec2.us-west-2.amazonaws.com" + | _ -> None) + | "ecs" -> + (match region with + | "ap-northeast-1" -> Some "ecs.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "ecs.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "ecs.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "ecs.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "ecs.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "ecs.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "ecs.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "ecs.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "ecs.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "ecs.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "ecs.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "ecs.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "ecs.us-east-1.amazonaws.com" + | "us-east-2" -> Some "ecs.us-east-2.amazonaws.com" + | "us-west-1" -> Some "ecs.us-west-1.amazonaws.com" + | "us-west-2" -> Some "ecs.us-west-2.amazonaws.com" + | _ -> None) + | "elasticache" -> + (match region with + | "ap-northeast-1" -> Some "elasticache.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "elasticache.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "elasticache.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "elasticache.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "elasticache.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "elasticache.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "elasticache.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "elasticache.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "elasticache.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "elasticache.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "elasticache.eu-west-3.amazonaws.com" + | "fips" -> Some "elasticache-fips.us-west-1.amazonaws.com" + | "sa-east-1" -> Some "elasticache.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "elasticache.us-east-1.amazonaws.com" + | "us-east-2" -> Some "elasticache.us-east-2.amazonaws.com" + | "us-west-1" -> Some "elasticache.us-west-1.amazonaws.com" + | "us-west-2" -> Some "elasticache.us-west-2.amazonaws.com" + | _ -> None) + | "elasticbeanstalk" -> + (match region with + | "ap-northeast-1" -> + Some "elasticbeanstalk.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "elasticbeanstalk.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "elasticbeanstalk.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "elasticbeanstalk.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "elasticbeanstalk.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "elasticbeanstalk.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "elasticbeanstalk.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "elasticbeanstalk.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "elasticbeanstalk.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "elasticbeanstalk.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "elasticbeanstalk.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "elasticbeanstalk.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "elasticbeanstalk.us-east-1.amazonaws.com" + | "us-east-2" -> Some "elasticbeanstalk.us-east-2.amazonaws.com" + | "us-west-1" -> Some "elasticbeanstalk.us-west-1.amazonaws.com" + | "us-west-2" -> Some "elasticbeanstalk.us-west-2.amazonaws.com" + | _ -> None) + | "elasticfilesystem" -> + (match region with + | "ap-northeast-1" -> + Some "elasticfilesystem.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "elasticfilesystem.ap-northeast-2.amazonaws.com" + | "ap-southeast-1" -> + Some "elasticfilesystem.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "elasticfilesystem.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> + Some "elasticfilesystem.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "elasticfilesystem.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "elasticfilesystem.eu-west-2.amazonaws.com" + | "us-east-1" -> Some "elasticfilesystem.us-east-1.amazonaws.com" + | "us-east-2" -> Some "elasticfilesystem.us-east-2.amazonaws.com" + | "us-west-1" -> Some "elasticfilesystem.us-west-1.amazonaws.com" + | "us-west-2" -> Some "elasticfilesystem.us-west-2.amazonaws.com" + | _ -> None) + | "elasticloadbalancing" -> + (match region with + | "ap-northeast-1" -> + Some "elasticloadbalancing.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "elasticloadbalancing.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "elasticloadbalancing.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "elasticloadbalancing.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "elasticloadbalancing.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> + Some "elasticloadbalancing.ca-central-1.amazonaws.com" + | "eu-central-1" -> + Some "elasticloadbalancing.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "elasticloadbalancing.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "elasticloadbalancing.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "elasticloadbalancing.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "elasticloadbalancing.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "elasticloadbalancing.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "elasticloadbalancing.us-east-1.amazonaws.com" + | "us-east-2" -> Some "elasticloadbalancing.us-east-2.amazonaws.com" + | "us-west-1" -> Some "elasticloadbalancing.us-west-1.amazonaws.com" + | "us-west-2" -> Some "elasticloadbalancing.us-west-2.amazonaws.com" + | _ -> None) + | "elasticmapreduce" -> + (match region with + | "ap-northeast-1" -> + Some "elasticmapreduce.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "elasticmapreduce.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "elasticmapreduce.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "elasticmapreduce.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "elasticmapreduce.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "elasticmapreduce.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "elasticmapreduce.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "elasticmapreduce.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "elasticmapreduce.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "elasticmapreduce.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "elasticmapreduce.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "elasticmapreduce.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "elasticmapreduce.us-east-1.amazonaws.com" + | "us-east-2" -> Some "elasticmapreduce.us-east-2.amazonaws.com" + | "us-west-1" -> Some "elasticmapreduce.us-west-1.amazonaws.com" + | "us-west-2" -> Some "elasticmapreduce.us-west-2.amazonaws.com" + | _ -> None) + | "elastictranscoder" -> + (match region with + | "ap-northeast-1" -> + Some "elastictranscoder.ap-northeast-1.amazonaws.com" + | "ap-south-1" -> Some "elastictranscoder.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "elastictranscoder.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "elastictranscoder.ap-southeast-2.amazonaws.com" + | "eu-west-1" -> Some "elastictranscoder.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "elastictranscoder.us-east-1.amazonaws.com" + | "us-west-1" -> Some "elastictranscoder.us-west-1.amazonaws.com" + | "us-west-2" -> Some "elastictranscoder.us-west-2.amazonaws.com" + | _ -> None) + | "email" -> + (match region with + | "eu-west-1" -> Some "email.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "email.us-east-1.amazonaws.com" + | "us-west-2" -> Some "email.us-west-2.amazonaws.com" + | _ -> None) + | "entitlement.marketplace" -> + (match region with + | "us-east-1" -> + Some "entitlement.marketplace.us-east-1.amazonaws.com" + | _ -> None) + | "es" -> + (match region with + | "ap-northeast-1" -> Some "es.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "es.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "es.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "es.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "es.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "es.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "es.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "es.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "es.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "es.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "es.eu-west-3.amazonaws.com" + | "fips" -> Some "es-fips.us-west-1.amazonaws.com" + | "sa-east-1" -> Some "es.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "es.us-east-1.amazonaws.com" + | "us-east-2" -> Some "es.us-east-2.amazonaws.com" + | "us-west-1" -> Some "es.us-west-1.amazonaws.com" + | "us-west-2" -> Some "es.us-west-2.amazonaws.com" + | _ -> None) + | "events" -> + (match region with + | "ap-northeast-1" -> Some "events.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "events.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "events.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "events.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "events.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "events.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "events.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "events.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "events.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "events.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "events.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "events.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "events.us-east-1.amazonaws.com" + | "us-east-2" -> Some "events.us-east-2.amazonaws.com" + | "us-west-1" -> Some "events.us-west-1.amazonaws.com" + | "us-west-2" -> Some "events.us-west-2.amazonaws.com" + | _ -> None) + | "firehose" -> + (match region with + | "ap-northeast-1" -> Some "firehose.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "firehose.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "firehose.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "firehose.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "firehose.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "firehose.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "firehose.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "firehose.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "firehose.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "firehose.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "firehose.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "firehose.us-east-1.amazonaws.com" + | "us-east-2" -> Some "firehose.us-east-2.amazonaws.com" + | "us-west-1" -> Some "firehose.us-west-1.amazonaws.com" + | "us-west-2" -> Some "firehose.us-west-2.amazonaws.com" + | _ -> None) + | "fms" -> + (match region with + | "ap-northeast-1" -> Some "fms.ap-northeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "fms.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "fms.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "fms.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "fms.us-east-1.amazonaws.com" + | "us-east-2" -> Some "fms.us-east-2.amazonaws.com" + | "us-west-2" -> Some "fms.us-west-2.amazonaws.com" + | _ -> None) + | "fsx" -> + (match region with + | "eu-west-1" -> Some "fsx.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "fsx.us-east-1.amazonaws.com" + | "us-east-2" -> Some "fsx.us-east-2.amazonaws.com" + | "us-west-2" -> Some "fsx.us-west-2.amazonaws.com" + | _ -> None) + | "gamelift" -> + (match region with + | "ap-northeast-1" -> Some "gamelift.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "gamelift.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "gamelift.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "gamelift.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "gamelift.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "gamelift.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "gamelift.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "gamelift.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "gamelift.eu-west-2.amazonaws.com" + | "sa-east-1" -> Some "gamelift.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "gamelift.us-east-1.amazonaws.com" + | "us-east-2" -> Some "gamelift.us-east-2.amazonaws.com" + | "us-west-1" -> Some "gamelift.us-west-1.amazonaws.com" + | "us-west-2" -> Some "gamelift.us-west-2.amazonaws.com" + | _ -> None) + | "glacier" -> + (match region with + | "ap-northeast-1" -> Some "glacier.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "glacier.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "glacier.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "glacier.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "glacier.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "glacier.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "glacier.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "glacier.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "glacier.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "glacier.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "glacier.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "glacier.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "glacier.us-east-1.amazonaws.com" + | "us-east-2" -> Some "glacier.us-east-2.amazonaws.com" + | "us-west-1" -> Some "glacier.us-west-1.amazonaws.com" + | "us-west-2" -> Some "glacier.us-west-2.amazonaws.com" + | _ -> None) + | "glue" -> + (match region with + | "ap-northeast-1" -> Some "glue.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "glue.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "glue.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "glue.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "glue.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "glue.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "glue.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "glue.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "glue.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "glue.eu-west-3.amazonaws.com" + | "us-east-1" -> Some "glue.us-east-1.amazonaws.com" + | "us-east-2" -> Some "glue.us-east-2.amazonaws.com" + | "us-west-1" -> Some "glue.us-west-1.amazonaws.com" + | "us-west-2" -> Some "glue.us-west-2.amazonaws.com" + | _ -> None) + | "greengrass" -> + (match region with + | "ap-northeast-1" -> Some "greengrass.ap-northeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "greengrass.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "greengrass.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "greengrass.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "greengrass.us-east-1.amazonaws.com" + | "us-west-2" -> Some "greengrass.us-west-2.amazonaws.com" + | _ -> None) + | "guardduty" -> + (match region with + | "ap-northeast-1" -> Some "guardduty.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "guardduty.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "guardduty.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "guardduty.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "guardduty.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "guardduty.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "guardduty.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "guardduty.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "guardduty.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "guardduty.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "guardduty.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "guardduty.us-east-1.amazonaws.com" + | "us-east-2" -> Some "guardduty.us-east-2.amazonaws.com" + | "us-west-1" -> Some "guardduty.us-west-1.amazonaws.com" + | "us-west-2" -> Some "guardduty.us-west-2.amazonaws.com" + | _ -> None) + | "health" -> + (match region with + | "us-east-1" -> Some "health.us-east-1.amazonaws.com" + | _ -> None) + | "iam" -> + (match region with + | "aws-global" -> Some "iam.amazonaws.com" + | _ -> None) + | "importexport" -> + (match region with + | "aws-global" -> Some "importexport.amazonaws.com" + | _ -> None) + | "inspector" -> + (match region with + | "ap-northeast-1" -> Some "inspector.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "inspector.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "inspector.ap-south-1.amazonaws.com" + | "ap-southeast-2" -> Some "inspector.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "inspector.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "inspector.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "inspector.us-east-1.amazonaws.com" + | "us-east-2" -> Some "inspector.us-east-2.amazonaws.com" + | "us-west-1" -> Some "inspector.us-west-1.amazonaws.com" + | "us-west-2" -> Some "inspector.us-west-2.amazonaws.com" + | _ -> None) + | "iot" -> + (match region with + | "ap-northeast-1" -> Some "iot.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "iot.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "iot.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "iot.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "iot.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "iot.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "iot.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "iot.eu-west-2.amazonaws.com" + | "us-east-1" -> Some "iot.us-east-1.amazonaws.com" + | "us-east-2" -> Some "iot.us-east-2.amazonaws.com" + | "us-west-2" -> Some "iot.us-west-2.amazonaws.com" + | _ -> None) + | "iotanalytics" -> + (match region with + | "ap-northeast-1" -> Some "iotanalytics.ap-northeast-1.amazonaws.com" + | "eu-central-1" -> Some "iotanalytics.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "iotanalytics.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "iotanalytics.us-east-1.amazonaws.com" + | "us-east-2" -> Some "iotanalytics.us-east-2.amazonaws.com" + | "us-west-2" -> Some "iotanalytics.us-west-2.amazonaws.com" + | _ -> None) + | "kinesis" -> + (match region with + | "ap-northeast-1" -> Some "kinesis.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "kinesis.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "kinesis.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "kinesis.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "kinesis.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "kinesis.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "kinesis.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "kinesis.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "kinesis.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "kinesis.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "kinesis.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "kinesis.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "kinesis.us-east-1.amazonaws.com" + | "us-east-2" -> Some "kinesis.us-east-2.amazonaws.com" + | "us-west-1" -> Some "kinesis.us-west-1.amazonaws.com" + | "us-west-2" -> Some "kinesis.us-west-2.amazonaws.com" + | _ -> None) + | "kinesisanalytics" -> + (match region with + | "eu-central-1" -> Some "kinesisanalytics.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "kinesisanalytics.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "kinesisanalytics.us-east-1.amazonaws.com" + | "us-east-2" -> Some "kinesisanalytics.us-east-2.amazonaws.com" + | "us-west-2" -> Some "kinesisanalytics.us-west-2.amazonaws.com" + | _ -> None) + | "kinesisvideo" -> + (match region with + | "ap-northeast-1" -> Some "kinesisvideo.ap-northeast-1.amazonaws.com" + | "eu-central-1" -> Some "kinesisvideo.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "kinesisvideo.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "kinesisvideo.us-east-1.amazonaws.com" + | "us-west-2" -> Some "kinesisvideo.us-west-2.amazonaws.com" + | _ -> None) + | "kms" -> + (match region with + | "ProdFips" -> Some "kms-fips.ca-central-1.amazonaws.com" + | "ap-northeast-1" -> Some "kms.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "kms.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "kms.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "kms.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "kms.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "kms.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "kms.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "kms.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "kms.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "kms.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "kms.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "kms.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "kms.us-east-1.amazonaws.com" + | "us-east-2" -> Some "kms.us-east-2.amazonaws.com" + | "us-west-1" -> Some "kms.us-west-1.amazonaws.com" + | "us-west-2" -> Some "kms.us-west-2.amazonaws.com" + | _ -> None) + | "lambda" -> + (match region with + | "ap-northeast-1" -> Some "lambda.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "lambda.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "lambda.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "lambda.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "lambda.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "lambda.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "lambda.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "lambda.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "lambda.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "lambda.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "lambda.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "lambda.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "lambda.us-east-1.amazonaws.com" + | "us-east-2" -> Some "lambda.us-east-2.amazonaws.com" + | "us-west-1" -> Some "lambda.us-west-1.amazonaws.com" + | "us-west-2" -> Some "lambda.us-west-2.amazonaws.com" + | _ -> None) + | "license-manager" -> + (match region with + | "ap-northeast-1" -> + Some "license-manager.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "license-manager.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "license-manager.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "license-manager.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "license-manager.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "license-manager.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "license-manager.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "license-manager.eu-west-2.amazonaws.com" + | "us-east-1" -> Some "license-manager.us-east-1.amazonaws.com" + | "us-east-2" -> Some "license-manager.us-east-2.amazonaws.com" + | "us-west-2" -> Some "license-manager.us-west-2.amazonaws.com" + | _ -> None) + | "lightsail" -> + (match region with + | "ap-northeast-1" -> Some "lightsail.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "lightsail.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "lightsail.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "lightsail.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "lightsail.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "lightsail.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "lightsail.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "lightsail.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "lightsail.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "lightsail.eu-west-3.amazonaws.com" + | "us-east-1" -> Some "lightsail.us-east-1.amazonaws.com" + | "us-east-2" -> Some "lightsail.us-east-2.amazonaws.com" + | "us-west-2" -> Some "lightsail.us-west-2.amazonaws.com" + | _ -> None) + | "logs" -> + (match region with + | "ap-northeast-1" -> Some "logs.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "logs.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "logs.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "logs.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "logs.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "logs.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "logs.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "logs.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "logs.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "logs.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "logs.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "logs.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "logs.us-east-1.amazonaws.com" + | "us-east-2" -> Some "logs.us-east-2.amazonaws.com" + | "us-west-1" -> Some "logs.us-west-1.amazonaws.com" + | "us-west-2" -> Some "logs.us-west-2.amazonaws.com" + | _ -> None) + | "machinelearning" -> + (match region with + | "eu-west-1" -> Some "machinelearning.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "machinelearning.us-east-1.amazonaws.com" + | _ -> None) + | "marketplacecommerceanalytics" -> + (match region with + | "us-east-1" -> + Some "marketplacecommerceanalytics.us-east-1.amazonaws.com" + | _ -> None) + | "mediaconvert" -> + (match region with + | "ap-northeast-1" -> Some "mediaconvert.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "mediaconvert.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "mediaconvert.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "mediaconvert.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "mediaconvert.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "mediaconvert.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "mediaconvert.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "mediaconvert.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "mediaconvert.eu-west-2.amazonaws.com" + | "sa-east-1" -> Some "mediaconvert.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "mediaconvert.us-east-1.amazonaws.com" + | "us-east-2" -> Some "mediaconvert.us-east-2.amazonaws.com" + | "us-west-1" -> Some "mediaconvert.us-west-1.amazonaws.com" + | "us-west-2" -> Some "mediaconvert.us-west-2.amazonaws.com" + | _ -> None) + | "medialive" -> + (match region with + | "ap-northeast-1" -> Some "medialive.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "medialive.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "medialive.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "medialive.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "medialive.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "medialive.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "medialive.eu-west-1.amazonaws.com" + | "sa-east-1" -> Some "medialive.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "medialive.us-east-1.amazonaws.com" + | "us-west-2" -> Some "medialive.us-west-2.amazonaws.com" + | _ -> None) + | "mediapackage" -> + (match region with + | "ap-northeast-1" -> Some "mediapackage.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "mediapackage.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "mediapackage.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "mediapackage.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "mediapackage.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "mediapackage.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "mediapackage.eu-west-1.amazonaws.com" + | "eu-west-3" -> Some "mediapackage.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "mediapackage.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "mediapackage.us-east-1.amazonaws.com" + | "us-west-1" -> Some "mediapackage.us-west-1.amazonaws.com" + | "us-west-2" -> Some "mediapackage.us-west-2.amazonaws.com" + | _ -> None) + | "mediastore" -> + (match region with + | "ap-northeast-1" -> Some "mediastore.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "mediastore.ap-northeast-2.amazonaws.com" + | "ap-southeast-2" -> Some "mediastore.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "mediastore.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "mediastore.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "mediastore.us-east-1.amazonaws.com" + | "us-west-2" -> Some "mediastore.us-west-2.amazonaws.com" + | _ -> None) + | "metering.marketplace" -> + (match region with + | "ap-northeast-1" -> + Some "metering.marketplace.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "metering.marketplace.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "metering.marketplace.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "metering.marketplace.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "metering.marketplace.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> + Some "metering.marketplace.ca-central-1.amazonaws.com" + | "eu-central-1" -> + Some "metering.marketplace.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "metering.marketplace.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "metering.marketplace.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "metering.marketplace.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "metering.marketplace.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "metering.marketplace.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "metering.marketplace.us-east-1.amazonaws.com" + | "us-east-2" -> Some "metering.marketplace.us-east-2.amazonaws.com" + | "us-west-1" -> Some "metering.marketplace.us-west-1.amazonaws.com" + | "us-west-2" -> Some "metering.marketplace.us-west-2.amazonaws.com" + | _ -> None) + | "mgh" -> + (match region with + | "us-west-2" -> Some "mgh.us-west-2.amazonaws.com" + | _ -> None) + | "mobileanalytics" -> + (match region with + | "us-east-1" -> Some "mobileanalytics.us-east-1.amazonaws.com" + | _ -> None) + | "models.lex" -> + (match region with + | "eu-west-1" -> Some "models.lex.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "models.lex.us-east-1.amazonaws.com" + | "us-west-2" -> Some "models.lex.us-west-2.amazonaws.com" + | _ -> None) + | "monitoring" -> + (match region with + | "ap-northeast-1" -> Some "monitoring.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "monitoring.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "monitoring.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "monitoring.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "monitoring.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "monitoring.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "monitoring.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "monitoring.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "monitoring.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "monitoring.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "monitoring.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "monitoring.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "monitoring.us-east-1.amazonaws.com" + | "us-east-2" -> Some "monitoring.us-east-2.amazonaws.com" + | "us-west-1" -> Some "monitoring.us-west-1.amazonaws.com" + | "us-west-2" -> Some "monitoring.us-west-2.amazonaws.com" + | _ -> None) + | "mq" -> + (match region with + | "ap-northeast-1" -> Some "mq.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "mq.ap-northeast-2.amazonaws.com" + | "ap-southeast-1" -> Some "mq.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "mq.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "mq.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "mq.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "mq.us-east-1.amazonaws.com" + | "us-east-2" -> Some "mq.us-east-2.amazonaws.com" + | "us-west-1" -> Some "mq.us-west-1.amazonaws.com" + | "us-west-2" -> Some "mq.us-west-2.amazonaws.com" + | _ -> None) + | "mturk-requester" -> + (match region with + | "sandbox" -> Some "mturk-requester-sandbox.us-east-1.amazonaws.com" + | "us-east-1" -> Some "mturk-requester.us-east-1.amazonaws.com" + | _ -> None) + | "neptune" -> + (match region with + | "ap-northeast-1" -> Some "rds.ap-northeast-1.amazonaws.com" + | "ap-southeast-1" -> Some "rds.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "rds.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "rds.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "rds.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "rds.eu-west-2.amazonaws.com" + | "us-east-1" -> Some "rds.us-east-1.amazonaws.com" + | "us-east-2" -> Some "rds.us-east-2.amazonaws.com" + | "us-west-2" -> Some "rds.us-west-2.amazonaws.com" + | _ -> None) + | "opsworks" -> + (match region with + | "ap-northeast-1" -> Some "opsworks.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "opsworks.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "opsworks.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "opsworks.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "opsworks.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "opsworks.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "opsworks.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "opsworks.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "opsworks.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "opsworks.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "opsworks.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "opsworks.us-east-1.amazonaws.com" + | "us-east-2" -> Some "opsworks.us-east-2.amazonaws.com" + | "us-west-1" -> Some "opsworks.us-west-1.amazonaws.com" + | "us-west-2" -> Some "opsworks.us-west-2.amazonaws.com" + | _ -> None) + | "opsworks-cm" -> + (match region with + | "ap-northeast-1" -> Some "opsworks-cm.ap-northeast-1.amazonaws.com" + | "ap-southeast-1" -> Some "opsworks-cm.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "opsworks-cm.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "opsworks-cm.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "opsworks-cm.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "opsworks-cm.us-east-1.amazonaws.com" + | "us-east-2" -> Some "opsworks-cm.us-east-2.amazonaws.com" + | "us-west-1" -> Some "opsworks-cm.us-west-1.amazonaws.com" + | "us-west-2" -> Some "opsworks-cm.us-west-2.amazonaws.com" + | _ -> None) + | "organizations" -> + (match region with + | "aws-global" -> Some "organizations.us-east-1.amazonaws.com" + | _ -> None) + | "pinpoint" -> + (match region with + | "eu-central-1" -> Some "pinpoint.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "pinpoint.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "pinpoint.us-east-1.amazonaws.com" + | "us-west-2" -> Some "pinpoint.us-west-2.amazonaws.com" + | _ -> None) + | "polly" -> + (match region with + | "ap-northeast-1" -> Some "polly.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "polly.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "polly.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "polly.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "polly.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "polly.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "polly.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "polly.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "polly.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "polly.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "polly.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "polly.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "polly.us-east-1.amazonaws.com" + | "us-east-2" -> Some "polly.us-east-2.amazonaws.com" + | "us-west-1" -> Some "polly.us-west-1.amazonaws.com" + | "us-west-2" -> Some "polly.us-west-2.amazonaws.com" + | _ -> None) + | "rds" -> + (match region with + | "ap-northeast-1" -> Some "rds.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "rds.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "rds.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "rds.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "rds.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "rds.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "rds.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "rds.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "rds.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "rds.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "rds.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "rds.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "rds.us-east-1.amazonaws.com" + | "us-east-2" -> Some "rds.us-east-2.amazonaws.com" + | "us-west-1" -> Some "rds.us-west-1.amazonaws.com" + | "us-west-2" -> Some "rds.us-west-2.amazonaws.com" + | _ -> None) + | "redshift" -> + (match region with + | "ap-northeast-1" -> Some "redshift.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "redshift.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "redshift.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "redshift.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "redshift.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "redshift.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "redshift.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "redshift.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "redshift.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "redshift.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "redshift.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "redshift.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "redshift.us-east-1.amazonaws.com" + | "us-east-2" -> Some "redshift.us-east-2.amazonaws.com" + | "us-west-1" -> Some "redshift.us-west-1.amazonaws.com" + | "us-west-2" -> Some "redshift.us-west-2.amazonaws.com" + | _ -> None) + | "rekognition" -> + (match region with + | "ap-northeast-1" -> Some "rekognition.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "rekognition.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "rekognition.ap-south-1.amazonaws.com" + | "ap-southeast-2" -> Some "rekognition.ap-southeast-2.amazonaws.com" + | "eu-west-1" -> Some "rekognition.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "rekognition.us-east-1.amazonaws.com" + | "us-east-2" -> Some "rekognition.us-east-2.amazonaws.com" + | "us-west-2" -> Some "rekognition.us-west-2.amazonaws.com" + | _ -> None) + | "resource-groups" -> + (match region with + | "ap-northeast-1" -> + Some "resource-groups.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "resource-groups.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "resource-groups.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "resource-groups.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "resource-groups.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "resource-groups.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "resource-groups.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "resource-groups.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "resource-groups.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "resource-groups.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "resource-groups.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "resource-groups.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "resource-groups.us-east-1.amazonaws.com" + | "us-east-2" -> Some "resource-groups.us-east-2.amazonaws.com" + | "us-west-1" -> Some "resource-groups.us-west-1.amazonaws.com" + | "us-west-2" -> Some "resource-groups.us-west-2.amazonaws.com" + | _ -> None) + | "robomaker" -> + (match region with + | "eu-west-1" -> Some "robomaker.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "robomaker.us-east-1.amazonaws.com" + | "us-west-2" -> Some "robomaker.us-west-2.amazonaws.com" + | _ -> None) + | "route53" -> + (match region with + | "aws-global" -> Some "route53.amazonaws.com" + | _ -> None) + | "route53domains" -> + (match region with + | "us-east-1" -> Some "route53domains.us-east-1.amazonaws.com" + | _ -> None) + | "route53resolver" -> + (match region with + | "ap-northeast-1" -> + Some "route53resolver.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "route53resolver.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "route53resolver.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "route53resolver.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "route53resolver.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "route53resolver.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "route53resolver.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "route53resolver.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "route53resolver.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "route53resolver.eu-west-3.amazonaws.com" + | "us-east-1" -> Some "route53resolver.us-east-1.amazonaws.com" + | "us-east-2" -> Some "route53resolver.us-east-2.amazonaws.com" + | "us-west-1" -> Some "route53resolver.us-west-1.amazonaws.com" + | "us-west-2" -> Some "route53resolver.us-west-2.amazonaws.com" + | _ -> None) + | "runtime.lex" -> + (match region with + | "eu-west-1" -> Some "runtime.lex.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "runtime.lex.us-east-1.amazonaws.com" + | "us-west-2" -> Some "runtime.lex.us-west-2.amazonaws.com" + | _ -> None) + | "runtime.sagemaker" -> + (match region with + | "ap-northeast-1" -> + Some "runtime.sagemaker.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "runtime.sagemaker.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "runtime.sagemaker.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "runtime.sagemaker.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "runtime.sagemaker.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> + Some "runtime.sagemaker.ca-central-1.amazonaws.com" + | "eu-central-1" -> + Some "runtime.sagemaker.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "runtime.sagemaker.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "runtime.sagemaker.eu-west-2.amazonaws.com" + | "us-east-1" -> Some "runtime.sagemaker.us-east-1.amazonaws.com" + | "us-east-2" -> Some "runtime.sagemaker.us-east-2.amazonaws.com" + | "us-west-1" -> Some "runtime.sagemaker.us-west-1.amazonaws.com" + | "us-west-2" -> Some "runtime.sagemaker.us-west-2.amazonaws.com" + | _ -> None) + | "s3" -> + (match region with + | "ap-northeast-1" -> Some "s3.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "s3.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "s3.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "s3.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "s3.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "s3.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "s3.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "s3.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "s3.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "s3.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "s3.eu-west-3.amazonaws.com" + | "s3-external-1" -> Some "s3-external-1.amazonaws.com" + | "sa-east-1" -> Some "s3.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "s3.amazonaws.com" + | "us-east-2" -> Some "s3.us-east-2.amazonaws.com" + | "us-west-1" -> Some "s3.us-west-1.amazonaws.com" + | "us-west-2" -> Some "s3.us-west-2.amazonaws.com" + | _ -> None) + | "s3-control" -> + (match region with + | "ap-northeast-1" -> Some "s3-control.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "s3-control.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "s3-control.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "s3-control.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "s3-control.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "s3-control.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "s3-control.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "s3-control.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "s3-control.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "s3-control.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "s3-control.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "s3-control.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "s3-control.us-east-1.amazonaws.com" + | "us-east-1-fips" -> Some "s3-control-fips.us-east-1.amazonaws.com" + | "us-east-2" -> Some "s3-control.us-east-2.amazonaws.com" + | "us-east-2-fips" -> Some "s3-control-fips.us-east-2.amazonaws.com" + | "us-west-1" -> Some "s3-control.us-west-1.amazonaws.com" + | "us-west-1-fips" -> Some "s3-control-fips.us-west-1.amazonaws.com" + | "us-west-2" -> Some "s3-control.us-west-2.amazonaws.com" + | "us-west-2-fips" -> Some "s3-control-fips.us-west-2.amazonaws.com" + | _ -> None) + | "sdb" -> + (match region with + | "ap-northeast-1" -> Some "sdb.ap-northeast-1.amazonaws.com" + | "ap-southeast-1" -> Some "sdb.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "sdb.ap-southeast-2.amazonaws.com" + | "eu-west-1" -> Some "sdb.eu-west-1.amazonaws.com" + | "sa-east-1" -> Some "sdb.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "sdb.amazonaws.com" + | "us-west-1" -> Some "sdb.us-west-1.amazonaws.com" + | "us-west-2" -> Some "sdb.us-west-2.amazonaws.com" + | _ -> None) + | "secretsmanager" -> + (match region with + | "ap-northeast-1" -> + Some "secretsmanager.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "secretsmanager.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "secretsmanager.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "secretsmanager.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "secretsmanager.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "secretsmanager.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "secretsmanager.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "secretsmanager.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "secretsmanager.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "secretsmanager.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "secretsmanager.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "secretsmanager.us-east-1.amazonaws.com" + | "us-east-1-fips" -> + Some "secretsmanager-fips.us-east-1.amazonaws.com" + | "us-east-2" -> Some "secretsmanager.us-east-2.amazonaws.com" + | "us-east-2-fips" -> + Some "secretsmanager-fips.us-east-2.amazonaws.com" + | "us-west-1" -> Some "secretsmanager.us-west-1.amazonaws.com" + | "us-west-1-fips" -> + Some "secretsmanager-fips.us-west-1.amazonaws.com" + | "us-west-2" -> Some "secretsmanager.us-west-2.amazonaws.com" + | "us-west-2-fips" -> + Some "secretsmanager-fips.us-west-2.amazonaws.com" + | _ -> None) + | "securityhub" -> + (match region with + | "ap-northeast-1" -> Some "securityhub.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "securityhub.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "securityhub.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "securityhub.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "securityhub.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "securityhub.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "securityhub.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "securityhub.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "securityhub.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "securityhub.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "securityhub.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "securityhub.us-east-1.amazonaws.com" + | "us-east-2" -> Some "securityhub.us-east-2.amazonaws.com" + | "us-west-1" -> Some "securityhub.us-west-1.amazonaws.com" + | "us-west-2" -> Some "securityhub.us-west-2.amazonaws.com" + | _ -> None) + | "serverlessrepo" -> + (match region with + | "ap-northeast-1" -> + Some "serverlessrepo.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "serverlessrepo.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "serverlessrepo.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "serverlessrepo.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "serverlessrepo.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "serverlessrepo.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "serverlessrepo.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "serverlessrepo.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "serverlessrepo.eu-west-2.amazonaws.com" + | "sa-east-1" -> Some "serverlessrepo.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "serverlessrepo.us-east-1.amazonaws.com" + | "us-east-2" -> Some "serverlessrepo.us-east-2.amazonaws.com" + | "us-west-1" -> Some "serverlessrepo.us-west-1.amazonaws.com" + | "us-west-2" -> Some "serverlessrepo.us-west-2.amazonaws.com" + | _ -> None) + | "servicecatalog" -> + (match region with + | "ap-northeast-1" -> + Some "servicecatalog.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "servicecatalog.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "servicecatalog.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "servicecatalog.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "servicecatalog.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "servicecatalog.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "servicecatalog.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "servicecatalog.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "servicecatalog.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "servicecatalog.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "servicecatalog.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "servicecatalog.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "servicecatalog.us-east-1.amazonaws.com" + | "us-east-1-fips" -> + Some "servicecatalog-fips.us-east-1.amazonaws.com" + | "us-east-2" -> Some "servicecatalog.us-east-2.amazonaws.com" + | "us-east-2-fips" -> + Some "servicecatalog-fips.us-east-2.amazonaws.com" + | "us-west-1" -> Some "servicecatalog.us-west-1.amazonaws.com" + | "us-west-1-fips" -> + Some "servicecatalog-fips.us-west-1.amazonaws.com" + | "us-west-2" -> Some "servicecatalog.us-west-2.amazonaws.com" + | "us-west-2-fips" -> + Some "servicecatalog-fips.us-west-2.amazonaws.com" + | _ -> None) + | "servicediscovery" -> + (match region with + | "ap-northeast-1" -> + Some "servicediscovery.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "servicediscovery.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "servicediscovery.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "servicediscovery.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "servicediscovery.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "servicediscovery.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "servicediscovery.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "servicediscovery.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "servicediscovery.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "servicediscovery.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "servicediscovery.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "servicediscovery.us-east-1.amazonaws.com" + | "us-east-2" -> Some "servicediscovery.us-east-2.amazonaws.com" + | "us-west-1" -> Some "servicediscovery.us-west-1.amazonaws.com" + | "us-west-2" -> Some "servicediscovery.us-west-2.amazonaws.com" + | _ -> None) + | "shield" -> + (match region with + | "us-east-1" -> Some "shield.us-east-1.amazonaws.com" + | _ -> None) + | "sms" -> + (match region with + | "ap-northeast-1" -> Some "sms.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "sms.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "sms.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "sms.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "sms.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "sms.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "sms.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "sms.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "sms.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "sms.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "sms.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "sms.us-east-1.amazonaws.com" + | "us-east-2" -> Some "sms.us-east-2.amazonaws.com" + | "us-west-1" -> Some "sms.us-west-1.amazonaws.com" + | "us-west-2" -> Some "sms.us-west-2.amazonaws.com" + | _ -> None) + | "snowball" -> + (match region with + | "ap-northeast-1" -> Some "snowball.ap-northeast-1.amazonaws.com" + | "ap-south-1" -> Some "snowball.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "snowball.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "snowball.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "snowball.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "snowball.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "snowball.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "snowball.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "snowball.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "snowball.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "snowball.us-east-1.amazonaws.com" + | "us-east-2" -> Some "snowball.us-east-2.amazonaws.com" + | "us-west-1" -> Some "snowball.us-west-1.amazonaws.com" + | "us-west-2" -> Some "snowball.us-west-2.amazonaws.com" + | _ -> None) + | "sns" -> + (match region with + | "ap-northeast-1" -> Some "sns.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "sns.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "sns.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "sns.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "sns.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "sns.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "sns.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "sns.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "sns.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "sns.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "sns.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "sns.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "sns.us-east-1.amazonaws.com" + | "us-east-2" -> Some "sns.us-east-2.amazonaws.com" + | "us-west-1" -> Some "sns.us-west-1.amazonaws.com" + | "us-west-2" -> Some "sns.us-west-2.amazonaws.com" + | _ -> None) + | "sqs" -> + (match region with + | "ap-northeast-1" -> Some "sqs.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "sqs.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "sqs.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "sqs.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "sqs.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "sqs.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "sqs.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "sqs.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "sqs.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "sqs.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "sqs.eu-west-3.amazonaws.com" + | "fips-us-east-1" -> Some "sqs-fips.us-east-1.amazonaws.com" + | "fips-us-east-2" -> Some "sqs-fips.us-east-2.amazonaws.com" + | "fips-us-west-1" -> Some "sqs-fips.us-west-1.amazonaws.com" + | "fips-us-west-2" -> Some "sqs-fips.us-west-2.amazonaws.com" + | "sa-east-1" -> Some "sqs.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "sqs.us-east-1.amazonaws.com" + | "us-east-2" -> Some "sqs.us-east-2.amazonaws.com" + | "us-west-1" -> Some "sqs.us-west-1.amazonaws.com" + | "us-west-2" -> Some "sqs.us-west-2.amazonaws.com" + | _ -> None) + | "ssm" -> + (match region with + | "ap-northeast-1" -> Some "ssm.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "ssm.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "ssm.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "ssm.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "ssm.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "ssm.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "ssm.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "ssm.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "ssm.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "ssm.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "ssm.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "ssm.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "ssm.us-east-1.amazonaws.com" + | "us-east-2" -> Some "ssm.us-east-2.amazonaws.com" + | "us-west-1" -> Some "ssm.us-west-1.amazonaws.com" + | "us-west-2" -> Some "ssm.us-west-2.amazonaws.com" + | _ -> None) + | "states" -> + (match region with + | "ap-northeast-1" -> Some "states.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "states.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "states.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "states.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "states.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "states.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "states.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "states.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "states.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "states.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "states.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "states.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "states.us-east-1.amazonaws.com" + | "us-east-2" -> Some "states.us-east-2.amazonaws.com" + | "us-west-1" -> Some "states.us-west-1.amazonaws.com" + | "us-west-2" -> Some "states.us-west-2.amazonaws.com" + | _ -> None) + | "storagegateway" -> + (match region with + | "ap-northeast-1" -> + Some "storagegateway.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "storagegateway.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "storagegateway.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "storagegateway.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "storagegateway.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "storagegateway.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "storagegateway.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "storagegateway.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "storagegateway.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "storagegateway.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "storagegateway.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "storagegateway.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "storagegateway.us-east-1.amazonaws.com" + | "us-east-2" -> Some "storagegateway.us-east-2.amazonaws.com" + | "us-west-1" -> Some "storagegateway.us-west-1.amazonaws.com" + | "us-west-2" -> Some "storagegateway.us-west-2.amazonaws.com" + | _ -> None) + | "streams.dynamodb" -> + (match region with + | "ap-northeast-1" -> + Some "streams.dynamodb.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> + Some "streams.dynamodb.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "streams.dynamodb.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> + Some "streams.dynamodb.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> + Some "streams.dynamodb.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "streams.dynamodb.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "streams.dynamodb.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "streams.dynamodb.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "streams.dynamodb.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "streams.dynamodb.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "streams.dynamodb.eu-west-3.amazonaws.com" + | "local" -> Some "localhost:8000" + | "sa-east-1" -> Some "streams.dynamodb.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "streams.dynamodb.us-east-1.amazonaws.com" + | "us-east-2" -> Some "streams.dynamodb.us-east-2.amazonaws.com" + | "us-west-1" -> Some "streams.dynamodb.us-west-1.amazonaws.com" + | "us-west-2" -> Some "streams.dynamodb.us-west-2.amazonaws.com" + | _ -> None) + | "sts" -> + (match region with + | "ap-northeast-1" -> Some "sts.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "sts.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "sts.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "sts.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "sts.ap-southeast-2.amazonaws.com" + | "aws-global" -> Some "sts.aws-global.amazonaws.com" + | "ca-central-1" -> Some "sts.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "sts.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "sts.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "sts.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "sts.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "sts.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "sts.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "sts.us-east-1.amazonaws.com" + | "us-east-1-fips" -> Some "sts-fips.us-east-1.amazonaws.com" + | "us-east-2" -> Some "sts.us-east-2.amazonaws.com" + | "us-east-2-fips" -> Some "sts-fips.us-east-2.amazonaws.com" + | "us-west-1" -> Some "sts.us-west-1.amazonaws.com" + | "us-west-1-fips" -> Some "sts-fips.us-west-1.amazonaws.com" + | "us-west-2" -> Some "sts.us-west-2.amazonaws.com" + | "us-west-2-fips" -> Some "sts-fips.us-west-2.amazonaws.com" + | _ -> None) + | "support" -> + (match region with + | "us-east-1" -> Some "support.us-east-1.amazonaws.com" + | _ -> None) + | "swf" -> + (match region with + | "ap-northeast-1" -> Some "swf.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "swf.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "swf.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "swf.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "swf.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "swf.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "swf.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "swf.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "swf.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "swf.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "swf.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "swf.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "swf.us-east-1.amazonaws.com" + | "us-east-2" -> Some "swf.us-east-2.amazonaws.com" + | "us-west-1" -> Some "swf.us-west-1.amazonaws.com" + | "us-west-2" -> Some "swf.us-west-2.amazonaws.com" + | _ -> None) + | "tagging" -> + (match region with + | "ap-northeast-1" -> Some "tagging.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "tagging.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "tagging.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "tagging.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "tagging.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "tagging.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "tagging.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "tagging.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "tagging.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "tagging.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "tagging.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "tagging.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "tagging.us-east-1.amazonaws.com" + | "us-east-2" -> Some "tagging.us-east-2.amazonaws.com" + | "us-west-1" -> Some "tagging.us-west-1.amazonaws.com" + | "us-west-2" -> Some "tagging.us-west-2.amazonaws.com" + | _ -> None) + | "transfer" -> + (match region with + | "ap-northeast-1" -> Some "transfer.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "transfer.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "transfer.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "transfer.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "transfer.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "transfer.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "transfer.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "transfer.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "transfer.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "transfer.eu-west-3.amazonaws.com" + | "us-east-1" -> Some "transfer.us-east-1.amazonaws.com" + | "us-east-2" -> Some "transfer.us-east-2.amazonaws.com" + | "us-west-1" -> Some "transfer.us-west-1.amazonaws.com" + | "us-west-2" -> Some "transfer.us-west-2.amazonaws.com" + | _ -> None) + | "translate" -> + (match region with + | "eu-west-1" -> Some "translate.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "translate.us-east-1.amazonaws.com" + | "us-east-1-fips" -> Some "translate-fips.us-east-1.amazonaws.com" + | "us-east-2" -> Some "translate.us-east-2.amazonaws.com" + | "us-east-2-fips" -> Some "translate-fips.us-east-2.amazonaws.com" + | "us-west-2" -> Some "translate.us-west-2.amazonaws.com" + | "us-west-2-fips" -> Some "translate-fips.us-west-2.amazonaws.com" + | _ -> None) + | "waf" -> + (match region with + | "aws-global" -> Some "waf.amazonaws.com" + | _ -> None) + | "waf-regional" -> + (match region with + | "ap-northeast-1" -> Some "waf-regional.ap-northeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "waf-regional.ap-southeast-2.amazonaws.com" + | "eu-central-1" -> Some "waf-regional.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "waf-regional.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "waf-regional.us-east-1.amazonaws.com" + | "us-east-2" -> Some "waf-regional.us-east-2.amazonaws.com" + | "us-west-1" -> Some "waf-regional.us-west-1.amazonaws.com" + | "us-west-2" -> Some "waf-regional.us-west-2.amazonaws.com" + | _ -> None) + | "workdocs" -> + (match region with + | "ap-northeast-1" -> Some "workdocs.ap-northeast-1.amazonaws.com" + | "ap-southeast-1" -> Some "workdocs.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "workdocs.ap-southeast-2.amazonaws.com" + | "eu-west-1" -> Some "workdocs.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "workdocs.us-east-1.amazonaws.com" + | "us-west-2" -> Some "workdocs.us-west-2.amazonaws.com" + | _ -> None) + | "workmail" -> + (match region with + | "eu-west-1" -> Some "workmail.eu-west-1.amazonaws.com" + | "us-east-1" -> Some "workmail.us-east-1.amazonaws.com" + | "us-west-2" -> Some "workmail.us-west-2.amazonaws.com" + | _ -> None) + | "workspaces" -> + (match region with + | "ap-northeast-1" -> Some "workspaces.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "workspaces.ap-northeast-2.amazonaws.com" + | "ap-southeast-1" -> Some "workspaces.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "workspaces.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "workspaces.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "workspaces.eu-central-1.amazonaws.com" + | "eu-west-1" -> Some "workspaces.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "workspaces.eu-west-2.amazonaws.com" + | "sa-east-1" -> Some "workspaces.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "workspaces.us-east-1.amazonaws.com" + | "us-west-2" -> Some "workspaces.us-west-2.amazonaws.com" + | _ -> None) + | "xray" -> + (match region with + | "ap-northeast-1" -> Some "xray.ap-northeast-1.amazonaws.com" + | "ap-northeast-2" -> Some "xray.ap-northeast-2.amazonaws.com" + | "ap-south-1" -> Some "xray.ap-south-1.amazonaws.com" + | "ap-southeast-1" -> Some "xray.ap-southeast-1.amazonaws.com" + | "ap-southeast-2" -> Some "xray.ap-southeast-2.amazonaws.com" + | "ca-central-1" -> Some "xray.ca-central-1.amazonaws.com" + | "eu-central-1" -> Some "xray.eu-central-1.amazonaws.com" + | "eu-north-1" -> Some "xray.eu-north-1.amazonaws.com" + | "eu-west-1" -> Some "xray.eu-west-1.amazonaws.com" + | "eu-west-2" -> Some "xray.eu-west-2.amazonaws.com" + | "eu-west-3" -> Some "xray.eu-west-3.amazonaws.com" + | "sa-east-1" -> Some "xray.sa-east-1.amazonaws.com" + | "us-east-1" -> Some "xray.us-east-1.amazonaws.com" + | "us-east-2" -> Some "xray.us-east-2.amazonaws.com" + | "us-west-1" -> Some "xray.us-west-1.amazonaws.com" + | "us-west-2" -> Some "xray.us-west-2.amazonaws.com" + | _ -> None) + | _ -> None +let url_of svc_name region = + match endpoint_of svc_name region with + | Some var -> Some ("https://" ^ var) + | None -> None \ No newline at end of file diff --git a/src/endpoint_gen.ml b/src/endpoint_gen.ml index e3bf91130..0635b79f0 100644 --- a/src/endpoint_gen.ml +++ b/src/endpoint_gen.ml @@ -3,35 +3,30 @@ open Cmdliner let () a b = Filename.concat a b let log s = Printf.eprintf (s ^^ "\n%!") -let print_partition (p : Endpoints_t.partition) = - print_endline ("dns_suffix: " ^ p.dns_suffix); - print_endline ("partition: " ^ p.partition); - print_endline ("partition_name: " ^ p.partition_name);; - -let var_replace hostname service_name region dns_suffix = +let var_replace hostname svc_name region dns_suffix = let hostname = Str.replace_first (Str.regexp_string {|{region}|}) region hostname in - let hostname = Str.replace_first (Str.regexp_string {|{service}|}) service_name hostname in + let hostname = Str.replace_first (Str.regexp_string {|{service}|}) svc_name hostname in Str.replace_first (Str.regexp_string {|{dnsSuffix}|}) dns_suffix hostname let write_endpoint - region + svc_name dns_suffix (default_hostname : string option) - ((service_name, endpoint) : (string * Endpoints_t.endpoint)) = Syntax.( + ((region, endpoint) : (string * Endpoints_t.endpoint)) = Syntax.( let host = match (endpoint.hostname, default_hostname) with | (None, None) -> (ident "None") - | (None, Some(h)) - | (Some(h), _) -> (app1 "Some" (str (var_replace h service_name region dns_suffix))) in - (service_name, host) + | (None, Some(hostname)) + | (Some(hostname), _) -> (app1 "Some" (str (var_replace hostname svc_name region dns_suffix))) in + (region, host) ) let write_service dns_suffix (partition_defaults : Endpoints_t.partition_defaults) - ((region, svc) : (string * Endpoints_t.service)) = Syntax.( - (region, (matchstrs + ((svc_name, svc) : (string * Endpoints_t.service)) = Syntax.( + (svc_name, (matchstrs (ident "region") - (svc.endpoints |> List.map (write_endpoint region dns_suffix partition_defaults.hostname)) + (svc.endpoints |> List.map (write_endpoint svc_name dns_suffix partition_defaults.hostname)) (ident "None"))) ) @@ -44,6 +39,16 @@ let write_partition (p : Endpoints_t.partition) = Syntax.( (ident "None"))) ) +let write_url_of = Syntax.( + let_ "url_of" + (fun2 "svc_name" "region" + (matchoption + (app2 "endpoint_of" (ident "svc_name") (ident "region")) + (app1 "Some" (app2 "^" (str "https://") (ident "var"))) + (ident "None") + )) +) + let main input outdir = log "Start processing endpoints"; @@ -53,9 +58,9 @@ let main input outdir = let endpoints = Endpoints_j.endpoints_of_string endpoint_data in let aws = endpoints.partitions |> List.find (fun p -> String.equal Endpoints_t.(p.partition) "aws") in - let outfile = (outdir "Aws_endpoints.ml") in + let outfile = (outdir "endpoints.ml") in let syntax = write_partition aws in - Util.Printing.write_structure outfile [syntax]; + Util.Printing.write_structure outfile [syntax; write_url_of]; close_in inc; module CommandLine = struct diff --git a/src/generate.ml b/src/generate.ml index 7359d9f05..e8d9e3e1b 100644 --- a/src/generate.ml +++ b/src/generate.ml @@ -43,6 +43,13 @@ let is_list ~shapes ~shp = | _ -> false with Not_found -> false +let is_flat_list ~shapes ~shp = + try + match (StringTable.find shp shapes).Shape.content with + | Shape.List (_,_,true) -> true + | _ -> false + with Not_found -> false + let toposort (shapes : Shape.t StringTable.t) = let open Graph in let module G = Imperative.Digraph.ConcreteBidirectional(struct @@ -62,7 +69,7 @@ let toposort (shapes : Shape.t StringTable.t) = match data.Shape.content with | Shape.Structure members -> List.iter (fun mem -> add_edge data mem.Structure.shape) members - | Shape.List (s,_) -> add_edge data s + | Shape.List (s,_,_) -> add_edge data s | Shape.Map ((ks,_), (vs,_)) -> add_edge data ks; add_edge data vs | Shape.Enum _ -> ()) shapes; @@ -90,7 +97,7 @@ let types is_ec2 shapes = mkrecty (List.map (fun m -> (m.Structure.field_name, m.Structure.shape ^ ".t", m.Structure.required || is_list ~shapes ~shp:m.Structure.shape)) members) - | Shape.List (shp, _) -> + | Shape.List (shp, _, _flatten) -> Syntax.tylet "t" (Syntax.ty1 "list" (shp ^ ".t")) | Shape.Map ((kshp, _loc), (vshp, _)) -> Syntax.tylet "t" (Syntax.ty2 "Hashtbl.t" (kshp ^ ".t") (vshp ^ ".t")) @@ -149,15 +156,23 @@ let types is_ec2 shapes = | Some name -> name | None -> mem.Structure.name in - let b = Syntax.(app2 "Util.option_bind" + let b = if is_flat_list ~shapes ~shp:mem.Structure.shape then + Syntax.( + (app1 (mem.Structure.shape ^ ".parse") + (ident "xml")) + ) + else + Syntax.(app2 "Util.option_bind" (app2 "Xml.member" (str loc_name) (ident "xml")) (ident (mem.Structure.shape ^ ".parse"))) in let op = if mem.Structure.required then Syntax.(app2 "Xml.required" (str loc_name) b) - else if is_list ~shapes ~shp:mem.Structure.shape then - Syntax.(app2 "Util.of_option" (list []) b) + else if is_list ~shapes ~shp:mem.Structure.shape then ( + print_endline ("is_list " ^ mem.Structure.shape); + print_endline ("is_flat " ^ string_of_bool(is_flat_list ~shapes ~shp:mem.Structure.shape)); + Syntax.(app2 "Util.of_option" (list []) b)) else b in @@ -169,16 +184,16 @@ let types is_ec2 shapes = Syntax.(let_ "parse" (fun_ "xml" (ident "None"))) - | Shape.List (shp, loc_name) -> + | Shape.List (shp, loc_name, _flatten) -> let item_name = match loc_name with | None -> "member" | Some nm -> nm in - Syntax.(let_ "parse" - (fun_ "xml" - (app1 "Util.option_all" - (app2 "List.map" - (ident (shp ^ ".parse")) - (app2 "Xml.members" (str item_name) (ident "xml")))))) + Syntax.(let_ "parse" + (fun_ "xml" + (app1 "Util.option_all" + (app2 "List.map" + (ident (shp ^ ".parse")) + (app2 "Xml.members" (str item_name) (ident "xml")))))) | Shape.Enum _opts -> Syntax.(let_ "parse" (fun_ "xml" @@ -213,7 +228,7 @@ let types is_ec2 shapes = then app1 "Some" (q (ident ("v." ^ mem.Structure.field_name))) else app2 "Util.option_map" (ident ("v." ^ mem.Structure.field_name)) (fun_ "f" (q (ident "f"))))) s)))) - | Shape.List (shp,_) -> + | Shape.List (shp,_,_flatten) -> (app2 "Query.to_query_list" (ident (shp ^ ".to_query")) (ident "v")) | Shape.Map ((key_shp,_),(val_shp,_)) -> (app3 "Query.to_query_hashtbl" (ident (key_shp ^ ".to_string")) (ident (val_shp ^ ".to_query")) (ident "v")) @@ -244,7 +259,7 @@ let types is_ec2 shapes = (fun_ "f" (q (ident "f"))) ) s)))) - | Shape.List (shp,_) -> + | Shape.List (shp,_,_flatten) -> (variant1 "List" (app2 "List.map" (ident (shp ^ ".to_json")) @@ -280,7 +295,7 @@ let types is_ec2 shapes = else fun v -> app2 "Util.option_map" v (ident (mem.Structure.shape ^ ".of_json"))) (app2 "Json.lookup" (ident "j") (str mem.Structure.field_name)))) s) - | Shape.List (shp,_) -> app2 "Json.to_list" (ident (shp ^ ".of_json")) (ident "j") + | Shape.List (shp,_,_flatten) -> app2 "Json.to_list" (ident (shp ^ ".of_json")) (ident "j") | Shape.Map ((key_shp,_),(val_shp,_)) -> app3 "Json.to_hashtbl" (ident (key_shp ^ ".of_string")) (ident (val_shp ^ ".of_json")) (ident "j") | Shape.Enum _ -> (app1 "Util.of_option_exn" @@ -315,7 +330,7 @@ let op service version _shapes op = letin "uri" (app2 "Uri.add_query_params" (app1 "Uri.of_string" - (app1 "Aws.Util.of_option_exn" (app2 "Aws_endpoints.endpoint_of" (ident "service") (ident "region")))) + (app1 "Aws.Util.of_option_exn" (app2 "Endpoints.url_of" (ident "service") (ident "region")))) (match op.Operation.input_shape with | None -> defaults | Some input_shape -> diff --git a/src/reading.ml b/src/reading.ml index eaeab6209..75f8ef58f 100644 --- a/src/reading.ml +++ b/src/reading.ml @@ -74,13 +74,16 @@ let shape ((nm, j) : (string * Yojson.Basic.t)) : Shape.parsed = (nm, "structure", Some (Shape.Structure (List.map (parse_member required) member))) | `String "list" -> let member = Json.member_exn "member" j in + let flattened = match Json.member "flattened" j with + | `Bool true -> true + | _ -> false in let shape = Json.member_exn "shape" member |> Json.to_string in let loc_name = match Json.member "locationName" member with | `Null -> None | loc_name -> Some (Json.to_string loc_name) in - (nm, "list", Some (Shape.List(shape, loc_name))) + (nm, "list", Some (Shape.List(shape, loc_name, flattened))) | `String "map" -> let key = Json.member_exn "key" j in let key_shape = Json.member_exn "shape" key |> Json.to_string in diff --git a/src/structures.ml b/src/structures.ml index 8d69eb817..803c03a42 100644 --- a/src/structures.ml +++ b/src/structures.ml @@ -13,7 +13,7 @@ end module Shape = struct type contents = | Structure of Structure.member list - | List of string * string option + | List of string * string option * bool | Enum of string list | Map of (string * string option) * (string * string option) diff --git a/src/structures.mli b/src/structures.mli index 550dba542..13cae858d 100644 --- a/src/structures.mli +++ b/src/structures.mli @@ -86,7 +86,7 @@ module Shape : sig type contents = | Structure of Structure.member list - | List of string * string option + | List of string * string option * bool | Enum of string list | Map of (string * string option) * (string * string option) diff --git a/src/util.ml b/src/util.ml index 1f5d8d94f..fbeb32e83 100644 --- a/src/util.ml +++ b/src/util.ml @@ -205,8 +205,9 @@ let inline_shapes (ops : Operation.t list) (shapes : Shape.parsed StringTable.t) Shape.Structure (List.map (fun member -> { member with Structure.shape = replace_shape member.Structure.shape }) ms) - | Some (Shape.List (shp, ln)) -> - Shape.List (replace_shape shp, ln) + | Some (Shape.List (shp, ln, flatten)) -> + print_endline ("shape " ^ shp ^ " is a list, flatten? " ^ (string_of_bool flatten)); + Shape.List (replace_shape shp, ln, flatten) | Some (Shape.Map ((kshp, kln), (vshp, vln))) -> Shape.Map ((replace_shape kshp, kln), (replace_shape vshp, vln)) | Some (Shape.Enum opts) -> Shape.Enum opts From 23e16c4c9c2545ff41200cddbe5534d7ce6903a1 Mon Sep 17 00:00:00 2001 From: Peter Mondlock Date: Sat, 9 Mar 2019 16:43:57 -0600 Subject: [PATCH 10/12] remove debugging print statements --- lib/aws.ml | 2 -- src/generate.ml | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/aws.ml b/lib/aws.ml index fee55e046..562c714df 100644 --- a/lib/aws.ml +++ b/lib/aws.ml @@ -456,8 +456,6 @@ module Signing = struct let credential_scope = datestamp ^ "/" ^ region ^ "/" ^ service ^ "/" ^ "aws4_request" in let string_to_sign = algorithm ^ "\n" ^ amzdate ^ "\n" ^ credential_scope ^ "\n" ^ Hash.sha256_hex canonical_request in let signing_key = get_signature_key secret_key datestamp region service in - print_endline ("\nstring_to_sign:\n" ^ string_to_sign); - print_endline ("\ncanonical string:\n" ^ canonical_request); let signature = Hash.sha256_hex ~key:signing_key string_to_sign in let authorization_header = String.concat "" [algorithm; " "; "Credential="; access_key; "/"; credential_scope; ", "; "SignedHeaders="; signed_headers; ", "; "Signature="; signature] in let headers = ("x-amz-date", amzdate) :: ("x-amz-content-sha256", payload_hash) :: ("Authorization", authorization_header) :: headers in diff --git a/src/generate.ml b/src/generate.ml index e8d9e3e1b..3abdf2d38 100644 --- a/src/generate.ml +++ b/src/generate.ml @@ -169,10 +169,8 @@ let types is_ec2 shapes = let op = if mem.Structure.required then Syntax.(app2 "Xml.required" (str loc_name) b) - else if is_list ~shapes ~shp:mem.Structure.shape then ( - print_endline ("is_list " ^ mem.Structure.shape); - print_endline ("is_flat " ^ string_of_bool(is_flat_list ~shapes ~shp:mem.Structure.shape)); - Syntax.(app2 "Util.of_option" (list []) b)) + else if is_list ~shapes ~shp:mem.Structure.shape then + Syntax.(app2 "Util.of_option" (list []) b) else b in From 3849a6111710eac13edf480fa54ba7c7d42bd7e2 Mon Sep 17 00:00:00 2001 From: Peter Mondlock Date: Sat, 9 Mar 2019 16:46:04 -0600 Subject: [PATCH 11/12] remove debugging print statements --- src/util.ml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/util.ml b/src/util.ml index fbeb32e83..570fc50dd 100644 --- a/src/util.ml +++ b/src/util.ml @@ -206,7 +206,6 @@ let inline_shapes (ops : Operation.t list) (shapes : Shape.parsed StringTable.t) { member with Structure.shape = replace_shape member.Structure.shape }) ms) | Some (Shape.List (shp, ln, flatten)) -> - print_endline ("shape " ^ shp ^ " is a list, flatten? " ^ (string_of_bool flatten)); Shape.List (replace_shape shp, ln, flatten) | Some (Shape.Map ((kshp, kln), (vshp, vln))) -> Shape.Map ((replace_shape kshp, kln), (replace_shape vshp, vln)) From f8221e055b8de6142f25d767be5f0ebe2a10b0d8 Mon Sep 17 00:00:00 2001 From: Peter Mondlock Date: Sat, 9 Mar 2019 19:00:32 -0600 Subject: [PATCH 12/12] remove unneeded function --- lib/aws.mli | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/aws.mli b/lib/aws.mli index cb2a12061..b754f4c18 100644 --- a/lib/aws.mli +++ b/lib/aws.mli @@ -278,8 +278,6 @@ module Util : sig (** If all values in list are Some v, produce Some (list_filter_opt list), else produce None. *) val option_all : 'a option list -> 'a list option - - val str_starts_with : string -> string -> bool end (** This module contains the V4 Authorization header AWS signature