Skip to content
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

Handling integers in request params #25

Closed
jdhollis opened this issue Dec 12, 2018 · 3 comments
Closed

Handling integers in request params #25

jdhollis opened this issue Dec 12, 2018 · 3 comments

Comments

@jdhollis
Copy link

From the (aws/ops) output, I expected :FromPort and :ToPort to require a number, but I got a casting error: “java.lang.Long cannot be cast to java.lang.String”.

(select-keys (get-in (aws/ops @ec2-client) 
                     [:AuthorizeSecurityGroupIngress :request])
             [:FromPort :ToPort])

{:FromPort integer, :ToPort integer}
(aws/invoke @ec2-client {:op :AuthorizeSecurityGroupIngress
                         :request {:CidrIp cidr-ip
                                   :FromPort 22
                                   :GroupId security-group-id
                                   :IpProtocol "tcp"
                                   :ToPort 22}})

Passing in strings works fine:

(aws/invoke @ec2-client {:op :AuthorizeSecurityGroupIngress
                         :request {:CidrIp cidr-ip
                                   :FromPort "22"
                                   :GroupId security-group-id
                                   :IpProtocol "tcp"
                                   :ToPort "22"}})

I’m using the following versions:

[com.cognitect.aws/api "0.8.149"]
[com.cognitect.aws/endpoints "1.1.11.462"]
[com.cognitect.aws/ec2 "681.2.373.0"]
[com.cognitect.aws/ecs "668.2.364.0"]

Should we always pass in strings as request parameters?

@jdhollis
Copy link
Author

jdhollis commented Dec 12, 2018

Found a counterexample in the ECS client:

(aws/invoke @ecs-client {:op :RunTask
                         :request {:cluster cluster-name
                                   :taskDefinition task-family
                                   :count 1
                                   … }})

If I pass "1" into :count, I get "class java.lang.String can not be converted to an Integer".

@dchelimsky
Copy link
Contributor

Yes, the counter example behaves as expected because it expects an int. The bug is that we're trying to url-encode the number, assuming it's a string. Fix coming soon.

@dchelimsky
Copy link
Contributor

Released in 0.8.155.

dchelimsky pushed a commit that referenced this issue May 15, 2023
* Add test suite with java s17

* Add matrix with java version

* Prettier name
dchelimsky pushed a commit that referenced this issue Jul 10, 2023
* Add test suite with java s17

* Add matrix with java version

* Prettier name
scottbale pushed a commit that referenced this issue Sep 13, 2023
* Add test suite with java s17

* Add matrix with java version

* Prettier name
scottbale pushed a commit that referenced this issue Sep 13, 2023
* Add test suite with java s17

* Add matrix with java version

* Prettier name
scottbale pushed a commit that referenced this issue Sep 13, 2023
* Add test suite with java s17

* Add matrix with java version

* Prettier name
scottbale pushed a commit that referenced this issue Sep 13, 2023
* Add test suite with java s17

* Add matrix with java version

* Prettier name
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

No branches or pull requests

2 participants