Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cli/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bufio"
"fmt"
"os"

"strings"

"github.com/cloudquery/cloudquery/cli/internal/enum"
Expand Down
2 changes: 1 addition & 1 deletion cli/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/cloudquery/cloudquery/cli
go 1.18

require (
github.com/cloudquery/plugin-sdk v0.1.2
github.com/cloudquery/plugin-sdk v0.2.4
github.com/getsentry/sentry-go v0.13.0
github.com/google/go-cmp v0.5.8
github.com/jackc/pgtype v1.12.0
Expand Down
4 changes: 2 additions & 2 deletions cli/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudquery/faker/v3 v3.7.7 h1:vODOmAXGhxAacVrUOjr4Jti2lFhXgkPjG6/L3C2REgQ=
github.com/cloudquery/faker/v3 v3.7.7/go.mod h1:1b8WVG9Gh0T2hVo1a8dWeXfu0AhqSB6J/mmJaesqOeo=
github.com/cloudquery/plugin-sdk v0.1.2 h1:AEnCpGXdufcGadjZTrUWZTs/Xo4EUHtBCK9niBIppZU=
github.com/cloudquery/plugin-sdk v0.1.2/go.mod h1:koovnuG54fgQopmLhC+1KKewLiiZw8ZPinvq2/BDjFo=
github.com/cloudquery/plugin-sdk v0.2.4 h1:Me2f5utaAUk8RlrAXrzfNlJn2+Nt4GvjO7NrxFDKO0U=
github.com/cloudquery/plugin-sdk v0.2.4/go.mod h1:koovnuG54fgQopmLhC+1KKewLiiZw8ZPinvq2/BDjFo=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
Expand Down
9 changes: 5 additions & 4 deletions cli/internal/destinations/postgresql/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ func (p *Client) autoMigrateTable(ctx context.Context, table *schema.Table) erro
}
pgColumn := pgColumns.getPgColumn(c.Name)

