Skip to content

Commit 22c696b

Browse files
committed
chore: Update databases.hcl file and others glue resources to match code
1 parent 6f11fb2 commit 22c696b

18 files changed

+61
-24
lines changed

plugins/source/aws/docs/tables/aws_glue_databases.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The Database object represents a logical grouping of tables that might reside in
77
|account_id|text|The AWS Account ID of the resource.|
88
|region|text|The AWS Region of the resource.|
99
|arn|text|The Amazon Resource Name (ARN) of the workflow.|
10+
|tags|jsonb||
1011
|name|text|The name of the database|
1112
|catalog_id|text|The ID of the Data Catalog in which the database resides|
1213
|create_table_default_permissions|jsonb|Creates a set of default permissions on the table for principals|
@@ -16,4 +17,3 @@ The Database object represents a logical grouping of tables that might reside in
1617
|parameters|jsonb|These key-value pairs define parameters and properties of the database|
1718
|target_database_catalog_id|text|The ID of the Data Catalog in which the database resides|
1819
|target_database_name|text|The name of the catalog database|
19-
|tags|jsonb||

plugins/source/aws/docs/tables/aws_glue_jobs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Specifies a job definition
66
| ------------- | ------------- | ----- |
77
|account_id|text|The AWS Account ID of the resource.|
88
|region|text|The AWS Region of the resource.|
9-
|arn|text|The Amazon Resource Name (ARN) of the workflow.|
9+
|arn|text|The Amazon Resource Name (ARN) of the glue resource.|
1010
|tags|jsonb|Resource tags.|
1111
|allocated_capacity|bigint|This field is deprecated|
1212
|code_gen_configuration_nodes|jsonb|The representation of a directed acyclic graph on which both the Glue Studio visual component and Glue Studio code generation is based|

plugins/source/aws/resources/services/glue/classifiers.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,6 @@ func fetchGlueClassifiers(ctx context.Context, meta schema.ClientMeta, parent *s
234234
}
235235
return nil
236236
}
237-
238-
// nolint:gocritic
239237
func resolveGlueClassifierName(ctx context.Context, meta schema.ClientMeta, resource *schema.Resource, c schema.Column) error {
240238
r := resource.Item.(types.Classifier)
241239
if r.CsvClassifier != nil {

plugins/source/aws/resources/services/glue/classifiers.hcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//check-for-changes
12
service = "aws"
23
output_directory = "."
34
add_generate = true

plugins/source/aws/resources/services/glue/connections.hcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//check-for-changes
12
service = "aws"
23
output_directory = "."
34
add_generate = true

plugins/source/aws/resources/services/glue/crawlers.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,10 @@ func resolveGlueCrawlerTags(ctx context.Context, meta schema.ClientMeta, resourc
424424
return diag.WrapError(resource.Set(c.Name, response.Tags))
425425
}
426426

427+
// ====================================================================================================================
428+
// User Defined Helpers
429+
// ====================================================================================================================
430+
427431
func crawlerARN(cl *client.Client, name string) string {
428432
return cl.ARN(client.GlueService, "crawler", name)
429433
}

plugins/source/aws/resources/services/glue/crawlers.hcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//check-for-changes
12
service = "aws"
23
output_directory = "."
34
add_generate = true

plugins/source/aws/resources/services/glue/databases.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ func Databases() *schema.Table {
4040
Type: schema.TypeString,
4141
Resolver: resolveGlueDatabaseArn,
4242
},
43+
{
44+
Name: "tags",
45+
Type: schema.TypeJSON,
46+
Resolver: resolveGlueDatabaseTags,
47+
},
4348
{
4449
Name: "name",
4550
Description: "The name of the database",
@@ -87,11 +92,6 @@ func Databases() *schema.Table {
8792
Type: schema.TypeString,
8893
Resolver: schema.PathResolver("TargetDatabase.DatabaseName"),
8994
},
90-
{
91-
Name: "tags",
92-
Type: schema.TypeJSON,
93-
Resolver: resolveGlueDatabaseTags,
94-
},
9595
},
9696
Relations: []*schema.Table{
9797
{
@@ -431,6 +431,19 @@ func resolveGlueDatabaseArn(ctx context.Context, meta schema.ClientMeta, resourc
431431
arn := aws.String(databaseARN(cl, aws.ToString(resource.Item.(types.Database).Name)))
432432
return diag.WrapError(resource.Set(c.Name, arn))
433433
}
434+
func resolveGlueDatabaseTags(ctx context.Context, meta schema.ClientMeta, resource *schema.Resource, c schema.Column) error {
435+
cl := meta.(*client.Client)
436+
svc := cl.Services().Glue
437+
input := glue.GetTagsInput{
438+
ResourceArn: aws.String(databaseARN(cl, aws.ToString(resource.Item.(types.Database).Name))),
439+
}
440+
441+
response, err := svc.GetTags(ctx, &input)
442+
if err != nil {
443+
return diag.WrapError(err)
444+
}
445+
return diag.WrapError(resource.Set(c.Name, response.Tags))
446+
}
434447
func fetchGlueDatabaseTables(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error {
435448
r := parent.Item.(types.Database)
436449
cl := meta.(*client.Client)
@@ -470,19 +483,6 @@ func fetchGlueDatabaseTableIndexes(ctx context.Context, meta schema.ClientMeta,
470483
}
471484
return nil
472485
}
473-
func resolveGlueDatabaseTags(ctx context.Context, meta schema.ClientMeta, resource *schema.Resource, c schema.Column) error {
474-
cl := meta.(*client.Client)
475-
svc := cl.Services().Glue
476-
input := glue.GetTagsInput{
477-
ResourceArn: aws.String(databaseARN(cl, aws.ToString(resource.Item.(types.Database).Name))),
478-
}
479-
480-
response, err := svc.GetTags(ctx, &input)
481-
if err != nil {
482-
return diag.WrapError(err)
483-
}
484-
return diag.WrapError(resource.Set(c.Name, response.Tags))
485-
}
486486

487487
// ====================================================================================================================
488488
// User Defined Helpers

plugins/source/aws/resources/services/glue/databases.hcl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//check-for-changes
12
service = "aws"
23
output_directory = "."
34
add_generate = true
@@ -40,6 +41,10 @@ resource "aws" "glue" "databases" {
4041
description = "The Amazon Resource Name (ARN) of the workflow."
4142
generate_resolver = true
4243
}
44+
userDefinedColumn "tags" {
45+
type = "json"
46+
generate_resolver = true
47+
}
4348

4449
user_relation "aws" "glue" "tables" {
4550
path = "github.com/aws/aws-sdk-go-v2/service/glue/types.Table"
@@ -90,7 +95,7 @@ resource "aws" "glue" "databases" {
9095
column "keys" {
9196
type = "json"
9297
resolver "resolverSliceToJson" {
93-
path = "github.com/cloudquery/cloudquery/cloudquery/plugins/source/aws/client.SliceJsonResolver"
98+
path = "github.com/cloudquery/cloudquery/plugins/source/aws/client.SliceJsonResolver"
9499
params = ["Keys", "Name", "Type"]
95100
}
96101
}

plugins/source/aws/resources/services/glue/datacatalog_encryption_settings.hcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//check-for-changes
12
service = "aws"
23
output_directory = "."
34
add_generate = true

0 commit comments

Comments
 (0)