diff --git a/gen/recipes/storage.go b/gen/recipes/storage.go index 68e6f5e..16c2688 100644 --- a/gen/recipes/storage.go +++ b/gen/recipes/storage.go @@ -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" ) @@ -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}, + }, + }, }, } } diff --git a/resources/services/storage/buckets.go b/resources/services/storage/buckets.go index c48cda9..dd11bca 100644 --- a/resources/services/storage/buckets.go +++ b/resources/services/storage/buckets.go @@ -17,11 +17,17 @@ func Buckets() *schema.Table { Name: "name", Type: schema.TypeString, Resolver: schema.PathResolver("Name"), + CreationOptions: schema.ColumnCreationOptions{ + PrimaryKey: true, + }, }, { Name: "folder_id", Type: schema.TypeString, Resolver: schema.PathResolver("FolderId"), + CreationOptions: schema.ColumnCreationOptions{ + PrimaryKey: true, + }, }, { Name: "anonymous_access_flags",