Writing Your First Table
- Overview
- Prerequisites
- Clone the Repository
- Build and Run Locally
- Make Your First Change
- Create a New Table
Overview
The Steampipe Plugin SDK makes writing tables fast, easy, and fun! This guide will walk you through building the AWS plugin locally, testing a minor change, and then how to start creating a new table.
Prerequisites
Clone the Repository
Clone the Steampipe Plugin AWS repository:
git clone https://github.com/turbot/steampipe-plugin-aws.gitcd steampipe-plugin-aws
Build and Run Locally
Copy the default
config/aws.spc
into~/.steampipe/config
. If not using the default AWS profile, please see AWS plugin for more information on connection configuration.cp config/aws.spc ~/.steampipe/config/aws.spcRun
make
to build the plugin locally and install the new version to your~/.steampipe/plugins
directory:makeLaunch the Steampipe query shell:
steampipe queryTest basic functionality:
.inspect awsselect name, region from aws_s3_bucket;
Make Your First Change
Edit the
aws/table_aws_s3_bucket.go
table file.Locate the definition for the
name
column:{Name: "name",Description: "The user friendly name of the bucket.",Type: proto.ColumnType_STRING,},Copy the code above and create a duplicate column
name_test
:{Name: "name_test",Description: "Testing new column.",Type: proto.ColumnType_STRING,Transform: transform.FromField("Name"),},Save your changes in
aws/table_aws_s3_bucket.go
.Run
make
to re-build the plugin:makeLaunch the Steampipe query shell:
steampipe queryTest your changes by inspecting and querying the new column:
.inspect aws_s3_bucketselect name, name_test, region from aws_s3_bucket;The
name
andname_test
columns should have the same data in them for each bucket.Undo your changes in
aws/table_aws_s3_bucket.go
once done testing:git restore aws/table_aws_s3_bucket.gomake
Create a New Table
Create a new file in
aws/
, copying an existing table and following the table naming standards in Steampipe Table & Column Standards:cp aws/table_aws_s3_bucket.go aws/table_aws_new_table.goCheck if the AWS service has a service connection function in
aws/service.go
already; if not, add a new function inaws/service.go
.Add an entry for the new table into the
TableMap
inaws/plugin.go
. For more information on this file, please see Writing Plugins - plugin.go.Update the code in your new table so the table returns the correct information for its AWS resource.
Add a document for the table in
docs/tables/
following the Table Documentation Standards.