Skip to content

Commit

Permalink
fix(storage_bucket): set primary key (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
kabachook authored Feb 20, 2023
1 parent de58a5d commit 946af0e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
18 changes: 17 additions & 1 deletion gen/recipes/storage.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package recipes

import (
"github.com/cloudquery/plugin-sdk/codegen"
"github.com/cloudquery/plugin-sdk/schema"
storage_resource "github.com/yandex-cloud/cq-provider-yandex/resources/services/storage"
)

Expand All @@ -10,9 +12,23 @@ func Storage() []*Resource {
Service: "storage",
SubService: "buckets",
Struct: new(storage_resource.Bucket),
SkipFields: []string{id}, // Id is always ""
SkipFields: []string{id, "Name", "FolderId"}, // Id is always ""
FieldsToUnwrap: []string{"Bucket"},
Multiplex: multiplexFolder,
ExtraColumns: codegen.ColumnDefinitions{
{
Name: "name",
Type: schema.TypeString,
Resolver: `schema.PathResolver("Name")`,
Options: schema.ColumnCreationOptions{PrimaryKey: true},
},
{
Name: "folder_id",
Type: schema.TypeString,
Resolver: `schema.PathResolver("FolderId")`,
Options: schema.ColumnCreationOptions{PrimaryKey: true},
},
},
},
}
}
6 changes: 6 additions & 0 deletions resources/services/storage/buckets.go

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

0 comments on commit 946af0e

Please sign in to comment.