Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions codegen/recipes/glue.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ func GlueResources() []*Resource {
}...),
},
{
SubService: "crawlers",
Struct: &types.Crawler{},
SkipFields: []string{},
SubService: "crawlers",
Struct: &ohaws.GlueCrawler{},
PreResourceResolver: "getGlueCrawler",
SkipFields: []string{},
UnwrapEmbeddedStructs: true,
ExtraColumns: append(
defaultRegionalColumns,
[]codegen.ColumnDefinition{
Expand All @@ -64,11 +66,6 @@ func GlueResources() []*Resource {
Resolver: `resolveGlueCrawlerArn`,
Options: schema.ColumnCreationOptions{PrimaryKey: true},
},
{
Name: "tags",
Type: schema.TypeJSON,
Resolver: `resolveGlueCrawlerTags`,
},
}...),
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/tables/aws_glue_crawlers.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ The primary key for this table is **arn**.
|account_id|String|
|region|String|
|arn (PK)|String|
|tags|JSON|
|classifiers|StringArray|
|configuration|String|
|crawl_elapsed_time|Int|
Expand All @@ -36,4 +35,5 @@ The primary key for this table is **arn**.
|state|String|
|table_prefix|String|
|targets|JSON|
|version|Int|
|version|Int|
|tags|JSON|
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/OpsHelmInc/cloudquery
go 1.24

require (
github.com/OpsHelmInc/ohaws v0.11.1
github.com/OpsHelmInc/ohaws v0.11.3-0.20251020143521-3a46f4c79769
github.com/aws/aws-sdk-go-v2 v1.37.2
github.com/aws/aws-sdk-go-v2/config v1.30.3
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.61
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/OpsHelmInc/ohaws v0.11.1 h1:r45US5566tRIKBHf5DlUHffeaEpiT3h+HnxYi1ETRrQ=
github.com/OpsHelmInc/ohaws v0.11.1/go.mod h1:oBn8DAX9YQwbvVAGxthUb7idOJB9KZ+h2IOhABM+EaI=
github.com/OpsHelmInc/ohaws v0.11.3-0.20251020143521-3a46f4c79769 h1:ljq3JssPTovEjckAVwZtR13MzVsT89Kzgs4oNfTsRY4=
github.com/OpsHelmInc/ohaws v0.11.3-0.20251020143521-3a46f4c79769/go.mod h1:oBn8DAX9YQwbvVAGxthUb7idOJB9KZ+h2IOhABM+EaI=
github.com/OpsHelmInc/pkg v0.0.0-20250806141928-951fad7f7312 h1:PF8jGY+FRmusqhdo+z8VEiiY9Sml2MxVT7WVWjQei74=
github.com/OpsHelmInc/pkg v0.0.0-20250806141928-951fad7f7312/go.mod h1:CO1WtHvUbiIdXfssnArlXCodHEyyZrmUUJ29D+HZR8E=
github.com/avast/retry-go/v4 v4.3.1 h1:Mtg11F9PdAIMkMiio2RKcYauoVHjl2aB3zQJJlzD4cE=
Expand Down
17 changes: 9 additions & 8 deletions resources/services/glue/crawlers.go

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

20 changes: 16 additions & 4 deletions resources/services/glue/crawlers_fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"

"github.com/OpsHelmInc/cloudquery/client"
"github.com/OpsHelmInc/ohaws"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/arn"
"github.com/aws/aws-sdk-go-v2/service/glue"
Expand Down Expand Up @@ -32,20 +33,31 @@ func fetchGlueCrawlers(ctx context.Context, meta schema.ClientMeta, parent *sche
}
func resolveGlueCrawlerArn(ctx context.Context, meta schema.ClientMeta, resource *schema.Resource, c schema.Column) error {
cl := meta.(*client.Client)
return resource.Set(c.Name, crawlerARN(cl, aws.ToString(resource.Item.(types.Crawler).Name)))
return resource.Set(c.Name, crawlerARN(cl, aws.ToString(resource.Item.(*ohaws.GlueCrawler).Name)))
}
func resolveGlueCrawlerTags(ctx context.Context, meta schema.ClientMeta, resource *schema.Resource, c schema.Column) error {

func getGlueCrawler(ctx context.Context, meta schema.ClientMeta, resource *schema.Resource) error {
cl := meta.(*client.Client)
svc := cl.Services().Glue
c := resource.Item.(types.Crawler)
input := glue.GetTagsInput{
ResourceArn: aws.String(crawlerARN(cl, aws.ToString(resource.Item.(types.Crawler).Name))),
ResourceArn: aws.String(crawlerARN(cl, aws.ToString(c.Name))),
}

response, err := svc.GetTags(ctx, &input)
if err != nil {
if cl.IsNotFoundError(err) {
return nil
}
return err
}
return resource.Set(c.Name, response.Tags)

resource.Item = &ohaws.GlueCrawler{
Crawler: c,
Tags: response.Tags,
}

return nil
}

// ====================================================================================================================
Expand Down