Fork me on GitHub
#aws
<
2021-01-21
>
kenny16:01:08

(def sp (aws-api/client {:api :savingsplans}))
(aws-api/invoke sp
  {:op      :DescribeSavingsPlansOfferingRates
   :request {:products ["EC2"]}})
=> {:message "Unsupported Media Type", :cognitect.anomalies/category :cognitect.anomalies/incorrect}
It seems the savingsplan API is not supported? I can get a result back via the CLI *aws* savingsplans describe-savings-plans-offerings --product-types EC2

kenny16:01:50

com.cognitect.aws/api          {:mvn/version "0.8.498"}
 com.cognitect.aws/endpoints    {:mvn/version "1.1.11.934"}
 com.cognitect.aws/savingsplans {:mvn/version "809.2.784.0"}

dchelimsky16:01:49

What does (aws-api/doc sp :DescribeSavingsPlansOfferingRates) say?

kenny16:01:52

{:serviceCodes
 [:seq-of [:one-of ["AmazonEC2" "AmazonECS" "AWSLambda"]]],
 :filters
 [:seq-of
  {:name
   [:one-of
    ["region"
     "instanceFamily"
     "instanceType"
     "productDescription"
     "tenancy"
     "productId"]],
   :values [:seq-of string]}],
 :savingsPlanOfferingIds [:seq-of string],
 :savingsPlanPaymentOptions
 [:seq-of [:one-of ["All Upfront" "Partial Upfront" "No Upfront"]]],
 :products [:seq-of [:one-of ["EC2" "Fargate" "Lambda"]]],
 :usageTypes [:seq-of string],
 :savingsPlanTypes [:seq-of [:one-of ["Compute" "EC2Instance"]]],
 :operations [:seq-of string],
 :nextToken string,
 :maxResults integer}

kenny16:01:17

^ for the request

dchelimsky16:01:19

What is required?

dchelimsky16:01:28

(below what you posted)

kenny16:01:37

(aws-api/invoke sp
  {:op :DescribeSavingsPlansOfferingRates})
=> {:message "Unsupported Media Type", :cognitect.anomalies/category :cognitect.anomalies/incorrect}

dchelimsky16:01:45

> It seems the savingsplan API is not supported You’d be getting different errors if that were true.

kenny16:01:12

Perhaps my definition of supported is different than yours? 🙂

dchelimsky16:01:26

We don’t “support apis” in that definition, but we’re splitting hairs.

✔️ 3
dchelimsky16:01:48

Would you please report this as a bug?

dchelimsky16:01:55

I can’t really investigate it right now.

kenny16:01:07

Do you have any idea where I could look to fix this?

dchelimsky16:01:38

I’d look at the request info from

(meta (aws-api/invoke sp
  {:op :DescribeSavingsPlansOfferingRates}))
and check to see the headers align w/ the aws docs.

dchelimsky16:01:16

Also, we’ve had cases where required things are not listed as such e.g. https://github.com/cognitect-labs/aws-api/issues/158

kenny16:01:45

I was thinking that, however, my call via the aws cli succeeds.

kenny16:01:58

Maybe they implicitly include some params?

dchelimsky16:01:38

That’s the problem in the issue I linked

kenny16:01:51

Thanks for the info. Will dig in. Here's the issue https://github.com/cognitect-labs/aws-api/issues/168

kenny16:01:24

> and check to see the headers align w/ the aws docs. Aren't headers common across all services?

Alex Miller (Clojure team)17:01:35

:rolling_on_the_floor_laughing:

kenny17:01:55

I know s3 is a monster. Was somewhat hoping newer aws apis would be mostly very similar. Do you know of service specific docs for the headers? The regular API references only point to the "CommonParameters" section.

dchelimsky13:01:01

I’m updating the issue so please check there for more info https://github.com/cognitect-labs/aws-api/issues/168

kenny15:01:49

Great, thanks