Skip to content

ec2 doesn't work with :filters parameter #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Gleefre opened this issue Jun 3, 2023 · 1 comment · May be fixed by #31
Open

ec2 doesn't work with :filters parameter #30

Gleefre opened this issue Jun 3, 2023 · 1 comment · May be fixed by #31

Comments

@Gleefre
Copy link

Gleefre commented Jun 3, 2023

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"))
@Gleefre Gleefre linked a pull request Jun 3, 2023 that will close this issue
@dtenny
Copy link

dtenny commented Jul 4, 2023

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-ids parameter gets turned into parameters of the form InstanceIds.1, but really needs to be InstanceId.1 (singular) (sample debug output below)
  • That filters are turned into Filter.member.<n> but need to become Filter.<n>.Name and Filter.<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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants