Skip to content

Commit

Permalink
feat(aws): Add Support for Eventbridge scheduler (#4693)
Browse files Browse the repository at this point in the history

#### Summary

<!--
Explain what problem this PR addresses
-->

<!--
  • Loading branch information
bbernays committed Nov 16, 2022
1 parent 7903539 commit a4ef661
Show file tree
Hide file tree
Showing 18 changed files with 619 additions and 0 deletions.
136 changes: 136 additions & 0 deletions plugins/source/aws/client/mocks/scheduler.go

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

3 changes: 3 additions & 0 deletions plugins/source/aws/client/services.go

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

16 changes: 16 additions & 0 deletions plugins/source/aws/client/services/scheduler.go

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

1 change: 1 addition & 0 deletions plugins/source/aws/codegen/main.go
Expand Up @@ -79,6 +79,7 @@ func generateResources() ([]*recipes.Resource, error) {
resources = append(resources, recipes.Route53Resources()...)
resources = append(resources, recipes.S3Resources()...)
resources = append(resources, recipes.SagemakerResources()...)
resources = append(resources, recipes.SchedulerResources()...)
resources = append(resources, recipes.SecretsManagerResources()...)
resources = append(resources, recipes.ServiceCatalogResources()...)
resources = append(resources, recipes.ServiceQuotasResources()...)
Expand Down
53 changes: 53 additions & 0 deletions plugins/source/aws/codegen/recipes/scheduler.go
@@ -0,0 +1,53 @@
package recipes

import (
"github.com/aws/aws-sdk-go-v2/service/scheduler"
"github.com/aws/aws-sdk-go-v2/service/scheduler/types"
"github.com/cloudquery/plugin-sdk/codegen"
"github.com/cloudquery/plugin-sdk/schema"
)

func SchedulerResources() []*Resource {
mx := `client.ServiceAccountRegionMultiplexer("scheduler")`
resources := []*Resource{
{
SubService: "schedule_groups",
Struct: new(types.ScheduleGroupSummary),
Multiplex: mx,
PKColumns: []string{"arn"},
ExtraColumns: append(
defaultRegionalColumns,
[]codegen.ColumnDefinition{

{
Name: "tags",
Type: schema.TypeJSON,
Resolver: `resolveSchedulerScheduleTags()`,
},
}...),
},
{
SubService: "schedules",
Struct: new(scheduler.GetScheduleOutput),
Multiplex: mx,
PKColumns: []string{"arn"},
SkipFields: []string{"ResultMetadata"},
ExtraColumns: append(
defaultRegionalColumns,
[]codegen.ColumnDefinition{

{
Name: "tags",
Type: schema.TypeJSON,
Resolver: `resolveSchedulerScheduleTags()`,
},
}...),
PreResourceResolver: "getSchedule",
},
}
for _, r := range resources {
r.Service = "scheduler"
r.Description = "https://docs.aws.amazon.com/scheduler/latest/APIReference/API_" + r.StructName() + ".html"
}
return resources
}
2 changes: 2 additions & 0 deletions plugins/source/aws/codegen/services/clients.go
Expand Up @@ -72,6 +72,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/aws/aws-sdk-go-v2/service/s3control"
"github.com/aws/aws-sdk-go-v2/service/sagemaker"
"github.com/aws/aws-sdk-go-v2/service/scheduler"
"github.com/aws/aws-sdk-go-v2/service/secretsmanager"
"github.com/aws/aws-sdk-go-v2/service/servicecatalog"
"github.com/aws/aws-sdk-go-v2/service/servicecatalogappregistry"
Expand Down Expand Up @@ -163,6 +164,7 @@ var clients = []interface{}{
&s3.Client{},
&s3control.Client{},
&sagemaker.Client{},
&scheduler.Client{},
&secretsmanager.Client{},
&servicecatalog.Client{},
&servicecatalogappregistry.Client{},
Expand Down
2 changes: 2 additions & 0 deletions plugins/source/aws/docs/tables/README.md
Expand Up @@ -391,6 +391,8 @@
| [aws_sagemaker_models](aws_sagemaker_models.md) |
| [aws_sagemaker_notebook_instances](aws_sagemaker_notebook_instances.md) |
| [aws_sagemaker_training_jobs](aws_sagemaker_training_jobs.md) |
| [aws_scheduler_schedule_groups](aws_scheduler_schedule_groups.md) |
| [aws_scheduler_schedules](aws_scheduler_schedules.md) |
| [aws_secretsmanager_secrets](aws_secretsmanager_secrets.md) |
| [aws_servicecatalog_portfolios](aws_servicecatalog_portfolios.md) |
| [aws_servicecatalog_products](aws_servicecatalog_products.md) |
Expand Down
22 changes: 22 additions & 0 deletions plugins/source/aws/docs/tables/aws_scheduler_schedule_groups.md
@@ -0,0 +1,22 @@
# Table: aws_scheduler_schedule_groups

https://docs.aws.amazon.com/scheduler/latest/APIReference/API_ScheduleGroupSummary.html

The primary key for this table is **arn**.


## Columns
| Name | Type |
| ------------- | ------------- |
|_cq_source_name|String|
|_cq_sync_time|Timestamp|
|_cq_id|UUID|
|_cq_parent_id|UUID|
|account_id|String|
|region|String|
|tags|JSON|
|arn (PK)|String|
|creation_date|Timestamp|
|last_modification_date|Timestamp|
|name|String|
|state|String|
31 changes: 31 additions & 0 deletions plugins/source/aws/docs/tables/aws_scheduler_schedules.md
@@ -0,0 +1,31 @@
# Table: aws_scheduler_schedules

https://docs.aws.amazon.com/scheduler/latest/APIReference/API_GetScheduleOutput.html

The primary key for this table is **arn**.


## Columns
| Name | Type |
| ------------- | ------------- |
|_cq_source_name|String|
|_cq_sync_time|Timestamp|
|_cq_id|UUID|
|_cq_parent_id|UUID|
|account_id|String|
|region|String|
|tags|JSON|
|arn (PK)|String|
|creation_date|Timestamp|
|description|String|
|end_date|Timestamp|
|flexible_time_window|JSON|
|group_name|String|
|kms_key_arn|String|
|last_modification_date|Timestamp|
|name|String|
|schedule_expression|String|
|schedule_expression_timezone|String|
|start_date|Timestamp|
|state|String|
|target|JSON|
1 change: 1 addition & 0 deletions plugins/source/aws/go.mod
Expand Up @@ -75,6 +75,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/s3 v1.29.2
github.com/aws/aws-sdk-go-v2/service/s3control v1.25.1
github.com/aws/aws-sdk-go-v2/service/sagemaker v1.54.0
github.com/aws/aws-sdk-go-v2/service/scheduler v1.0.1
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.5
github.com/aws/aws-sdk-go-v2/service/servicecatalog v1.14.19
github.com/aws/aws-sdk-go-v2/service/servicecatalogappregistry v1.14.3
Expand Down
2 changes: 2 additions & 0 deletions plugins/source/aws/go.sum
Expand Up @@ -206,6 +206,8 @@ github.com/aws/aws-sdk-go-v2/service/s3control v1.25.1 h1:ZCWImHditFy/7vwV5jqn6Y
github.com/aws/aws-sdk-go-v2/service/s3control v1.25.1/go.mod h1:F2RWJqngKxHGxZUYA4jt/veKlbyXEpgSMZ67VyVpSEg=
github.com/aws/aws-sdk-go-v2/service/sagemaker v1.54.0 h1:jFgUbmNSv6YoRCOQ0QqLtWU2IQh5RywBoNMDXoHxfO8=
github.com/aws/aws-sdk-go-v2/service/sagemaker v1.54.0/go.mod h1:umigFBRAb3i0OTRXRYDLlCawnJPYCWLhod55+tZHOFA=
github.com/aws/aws-sdk-go-v2/service/scheduler v1.0.1 h1:1ugkiW/1zwdXGBHP2ZWKByC9TSWIyvR8CJl8tNExeQU=
github.com/aws/aws-sdk-go-v2/service/scheduler v1.0.1/go.mod h1:N/NG6yPA4kDtE3mj4wMQUQlmyW8lFhqe8Z7zlt3pBwk=
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.5 h1:De+sGzRmk6+/lzKqZXa6RdC1ZVGLPHI1nvjOxw4ooj0=
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.5/go.mod h1:k6CPuxyzO247nYEM1baEwHH1kRtosRCvgahAepaaShw=
github.com/aws/aws-sdk-go-v2/service/servicecatalog v1.14.19 h1:IsBui5OwBHfMiwdBnfN7fLX4RCWnwu3s/v+yB1K2WiY=
Expand Down
3 changes: 3 additions & 0 deletions plugins/source/aws/resources/plugin/tables.go

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

0 comments on commit a4ef661

Please sign in to comment.