On this page:
endpoint
dict->form-urlencoded
tags
first-tag-value

11 Utilities

 (require (planet gh/aws:1:=0/util))

Although the following are mainly for internal use, they’re provided in case you find them helpful.

struct

(struct endpoint (host ssl?)
  #:extra-constructor-name make-endpoint)
  host : string?
  ssl? : boolean?
Used to represent an AWS service endpoint.

procedure

(dict->form-urlencoded dictionary)  string?

  dictionary : dict?
Like alist->form-urlencoded, but dictionary is a Racket dict, which includes but is not limited to an association list.

Also, and more importantly, the “percent encoding” is done using RFC 3986, which encodes some extra characters compared to RFC 2396. Doing so is important especially for SDB and its Select action: The SQL-like statement contains characters like #\*, #\(, and #\), which SDB requires to be percent-encoded.

procedure

(tags xexpr tag [direct-child-of])  (listof xexpr?)

  xexpr : xexpr?
  tag : symbol?
  direct-child-of : (or/c #f symbol?) = #f
Given xexpr return a list of all the elements starting with tag. If direct-child-of is #f, it will return elements at any depth. It will even return nested elements multiple times – once on their own, and once within their parent. If you only want elements that have a specific immediate parent, set direct-child-of to that symbol.

Although there are more sophisticated and correct ways to make sense of XML, this is useful when the XML structure is small and predictable, and you care about extracting a few specific elements.

procedure

(first-tag-value xexpr tag [def])  string?

  xexpr : xexpr?
  tag : symbol?
  def : any/c = #f
Given xexpr, return the value of just the first element having tag tag, or if none found, def.