Module Awso.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 __resource_type_of_yojson__ : Ppx_yojson_conv_lib.Yojson.Safe.t -> resource_type
Sourcetype qualifier = [
  1. | `Slash_delimited of string
  2. | `Colon_delimited of string
  3. | `None
]
Sourceval __qualifier_of_yojson__ : Ppx_yojson_conv_lib.Yojson.Safe.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 Ppx_yojson_conv_lib.Yojsonable.S with type t := t
Sourceval t_of_yojson : Yojson.Safe.t -> t
Sourceval yojson_of_t : t -> Yojson.Safe.t
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