Hi! Does the Cloud Pricing API have an OpenAPI spe...
# help
a
Hi! Does the Cloud Pricing API have an OpenAPI specification?
w
👋 Hi Sam! The Cloud Pricing API uses GraphQL and as far as I know, OpenAPI is for REST APIs. I’m curious what you’re use-case if you’d like to share
a
Ah ok! I'm just trying to generate a golang client library to make calls. I need to programmatically get gcp vm instance pricing.
And from what I've seen, there's very little by way of making programatic calls to get pricing data with gcp, other than SKUs which require lots of processing
Do you have a graphql schema that I could use?
w
very cool! You can download the latest live schema from the GraphQL Playground - install the modheader browser extension so you can set the custom HTTP header
X-Api-Key
to your Infracost API key so you can open the playground. Here’s an example query for google: https://github.com/infracost/cloud-pricing-api/tree/master/examples/queries/gcp The CLI code has examples of the filters you need to pass-in, e.g. for google compute instances here’s an example
a
Thanks! Is there a way I can get storage/disk pricing too via your api?
w
Yep, all ~4M prices from AWS, Azure and Google are available and updated automatically in this API 🙂 Checkout https://github.com/infracost/infracost/tree/6d78e4b5952eb06b9398909fabeaa4961890473d/internal/resources/google for the other resource prices, e.g. compute_disk.go shows the function that’s calculating the disk costs, you can follow that function to see what graphql filters it uses
a
Thanks! Would you be able to give me an example request I could make to get GCP disk prices?