github.com/turbot/steampipe-plugin-sdk/v5 (go): A plugin is defined by plugin.Plugin.  Create the file <plugin-name>/plugin.go, then implement a plugin.PluginFunc that creates a plugin.Plugin and returns a pointer to it.  Note: The Go files for your plugin (except main.go) should reside in the <plugin-name> folder.  Examples:  Create main.go in your plugin's root directory. Add a main function which is the entry point for your plugin.  This function must call plugin.Serve to instantiate your plugin's gRPC server, and pass the plugin.PluginFunc that you just wrote.  Examples:  By convention, each table lives in a separate file named table_<table name>.go.  Each table has a single table definition function that returns a pointer to a plugin.Table.  The table definition includes the name and description of the table, a set of column definitions, and the functions to call in order to list the data for all the rows, or to get data for a single row.  Every table MUST define a List and/or Get function.  Examples:  This is a plugin.HydrateFunc that calls an API and returns data for all rows for the table.  To define it, set the property plugin.Plugin.ListConfig.  This is a plugin.HydrateFunc that calls an API and returns data for one row of the table. If the API can return a single item keyed by id, you should implement Get so that queries can filter the data as cheaply as possible.  To define it, set the property plugin.Plugin.GetConfig.  Use plugin.Column to define columns.  A column may be populated by a List or Get call. If a column requires data not provide by List or Get, it may define a plugin.HydrateFunc that makes an additional API call for each row.  Add a hydrate function for a column by setting plugin.Column.Hydrate.  Use transform functions to extract and/or reformat data returned by a hydrate function.  A plugin.Logger is passed to the plugin via its context.Context. Messages are written to ~/.steampipe/logs, e.g. ~/.steampipe/logs/plugin-2022-01-01.log.  Steampipe uses go-hclog which supports standard log levels: TRACE, DEBUG, INFO, WARN, ERROR. The default is WARN.  Use the STEAMPIPE_LOG_LEVEL environment variable to set the level.  Steampipe parallelizes hydrate functions as much as possible. Sometimes, however, one hydrate function requires the output from another.  Use plugin.HydrateConfig to define the dependency.  Use dynamic_tables when you cannot know a table's schema in advance, e.g. the CSV plugin.  A user runs a query.  Postgres parses the query and sends the parsed request to the Steampipe foreign data wrapper (FDW).  The FDW determines which tables and columns are required.  The FDW calls one or more [HydrateFunc] to fetch API data.  Each table defines special hydrate functions: List and optionally Get. These will always be called before any other hydrate function in the table, as the other functions typically depend on the List or Get.  One or more transform functions are called for each column. These extract and/or reformat data returned by the hydrate functions.  The plugin returns the transformed data to the FDW.  Steampipe FDW returns the results to the database.
Keywords: hacktoberfest|postgresql|postgresql-fdw|sql|steampipe|steampipe-plugin