README: Add TODO item.
[software/guile-aws.git] / README.org
1 Guile AWS is pre-alpha software. At the very least it’s yet another demonstration that Guile’s compiler tower can be used to generate an embedded domain specific language from JSON specifications.
2
3 Here is an example session to create an EFS and make it ready for mounting on an EC2 instance:
4
5 #+begin_src scheme
6 (import (aws api elasticfilesystem-2015-02-01))
7
8 (CreateFileSystem
9 #:CreationToken "my-guile-aws-filesystem")
10
11 #; (("ThroughputMode" . "bursting")
12 ("Tags" . #())
13 ("SizeInBytes"
14 ("ValueInStandard" . 0)
15 ("ValueInIA" . 0)
16 ("Value" . 0)
17 ("Timestamp" . null))
18 ("ReplicationPolicies" . null)
19 ("ProvisionedThroughputInMibps" . null)
20 ("PerformanceMode" . "generalPurpose")
21 ("OwnerId" . "439516136713")
22 ("NumberOfMountTargets" . 0)
23 ("Name" . null)
24 ("LifeCycleState" . "creating")
25 ("KmsKeyId" . null)
26 ("FileSystemId" . "fs-8bee03d0")
27 ("FileSystemArn"
28 .
29 "arn:aws:elasticfilesystem:eu-central-1:439516136713:file-system/fs-3c759b67")
30 ("Encrypted" . #f)
31 ("CreationToken" . "my-guile-aws-filesystem")
32 ("CreationTime" . 1614808760.0)
33 ("AvailabilityZoneName" . null)
34 ("AvailabilityZoneId" . null))
35
36 (CreateAccessPoint
37 #:ClientToken "my-guile-aws-filesystem"
38 #:FileSystemId "fs-8bee03d0")
39
40 #;
41 (("Tags" . #())
42 ("RootDirectory"
43 ("Path" . "/")
44 ("CreationInfo" . null))
45 ("PosixUser" . null)
46 ("OwnerId" . "439516136713")
47 ("Name" . null)
48 ("LifeCycleState" . "creating")
49 ("FileSystemId" . "fs-8bee03d0")
50 ("ClientToken" . "my-guile-aws-filesystem")
51 ("AccessPointId" . "fsap-0d9a986284d086526")
52 ("AccessPointArn"
53 .
54 "arn:aws:elasticfilesystem:eu-central-1:439516136713:access-point/fsap-0d9a986284d086526"))
55
56 ;; Use the same subnet identifier as your EC2 instances.
57 (CreateMountTarget
58 #:FileSystemId "fs-8bee03d0"
59 #:SubnetId "subnet-7f6a7102")
60
61 #;
62 (("VpcId" . "vpc-8e31f4e4")
63 ("SubnetId" . "subnet-7f6a7102")
64 ("OwnerId" . "439516136713")
65 ("NetworkInterfaceId" . "eni-08df70c51f2ecbc33")
66 ("MountTargetId" . "fsmt-023b3e5b")
67 ("LifeCycleState" . "creating")
68 ("IpAddress" . "172.31.44.41")
69 ("FileSystemId" . "fs-3c759b67")
70 ("AvailabilityZoneName" . "eu-central-1b")
71 ("AvailabilityZoneId" . "euc1-az3"))
72
73 ;; Tear down
74 (DeleteMountTarget
75 #:MountTargetId "fsmt-284b4e71")
76
77 #; #t
78
79 (DeleteAccessPoint
80 #:AccessPointId "fsap-0d9a986284d086526")
81
82 #; #t
83
84 (DeleteFileSystem
85 #:FileSystemId "fs-8bee03d0")
86
87 #; #t
88 #+end_src
89
90 You can also separate the request definition from submitting the request. This is useful if you want your requests type-checked well before even getting near to submission:
91
92 #+begin_src scheme
93 ;; This is type-checked right away, so any errors will show up here.
94 (define req
95 (DeleteFileSystemRequest
96 #:FileSystemId "fs-8bee03d0"))
97
98 ;; Actually submit the request
99 (DeleteFileSystem req)
100 #+end_src
101
102 As you can see, the output is pretty bad as it is currently unprocessed SXML or JSON. It may not even work at all, because the AWS APIs are all a little different.
103
104 Considering all these caveats there are a couple of obvious things to work on:
105
106 ** Extend requestUri formatting
107 The =(aws request)= module interprets the =requestUri= field and substitutes placeholders. However, this was only tested with the EFS API. The S3 API uses fancier placeholders such as ="/{Bucket}/{Key+}?restore"= — it is not clear yet how to interpret the plus.
108 ** Create aliases
109 The S3 API (for example) defines aliases for some operations, such as “PostObjectRestore” for “RestoreObject”. The compiler should process the “alias” field.
110 ** Record possible errors
111 The S3 API and the EFS API (for example) define possible error names. While their shape is not specified anywhere we should generate values for these error conditions.
112 ** Process output shapes
113 We generate types for all defined shapes — including output shapes — but we don’t mashall the output SXML into appropriate Scheme values yet.
114 ** Turn errors into Scheme conditions
115 This is easier said than done because different APIs return different kinds of errors.
116 ** TODO Respect “location” and “locationName”
117 In the S3 API some values have a “location” property with value “header”, others with “querystring”. These values must appear in the headers or the querystring, respectively, and should not be added to the body.