Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
chore!: Update SDK to v0.14.1 (#422)
Browse files Browse the repository at this point in the history
Co-authored-by: Kemal Hadimli <[email protected]>
  • Loading branch information
disq and disq authored Jul 20, 2022
1 parent 347bb8e commit 92afc51
Show file tree
Hide file tree
Showing 6 changed files with 1,540 additions and 51 deletions.
26 changes: 2 additions & 24 deletions client/config.go
Original file line number Diff line number Diff line change
@@ -1,37 +1,15 @@
package client

import "github.com/cloudquery/cq-provider-sdk/cqproto"

// Provider Configuration

type Config struct {
Subscriptions []string `hcl:"subscriptions,optional"`

requestedFormat cqproto.ConfigFormat
}

func NewConfig(f cqproto.ConfigFormat) *Config {
return &Config{
requestedFormat: f,
}
}

func (c Config) Example() string {
switch c.requestedFormat {
case cqproto.ConfigHCL:
return `configuration {
// Optional. if you not specified, cloudquery tries to access all subscriptions available to tenant
// subscriptions = ["<YOUR_SUBSCRIPTION_ID_HERE>"]
}`
default:
return `
func (Config) Example() string {
return `
Optional. if you not specified, cloudquery tries to access all subscriptions available to tenant
subscriptions:
- "<YOUR_SUBSCRIPTION_ID_HERE>"
`
}
}

func (c Config) Format() cqproto.ConfigFormat {
return c.requestedFormat
}
13 changes: 6 additions & 7 deletions client/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"

"github.com/cloudquery/cq-provider-azure/client/services"
"github.com/cloudquery/cq-provider-sdk/cqproto"
"github.com/cloudquery/cq-provider-sdk/logging"
"github.com/cloudquery/cq-provider-sdk/provider"
"github.com/cloudquery/cq-provider-sdk/provider/diag"
Expand All @@ -29,8 +28,8 @@ func AzureMockTestHelper(t *testing.T, table *schema.Table, builder func(*testin
ctrl := gomock.NewController(t)

cfg := `
subscriptions = ["test_sub"]
`
subscriptions: ["test_sub"]
`
providertest.TestResource(t, providertest.ResourceTestCase{
Provider: &provider.Provider{
Name: "azure_mock_test_provider",
Expand All @@ -45,8 +44,8 @@ func AzureMockTestHelper(t *testing.T, table *schema.Table, builder func(*testin
ResourceMap: map[string]*schema.Table{
"test_resource": table,
},
Config: func(f cqproto.ConfigFormat) provider.Config {
return NewConfig(f)
Config: func() provider.Config {
return &Config{}
},
},
Config: cfg,
Expand All @@ -62,8 +61,8 @@ func AzureTestHelper(t *testing.T, table *schema.Table) {
Name: "azure_mock_test_provider",
Version: "development",
Configure: Configure,
Config: func(f cqproto.ConfigFormat) provider.Config {
return NewConfig(f)
Config: func() provider.Config {
return &Config{}
},
ResourceMap: map[string]*schema.Table{
"test_resource": table,
Expand Down
4 changes: 2 additions & 2 deletions docs/docs.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"fmt"
"log"

"github.com/cloudquery/cq-provider-azure/resources/provider"
"github.com/cloudquery/cq-provider-sdk/provider/docs"
Expand All @@ -10,6 +10,6 @@ import (
func main() {
err := docs.GenerateDocs(provider.Provider(), "./docs", true)
if err != nil {
fmt.Sprintf("Failed to geneerate docs: %s", err)
log.Fatalf("Failed to generate docs: %s", err)
}
}
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require (
github.com/Azure/azure-sdk-for-go v61.6.0+incompatible
github.com/Azure/go-autorest/autorest v0.11.27
github.com/Azure/go-autorest/autorest/azure/auth v0.5.11
github.com/cloudquery/cq-provider-sdk v0.13.5
github.com/cloudquery/faker/v3 v3.7.6
github.com/cloudquery/cq-provider-sdk v0.14.1
github.com/cloudquery/faker/v3 v3.7.7
github.com/gofrs/uuid v4.2.0+incompatible
github.com/golang/mock v1.6.0
github.com/hashicorp/go-hclog v1.2.1
Expand Down Expand Up @@ -38,7 +38,6 @@ require (
github.com/georgysavva/scany v1.0.0 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-plugin v1.4.4 // indirect
Expand All @@ -55,7 +54,6 @@ require (
github.com/jackc/pgtype v1.11.0 // indirect
github.com/jackc/pgx/v4 v4.16.1 // indirect
github.com/jackc/puddle v1.2.1 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/lorenzosaino/go-sysctl v0.3.1 // indirect
Expand Down Expand Up @@ -86,7 +84,7 @@ require (
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.11 // indirect
google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106 // indirect
google.golang.org/grpc v1.47.0 // indirect
google.golang.org/grpc v1.48.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 92afc51

Please sign in to comment.