if pgColumn == nil {
switch {
case pgColumn == nil:
p.logger.Info().Str("table", table.Name).Str("column", c.Name).Msg("Column doesn't exist, creating")

sql := "alter table " + tableName + " add column " + columnName + " " + columnType
Expand All @@ -244,7 +245,7 @@ func (p *Client) autoMigrateTable(ctx context.Context, table *schema.Table) erro
if _, err := p.conn.Exec(ctx, sql); err != nil {
return fmt.Errorf("failed to add column %s on table %s: %w", c.Name, table.Name, err)
}
} else if pgColumn.typ != columnType {
case pgColumn.typ != columnType:
p.logger.Info().Str("table", table.Name).Str("column", c.Name).Str("old_type", pgColumn.typ).Str("new_type", columnType).Msg("Column exist but type is different, re-creating")
// column exists but type is different

Expand All @@ -261,7 +262,7 @@ func (p *Client) autoMigrateTable(ctx context.Context, table *schema.Table) erro
if _, err := p.conn.Exec(ctx, sql); err != nil {
return fmt.Errorf("failed to add column %s on table %s: %w", c.Name, table.Name, err)
}
} else {
default:
// column exists and type is the same but constraint might differ
p.logger.Info().Str("table", table.Name).Str("column", c.Name).Str("type", c.Type.String()).Msg("Column exists with the same type")
if pgPKs.columnExist(columnName) != c.CreationOptions.PrimaryKey {
Expand Down Expand Up @@ -336,7 +337,7 @@ func upsert(table string, data map[string]interface{}) (string, []interface{}) {
sb.WriteString(") values (")
}
}
for i, _ := range values {
for i := range values {
sb.WriteString(fmt.Sprintf("$%d", i+1))
if i < len(values)-1 {
sb.WriteString(",")
Expand Down
3 changes: 1 addition & 2 deletions cli/internal/plugins/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package plugins
import (
"archive/zip"
"bufio"
"context"
"encoding/json"
"fmt"
"io"
Expand All @@ -16,8 +17,6 @@ import (
"runtime"
"strings"

"context"

"github.com/cloudquery/cloudquery/cli/internal/destinations/postgresql"
"github.com/cloudquery/cloudquery/cli/internal/versions"
"github.com/cloudquery/plugin-sdk/clients"
Expand Down
1 change: 0 additions & 1 deletion plugins/source/gcp/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type Client struct {
}

const (
defaultProjectIdName = "<CHANGE_THIS_TO_YOUR_PROJECT_ID>"
serviceAccountEnvKey = "CQ_SERVICE_ACCOUNT_KEY_JSON"
)

Expand Down
129 changes: 0 additions & 129 deletions plugins/source/gcp/client/client_test.go

This file was deleted.

6 changes: 1 addition & 5 deletions plugins/source/gcp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ require (
cloud.google.com/go/secretmanager v1.5.0
cloud.google.com/go/serviceusage v1.2.0
cloud.google.com/go/storage v1.26.0
github.com/cloudquery/plugin-sdk v0.1.2
github.com/cloudquery/plugin-sdk v0.2.4
github.com/golang/mock v1.6.0
github.com/googleapis/gax-go/v2 v2.5.1
github.com/iancoleman/strcase v0.2.0
github.com/julienschmidt/httprouter v1.3.0
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.28.0
github.com/spf13/cast v1.5.0
github.com/stretchr/testify v1.8.0
github.com/thoas/go-funk v0.9.2
google.golang.org/api v0.94.0
google.golang.org/genproto v0.0.0-20220819153447-c7cd466b0e09
Expand All @@ -36,7 +35,6 @@ require (
cloud.google.com/go v0.102.1 // indirect
cloud.google.com/go/iam v0.3.0 // indirect
github.com/cloudquery/faker/v3 v3.7.7 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/getsentry/sentry-go v0.13.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/gofrs/uuid v4.2.0+incompatible // indirect
Expand All @@ -51,7 +49,6 @@ require (
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/cobra v1.5.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
Expand All @@ -69,5 +66,4 @@ require (
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
9 changes: 2 additions & 7 deletions plugins/source/gcp/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudquery/faker/v3 v3.7.7 h1:vODOmAXGhxAacVrUOjr4Jti2lFhXgkPjG6/L3C2REgQ=
github.com/cloudquery/faker/v3 v3.7.7/go.mod h1:1b8WVG9Gh0T2hVo1a8dWeXfu0AhqSB6J/mmJaesqOeo=
github.com/cloudquery/plugin-sdk v0.1.2 h1:AEnCpGXdufcGadjZTrUWZTs/Xo4EUHtBCK9niBIppZU=
github.com/cloudquery/plugin-sdk v0.1.2/go.mod h1:koovnuG54fgQopmLhC+1KKewLiiZw8ZPinvq2/BDjFo=
github.com/cloudquery/plugin-sdk v0.2.4 h1:Me2f5utaAUk8RlrAXrzfNlJn2+Nt4GvjO7NrxFDKO0U=
github.com/cloudquery/plugin-sdk v0.2.4/go.mod h1:koovnuG54fgQopmLhC+1KKewLiiZw8ZPinvq2/BDjFo=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
Expand All @@ -116,7 +116,6 @@ github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
Expand Down Expand Up @@ -286,15 +285,12 @@ github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJ
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/thoas/go-funk v0.9.2 h1:oKlNYv0AY5nyf9g+/GhMgS/UO2ces0QRdPKwkhY3VCk=
github.com/thoas/go-funk v0.9.2/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
Expand Down Expand Up @@ -773,7 +769,6 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/cloudquery/plugin-sdk/schema"
"github.com/cloudquery/plugins/source/gcp/client"
"github.com/pkg/errors"

pb "google.golang.org/genproto/googleapis/container/v1"
)

Expand Down
4 changes: 2 additions & 2 deletions plugins/source/gcp/resources/services/kms/keyrings_fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

func fetchKeyrings(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error {
c := meta.(*client.Client)
locations, err := getAllKmsLocations(ctx, c)
locations, err := getAllKmsLocations(c)
if err != nil {
return errors.WithStack(fmt.Errorf("failed to get kms locations. %w", err))
}
Expand All @@ -37,7 +37,7 @@ func fetchKeyrings(ctx context.Context, meta schema.ClientMeta, parent *schema.R
return nil
}

func getAllKmsLocations(ctx context.Context, c *client.Client) ([]*cloudkms.Location, error) {
func getAllKmsLocations(c *client.Client) ([]*cloudkms.Location, error) {
var locations []*cloudkms.Location
call := c.Services.KmsoldService.Projects.Locations.List("projects/" + c.ProjectId)
nextPageToken := ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ import (
"github.com/cloudquery/plugins/source/gcp/client"
"github.com/julienschmidt/httprouter"
kmsold "google.golang.org/api/cloudkms/v1"
"google.golang.org/api/option"
pb "google.golang.org/genproto/googleapis/cloud/kms/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

pb "google.golang.org/genproto/googleapis/cloud/kms/v1"

"google.golang.org/api/option"
)

func createKeyrings() (*client.Services, error) {
Expand Down Expand Up @@ -91,7 +89,7 @@ type fakeKeyringsServer struct {
pb.UnimplementedKeyManagementServiceServer
}

func (f *fakeKeyringsServer) ListKeyRings(context.Context, *pb.ListKeyRingsRequest) (*pb.ListKeyRingsResponse, error) {
func (*fakeKeyringsServer) ListKeyRings(context.Context, *pb.ListKeyRingsRequest) (*pb.ListKeyRingsResponse, error) {
resp := pb.ListKeyRingsResponse{}
if err := faker.FakeObject(&resp); err != nil {
return nil, fmt.Errorf("failed to fake data: %w", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import (
"github.com/cloudquery/plugin-sdk/faker"
"github.com/cloudquery/plugins/source/gcp/client"
"github.com/julienschmidt/httprouter"

sql "google.golang.org/api/sqladmin/v1beta4"

"google.golang.org/api/option"
sql "google.golang.org/api/sqladmin/v1beta4"
)

func createInstances() (*client.Services, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import (
"net/http/httptest"
"testing"

"cloud.google.com/go/storage"
"github.com/cloudquery/plugin-sdk/faker"
"github.com/cloudquery/plugins/source/gcp/client"
"github.com/julienschmidt/httprouter"

"cloud.google.com/go/storage"

"google.golang.org/api/option"
oldapi "google.golang.org/api/storage/v1"
)
Expand Down
4 changes: 3 additions & 1 deletion plugins/source/heroku/codegen/account_feature.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading