From 868530bd00604f60c27d2d7850de2a76d3a42617 Mon Sep 17 00:00:00 2001 From: codenio Date: Sun, 12 Oct 2025 08:23:14 +0530 Subject: [PATCH 1/3] changes as per plugin checklist --- .github/workflows/ci.yaml | 22 ++++++++++++++++++++++ Makefile | 15 ++++++++++++--- config/pdns.spc | 2 +- docs/index.md | 2 +- go.mod | 2 +- 5 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..3c431a9 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,22 @@ +name: Build + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + + - uses: actions/setup-go@v6 + with: + go-version: '1.24' + + - run: make + + - name: golangci-lint + uses: golangci/golangci-lint-action@v8 + with: + version: latest \ No newline at end of file diff --git a/Makefile b/Makefile index 184511e..b12669e 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,16 @@ STEAMPIPE_INSTALL_DIR ?= ~/.steampipe BUILD_TAGS = netgo install: - go build -o $(STEAMPIPE_INSTALL_DIR)/plugins/hub.steampipe.io/plugins/turbot/pdns@latest/steampipe-plugin-pdns.plugin -tags "${BUILD_TAGS}" *.go + go build -o $(STEAMPIPE_INSTALL_DIR)/plugins/hub.steampipe.io/plugins/codnio/pdns@latest/steampipe-plugin-pdns.plugin -tags "${BUILD_TAGS}" *.go -dev: - go build -o $(STEAMPIPE_INSTALL_DIR)/plugins/hub.steampipe.io/plugins/turbot/pdns@latest/steampipe-plugin-pdns.plugin -tags "dev ${BUILD_TAGS}" *.go +build-linux: + GOOS=linux GOARCH=amd64 go build -o build/steampipe-plugin-pdns-linux-amd64.plugin -tags "${BUILD_TAGS}" *.go + +build-darwin: + GOOS=darwin GOARCH=amd64 go build -o build/steampipe-plugin-pdns-darwin-amd64.plugin -tags "${BUILD_TAGS}" *.go + +build-darwin-arm64: + GOOS=darwin GOARCH=arm64 go build -o build/steampipe-plugin-pdns-darwin-arm64.plugin -tags "${BUILD_TAGS}" *.go + +build-windows: + GOOS=windows GOARCH=amd64 go build -o build/steampipe-plugin-pdns-windows-amd64.plugin -tags "${BUILD_TAGS}" *.go \ No newline at end of file diff --git a/config/pdns.spc b/config/pdns.spc index de1d312..5db4f6b 100644 --- a/config/pdns.spc +++ b/config/pdns.spc @@ -11,7 +11,7 @@ connection "pdns" { # PowerDNS API key (Required) # Can also be set with PDNS_APIKEY environment variable - # api_key = "your-api-key-here" + # api_key = "ODl4Tkx2c3erZnY4W***" # For more information about PowerDNS API configuration: # https://doc.powerdns.com/authoritative/http-api/index.html diff --git a/docs/index.md b/docs/index.md index 0f78f45..5db925d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,6 @@ --- organization: Turbot -category: ["networking"] +category: ["internet"] icon_url: "/images/plugins/codenio/pdns.svg" brand_color: "#F48220" display_name: "PowerDNS" diff --git a/go.mod b/go.mod index d02d980..de8cf45 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/codenio/steampipe-plugin-pdns -go 1.23.3 +go 1.24 require ( github.com/joeig/go-powerdns/v3 v3.16.0 From a12f88da6564d7ca82bacaea0325e5a043a41bb1 Mon Sep 17 00:00:00 2001 From: codenio Date: Sun, 12 Oct 2025 08:31:07 +0530 Subject: [PATCH 2/3] fix linting erros --- pdns/connect.go | 2 +- pdns/table_pdns_records.go | 78 -------------------------------------- 2 files changed, 1 insertion(+), 79 deletions(-) delete mode 100644 pdns/table_pdns_records.go diff --git a/pdns/connect.go b/pdns/connect.go index d8bdaa1..bd4c298 100644 --- a/pdns/connect.go +++ b/pdns/connect.go @@ -44,7 +44,7 @@ func connectUncached(ctx context.Context, d *plugin.QueryData, _ *plugin.Hydrate // Error if the minimum config is not set if server_url == "" || vhost == "" || api_key == "" { - return nil, errors.New("'server_url', 'username' and 'api_key' must be set in the connection configuration. Edit your connection configuration file and then restart Steampipe.") + return nil, errors.New("'server_url', 'username' and 'api_key' must be set in the connection configuration. Edit your connection configuration file and then restart Steampipe") } return powerdns.New(server_url, vhost, powerdns.WithAPIKey(api_key)), nil diff --git a/pdns/table_pdns_records.go b/pdns/table_pdns_records.go deleted file mode 100644 index 84bc4b0..0000000 --- a/pdns/table_pdns_records.go +++ /dev/null @@ -1,78 +0,0 @@ -package pdns - -import ( - "context" - - "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" - "github.com/turbot/steampipe-plugin-sdk/v5/plugin" - "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" -) - -//// TABLE DEFINITION -/* - "account": "", - "catalog": "", - "dnssec": false, - "edited_serial": 1, - "id": "example.com.", - "kind": "Native", - "last_check": 0, - "masters": [], - "name": "example.com.", - "notified_serial": 0, - "serial": 1, - "url": "/api/v1/servers/localhost/zones/example.com." -*/ - -func tablePdnsZoneRecord() *plugin.Table { - return &plugin.Table{ - Name: "pdns_zone_record", - Description: "An extension to pdns functionality provided separately from pdns Core.", - List: &plugin.ListConfig{ - Hydrate: listPdnsZone, - }, - - Columns: []*plugin.Column{ - {Name: "name", Type: proto.ColumnType_STRING, Hydrate: listPdnsZone, Transform: transform.FromField("Name"), Description: "The DNS zone name (FQDN with trailing dot)."}, - {Name: "id", Type: proto.ColumnType_STRING, Hydrate: listPdnsZone, Transform: transform.FromField("ID"), Description: "Internal unique identifier for the zone (typically same as name)."}, - {Name: "kind", Type: proto.ColumnType_STRING, Hydrate: listPdnsZone, Transform: transform.FromField("Kind"), Description: "The type of zone: Native, Master, or Slave."}, - {Name: "account", Type: proto.ColumnType_STRING, Hydrate: listPdnsZone, Transform: transform.FromField("Account"), Description: "Optional account name for multi-tenant setups."}, - {Name: "catalog", Type: proto.ColumnType_STRING, Hydrate: listPdnsZone, Transform: transform.FromField("Catalog"), Description: "Catalog zone name if the zone is part of a DNS catalog."}, - {Name: "dnssec", Type: proto.ColumnType_BOOL, Hydrate: listPdnsZone, Transform: transform.FromField("DNSsec"), Description: "Whether DNSSEC is enabled for the zone."}, - {Name: "serial", Type: proto.ColumnType_INT, Hydrate: listPdnsZone, Transform: transform.FromField("Serial"), Description: "The current serial number of the SOA record."}, - {Name: "edited_serial", Type: proto.ColumnType_INT, Hydrate: listPdnsZone, Transform: transform.FromField("EditedSerial"), Description: "Serial number set manually or most recently edited."}, - {Name: "notified_serial", Type: proto.ColumnType_INT, Hydrate: listPdnsZone, Transform: transform.FromField("NotifiedSerial"), Description: "Last serial number notified to slaves."}, - {Name: "masters", Type: proto.ColumnType_JSON, Hydrate: listPdnsZone, Transform: transform.FromField("Masters"), Description: "List of master server IPs for slave zones."}, - {Name: "url", Type: proto.ColumnType_STRING, Hydrate: listPdnsZone, Transform: transform.FromField("URL"), Description: "API URL to access this zone."}, - }, - } -} - -//// LIST FUNCTION - -func listPdnsZoneRecord(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) { - client, err := Connect(ctx, d) - if err != nil { - return nil, err - } - zones, err := client.Zones.List(ctx) - if err != nil { - return nil, err - } - for _, zone := range zones { - d.StreamListItem(ctx, map[string]interface{}{ - "Name": zone.Name, - "ID": zone.ID, - "Kind": zone.Kind, - "Account": zone.Account, - "Catalog": zone.Catalog, - "DNSsec": zone.DNSsec, - "Serial": zone.Serial, - "EditedSerial": zone.EditedSerial, - "NotifiedSerial": zone.NotifiedSerial, - "Masters": zone.Masters, - "URL": zone.URL, - }) - } - return nil, nil -} From cd739e8850e127cc5a4909a45dd53cdbc39e277f Mon Sep 17 00:00:00 2001 From: codenio Date: Sun, 12 Oct 2025 08:41:13 +0530 Subject: [PATCH 3/3] add release workflow --- .github/workflows/release.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..47c2388 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,15 @@ +name: Build and Deploy OCI Image + +on: + push: + tags: + - 'v*' + +jobs: + build: + name: Build and publish + runs-on: ubuntu-latest + steps: + - uses: francois2metz/steampipe-plugin-build-push-action@v0 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file