Skip to content

lyda/steampipe-plugin-oapigen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

    OpenAPI -> [generate tables + generate requests]
                        +
    Steampipe

OAPIGen Plugin for Steampipe

Use OpenAPI definitions to generate Steampipe SQL tables.

Quick start

Install

Download and install the latest OAPIGen plugin:

steampipe plugin install oapigen

Configure your config file to include directories with OAPIGen definition files.

connection "oapigen" {
  plugin = "oapigen"

  # Documents refers to the OpenAPI definition(s) being used.
  documents = ["some/path/to/openapi-definition.yaml"]

  # Version of OpenAPI spec being used.
  Version = 3 

  # Prefix is the prefix for the defined paths.
  prefix = "http://127.0.0.1:1234"
}

Run steampipe:

steampipe query

TODO: include a petstore yaml file.

Query all the pets available from the petstore api:

select
  pet_id,
  pet_name,
  pet_type
from
  oapigen_petstore_pets;
+--------+-----------------+-----------+
| pet_id | pet_name        | pet_type  |
+--------+-----------------+-----------+
| 1      | Fido            | dog       |
| 2      | Fluffy          | cat       |
+--------+-----------------+-----------+

Developing

Prerequisites:

Clone:

git clone https://github.com/lyda/steampipe-plugin-oapigen.git
cd steampipe-plugin-oapigen

Build, which automatically installs the new version to your ~/.steampipe/plugins directory:

make

Configure the plugin:

cp config/* ~/.steampipe/config
vi ~/.steampipe/config/oapigen.spc

Try it!

steampipe query
> .inspect oapigen

Further reading:

Contributing

Please see the contribution guidelines and our code of conduct. All contributions are subject to the Apache 2.0 open source license.

help wanted issues:

About

Generate steampipe tables from OpenAPI documents

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published