diff --git a/provider/describer/blueprints.go b/provider/describer/blueprints.go index 372e32da..976697a9 100644 --- a/provider/describer/blueprints.go +++ b/provider/describer/blueprints.go @@ -11,7 +11,7 @@ import ( "sync" ) -func ListBluePrints(ctx context.Context, handler *RenderAPIHandler, stream *models.StreamSender) ([]models.Resource, error) { +func ListBlueprints(ctx context.Context, handler *RenderAPIHandler, stream *models.StreamSender) ([]models.Resource, error) { var wg sync.WaitGroup renderChan := make(chan models.Resource) errorChan := make(chan error, 1) // Buffered channel to capture errors @@ -19,7 +19,7 @@ func ListBluePrints(ctx context.Context, handler *RenderAPIHandler, stream *mode go func() { defer close(renderChan) defer close(errorChan) - if err := processBluePrints(ctx, handler, renderChan, &wg); err != nil { + if err := processBlueprints(ctx, handler, renderChan, &wg); err != nil { errorChan <- err // Send error to the error channel } wg.Wait() @@ -45,8 +45,8 @@ func ListBluePrints(ctx context.Context, handler *RenderAPIHandler, stream *mode } } -func GetBluePrint(ctx context.Context, handler *RenderAPIHandler, resourceID string) (*models.Resource, error) { - blueprint, err := processBluePrint(ctx, handler, resourceID) +func GetBlueprint(ctx context.Context, handler *RenderAPIHandler, resourceID string) (*models.Resource, error) { + blueprint, err := processBlueprint(ctx, handler, resourceID) if err != nil { return nil, err } @@ -60,7 +60,7 @@ func GetBluePrint(ctx context.Context, handler *RenderAPIHandler, resourceID str return &value, nil } -func processBluePrints(ctx context.Context, handler *RenderAPIHandler, renderChan chan<- models.Resource, wg *sync.WaitGroup) error { +func processBlueprints(ctx context.Context, handler *RenderAPIHandler, renderChan chan<- models.Resource, wg *sync.WaitGroup) error { var blueprints []model.BlueprintDescription var blueprintListResponse []model.BlueprintResponse var resp *http.Response @@ -125,7 +125,7 @@ func processBluePrints(ctx context.Context, handler *RenderAPIHandler, renderCha return nil } -func processBluePrint(ctx context.Context, handler *RenderAPIHandler, resourceID string) (*model.ProjectDescription, error) { +func processBlueprint(ctx context.Context, handler *RenderAPIHandler, resourceID string) (*model.ProjectDescription, error) { var project model.ProjectDescription var resp *http.Response baseURL := "https://api.render.com/v1/blueprints/" diff --git a/provider/resource_types/resource-types.json b/provider/resource_types/resource-types.json index 1774fe15..4b863183 100644 --- a/provider/resource_types/resource-types.json +++ b/provider/resource_types/resource-types.json @@ -1,9 +1,79 @@ [ { - "ResourceName": "AWS::Redshift::Snapshot", - "ListDescriber": "ParallelDescribeRegional(describer.RedshiftSnapshot)", - "GetDescriber": "ParallelDescribeRegionalSingleResource(describer.GetRedshiftSnapshot)", - "SteampipeTable": "aws_redshift_snapshot", - "Model": "RedshiftSnapshot" + "ResourceName": "Render/Blueprint", + "ListDescriber": "DescribeListByRender(describer.ListBlueprints)", + "GetDescriber": "DescribeSingleByRender(describer.GetBlueprint)", + "SteampipeTable": "render_blueprint", + "Model": "Blueprint" + }, + { + "ResourceName": "Render/Deploy", + "ListDescriber": "DescribeListByRender(describer.ListDeploys)", + "GetDescriber": "DescribeSingleByRender(describer.GetDeploy)", + "SteampipeTable": "render_deploy", + "Model": "Deploy" + }, + { + "ResourceName": "Render/Disk", + "ListDescriber": "DescribeListByRender(describer.ListDisks)", + "GetDescriber": "DescribeSingleByRender(describer.GetDisk)", + "SteampipeTable": "render_disk", + "Model": "Disk" + }, + { + "ResourceName": "Render/EnvGroup", + "ListDescriber": "DescribeListByRender(describer.ListEnvGroups)", + "GetDescriber": "DescribeSingleByRender(describer.GetEnvGroup)", + "SteampipeTable": "render_env_group", + "Model": "EnvGroup" + }, + { + "ResourceName": "Render/Environment", + "ListDescriber": "DescribeListByRender(describer.ListEnvironments)", + "GetDescriber": "DescribeSingleByRender(describer.GetEnvironment)", + "SteampipeTable": "render_environment", + "Model": "Environment" + }, + { + "ResourceName": "Render/Header", + "ListDescriber": "DescribeListByRender(describer.ListHeaders)", + "GetDescriber": "DescribeSingleByRender(describer.GetHeader)", + "SteampipeTable": "render_header", + "Model": "Header" + }, + { + "ResourceName": "Render/Job", + "ListDescriber": "DescribeListByRender(describer.ListJobs)", + "GetDescriber": "DescribeSingleByRender(describer.GetJob)", + "SteampipeTable": "render_job", + "Model": "Job" + }, + { + "ResourceName": "Render/PostgresInstance", + "ListDescriber": "DescribeListByRender(describer.ListPostgresInstances)", + "GetDescriber": "DescribeSingleByRender(describer.GetPostgresInstance)", + "SteampipeTable": "render_postgres_instance", + "Model": "Postgres" + }, + { + "ResourceName": "Render/Project", + "ListDescriber": "DescribeListByRender(describer.ListProjects)", + "GetDescriber": "DescribeSingleByRender(describer.GetProject)", + "SteampipeTable": "render_project", + "Model": "Project" + }, + { + "ResourceName": "Render/Route", + "ListDescriber": "DescribeListByRender(describer.ListRoutes)", + "GetDescriber": "DescribeSingleByRender(describer.GetRoute)", + "SteampipeTable": "render_route", + "Model": "Route" + }, + { + "ResourceName": "Render/Service", + "ListDescriber": "DescribeListByRender(describer.ListServices)", + "GetDescriber": "DescribeSingleByRender(describer.GetService)", + "SteampipeTable": "render_service", + "Model": "Service" } ] \ No newline at end of file diff --git a/steampipe-plugin-render/.github/ISSUE_TEMPLATE/config.yml b/steampipe-plugin-render/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..bef76500 --- /dev/null +++ b/steampipe-plugin-render/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Questions + url: https://turbot.com/community/join + about: GitHub issues in this repository are only intended for bug reports and feature requests. Other issues will be closed. Please ask and answer questions through the Steampipe Slack community. + - name: Steampipe CLI Bug Reports and Feature Requests + url: https://github.com/turbot/steampipe/issues/new/choose + about: Steampipe CLI has its own codebase. Bug reports and feature requests for those pieces of functionality should be directed to that repository. \ No newline at end of file diff --git a/steampipe-plugin-render/.github/dependabot.yml b/steampipe-plugin-render/.github/dependabot.yml new file mode 100644 index 00000000..8450b99b --- /dev/null +++ b/steampipe-plugin-render/.github/dependabot.yml @@ -0,0 +1,18 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "gomod" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + pull-request-branch-name: + separator: "-" + assignees: + - "misraved" + - "madhushreeray30" + labels: + - "dependencies" diff --git a/steampipe-plugin-render/.github/workflows/golangci-lint.yml b/steampipe-plugin-render/.github/workflows/golangci-lint.yml new file mode 100644 index 00000000..89d69978 --- /dev/null +++ b/steampipe-plugin-render/.github/workflows/golangci-lint.yml @@ -0,0 +1,12 @@ +name: golangci-lint +on: + push: + tags: + - v* + branches: + - main + pull_request: + +jobs: + golangci_lint_workflow: + uses: turbot/steampipe-workflows/.github/workflows/golangci-lint.yml@main diff --git a/steampipe-plugin-render/.github/workflows/registry-publish.yml b/steampipe-plugin-render/.github/workflows/registry-publish.yml new file mode 100644 index 00000000..08f3d594 --- /dev/null +++ b/steampipe-plugin-render/.github/workflows/registry-publish.yml @@ -0,0 +1,13 @@ +name: Build and Deploy OCI Image + +on: + push: + tags: + - 'v*' + +jobs: + registry_publish_workflow_ghcr: + uses: turbot/steampipe-workflows/.github/workflows/registry-publish-ghcr.yml@main + secrets: inherit + with: + releaseTimeout: 60m diff --git a/steampipe-plugin-render/.github/workflows/stale.yml b/steampipe-plugin-render/.github/workflows/stale.yml new file mode 100644 index 00000000..6a30f3b3 --- /dev/null +++ b/steampipe-plugin-render/.github/workflows/stale.yml @@ -0,0 +1,17 @@ +name: Stale Issues and PRs +on: + schedule: + - cron: "30 23 * * *" + workflow_dispatch: + inputs: + dryRun: + description: Set to true for a dry run + required: false + default: "false" + type: string + +jobs: + stale_workflow: + uses: turbot/steampipe-workflows/.github/workflows/stale.yml@main + with: + dryRun: ${{ github.event.inputs.dryRun }} diff --git a/steampipe-plugin-render/.github/workflows/steampipe-anywhere.yml b/steampipe-plugin-render/.github/workflows/steampipe-anywhere.yml new file mode 100644 index 00000000..05092d63 --- /dev/null +++ b/steampipe-plugin-render/.github/workflows/steampipe-anywhere.yml @@ -0,0 +1,12 @@ +name: Release Steampipe Anywhere Components + +on: + push: + tags: + - 'v*' + + +jobs: + anywhere_publish_workflow: + uses: turbot/steampipe-workflows/.github/workflows/steampipe-anywhere.yml@main + secrets: inherit diff --git a/steampipe-plugin-render/.github/workflows/sync-labels.yml b/steampipe-plugin-render/.github/workflows/sync-labels.yml new file mode 100644 index 00000000..6a2e42a5 --- /dev/null +++ b/steampipe-plugin-render/.github/workflows/sync-labels.yml @@ -0,0 +1,9 @@ +name: Sync Labels +on: + schedule: + - cron: "30 22 * * 1" + workflow_dispatch: + +jobs: + sync_labels_workflow: + uses: turbot/steampipe-workflows/.github/workflows/sync-labels.yml@main diff --git a/steampipe-plugin-render/.gitignore b/steampipe-plugin-render/.gitignore new file mode 100644 index 00000000..e40dfd1f --- /dev/null +++ b/steampipe-plugin-render/.gitignore @@ -0,0 +1,19 @@ +# Editor cache and lock files +*.swp +*.swo + +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ diff --git a/steampipe-plugin-render/.goreleaser.yml b/steampipe-plugin-render/.goreleaser.yml new file mode 100644 index 00000000..63891a35 --- /dev/null +++ b/steampipe-plugin-render/.goreleaser.yml @@ -0,0 +1,37 @@ +# This is an example goreleaser.yaml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +before: + hooks: + - go mod tidy +builds: + - env: + - CGO_ENABLED=0 + - GO111MODULE=on + - GOPRIVATE=github.com/turbot + goos: + - linux + - darwin + + goarch: + - amd64 + - arm64 + + id: "steampipe" + binary: "{{ .ProjectName }}.plugin" + flags: + - -tags=netgo + +archives: + - format: gz + name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}" + files: + - none* +checksum: + name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS" + algorithm: sha256 +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" diff --git a/steampipe-plugin-render/LICENSE b/steampipe-plugin-render/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/steampipe-plugin-render/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/steampipe-plugin-render/Makefile b/steampipe-plugin-render/Makefile new file mode 100644 index 00000000..4b483b12 --- /dev/null +++ b/steampipe-plugin-render/Makefile @@ -0,0 +1,8 @@ +STEAMPIPE_INSTALL_DIR ?= ~/.steampipe +BUILD_TAGS = netgo + +build: + GOPRIVATE="github.com/opengovern" CC=/usr/bin/musl-gcc GOOS=linux GOARCH=amd64 go build -v -mod=mod -ldflags "-linkmode external -extldflags '-static' -s -w" -o ./build/steampipe-plugin-render.plugin *.go + +install: + go build -o $(STEAMPIPE_INSTALL_DIR)/plugins/hub.steampipe.io/plugins/turbot/linode@latest/steampipe-plugin-render.plugin -tags "${BUILD_TAGS}" *.go \ No newline at end of file diff --git a/steampipe-plugin-render/docker/Dockerfile b/steampipe-plugin-render/docker/Dockerfile new file mode 100644 index 00000000..20e835da --- /dev/null +++ b/steampipe-plugin-render/docker/Dockerfile @@ -0,0 +1,3 @@ +FROM alpine:latest + +COPY ../build/steampipe-plugin-render.plugin /steampipe-plugin-render.plugin diff --git a/steampipe-plugin-render/main.go b/steampipe-plugin-render/main.go new file mode 100644 index 00000000..5516ef7b --- /dev/null +++ b/steampipe-plugin-render/main.go @@ -0,0 +1,10 @@ +package main + +import ( + "github.com/opengovern/og-describer-render/steampipe-plugin-render/render" + "github.com/turbot/steampipe-plugin-sdk/v5/plugin" +) + +func main() { + plugin.Serve(&plugin.ServeOpts{PluginFunc: render.Plugin}) +} diff --git a/steampipe-plugin-render/render/plugin.go b/steampipe-plugin-render/render/plugin.go new file mode 100644 index 00000000..a0ce0ad0 --- /dev/null +++ b/steampipe-plugin-render/render/plugin.go @@ -0,0 +1,64 @@ +package render + +import ( + "context" + essdk "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" + + "github.com/turbot/steampipe-plugin-sdk/v5/plugin" + "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" +) + +func Plugin(ctx context.Context) *plugin.Plugin { + p := &plugin.Plugin{ + Name: "steampipe-plugin-render", + ConnectionConfigSchema: &plugin.ConnectionConfigSchema{ + NewInstance: essdk.ConfigInstance, + Schema: essdk.ConfigSchema(), + }, + DefaultTransform: transform.FromCamel(), + TableMap: map[string]*plugin.Table{ + "render_blueprint": tableRenderBlueprint(ctx), + "render_deploy": tableRenderDeploy(ctx), + "render_disk": tableRenderDisk(ctx), + "render_env_group": tableRenderEnvGroup(ctx), + "render_environment": tableRenderEnvironment(ctx), + "render_header": tableRenderHeader(ctx), + "render_job": tableRenderJob(ctx), + "render_postgres_instance": tableRenderPostgres(ctx), + "render_project": tableRenderProject(ctx), + "render_route": tableRenderRoute(ctx), + "render_service": tableRenderService(ctx), + }, + } + for key, table := range p.TableMap { + if table == nil { + continue + } + if table.Get != nil && table.Get.Hydrate == nil { + delete(p.TableMap, key) + continue + } + if table.List != nil && table.List.Hydrate == nil { + delete(p.TableMap, key) + continue + } + + opengovernanceTable := false + for _, col := range table.Columns { + if col != nil && col.Name == "platform_account_id" { + opengovernanceTable = true + } + } + + if opengovernanceTable { + if table.Get != nil { + table.Get.KeyColumns = append(table.Get.KeyColumns, plugin.OptionalColumns([]string{"platform_account_id", "platform_resource_id"})...) + } + + if table.List != nil { + table.List.KeyColumns = append(table.List.KeyColumns, plugin.OptionalColumns([]string{"platform_account_id", "platform_resource_id"})...) + } + } + } + return p +} diff --git a/steampipe-plugin-render/render/table_render_blueprint.go b/steampipe-plugin-render/render/table_render_blueprint.go new file mode 100644 index 00000000..8a6cab3d --- /dev/null +++ b/steampipe-plugin-render/render/table_render_blueprint.go @@ -0,0 +1,30 @@ +package render + +import ( + "context" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" + "github.com/turbot/steampipe-plugin-sdk/v5/plugin" +) + +func tableRenderBlueprint(ctx context.Context) *plugin.Table { + return &plugin.Table{ + Name: "render_blueprint", + Description: "Information about blueprint descriptions, including ID, name, status, and synchronization details.", + List: &plugin.ListConfig{ + Hydrate: nil, + }, + Get: &plugin.GetConfig{ + Hydrate: nil, + }, + Columns: []*plugin.Column{ + // Top columns + {Name: "id", Type: proto.ColumnType_STRING, Description: "The unique identifier for the blueprint."}, + {Name: "name", Type: proto.ColumnType_STRING, Description: "The name of the blueprint."}, + {Name: "status", Type: proto.ColumnType_STRING, Description: "The current status of the blueprint (e.g., active, inactive)."}, + {Name: "autoSync", Type: proto.ColumnType_BOOL, Description: "Indicates whether auto-sync is enabled for the blueprint."}, + {Name: "repo", Type: proto.ColumnType_STRING, Description: "The repository associated with the blueprint."}, + {Name: "branch", Type: proto.ColumnType_STRING, Description: "The branch in the repository for the blueprint."}, + {Name: "lastSync", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of the last sync for the blueprint."}, + }, + } +} diff --git a/steampipe-plugin-render/render/table_render_deploy.go b/steampipe-plugin-render/render/table_render_deploy.go new file mode 100644 index 00000000..726541af --- /dev/null +++ b/steampipe-plugin-render/render/table_render_deploy.go @@ -0,0 +1,31 @@ +package render + +import ( + "context" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" + "github.com/turbot/steampipe-plugin-sdk/v5/plugin" +) + +func tableRenderDeploy(ctx context.Context) *plugin.Table { + return &plugin.Table{ + Name: "render_deploy", + Description: "Information about deployment descriptions, including ID, commit details, image, status, and timestamps.", + List: &plugin.ListConfig{ + Hydrate: nil, + }, + Get: &plugin.GetConfig{ + Hydrate: nil, + }, + Columns: []*plugin.Column{ + // Top columns + {Name: "id", Type: proto.ColumnType_STRING, Description: "The unique identifier for the deployment."}, + {Name: "commit", Type: proto.ColumnType_JSON, Description: "The commit details associated with the deployment."}, + {Name: "image", Type: proto.ColumnType_JSON, Description: "The image details used in the deployment."}, + {Name: "status", Type: proto.ColumnType_STRING, Description: "The current status of the deployment (e.g., pending, completed)."}, + {Name: "trigger", Type: proto.ColumnType_STRING, Description: "The trigger that initiated the deployment."}, + {Name: "finishedAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of when the deployment finished."}, + {Name: "createdAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of when the deployment was created."}, + {Name: "updatedAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of the last update to the deployment."}, + }, + } +} diff --git a/steampipe-plugin-render/render/table_render_disk.go b/steampipe-plugin-render/render/table_render_disk.go new file mode 100644 index 00000000..2cdae5bb --- /dev/null +++ b/steampipe-plugin-render/render/table_render_disk.go @@ -0,0 +1,30 @@ +package render + +import ( + "context" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" + "github.com/turbot/steampipe-plugin-sdk/v5/plugin" +) + +func tableRenderDisk(ctx context.Context) *plugin.Table { + return &plugin.Table{ + Name: "render_disk", + Description: "Information about disk descriptions, including ID, name, size, mount path, and timestamps.", + List: &plugin.ListConfig{ + Hydrate: nil, + }, + Get: &plugin.GetConfig{ + Hydrate: nil, + }, + Columns: []*plugin.Column{ + // Top columns + {Name: "id", Type: proto.ColumnType_STRING, Description: "The unique identifier for the disk."}, + {Name: "name", Type: proto.ColumnType_STRING, Description: "The name of the disk."}, + {Name: "sizeGB", Type: proto.ColumnType_INT, Description: "The size of the disk in gigabytes."}, + {Name: "mountPath", Type: proto.ColumnType_STRING, Description: "The mount path of the disk."}, + {Name: "serviceId", Type: proto.ColumnType_STRING, Description: "The ID of the service associated with the disk."}, + {Name: "createdAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of when the disk was created."}, + {Name: "updatedAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of the last update to the disk."}, + }, + } +} diff --git a/steampipe-plugin-render/render/table_render_env_group.go b/steampipe-plugin-render/render/table_render_env_group.go new file mode 100644 index 00000000..51b8851a --- /dev/null +++ b/steampipe-plugin-render/render/table_render_env_group.go @@ -0,0 +1,30 @@ +package render + +import ( + "context" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" + "github.com/turbot/steampipe-plugin-sdk/v5/plugin" +) + +func tableRenderEnvGroup(ctx context.Context) *plugin.Table { + return &plugin.Table{ + Name: "render_env_group", + Description: "Information about environment group descriptions, including ID, name, owner, service links, and timestamps.", + List: &plugin.ListConfig{ + Hydrate: nil, + }, + Get: &plugin.GetConfig{ + Hydrate: nil, + }, + Columns: []*plugin.Column{ + // Top columns + {Name: "id", Type: proto.ColumnType_STRING, Description: "The unique identifier for the environment group."}, + {Name: "name", Type: proto.ColumnType_STRING, Description: "The name of the environment group."}, + {Name: "ownerId", Type: proto.ColumnType_STRING, Description: "The ID of the owner of the environment group."}, + {Name: "createdAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of when the environment group was created."}, + {Name: "updatedAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of the last update to the environment group."}, + {Name: "serviceLinks", Type: proto.ColumnType_JSON, Description: "A list of service links associated with the environment group."}, + {Name: "environmentId", Type: proto.ColumnType_STRING, Description: "The ID of the associated environment."}, + }, + } +} diff --git a/steampipe-plugin-render/render/table_render_environment.go b/steampipe-plugin-render/render/table_render_environment.go new file mode 100644 index 00000000..b3b6f652 --- /dev/null +++ b/steampipe-plugin-render/render/table_render_environment.go @@ -0,0 +1,31 @@ +package render + +import ( + "context" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" + "github.com/turbot/steampipe-plugin-sdk/v5/plugin" +) + +func tableRenderEnvironment(ctx context.Context) *plugin.Table { + return &plugin.Table{ + Name: "render_environment", + Description: "Information about environment descriptions, including ID, name, project details, and associated resources.", + List: &plugin.ListConfig{ + Hydrate: nil, + }, + Get: &plugin.GetConfig{ + Hydrate: nil, + }, + Columns: []*plugin.Column{ + // Top columns + {Name: "id", Type: proto.ColumnType_STRING, Description: "The unique identifier for the environment."}, + {Name: "name", Type: proto.ColumnType_STRING, Description: "The name of the environment."}, + {Name: "projectId", Type: proto.ColumnType_STRING, Description: "The ID of the project associated with the environment."}, + {Name: "databasesIds", Type: proto.ColumnType_JSON, Description: "A list of database IDs associated with the environment."}, + {Name: "redisIds", Type: proto.ColumnType_JSON, Description: "A list of Redis instance IDs associated with the environment."}, + {Name: "serviceIds", Type: proto.ColumnType_JSON, Description: "A list of service IDs associated with the environment."}, + {Name: "envGroupIds", Type: proto.ColumnType_JSON, Description: "A list of environment group IDs associated with the environment."}, + {Name: "protectedStatus", Type: proto.ColumnType_STRING, Description: "The protected status of the environment."}, + }, + } +} diff --git a/steampipe-plugin-render/render/table_render_header.go b/steampipe-plugin-render/render/table_render_header.go new file mode 100644 index 00000000..76601c54 --- /dev/null +++ b/steampipe-plugin-render/render/table_render_header.go @@ -0,0 +1,27 @@ +package render + +import ( + "context" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" + "github.com/turbot/steampipe-plugin-sdk/v5/plugin" +) + +func tableRenderHeader(ctx context.Context) *plugin.Table { + return &plugin.Table{ + Name: "render_header", + Description: "Information about header descriptions, including ID, path, name, and value.", + List: &plugin.ListConfig{ + Hydrate: nil, + }, + Get: &plugin.GetConfig{ + Hydrate: nil, + }, + Columns: []*plugin.Column{ + // Top columns + {Name: "id", Type: proto.ColumnType_STRING, Description: "The unique identifier for the header."}, + {Name: "path", Type: proto.ColumnType_STRING, Description: "The path of the header."}, + {Name: "name", Type: proto.ColumnType_STRING, Description: "The name of the header."}, + {Name: "value", Type: proto.ColumnType_STRING, Description: "The value of the header."}, + }, + } +} diff --git a/steampipe-plugin-render/render/table_render_job.go b/steampipe-plugin-render/render/table_render_job.go new file mode 100644 index 00000000..226c27d0 --- /dev/null +++ b/steampipe-plugin-render/render/table_render_job.go @@ -0,0 +1,31 @@ +package render + +import ( + "context" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" + "github.com/turbot/steampipe-plugin-sdk/v5/plugin" +) + +func tableRenderJob(ctx context.Context) *plugin.Table { + return &plugin.Table{ + Name: "render_job", + Description: "Information about job descriptions, including ID, service details, status, and timestamps.", + List: &plugin.ListConfig{ + Hydrate: nil, + }, + Get: &plugin.GetConfig{ + Hydrate: nil, + }, + Columns: []*plugin.Column{ + // Top columns + {Name: "id", Type: proto.ColumnType_STRING, Description: "The unique identifier for the job."}, + {Name: "serviceId", Type: proto.ColumnType_STRING, Description: "The ID of the service associated with the job."}, + {Name: "startCommand", Type: proto.ColumnType_STRING, Description: "The start command for the job."}, + {Name: "planId", Type: proto.ColumnType_STRING, Description: "The ID of the plan associated with the job."}, + {Name: "status", Type: proto.ColumnType_STRING, Description: "The current status of the job (e.g., running, completed)."}, + {Name: "createdAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of when the job was created."}, + {Name: "startedAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of when the job started."}, + {Name: "finishedAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of when the job finished."}, + }, + } +} diff --git a/steampipe-plugin-render/render/table_render_postgres_instance.go b/steampipe-plugin-render/render/table_render_postgres_instance.go new file mode 100644 index 00000000..73b3ee70 --- /dev/null +++ b/steampipe-plugin-render/render/table_render_postgres_instance.go @@ -0,0 +1,45 @@ +package render + +import ( + "context" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" + "github.com/turbot/steampipe-plugin-sdk/v5/plugin" +) + +func tableRenderPostgres(ctx context.Context) *plugin.Table { + return &plugin.Table{ + Name: "render_postgres_instance", + Description: "Information about PostgreSQL database descriptions, including ID, configuration, status, and timestamps.", + List: &plugin.ListConfig{ + Hydrate: nil, + }, + Get: &plugin.GetConfig{ + Hydrate: nil, + }, + Columns: []*plugin.Column{ + // Top columns + {Name: "id", Type: proto.ColumnType_STRING, Description: "The unique identifier for the PostgreSQL instance."}, + {Name: "ipAllowList", Type: proto.ColumnType_JSON, Description: "A list of IP addresses allowed to access the PostgreSQL instance."}, + {Name: "createdAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of when the PostgreSQL instance was created."}, + {Name: "updatedAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of the last update to the PostgreSQL instance."}, + {Name: "expiresAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of when the PostgreSQL instance expires."}, + {Name: "databaseName", Type: proto.ColumnType_STRING, Description: "The name of the PostgreSQL database."}, + {Name: "databaseUser", Type: proto.ColumnType_STRING, Description: "The username for the PostgreSQL database."}, + {Name: "environmentId", Type: proto.ColumnType_STRING, Description: "The ID of the environment associated with the PostgreSQL instance."}, + {Name: "highAvailabilityEnabled", Type: proto.ColumnType_BOOL, Description: "Indicates whether high availability is enabled for the PostgreSQL instance."}, + {Name: "name", Type: proto.ColumnType_STRING, Description: "The name of the PostgreSQL instance."}, + {Name: "owner", Type: proto.ColumnType_JSON, Description: "Information about the owner of the PostgreSQL instance."}, + {Name: "plan", Type: proto.ColumnType_STRING, Description: "The plan associated with the PostgreSQL instance."}, + {Name: "diskSizeGB", Type: proto.ColumnType_INT, Description: "The disk size of the PostgreSQL instance in gigabytes."}, + {Name: "primaryPostgresID", Type: proto.ColumnType_STRING, Description: "The ID of the primary PostgreSQL instance."}, + {Name: "region", Type: proto.ColumnType_STRING, Description: "The region where the PostgreSQL instance is located."}, + {Name: "readReplicas", Type: proto.ColumnType_JSON, Description: "A list of read replicas associated with the PostgreSQL instance."}, + {Name: "role", Type: proto.ColumnType_STRING, Description: "The role of the PostgreSQL instance (e.g., primary, replica)."}, + {Name: "status", Type: proto.ColumnType_STRING, Description: "The status of the PostgreSQL instance."}, + {Name: "version", Type: proto.ColumnType_STRING, Description: "The version of PostgreSQL used in the instance."}, + {Name: "suspended", Type: proto.ColumnType_STRING, Description: "Indicates whether the PostgreSQL instance is suspended."}, + {Name: "suspenders", Type: proto.ColumnType_JSON, Description: "A list of suspenders associated with the PostgreSQL instance."}, + {Name: "dashboardUrl", Type: proto.ColumnType_STRING, Description: "The URL of the PostgreSQL instance's dashboard."}, + }, + } +} diff --git a/steampipe-plugin-render/render/table_render_project.go b/steampipe-plugin-render/render/table_render_project.go new file mode 100644 index 00000000..bbc6ac6c --- /dev/null +++ b/steampipe-plugin-render/render/table_render_project.go @@ -0,0 +1,29 @@ +package render + +import ( + "context" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" + "github.com/turbot/steampipe-plugin-sdk/v5/plugin" +) + +func tableRenderProject(ctx context.Context) *plugin.Table { + return &plugin.Table{ + Name: "render_project", + Description: "Information about project descriptions, including ID, name, owner, and associated environments.", + List: &plugin.ListConfig{ + Hydrate: nil, + }, + Get: &plugin.GetConfig{ + Hydrate: nil, + }, + Columns: []*plugin.Column{ + // Top columns + {Name: "id", Type: proto.ColumnType_STRING, Description: "The unique identifier for the project."}, + {Name: "createdAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of when the project was created."}, + {Name: "updatedAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of the last update to the project."}, + {Name: "name", Type: proto.ColumnType_STRING, Description: "The name of the project."}, + {Name: "owner", Type: proto.ColumnType_JSON, Description: "Information about the owner of the project."}, + {Name: "environmentIds", Type: proto.ColumnType_JSON, Description: "A list of environment IDs associated with the project."}, + }, + } +} diff --git a/steampipe-plugin-render/render/table_render_route.go b/steampipe-plugin-render/render/table_render_route.go new file mode 100644 index 00000000..da329010 --- /dev/null +++ b/steampipe-plugin-render/render/table_render_route.go @@ -0,0 +1,28 @@ +package render + +import ( + "context" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" + "github.com/turbot/steampipe-plugin-sdk/v5/plugin" +) + +func tableRenderRoute(ctx context.Context) *plugin.Table { + return &plugin.Table{ + Name: "render_route", + Description: "Information about route descriptions, including ID, type, source, destination, and priority.", + List: &plugin.ListConfig{ + Hydrate: nil, + }, + Get: &plugin.GetConfig{ + Hydrate: nil, + }, + Columns: []*plugin.Column{ + // Top columns + {Name: "id", Type: proto.ColumnType_STRING, Description: "The unique identifier for the route."}, + {Name: "type", Type: proto.ColumnType_STRING, Description: "The type of the route."}, + {Name: "source", Type: proto.ColumnType_STRING, Description: "The source of the route."}, + {Name: "destination", Type: proto.ColumnType_STRING, Description: "The destination of the route."}, + {Name: "priority", Type: proto.ColumnType_INT, Description: "The priority of the route."}, + }, + } +} diff --git a/steampipe-plugin-render/render/table_render_service.go b/steampipe-plugin-render/render/table_render_service.go new file mode 100644 index 00000000..66518063 --- /dev/null +++ b/steampipe-plugin-render/render/table_render_service.go @@ -0,0 +1,43 @@ +package render + +import ( + "context" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" + "github.com/turbot/steampipe-plugin-sdk/v5/plugin" +) + +func tableRenderService(ctx context.Context) *plugin.Table { + return &plugin.Table{ + Name: "render_service", + Description: "Information about service descriptions, including ID, name, environment, and deployment configuration.", + List: &plugin.ListConfig{ + Hydrate: nil, + }, + Get: &plugin.GetConfig{ + Hydrate: nil, + }, + Columns: []*plugin.Column{ + // Top columns + {Name: "id", Type: proto.ColumnType_STRING, Description: "The unique identifier for the service."}, + {Name: "autoDeploy", Type: proto.ColumnType_STRING, Description: "Indicates whether the service deploys automatically."}, + {Name: "branch", Type: proto.ColumnType_STRING, Description: "The branch associated with the service."}, + {Name: "buildFilter", Type: proto.ColumnType_JSON, Description: "The build filter associated with the service."}, + {Name: "createdAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of when the service was created."}, + {Name: "dashboardUrl", Type: proto.ColumnType_STRING, Description: "The URL to the service's dashboard."}, + {Name: "environmentId", Type: proto.ColumnType_STRING, Description: "The ID of the environment associated with the service."}, + {Name: "imagePath", Type: proto.ColumnType_STRING, Description: "The image path used by the service."}, + {Name: "name", Type: proto.ColumnType_STRING, Description: "The name of the service."}, + {Name: "notifyOnFail", Type: proto.ColumnType_STRING, Description: "Indicates whether to notify on build failure."}, + {Name: "ownerId", Type: proto.ColumnType_STRING, Description: "The ID of the owner of the service."}, + {Name: "registryCredential", Type: proto.ColumnType_JSON, Description: "The registry credentials associated with the service."}, + {Name: "repo", Type: proto.ColumnType_STRING, Description: "The repository associated with the service."}, + {Name: "rootDir", Type: proto.ColumnType_STRING, Description: "The root directory for the service."}, + {Name: "slug", Type: proto.ColumnType_STRING, Description: "The slug associated with the service."}, + {Name: "suspended", Type: proto.ColumnType_STRING, Description: "Indicates whether the service is suspended."}, + {Name: "suspenders", Type: proto.ColumnType_JSON, Description: "A list of suspenders associated with the service."}, + {Name: "type", Type: proto.ColumnType_STRING, Description: "The type of the service."}, + {Name: "updatedAt", Type: proto.ColumnType_TIMESTAMP, Description: "The timestamp of the last update to the service."}, + {Name: "serviceDetails", Type: proto.ColumnType_JSON, Description: "The details of the service."}, + }, + } +}