aws-sdk-lisp
aws-sdk-lisp copied to clipboard
ec2 doesn't work with :filters parameter
Consider the following request:
(aws/ec2:describe-instances :filters (list (aws/ec2:make-filter :name "filter-1"
:values (list "val-1" "val-2"))
(aws/ec2:make-filter :name "filter-2"
:values (list "val-3"))))
An error occurs:
;; sbcl
The value of QURI.ENCODE::VALUE is #S(AWS-SDK/SERVICES/EC2/API:FILTER
:NAME "filter-1"
:VALUES ("val-1" "val-2")), which is not of type (OR
STRING
NUMBER
(SIMPLE-ARRAY
(UNSIGNED-BYTE
8)
(*))).
[Condition of type SIMPLE-TYPE-ERROR]
After some investigation, it seems that ec2-request is not generated properly when :filters argument is presented.
The generated request has following request-params:
(("Action" . "DescribeInstances") ("Version" . "2016-11-15")
("Filters.member.1"
. #S(AWS-SDK/SERVICES/EC2/API:FILTER
:NAME "filter-1"
:VALUES ("val-1" "val-2")))
("Filters.member.2"
. #S(AWS-SDK/SERVICES/EC2/API:FILTER :NAME "filter-2" :VALUES ("val-3"))))
instead of something like this:
(("Action" . "DescribeInstances") ("Version" . "2016-11-15")
("Filters.member.1.Name" . "filter-1")
("Filters.member.1.Values.member.1" . "val-1")
("Filters.member.1.Values.member.2" . "val-2")
("Filters.member.2.Name" . "filter-2")
("Filters.member.2.Values.member.1" . "val-3"))
Just to follow up here, the ec2 describe-instances logic has a number of problems,
- The first being parsing partially fixed in Gleefre's diffs above.
- That the
instance-idsparameter gets turned into parameters of the formInstanceIds.1, but really needs to beInstanceId.1(singular) (sample debug output below) - That filters are turned into
Filter.member.<n>but need to becomeFilter.<n>.NameandFilter.<n>.Value. with possibly an additional suffix after values i.e.Filter.<n>.Value.<m>when there are multiple values on a filter expression for a specific filter name.
Here's the sample incorrect params for :instance-ids
(let ((dex:*verbose* :debug))
(aws/ec2:describe-instances :instance-ids '("i-0ff9a89a4b89353c0")))
POST /?Action=DescribeInstances&Version=2016-11-15&InstanceIds.1=i-0ff9a89a4b89353c0 HTTP/1.1
Sorry there won't be any patches from me, I solved my problem other ways and have moved on. I like that the project is trying to build a comprehensive interface, good luck!