Skip to content

Commit 7601455

Browse files
authored
Merge pull request #35 from opengovern/fix-folder-reorganization
fix: auto generate files
2 parents a2cf588 + 185457e commit 7601455

File tree

6 files changed

+528
-460
lines changed

6 files changed

+528
-460
lines changed

discovery/pkg/runable/resource_type/main.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ func main() {
5555
// Define the template with Labels and Annotations included
5656
tmpl, err := template.New("").Parse(fmt.Sprintf(`
5757
"{{ .ResourceName }}": {
58-
IntegrationType: configs.IntegrationName,
58+
IntegrationType: IntegrationName,
5959
ResourceName: "{{ .ResourceName }}",
6060
Tags: {{ .TagsString }},
6161
Labels: {{ .LabelsString }},
6262
Annotations: {{ .AnnotationsString }},
63-
ListDescriber: {{ .ListDescriber }},
64-
GetDescriber: {{ if .GetDescriber }}{{ .GetDescriber }}{{ else }}nil{{ end }},
63+
ListDescriber: provider.{{ .ListDescriber }},
64+
GetDescriber: {{ if .GetDescriber }}provider.{{ .GetDescriber }}{{ else }}nil{{ end }},
6565
},
6666
`))
6767
if err != nil {
@@ -70,7 +70,7 @@ func main() {
7070

7171
// Set default output paths if not provided
7272
if output == nil || len(*output) == 0 {
73-
v := "provider/provider_resource_types.go"
73+
v := "global/maps/provider_resource_types.go"
7474
output = &v
7575
}
7676

@@ -81,14 +81,19 @@ func main() {
8181

8282
// Initialize a strings.Builder to construct the output file content
8383
b := &strings.Builder{}
84-
b.WriteString(fmt.Sprintf(`package provider
84+
b.WriteString(fmt.Sprintf(`package maps
8585
import (
86-
"%[1]s/provider/describer"
87-
"%[1]s/provider/configs"
88-
model "github.com/opengovern/og-describer-%[2]s/pkg/models"
86+
"%[1]s/discovery/describers"
87+
"%[1]s/discovery/provider"
88+
model "github.com/opengovern/og-describer-%[2]s/discovery/pkg/models"
89+
"github.com/opengovern/og-util/pkg/integration"
90+
)
91+
92+
const (
93+
IntegrationName = integration.Type("%[3]s")
8994
)
9095
var ResourceTypes = map[string]model.ResourceType{
91-
`, global.OGPluginRepoURL, global.IntegrationTypeLower))
96+
`, global.OGPluginRepoURL, global.IntegrationTypeLower,global.IntegrationName))
9297

9398
// Iterate over each resource type to build its string representations
9499
for _, resourceType := range resourceTypes {

discovery/pkg/runable/steampipe_es_client_generator/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var (
2323
pluginPath = flag.String("pluginPath", "", "Location of the steampipe plugin")
2424
)
2525

26-
const PluginPath = "../../../../steampipe-plugin-github/github"
26+
var PluginPath = fmt.Sprintf("../../../../cloudql/"+global.IntegrationTypeLower)
2727

2828
type IntegrationType struct {
2929
Name string
@@ -47,7 +47,7 @@ func main() {
4747
output = &v
4848
}
4949
if file == nil || len(*file) == 0 {
50-
v := "../../../../provider/model/model.go"
50+
v := "../../../provider/model.go"
5151
file = &v
5252
}
5353

@@ -404,7 +404,7 @@ func Get{{ .Name }}(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateD
404404
essdk "github.com/opengovern/og-util/pkg/opengovernance-es-sdk"
405405
steampipesdk "github.com/opengovern/og-util/pkg/steampipe"
406406
"github.com/turbot/steampipe-plugin-sdk/v5/plugin"
407-
`+global.IntegrationTypeLower+` "`+global.OGPluginRepoURL+`/provider/model"
407+
`+global.IntegrationTypeLower+` "`+global.OGPluginRepoURL+`/discovery/provider"
408408
"runtime"
409409
)
410410

discovery/pkg/runable/steampipe_index_map/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ func main() {
3636
var resourceTypes []ResourceType
3737

3838
if resourceTypesFile == nil || len(*resourceTypesFile) == 0 {
39-
rt := "provider/resource-types.json"
39+
rt := "global/maps/resource-types.json"
4040
resourceTypesFile = &rt
4141
}
4242

4343
if indexMap == nil || len(*indexMap) == 0 {
44-
v := "steampipe/table_index_map.go"
44+
v := "global/maps/table_index_map.go"
4545
indexMap = &v
4646
}
4747

@@ -56,10 +56,10 @@ func main() {
5656

5757
// Generate the index map file as before
5858
b := &strings.Builder{}
59-
b.WriteString(fmt.Sprintf(`package steampipe
59+
b.WriteString(fmt.Sprintf(`package maps
6060
6161
import (
62-
"%[1]s/pkg/sdk/es"
62+
"%[1]s/discovery/pkg/es"
6363
)
6464
6565
var Map = map[string]string{

0 commit comments

Comments
 (0)