Giter Site home page Giter Site logo

turbot / steampipe-plugin-openapi Goto Github PK

View Code? Open in Web Editor NEW
7.0 11.0 0.0 467 KB

Use SQL to instantly query resources from OpenAPI. Open source CLI. No DB required.

Home Page: https://hub.steampipe.io/plugins/turbot/openapi

License: Apache License 2.0

Makefile 0.28% PLSQL 3.67% Go 96.05%
openapi postgresql sql steampipe steampipe-plugin hacktoberfest postgresql-fdw backup etl sqlite zero-etl

steampipe-plugin-openapi's Introduction

image

OpenAPI Plugin for Steampipe

Use SQL to query introspection of the OpenAPI definition.

Quick start

Install

Download and install the latest OpenAPI plugin:

steampipe plugin install openapi

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

connection "openapi" {
  plugin = "openapi"

  # Paths is a list of locations to search for OpenAPI definition files
  # Paths can be configured with a local directory, a remote Git repository URL, or an S3 bucket URL
  # Refer https://hub.steampipe.io/plugins/turbot/openapi#supported-path-formats for more information
  # Wildcard based searches are supported, including recursive searches
  # Local paths are resolved relative to the current working directory (CWD)

  # For example:
  #  - "*.json" matches all OpenAPI JSON definition files in the CWD
  #  - "**/*.json" matches all OpenAPI JSON definition files in the CWD and all sub-directories
  #  - "../*.json" matches all OpenAPI JSON definition files in the CWD's parent directory
  #  - "*.yml" or "*.yaml" matches all OpenAPI YML or YAML definition files in the CWD
  #  - "**/*.yml" or "**/*.yaml" matches all OpenAPI YML or YAML definition files in the CWD and all sub-directories
  #  - "../*.yml" or "../*.yaml" matches all OpenAPI YML or YAML definition files in the CWD's parent directory
  #  - "steampipe*.json" or "steampipe*.yml" or "steampipe*.yaml" matches all OpenAPI definition files starting with "steampipe" in the CWD
  #  - "/path/to/dir/*.json" or "/path/to/dir/*.yml" or "/path/to/dir/*.yaml" matches all OpenAPI definition files in a specific directory
  #  - "/path/to/dir/main.json" or "/path/to/dir/main.yml" or "/path/to/dir/main.yaml" matches a specific file

  # If paths includes "*", all files (including non-OpenAPI definition files) in
  # the CWD will be matched, which may cause errors if incompatible file types exist

  # Defaults to CWD
  paths = [ "*.json", "*.yml", "*.yaml" ]
}

Run steampipe:

steampipe query

Query all the endpoints available for an API:

select
  api_path,
  operation_id,
  summary,
  deprecated,
  tags
from
  openapi_path;
+----------+---------------------+--------------------------+------------+--------+
| api_path | operation_id        | summary                  | deprecated | tags   |
+----------+---------------------+--------------------------+------------+--------+
| /get     | listVersionsv2      | List API versions        | false      | <null> |
| /v2/get  | getVersionDetailsv2 | Show API version details | false      | <null> |
+----------+---------------------+--------------------------+------------+--------+

Engines

This plugin is available for the following engines:

Engine Description
Steampipe The Steampipe CLI exposes APIs and services as a high-performance relational database, giving you the ability to write SQL-based queries to explore dynamic data. Mods extend Steampipe's capabilities with dashboards, reports, and controls built with simple HCL. The Steampipe CLI is a turnkey solution that includes its own Postgres database, plugin management, and mod support.
Postgres FDW Steampipe Postgres FDWs are native Postgres Foreign Data Wrappers that translate APIs to foreign tables. Unlike Steampipe CLI, which ships with its own Postgres server instance, the Steampipe Postgres FDWs can be installed in any supported Postgres database version.
SQLite Extension Steampipe SQLite Extensions provide SQLite virtual tables that translate your queries into API calls, transparently fetching information from your API or service as you request it.
Export Steampipe Plugin Exporters provide a flexible mechanism for exporting information from cloud services and APIs. Each exporter is a stand-alone binary that allows you to extract data using Steampipe plugins without a database.
Turbot Pipes Turbot Pipes is the only intelligence, automation & security platform built specifically for DevOps. Pipes provide hosted Steampipe database instances, shared dashboards, snapshots, and more.

Developing

Prerequisites:

Clone:

git clone https://github.com/turbot/steampipe-plugin-openapi.git
cd steampipe-plugin-openapi

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

make

Configure the plugin:

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

Try it!

steampipe query
> .inspect openapi

Further reading:

Open Source & Contributing

This repository is published under the Apache 2.0 (source code) and CC BY-NC-ND (docs) licenses. Please see our code of conduct. We look forward to collaborating with you!

Steampipe is a product produced from this open source software, exclusively by Turbot HQ, Inc. It is distributed under our commercial terms. Others are allowed to make their own distribution of the software, but cannot use any of the Turbot trademarks, cloud services, etc. You can learn more in our Open Source FAQ.

Get Involved

Join #steampipe on Slack →

Want to help but don't know where to start? Pick up one of the help wanted issues:

steampipe-plugin-openapi's People

Contributors

misraved avatar subhajit97 avatar cbruno10 avatar dependabot[bot] avatar

Stargazers

Paul Dougan avatar  avatar Ming Fang avatar Kevin Lyda avatar Chris avatar  avatar Edward Vielmetti avatar

Watchers

Edward Vielmetti avatar Jon Udell avatar David Boeke avatar Luis Cavalcante avatar Mike Burgess avatar Nathan Wallace avatar Karan Popat avatar  avatar  avatar  avatar  avatar

steampipe-plugin-openapi's Issues

Adding starting and ending line numbers to all possible tables

Is your feature request related to a problem? Please describe.
When looking to reference a resource from a table, I'm not sure where it is in the file at first

Describe the solution you'd like
View the starting and ending line number for the resource definition

Describe alternatives you've considered
Searching for the resource in the file based on its name or other properties

Additional context
Add any other context or screenshots about the feature request here.

Test which tables support OpenAPI 2.0 (Swagger 2.0) documents

Is your feature request related to a problem? Please describe.
Some OpenAPI 2.0 documents fail when queried, e.g., openapi_path_response. I'm not sure if this is based on an error in the document itself or if it's because the parser we're using can't process them correctly.

Describe the solution you'd like
It'd be helpful to understand which tables in this plugin support 2.0 documents, and then update them to work with 2.0 (either in place updates or potentially a new table).

Describe alternatives you've considered
N/A

Additional context
Add any other context or screenshots about the feature request here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.