Skip to content

Commit

Permalink
Recompile plugin with steampipe-plugin-sdk v5.10.1 and add support fo…
Browse files Browse the repository at this point in the history
…r connection key columns (#21)



Co-authored-by: ParthaI <[email protected]>
Co-authored-by: ParthaI <[email protected]>
  • Loading branch information
3 people authored Jul 9, 2024
1 parent 601a832 commit fb61512
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 143 deletions.
31 changes: 31 additions & 0 deletions dockerhub/common_columns.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package dockerhub

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"
)

func commonColumns(c []*plugin.Column) []*plugin.Column {
return append([]*plugin.Column{
{
Name: "account_id",
Description: "Docker Hub account ID.",
Type: proto.ColumnType_STRING,
Hydrate: getDockerHubAccountId,
Transform: transform.FromValue(),
},
}, c...)
}

func getDockerHubAccountId(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) {
acc, err := getUserInfo(ctx, d)
if err != nil {
plugin.Logger(ctx).Error("getDockerHubAccountId", err)
return nil, err
}

return acc.ID, nil
}
6 changes: 6 additions & 0 deletions dockerhub/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ func Plugin(ctx context.Context) *plugin.Plugin {
ConnectionConfigSchema: &plugin.ConnectionConfigSchema{
NewInstance: ConfigInstance,
},
ConnectionKeyColumns: []plugin.ConnectionKeyColumn{
{
Name: "account_id",
Hydrate: getDockerHubAccountId,
},
},
TableMap: map[string]*plugin.Table{
"dockerhub_repository": tableDockerHubRepository(ctx),
"dockerhub_tag": tableDockerHubTag(ctx),
Expand Down
4 changes: 2 additions & 2 deletions dockerhub/table_dockerhub_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func tableDockerHubRepository(_ context.Context) *plugin.Table {
List: &plugin.ListConfig{
Hydrate: listRepositories,
},
Columns: []*plugin.Column{
Columns: commonColumns([]*plugin.Column{
{
Name: "name",
Type: proto.ColumnType_STRING,
Expand Down Expand Up @@ -56,7 +56,7 @@ func tableDockerHubRepository(_ context.Context) *plugin.Table {
Type: proto.ColumnType_STRING,
Transform: transform.FromField("Name"),
},
},
}),
}
}

Expand Down
4 changes: 2 additions & 2 deletions dockerhub/table_dockerhub_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func tableDockerHubTag(_ context.Context) *plugin.Table {
ParentHydrate: listRepositories,
Hydrate: listTags,
},
Columns: []*plugin.Column{
Columns: commonColumns([]*plugin.Column{
{
Name: "name",
Type: proto.ColumnType_STRING,
Expand Down Expand Up @@ -68,7 +68,7 @@ func tableDockerHubTag(_ context.Context) *plugin.Table {
Type: proto.ColumnType_STRING,
Transform: transform.FromField("Name"),
},
},
}),
}
}

Expand Down
4 changes: 2 additions & 2 deletions dockerhub/table_dockerhub_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func tableDockerHubToken(_ context.Context) *plugin.Table {
KeyColumns: plugin.SingleColumn("uuid"),
Hydrate: getToken,
},
Columns: []*plugin.Column{
Columns: commonColumns([]*plugin.Column{
{
Name: "uuid",
Type: proto.ColumnType_STRING,
Expand Down Expand Up @@ -85,7 +85,7 @@ func tableDockerHubToken(_ context.Context) *plugin.Table {
Type: proto.ColumnType_STRING,
Transform: transform.FromValue().Transform(fetchUUID),
},
},
}),
}
}

Expand Down
4 changes: 2 additions & 2 deletions dockerhub/table_dockerhub_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func tableDockerHubUser(_ context.Context) *plugin.Table {
List: &plugin.ListConfig{
Hydrate: listUserInfo,
},
Columns: []*plugin.Column{
Columns: commonColumns([]*plugin.Column{
{
Name: "id",
Type: proto.ColumnType_STRING,
Expand Down Expand Up @@ -75,7 +75,7 @@ func tableDockerHubUser(_ context.Context) *plugin.Table {
Type: proto.ColumnType_STRING,
Transform: transform.FromField("Name"),
},
},
}),
}
}

Expand Down
94 changes: 50 additions & 44 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
module github.com/turbot/steampipe-plugin-dockerhub

go 1.21
go 1.21.0

toolchain go1.21.1

require (
github.com/docker/hub-tool v0.4.5
github.com/turbot/steampipe-plugin-sdk/v5 v5.8.0
github.com/turbot/steampipe-plugin-sdk/v5 v5.10.1
)

require (
cloud.google.com/go v0.110.7 // indirect
cloud.google.com/go/compute v1.23.0 // indirect
cloud.google.com/go v0.112.0 // indirect
cloud.google.com/go/compute v1.24.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.1 // indirect
cloud.google.com/go/storage v1.30.1 // indirect
cloud.google.com/go/iam v1.1.6 // indirect
cloud.google.com/go/storage v1.36.0 // indirect
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
github.com/agext/levenshtein v1.2.2 // indirect
github.com/allegro/bigcache/v3 v3.1.0 // indirect
Expand All @@ -21,7 +23,7 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/btubbs/datetime v0.1.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
Expand All @@ -34,29 +36,30 @@ require (
github.com/eko/gocache/store/bigcache/v4 v4.2.1 // indirect
github.com/eko/gocache/store/ristretto/v4 v4.2.1 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gertd/go-pluralize v0.2.1 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.1.2 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter v1.7.3 // indirect
github.com/hashicorp/go-hclog v1.6.1 // indirect
github.com/hashicorp/go-getter v1.7.4 // indirect
github.com/hashicorp/go-hclog v1.6.2 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hcl/v2 v2.19.1 // indirect
github.com/hashicorp/hcl/v2 v2.20.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
Expand All @@ -83,34 +86,37 @@ require (
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/stevenle/topsort v0.2.0 // indirect
github.com/tkrajina/go-reflector v0.5.6 // indirect
github.com/turbot/go-kit v0.9.0-rc.1 // indirect
github.com/turbot/go-kit v0.10.0-rc.0 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
github.com/zclconf/go-cty v1.14.1 // indirect
github.com/zclconf/go-cty v1.14.4 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.44.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
go.opentelemetry.io/otel v1.26.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.26.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.26.0 // indirect
go.opentelemetry.io/otel/sdk v1.26.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.26.0 // indirect
go.opentelemetry.io/otel/trace v1.26.0 // indirect
go.opentelemetry.io/proto/otlp v1.2.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.11.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.126.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/api v0.162.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Loading

0 comments on commit fb61512

Please sign in to comment.