Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
feat: Added Athena resources: data_catalogs, work_groups, named_queri…
Browse files Browse the repository at this point in the history
…es, prepared_statements (#804)

* added data catalogs

* added migration

* added e2e resources

* integration tests, docs, linter

* add terraform lock

* optimized fetch

* linter

* tf lock update

* migrations merge

* e2e fix

* workgroups added

* migration adjusted

* lock upgrade

* lock upgrade

* removed terraform

* e2e fix

* e2e fix

* migrations fix

* migrations fix

* migrations fix

* added arn, migration fix

* added arn, migration fix

* docs

* migrations fix

* migrations fix

* fix
  • Loading branch information
amanenk authored May 12, 2022
1 parent 0aa8fa7 commit bf77311
Show file tree
Hide file tree
Showing 25 changed files with 2,077 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/apigateway"
"github.com/aws/aws-sdk-go-v2/service/apigatewayv2"
"github.com/aws/aws-sdk-go-v2/service/applicationautoscaling"
"github.com/aws/aws-sdk-go-v2/service/athena"
"github.com/aws/aws-sdk-go-v2/service/autoscaling"
"github.com/aws/aws-sdk-go-v2/service/backup"
"github.com/aws/aws-sdk-go-v2/service/cloudformation"
Expand Down Expand Up @@ -105,6 +106,7 @@ type Services struct {
Apigateway ApigatewayClient
Apigatewayv2 Apigatewayv2Client
ApplicationAutoscaling ApplicationAutoscalingClient
Athena AthenaClient
Autoscaling AutoscalingClient
Backup BackupClient
Cloudformation CloudFormationClient
Expand Down Expand Up @@ -534,6 +536,7 @@ func initServices(region string, c aws.Config) Services {
Apigatewayv2: apigatewayv2.NewFromConfig(awsCfg),
ApplicationAutoscaling: applicationautoscaling.NewFromConfig(awsCfg),
Autoscaling: autoscaling.NewFromConfig(awsCfg),
Athena: athena.NewFromConfig(awsCfg),
Backup: backup.NewFromConfig(awsCfg),
Cloudfront: cloudfront.NewFromConfig(awsCfg),
Cloudtrail: cloudtrail.NewFromConfig(awsCfg),
Expand Down
1 change: 1 addition & 0 deletions client/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ type AWSService string

const (
ApigatewayService AWSService = "apigateway"
Athena AWSService = "athena"
CloudfrontService AWSService = "cloudfront"
CognitoIdentityService AWSService = "cognito-identity"
DirectConnectService AWSService = "directconnect"
Expand Down
296 changes: 296 additions & 0 deletions client/mocks/mock_athena.go

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

18 changes: 18 additions & 0 deletions client/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/apigateway"
"github.com/aws/aws-sdk-go-v2/service/apigatewayv2"
"github.com/aws/aws-sdk-go-v2/service/applicationautoscaling"
"github.com/aws/aws-sdk-go-v2/service/athena"
"github.com/aws/aws-sdk-go-v2/service/autoscaling"
"github.com/aws/aws-sdk-go-v2/service/backup"
"github.com/aws/aws-sdk-go-v2/service/cloudformation"
Expand Down Expand Up @@ -127,6 +128,23 @@ type Apigatewayv2Client interface {
GetTags(ctx context.Context, params *apigatewayv2.GetTagsInput, optFns ...func(*apigatewayv2.Options)) (*apigatewayv2.GetTagsOutput, error)
}

//go:generate mockgen -package=mocks -destination=./mocks/mock_athena.go . AthenaClient
type AthenaClient interface {
ListDataCatalogs(ctx context.Context, params *athena.ListDataCatalogsInput, optFns ...func(*athena.Options)) (*athena.ListDataCatalogsOutput, error)
GetDataCatalog(ctx context.Context, params *athena.GetDataCatalogInput, optFns ...func(*athena.Options)) (*athena.GetDataCatalogOutput, error)
ListDatabases(ctx context.Context, params *athena.ListDatabasesInput, optFns ...func(*athena.Options)) (*athena.ListDatabasesOutput, error)
ListTableMetadata(ctx context.Context, params *athena.ListTableMetadataInput, optFns ...func(*athena.Options)) (*athena.ListTableMetadataOutput, error)
ListTagsForResource(ctx context.Context, params *athena.ListTagsForResourceInput, optFns ...func(*athena.Options)) (*athena.ListTagsForResourceOutput, error)
ListWorkGroups(ctx context.Context, params *athena.ListWorkGroupsInput, optFns ...func(*athena.Options)) (*athena.ListWorkGroupsOutput, error)
GetWorkGroup(ctx context.Context, params *athena.GetWorkGroupInput, optFns ...func(*athena.Options)) (*athena.GetWorkGroupOutput, error)
ListPreparedStatements(ctx context.Context, params *athena.ListPreparedStatementsInput, optFns ...func(*athena.Options)) (*athena.ListPreparedStatementsOutput, error)
GetPreparedStatement(ctx context.Context, params *athena.GetPreparedStatementInput, optFns ...func(*athena.Options)) (*athena.GetPreparedStatementOutput, error)
ListQueryExecutions(ctx context.Context, params *athena.ListQueryExecutionsInput, optFns ...func(*athena.Options)) (*athena.ListQueryExecutionsOutput, error)
ListNamedQueries(ctx context.Context, params *athena.ListNamedQueriesInput, optFns ...func(*athena.Options)) (*athena.ListNamedQueriesOutput, error)
GetNamedQuery(ctx context.Context, params *athena.GetNamedQueryInput, optFns ...func(*athena.Options)) (*athena.GetNamedQueryOutput, error)
GetQueryExecution(ctx context.Context, params *athena.GetQueryExecutionInput, optFns ...func(*athena.Options)) (*athena.GetQueryExecutionOutput, error)
}

//go:generate mockgen -package=mocks -destination=./mocks/mock_cloudfront.go . CloudfrontClient
type CloudfrontClient interface {
ListDistributions(ctx context.Context, params *cloudfront.ListDistributionsInput, optFns ...func(*cloudfront.Options)) (*cloudfront.ListDistributionsOutput, error)
Expand Down
10 changes: 10 additions & 0 deletions docs/tables/aws_athena_data_catalog_database_table_columns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# Table: aws_athena_data_catalog_database_table_columns
Contains metadata for a column in a table
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|data_catalog_database_table_cq_id|uuid|Unique CloudQuery ID of aws_athena_data_catalog_database_tables table (FK)|
|name|text|The name of the column|
|comment|text|Optional information about the column|
|type|text|The data type of the column|
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# Table: aws_athena_data_catalog_database_table_partition_keys
Contains metadata for a column in a table
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|data_catalog_database_table_cq_id|uuid|Unique CloudQuery ID of aws_athena_data_catalog_database_tables table (FK)|
|name|text|The name of the column|
|comment|text|Optional information about the column|
|type|text|The data type of the column|
12 changes: 12 additions & 0 deletions docs/tables/aws_athena_data_catalog_database_tables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# Table: aws_athena_data_catalog_database_tables
Contains metadata for a table
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|data_catalog_database_cq_id|uuid|Unique CloudQuery ID of aws_athena_data_catalog_databases table (FK)|
|name|text|The name of the table|
|create_time|timestamp without time zone|The time that the table was created|
|last_access_time|timestamp without time zone|The last time the table was accessed|
|parameters|jsonb|A set of custom key/value pairs for table properties|
|table_type|text|The type of table|
Loading

0 comments on commit bf77311

Please sign in to comment.