Firkin.XML (firkin v0.2.1)

Copy Markdown View Source

XML generation and parsing for S3 protocol messages.

Uses Saxy for both generation (simple form builder) and parsing (SAX event-based parsing for request bodies).

Summary

Functions

Generates the CompleteMultipartUploadResult XML response.

Generates the CopyObjectResult XML response.

Generates the DeleteResult XML response.

Generates an S3 error XML response.

Generates the LocationConstraint XML response.

Generates the InitiateMultipartUploadResult XML response.

Generates the ListAllMyBucketsResult XML response.

Generates the ListMultipartUploadsResult XML response.

Generates the ListBucketResult (V2) XML response.

Generates the ListPartsResult XML response.

Parses a CompleteMultipartUpload XML request body, extracting parts.

Parses a DeleteObjects XML request body, extracting the list of keys.

Functions

complete_multipart_upload_response(result)

@spec complete_multipart_upload_response(Firkin.CompleteResult.t()) :: String.t()

Generates the CompleteMultipartUploadResult XML response.

copy_object_response(result)

@spec copy_object_response(Firkin.CopyResult.t()) :: String.t()

Generates the CopyObjectResult XML response.

delete_objects_response(result)

@spec delete_objects_response(Firkin.DeleteResult.t()) :: String.t()

Generates the DeleteResult XML response.

error_response(error)

@spec error_response(Firkin.Error.t()) :: String.t()

Generates an S3 error XML response.

get_bucket_location_response(location)

@spec get_bucket_location_response(String.t()) :: String.t()

Generates the LocationConstraint XML response.

initiate_multipart_upload_response(bucket, key, upload_id)

@spec initiate_multipart_upload_response(String.t(), String.t(), String.t()) ::
  String.t()

Generates the InitiateMultipartUploadResult XML response.

list_buckets_response(buckets)

@spec list_buckets_response([Firkin.Bucket.t()]) :: String.t()

Generates the ListAllMyBucketsResult XML response.

list_multipart_uploads_response(result)

@spec list_multipart_uploads_response(Firkin.MultipartList.t()) :: String.t()

Generates the ListMultipartUploadsResult XML response.

list_objects_v2_response(result)

@spec list_objects_v2_response(Firkin.ListResult.t()) :: String.t()

Generates the ListBucketResult (V2) XML response.

list_parts_response(result)

@spec list_parts_response(Firkin.PartList.t()) :: String.t()

Generates the ListPartsResult XML response.

parse_complete_multipart(xml)

@spec parse_complete_multipart(String.t()) ::
  {:ok, [{pos_integer(), String.t()}]} | {:error, :invalid_xml}

Parses a CompleteMultipartUpload XML request body, extracting parts.

parse_delete_objects(xml)

@spec parse_delete_objects(String.t()) :: {:ok, [String.t()]} | {:error, :invalid_xml}

Parses a DeleteObjects XML request body, extracting the list of keys.