Skip to content

Commit

Permalink
feat(pagerduty)!: Migrate to Arrow native SDK (#11004)
Browse files Browse the repository at this point in the history
Closes #10761

BEGIN_COMMIT_OVERRIDE
feat: Update to use [Apache Arrow](https://arrow.apache.org/) type system (#11004)

BREAKING-CHANGE: This release introduces an internal change to our type system to use [Apache Arrow](https://arrow.apache.org/). This should not have any visible breaking changes, however due to the size of the change we are introducing it under a major version bump to communicate that it might have some bugs that we weren't able to catch during our internal tests. If you encounter an issue during the upgrade, please submit a [bug report](https://github.com/cloudquery/cloudquery/issues/new/choose). You will also need to update destinations depending on which one you use:
- Azure Blob Storage >= v3.2.0
- BigQuery >= v3.0.0
- ClickHouse >= v3.1.1
- DuckDB >= v1.1.6
- Elasticsearch >= v2.0.0
- File >= v3.2.0
- Firehose >= v2.0.2
- GCS >= v3.2.0
- Gremlin >= v2.1.10
- Kafka >= v3.0.1
- Meilisearch >= v2.0.1
- Microsoft SQL Server >= v4.2.0
- MongoDB >= v2.0.1
- MySQL >= v2.0.2
- Neo4j >= v3.0.0
- PostgreSQL >= v4.2.0
- S3 >= v4.4.0
- Snowflake >= v2.1.1
- SQLite >= v2.2.0

END_COMMIT_OVERRIDE
  • Loading branch information
disq committed May 26, 2023
1 parent b920b47 commit 3004189
Show file tree
Hide file tree
Showing 91 changed files with 627 additions and 641 deletions.
4 changes: 2 additions & 2 deletions plugins/source/pagerduty/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (

"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/plugin-pb-go/specs"
"github.com/cloudquery/plugin-sdk/v2/plugins/source"
"github.com/cloudquery/plugin-sdk/v2/schema"
"github.com/cloudquery/plugin-sdk/v3/plugins/source"
"github.com/cloudquery/plugin-sdk/v3/schema"
"github.com/rs/zerolog"
"gopkg.in/yaml.v3"
)
Expand Down
4 changes: 2 additions & 2 deletions plugins/source/pagerduty/client/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (

"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/plugin-pb-go/specs"
"github.com/cloudquery/plugin-sdk/v2/plugins/source"
"github.com/cloudquery/plugin-sdk/v2/schema"
"github.com/cloudquery/plugin-sdk/v3/plugins/source"
"github.com/cloudquery/plugin-sdk/v3/schema"
"github.com/rs/zerolog"
"golang.org/x/exp/slices"
)
Expand Down
9 changes: 5 additions & 4 deletions plugins/source/pagerduty/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ go 1.19

require (
github.com/PagerDuty/go-pagerduty v1.6.0
github.com/apache/arrow/go/v13 v13.0.0-20230509040948-de6c3cd2b604
github.com/cloudquery/plugin-pb-go v1.0.8
github.com/cloudquery/plugin-sdk/v2 v2.7.0
github.com/cloudquery/plugin-sdk/v3 v3.6.4
github.com/rs/zerolog v1.29.0
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
golang.org/x/time v0.3.0
gopkg.in/yaml.v3 v3.0.1
)

// TODO: remove once all updates are merged
replace github.com/apache/arrow/go/v13 => github.com/cloudquery/arrow/go/v13 v13.0.0-20230509053643-898a79b1d3c8
replace github.com/apache/arrow/go/v13 => github.com/cloudquery/arrow/go/v13 v13.0.0-20230525142029-2d32efeedad8

require (
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/apache/arrow/go/v13 v13.0.0-20230509040948-de6c3cd2b604 // indirect
github.com/apache/thrift v0.16.0 // indirect
github.com/cloudquery/plugin-sdk/v2 v2.7.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/getsentry/sentry-go v0.20.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
Expand All @@ -38,6 +38,7 @@ require (
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 // indirect
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 // indirect
github.com/pierrec/lz4/v4 v4.1.15 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.6.1 // indirect
Expand Down
7 changes: 5 additions & 2 deletions plugins/source/pagerduty/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudquery/arrow/go/v13 v13.0.0-20230509053643-898a79b1d3c8 h1:CmgLSEGQNLHpUQ5cU4L4aF7cuJZRnc1toIIWqC1gmPg=
github.com/cloudquery/arrow/go/v13 v13.0.0-20230509053643-898a79b1d3c8/go.mod h1:/XatdE3kDIBqZKhZ7OBUHwP2jaASDFZHqF4puOWM8po=
github.com/cloudquery/arrow/go/v13 v13.0.0-20230525142029-2d32efeedad8 h1:/mgK+To5HNUzuZDWdVygbfn8oaPG5c7I/8qCxwwpWO8=
github.com/cloudquery/arrow/go/v13 v13.0.0-20230525142029-2d32efeedad8/go.mod h1:/XatdE3kDIBqZKhZ7OBUHwP2jaASDFZHqF4puOWM8po=
github.com/cloudquery/plugin-pb-go v1.0.8 h1:wn3GXhcNItcP+6wUUZuzUFbvdL59liKBO37/izMi+FQ=
github.com/cloudquery/plugin-pb-go v1.0.8/go.mod h1:vAGA27psem7ZZNAY4a3S9TKuA/JDQWstjKcHPJX91Mc=
github.com/cloudquery/plugin-sdk/v2 v2.7.0 h1:hRXsdEiaOxJtsn/wZMFQC9/jPfU1MeMK3KF+gPGqm7U=
github.com/cloudquery/plugin-sdk/v2 v2.7.0/go.mod h1:pAX6ojIW99b/Vg4CkhnsGkRIzNaVEceYMR+Bdit73ug=
github.com/cloudquery/plugin-sdk/v3 v3.6.4 h1:P4OkS5tJYkv3OqeL60DAVqXXbFQUyPKJ5YDtAgjl9b4=
github.com/cloudquery/plugin-sdk/v3 v3.6.4/go.mod h1:3JrZXEULmGXpkOukVaRIzaA63d7TJr9Ukp6hemTjbtc=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
Expand Down Expand Up @@ -189,6 +191,7 @@ github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceT
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/pierrec/lz4/v4 v4.1.15 h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0=
github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down
2 changes: 1 addition & 1 deletion plugins/source/pagerduty/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"github.com/cloudquery/cloudquery/plugins/source/pagerduty/resources/plugin"

"github.com/cloudquery/plugin-sdk/v2/serve"
"github.com/cloudquery/plugin-sdk/v3/serve"
)

const sentryDsn = "https://88b3936014084326bed8d93aaf24e559@o1396617.ingest.sentry.io/4504321041432576"
Expand Down
2 changes: 1 addition & 1 deletion plugins/source/pagerduty/resources/plugin/all_tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/cloudquery/cloudquery/plugins/source/pagerduty/resources/services/teams"
"github.com/cloudquery/cloudquery/plugins/source/pagerduty/resources/services/users"
"github.com/cloudquery/cloudquery/plugins/source/pagerduty/resources/services/vendors"
"github.com/cloudquery/plugin-sdk/v2/schema"
"github.com/cloudquery/plugin-sdk/v3/schema"
)

func AllTables() []*schema.Table {
Expand Down
6 changes: 3 additions & 3 deletions plugins/source/pagerduty/resources/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package plugin

import (
"github.com/cloudquery/cloudquery/plugins/source/pagerduty/client"
"github.com/cloudquery/plugin-sdk/v2/caser"
"github.com/cloudquery/plugin-sdk/v2/plugins/source"
"github.com/cloudquery/plugin-sdk/v2/schema"
"github.com/cloudquery/plugin-sdk/v3/caser"
"github.com/cloudquery/plugin-sdk/v3/plugins/source"
"github.com/cloudquery/plugin-sdk/v3/schema"
)

var (
Expand Down
15 changes: 7 additions & 8 deletions plugins/source/pagerduty/resources/services/addons/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package addons

import (
"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/plugin-sdk/v2/schema"
"github.com/cloudquery/plugin-sdk/v2/transformers"
"github.com/apache/arrow/go/v13/arrow"
"github.com/cloudquery/plugin-sdk/v3/schema"
"github.com/cloudquery/plugin-sdk/v3/transformers"
)

func Addons() *schema.Table {
Expand All @@ -14,12 +15,10 @@ func Addons() *schema.Table {
Transform: transformers.TransformWithStruct(&pagerduty.Addon{}, transformers.WithUnwrapAllEmbeddedStructs()),
Columns: []schema.Column{
{
Name: "id",
Type: schema.TypeString,
Resolver: schema.PathResolver("ID"),
CreationOptions: schema.ColumnCreationOptions{
PrimaryKey: true,
},
Name: "id",
Type: arrow.BinaryTypes.String,
Resolver: schema.PathResolver("ID"),
PrimaryKey: true,
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/cloudquery/plugins/source/pagerduty/client"
"github.com/cloudquery/plugin-sdk/v2/schema"
"github.com/cloudquery/plugin-sdk/v3/schema"
)

func fetchAddons(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- any) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/cloudquery/plugins/source/pagerduty/client"
"github.com/cloudquery/plugin-sdk/v2/faker"
"github.com/cloudquery/plugin-sdk/v3/faker"
)

func buildMockHttpClient() *client.MockHttpClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package business_services

import (
"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/plugin-sdk/v2/schema"
"github.com/cloudquery/plugin-sdk/v2/transformers"
"github.com/apache/arrow/go/v13/arrow"
"github.com/cloudquery/plugin-sdk/v3/schema"
"github.com/cloudquery/plugin-sdk/v3/transformers"
"github.com/cloudquery/plugin-sdk/v3/types"
)

func BusinessServices() *schema.Table {
Expand All @@ -15,20 +17,18 @@ func BusinessServices() *schema.Table {
Columns: []schema.Column{
{
Name: "dependencies",
Type: schema.TypeJSON,
Type: types.ExtensionTypes.JSON,
Resolver: DependenciesResolver,
},
{
Name: "id",
Type: schema.TypeString,
Resolver: schema.PathResolver("ID"),
CreationOptions: schema.ColumnCreationOptions{
PrimaryKey: true,
},
Name: "id",
Type: arrow.BinaryTypes.String,
Resolver: schema.PathResolver("ID"),
PrimaryKey: true,
},
{
Name: "html_url",
Type: schema.TypeString,
Type: arrow.BinaryTypes.String,
Resolver: schema.PathResolver("HTMLUrl"),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/cloudquery/plugins/source/pagerduty/client"
"github.com/cloudquery/plugin-sdk/v2/schema"
"github.com/cloudquery/plugin-sdk/v3/schema"
)

func fetchBusinessServices(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- any) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/cloudquery/plugins/source/pagerduty/client"
"github.com/cloudquery/plugin-sdk/v2/faker"
"github.com/cloudquery/plugin-sdk/v3/faker"
)

func buildMockHttpClient() *client.MockHttpClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/cloudquery/plugins/source/pagerduty/client"
"github.com/cloudquery/plugin-sdk/v2/schema"
"github.com/cloudquery/plugin-sdk/v3/schema"
)

func DependenciesResolver(ctx context.Context, meta schema.ClientMeta, resource *schema.Resource, c schema.Column) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package escalation_policies

import (
"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/plugin-sdk/v2/schema"
"github.com/cloudquery/plugin-sdk/v2/transformers"
"github.com/apache/arrow/go/v13/arrow"
"github.com/cloudquery/plugin-sdk/v3/schema"
"github.com/cloudquery/plugin-sdk/v3/transformers"
)

func EscalationPolicies() *schema.Table {
Expand All @@ -14,16 +15,14 @@ func EscalationPolicies() *schema.Table {
Transform: transformers.TransformWithStruct(&pagerduty.EscalationPolicy{}, transformers.WithUnwrapAllEmbeddedStructs(), transformers.WithSkipFields("HTMLURL")),
Columns: []schema.Column{
{
Name: "id",
Type: schema.TypeString,
Resolver: schema.PathResolver("ID"),
CreationOptions: schema.ColumnCreationOptions{
PrimaryKey: true,
},
Name: "id",
Type: arrow.BinaryTypes.String,
Resolver: schema.PathResolver("ID"),
PrimaryKey: true,
},
{
Name: "html_url",
Type: schema.TypeString,
Type: arrow.BinaryTypes.String,
Resolver: schema.PathResolver("HTMLURL"),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/cloudquery/plugins/source/pagerduty/client"
"github.com/cloudquery/plugin-sdk/v2/schema"
"github.com/cloudquery/plugin-sdk/v3/schema"
)

func fetchEscalationPolicies(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- any) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/cloudquery/plugins/source/pagerduty/client"
"github.com/cloudquery/plugin-sdk/v2/faker"
"github.com/cloudquery/plugin-sdk/v3/faker"
)

func buildMockHttpClient() *client.MockHttpClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package extension_schemas

import (
"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/plugin-sdk/v2/schema"
"github.com/cloudquery/plugin-sdk/v2/transformers"
"github.com/apache/arrow/go/v13/arrow"
"github.com/cloudquery/plugin-sdk/v3/schema"
"github.com/cloudquery/plugin-sdk/v3/transformers"
)

func ExtensionSchemas() *schema.Table {
Expand All @@ -14,36 +15,34 @@ func ExtensionSchemas() *schema.Table {
Transform: transformers.TransformWithStruct(&pagerduty.ExtensionSchema{}, transformers.WithUnwrapAllEmbeddedStructs(), transformers.WithSkipFields("HTMLURL", "URL", "IconURL", "LogoURL")),
Columns: []schema.Column{
{
Name: "id",
Type: schema.TypeString,
Resolver: schema.PathResolver("ID"),
CreationOptions: schema.ColumnCreationOptions{
PrimaryKey: true,
},
Name: "id",
Type: arrow.BinaryTypes.String,
Resolver: schema.PathResolver("ID"),
PrimaryKey: true,
},
{
Name: "html_url",
Type: schema.TypeString,
Type: arrow.BinaryTypes.String,
Resolver: schema.PathResolver("HTMLURL"),
},
{
Name: "icon_url",
Type: schema.TypeString,
Type: arrow.BinaryTypes.String,
Resolver: schema.PathResolver("IconURL"),
},
{
Name: "logo_url",
Type: schema.TypeString,
Type: arrow.BinaryTypes.String,
Resolver: schema.PathResolver("LogoURL"),
},
{
Name: "guide_url",
Type: schema.TypeString,
Type: arrow.BinaryTypes.String,
Resolver: schema.PathResolver("GuideURL"),
},
{
Name: "url",
Type: schema.TypeString,
Type: arrow.BinaryTypes.String,
Resolver: schema.PathResolver("URL"),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/cloudquery/plugins/source/pagerduty/client"
"github.com/cloudquery/plugin-sdk/v2/schema"
"github.com/cloudquery/plugin-sdk/v3/schema"
)

func fetchExtensionSchemas(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- any) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/cloudquery/plugins/source/pagerduty/client"
"github.com/cloudquery/plugin-sdk/v2/faker"
"github.com/cloudquery/plugin-sdk/v3/faker"
)

func buildMockHttpClient() *client.MockHttpClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package extensions

import (
"github.com/PagerDuty/go-pagerduty"
"github.com/cloudquery/plugin-sdk/v2/schema"
"github.com/cloudquery/plugin-sdk/v2/transformers"
"github.com/apache/arrow/go/v13/arrow"
"github.com/cloudquery/plugin-sdk/v3/schema"
"github.com/cloudquery/plugin-sdk/v3/transformers"
)

func Extensions() *schema.Table {
Expand All @@ -14,21 +15,19 @@ func Extensions() *schema.Table {
Transform: transformers.TransformWithStruct(&pagerduty.Extension{}, transformers.WithUnwrapAllEmbeddedStructs(), transformers.WithSkipFields("HTMLURL", "EndpointURL")),
Columns: []schema.Column{
{
Name: "id",
Type: schema.TypeString,
Resolver: schema.PathResolver("ID"),
CreationOptions: schema.ColumnCreationOptions{
PrimaryKey: true,
},
Name: "id",
Type: arrow.BinaryTypes.String,
Resolver: schema.PathResolver("ID"),
PrimaryKey: true,
},
{
Name: "html_url",
Type: schema.TypeString,
Type: arrow.BinaryTypes.String,
Resolver: schema.PathResolver("HTMLURL"),
},
{
Name: "endpoint_url",
Type: schema.TypeString,
Type: arrow.BinaryTypes.String,
Resolver: schema.PathResolver("EndpointURL"),
},
},
Expand Down

0 comments on commit 3004189

Please sign in to comment.