package awsm

  1. Overview
  2. Docs

Module Awsm.ArnSource

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).

Sourcemodule Error : sig ... end
Sourcetype resource_type = [
  1. | `Slash_delimited of string
  2. | `Colon_delimited of string
  3. | `None
]
Sourceval sexp_of_resource_type : resource_type -> Sexplib0.Sexp.t
Sourceval resource_type_of_sexp : Sexplib0.Sexp.t -> resource_type
Sourceval __resource_type_of_sexp__ : Sexplib0.Sexp.t -> resource_type
Sourcetype qualifier = [
  1. | `Slash_delimited of string
  2. | `Colon_delimited of string
  3. | `None
]
Sourceval sexp_of_qualifier : qualifier -> Sexplib0.Sexp.t
Sourceval qualifier_of_sexp : Sexplib0.Sexp.t -> qualifier
Sourceval __qualifier_of_sexp__ : Sexplib0.Sexp.t -> qualifier
Sourcetype 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
Sourceval t_of_sexp : Sexplib0.Sexp.t -> t
Sourceval sexp_of_t : t -> Sexplib0.Sexp.t
include Ppx_compare_lib.Comparable.S with type t := t
Sourceval compare : t Base__Ppx_compare_lib.compare
Sourceval 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

Sourceval to_string : t -> string

to_string t prints a valid ARN string.

Sourceval of_string : string -> t

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

  • raises Invalid_arn_format
Sourceval 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.

Sourcemodule Default : sig ... end
Sourcemodule Exn : sig ... end
OCaml

Innovation. Community. Security.