package awsm

  1. Overview
  2. Docs

Amazon Resource Names. See AWS's documentation Amazon Resource Names (ARNs) and AWS Service Namespaces for details, but roughly ARNs are strings of the form:

arn:partition:service:region:account-id:resourcetype/resource/qualifier

We provide a type t deconstructing this string into its components. Functions to_string and of_string print and parse strings according to the AWS specification.

Additionally, we provide functions for constructing ARNs specific to a service, e.g. s3. These are more convenient because certain services don't require or disallow certain components of a general ARN, so these functions ask for only what is needed. Also, ARNs may have additional requirements for a given service, which these functions may enforce (though we don't yet).

module Error : sig ... end
type resource_type = [
  1. | `Slash_delimited of string
  2. | `Colon_delimited of string
  3. | `None
]
val sexp_of_resource_type : resource_type -> Sexplib0.Sexp.t
val resource_type_of_sexp : Sexplib0.Sexp.t -> resource_type
val __resource_type_of_sexp__ : Sexplib0.Sexp.t -> resource_type
type qualifier = [
  1. | `Slash_delimited of string
  2. | `Colon_delimited of string
  3. | `None
]
val sexp_of_qualifier : qualifier -> Sexplib0.Sexp.t
val qualifier_of_sexp : Sexplib0.Sexp.t -> qualifier
val __qualifier_of_sexp__ : Sexplib0.Sexp.t -> qualifier
type t = {
  1. partition : string;
  2. service : Service.t;
  3. region : Region.t option;
  4. account_id : string option;
  5. resource : string;
  6. resource_type : resource_type;
  7. qualifier : qualifier;
}
include Sexplib0.Sexpable.S with type t := t
val t_of_sexp : Sexplib0__.Sexp.t -> t
val sexp_of_t : t -> Sexplib0__.Sexp.t
include Ppx_compare_lib.Comparable.S with type t := t
val compare : t Base__Ppx_compare_lib.compare
val make : ?partition:string -> ?region:Region.t -> ?account_id:string -> ?resource_type:resource_type -> ?qualifier:qualifier -> service:Service.t -> resource:string -> unit -> [ `Ok of t | Error.make ]

Make an ARN. Defaults: - partition: Default.partition - region: None - account_id: None - resource_type: `None - qualifier: `None

val to_string : t -> string

to_string t prints a valid ARN string.

val of_string : string -> t

of_string s parses an ARN string according to the AWS specification.

  • raises Invalid_arn_format
val s3 : ?partition:string -> bucket:string -> key:string -> unit -> [ `Ok of t | `Invalid_bucket of string | `Invalid_key of string ]

Produce an S3 ARN. Default partition is Default.partition.

module Default : sig ... end
module Exn : sig ... end
OCaml

Innovation. Community. Security.