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

feat: Add support for EventBridge #1407

Merged
merged 7 commits into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import (
elbv2 "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2"
"github.com/aws/aws-sdk-go-v2/service/elasticsearchservice"
"github.com/aws/aws-sdk-go-v2/service/emr"
"github.com/aws/aws-sdk-go-v2/service/eventbridge"
"github.com/aws/aws-sdk-go-v2/service/fsx"
"github.com/aws/aws-sdk-go-v2/service/glue"
"github.com/aws/aws-sdk-go-v2/service/guardduty"
Expand Down Expand Up @@ -152,6 +153,7 @@ type Services struct {
ELBv1 ElbV1Client
ELBv2 ElbV2Client
EMR EmrClient
EventBridge EventBridgeClient
FSX FsxClient
Glue GlueClient
GuardDuty GuardDutyClient
Expand Down Expand Up @@ -651,6 +653,7 @@ func initServices(region string, c aws.Config) Services {
ELBv1: elbv1.NewFromConfig(awsCfg),
ELBv2: elbv2.NewFromConfig(awsCfg),
EMR: emr.NewFromConfig(awsCfg),
EventBridge: eventbridge.NewFromConfig(awsCfg),
FSX: fsx.NewFromConfig(awsCfg),
Glue: glue.NewFromConfig(awsCfg),
GuardDuty: guardduty.NewFromConfig(awsCfg),
Expand Down
96 changes: 96 additions & 0 deletions client/mocks/mock_eventbridge.go

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

8 changes: 8 additions & 0 deletions client/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
elbv2 "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2"
"github.com/aws/aws-sdk-go-v2/service/elasticsearchservice"
"github.com/aws/aws-sdk-go-v2/service/emr"
"github.com/aws/aws-sdk-go-v2/service/eventbridge"
"github.com/aws/aws-sdk-go-v2/service/fsx"
"github.com/aws/aws-sdk-go-v2/service/glue"
"github.com/aws/aws-sdk-go-v2/service/guardduty"
Expand Down Expand Up @@ -790,3 +791,10 @@ type KinesisClient interface {
ListStreams(ctx context.Context, params *kinesis.ListStreamsInput, optFns ...func(*kinesis.Options)) (*kinesis.ListStreamsOutput, error)
ListTagsForStream(ctx context.Context, params *kinesis.ListTagsForStreamInput, optFns ...func(*kinesis.Options)) (*kinesis.ListTagsForStreamOutput, error)
}

//go:generate mockgen -package=mocks -destination=./mocks/mock_eventbridge.go . EventBridgeClient
type EventBridgeClient interface {
ListEventBuses(ctx context.Context, params *eventbridge.ListEventBusesInput, optFns ...func(*eventbridge.Options)) (*eventbridge.ListEventBusesOutput, error)
ListRules(ctx context.Context, params *eventbridge.ListRulesInput, optFns ...func(*eventbridge.Options)) (*eventbridge.ListRulesOutput, error)
ListTagsForResource(ctx context.Context, params *eventbridge.ListTagsForResourceInput, optFns ...func(*eventbridge.Options)) (*eventbridge.ListTagsForResourceOutput, error)
}
17 changes: 17 additions & 0 deletions docs/tables/aws_eventbridge_event_bus_rules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

# Table: aws_eventbridge_event_bus_rules
Contains information about a rule in Amazon EventBridge
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|event_bus_cq_id|uuid|Unique CloudQuery ID of aws_eventbridge_event_buses table (FK)|
|tags|jsonb||
|arn|text|The Amazon Resource Name (ARN) of the rule|
|description|text|The description of the rule|
|event_bus_name|text|The name or ARN of the event bus associated with the rule|
|event_pattern|text|The event pattern of the rule|
|managed_by|text|If the rule was created on behalf of your account by an Amazon Web Services service, this field displays the principal name of the service that created the rule|
|name|text|The name of the rule|
|role_arn|text|The Amazon Resource Name (ARN) of the role that is used for target invocation If you're setting an event bus in another account as the target and that account granted permission to your account through an organization instead of directly by the account ID, you must specify a RoleArn with proper permissions in the Target structure, instead of here in this parameter|
|schedule_expression|text|The scheduling expression|
|state|text|The state of the rule|
12 changes: 12 additions & 0 deletions docs/tables/aws_eventbridge_event_buses.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# Table: aws_eventbridge_event_buses
An event bus receives events from a source and routes them to rules associated with that event bus
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|account_id|text|The AWS Account ID of the resource.|
|region|text|The AWS Region of the resource.|
|tags|jsonb||
|arn|text|The ARN of the event bus|
|name|text|The name of the event bus|
|policy|text|The permissions policy of the event bus, describing which other Amazon Web Services accounts can write events to this event bus|
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/cloudquery/cq-provider-aws
go 1.18

require (
github.com/aws/aws-sdk-go-v2 v1.16.8
github.com/aws/aws-sdk-go-v2 v1.16.10
github.com/aws/aws-sdk-go-v2/config v1.15.14
github.com/aws/aws-sdk-go-v2/credentials v1.12.9
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.20
Expand Down Expand Up @@ -66,7 +66,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/wafv2 v1.20.4
github.com/aws/aws-sdk-go-v2/service/workspaces v1.19.1
github.com/aws/aws-sdk-go-v2/service/xray v1.13.8
github.com/aws/smithy-go v1.12.0
github.com/aws/smithy-go v1.12.1
github.com/basgys/goxml2json v1.1.0
github.com/bxcodec/faker v2.0.1+incompatible
github.com/cloudquery/cq-gen v0.0.8
Expand All @@ -85,7 +85,8 @@ require (

require (
github.com/BurntSushi/toml v1.2.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.5 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.8 // indirect
github.com/aws/aws-sdk-go-v2/service/eventbridge v1.16.8 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.9 // indirect
github.com/bitly/go-simplejson v0.5.0 // indirect
github.com/elliotchance/orderedmap v1.4.0 // indirect
Expand All @@ -104,8 +105,8 @@ require (
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.3 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.8 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.15 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.11 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.15 // indirect
github.com/aws/aws-sdk-go-v2/service/athena v1.16.0
github.com/aws/aws-sdk-go-v2/service/backup v1.16.3
Expand Down
17 changes: 12 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
github.com/aws/aws-sdk-go-v2 v1.16.6/go.mod h1:6CpKuLXg2w7If3ABZCl/qZ6rEgwtjZTn4eAf4RcEyuw=
github.com/aws/aws-sdk-go-v2 v1.16.7/go.mod h1:6CpKuLXg2w7If3ABZCl/qZ6rEgwtjZTn4eAf4RcEyuw=
github.com/aws/aws-sdk-go-v2 v1.16.8 h1:gOe9UPR98XSf7oEJCcojYg+N2/jCRm4DdeIsP85pIyQ=
github.com/aws/aws-sdk-go-v2 v1.16.8/go.mod h1:6CpKuLXg2w7If3ABZCl/qZ6rEgwtjZTn4eAf4RcEyuw=
github.com/aws/aws-sdk-go-v2 v1.16.10 h1:+yDD0tcuHRQZgqONkpDwzepqmElQaSlFPymHRHR9mrc=
github.com/aws/aws-sdk-go-v2 v1.16.10/go.mod h1:WTACcleLz6VZTp7fak4EO5b9Q4foxbn+8PIz3PmyKlo=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.3 h1:S/ZBwevQkr7gv5YxONYpGQxlMFFYSRfz3RMcjsC9Qhk=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.3/go.mod h1:gNsR5CaXKmQSSzrmGxmwmct/r+ZBfbxorAuXYsj/M5Y=
github.com/aws/aws-sdk-go-v2/config v1.15.14 h1:+BqpqlydTq4c2et9Daury7gE+o67P4lbk7eybiCBNc4=
Expand All @@ -70,16 +71,19 @@ github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.20 h1:J7/+NFr8N7ebaC/Khie8
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.20/go.mod h1:IOgK2DAat3WO2qAaPmIzTdF+QqL18samL3dqZdjRBZI=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.13/go.mod h1:wLLesU+LdMZDM3U0PP9vZXJW39zmD/7L4nY2pSrYZ/g=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.14/go.mod h1:kdjrMwHwrC3+FsKhNcCMJ7tUVj/8uSD5CZXeQ4wV6fM=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.15 h1:bx5F2mr6H6FC7zNIQoDoUr8wEKnvmwRncujT3FYRtic=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.15/go.mod h1:pWrr2OoHlT7M/Pd2y4HV3gJyPb3qj5qMmnPkKSNPYK4=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.17 h1:U8DZvyFFesBmK62dYC6BRXm4Cd/wPP3aPcecu3xv/F4=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.17/go.mod h1:6qtGip7sJEyvgsLjphRZWF9qPe3xJf1mL/MM01E35Wc=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.7/go.mod h1:93Uot80ddyVzSl//xEJreNKMhxntr71WtR3v/A1cRYk=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.8/go.mod h1:ZIV8GYoC6WLBW5KGs+o4rsc65/ozd+eQ0L31XF5VDwk=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.9 h1:5sbyznZC2TeFpa4fvtpvpcGbzeXEEs1l1Jo51ynUNsQ=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.9/go.mod h1:08tUpeSGN33QKSO7fwxXczNfiwCpbj+GxK6XKwqWVv0=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.11 h1:GMp98usVW5tzQhxd26KWhoNQPlR2noIlfbzqjVGBhLU=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.11/go.mod h1:cYAfnB+9ZkmZWpQWmPDsuIGm4EA+6k2ZVtxKjw/XJBY=
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.15 h1:QquxR7NH3ULBsKC+NoTpilzbKKS+5AELfNREInbhvas=
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.15/go.mod h1:Tkrthp/0sNBShQQsamR7j/zY4p19tVTAs+nnqhH6R3c=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.5 h1:tEEHn+PGAxRVqMPEhtU8oCSW/1Ge3zP5nUgPrGQNUPs=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.5/go.mod h1:aIwFF3dUk95ocCcA3zfk3nhz0oLkpzHFWuMp8l/4nNs=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.8 h1:9PY5a+kHQzC6d9eR+KLNSJP3DHDLYmPFA5/+eSDBo9o=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.8/go.mod h1:pcQfUOFVK4lMnSzgX3dCA81UsA9YCilRUSYgkjSU2i8=
github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.15.8 h1:5P7QmaYl7Q0wcSUK8Cuvvijm51fw7STKl+s1YmmOMWo=
github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.15.8/go.mod h1:YKtx2MNPsEyWsZTeyZYhory0lwpm8Qn/jgjUvNnUE/8=
github.com/aws/aws-sdk-go-v2/service/acm v1.14.8 h1:4JNBqDNPNp+0ZLZMIaY8iMwZ9czfd8RseQOb3MhxuaY=
Expand Down Expand Up @@ -146,6 +150,8 @@ github.com/aws/aws-sdk-go-v2/service/elasticsearchservice v1.15.7 h1:X2y6k6CLSpV
github.com/aws/aws-sdk-go-v2/service/elasticsearchservice v1.15.7/go.mod h1:w2COcofMWoC7brXNfjcuZj4PGzaAL5FOdEBSBMokr0I=
github.com/aws/aws-sdk-go-v2/service/emr v1.20.0 h1:2xjz2hES5SnQLgmW1bBVdVz6j0mjXyy7/4lrq2W/0j8=
github.com/aws/aws-sdk-go-v2/service/emr v1.20.0/go.mod h1:OVVv6VrQG33CuCR+V0GiaBuWbwYGogGxWGi9TDrM2yk=
github.com/aws/aws-sdk-go-v2/service/eventbridge v1.16.8 h1:RE7eIYoWMJRqMNM8cdQfEOV0ruexieh/J3yM3PYh+HU=
github.com/aws/aws-sdk-go-v2/service/eventbridge v1.16.8/go.mod h1:ShtRcolaihIMdVmjL7qqWXkOlMCz64L3XfjaeEBXnTg=
github.com/aws/aws-sdk-go-v2/service/fsx v1.24.2 h1:8ko+AFpvJUbpjtCIEgtaXcXtndkZBi0N7e2ePGocqf8=
github.com/aws/aws-sdk-go-v2/service/fsx v1.24.2/go.mod h1:K3Ym90NBYdXV+BCHvpuiDXCeMAtayFdiGdJ0I1uop5Q=
github.com/aws/aws-sdk-go-v2/service/glue v1.28.1 h1:rG+jzafWyw73tdv+48e4jZYyehihEORcEcqzyBbZUGA=
Expand Down Expand Up @@ -222,8 +228,9 @@ github.com/aws/aws-sdk-go-v2/service/workspaces v1.19.1 h1:9RPddc77OH7e7JNYlUyZd
github.com/aws/aws-sdk-go-v2/service/workspaces v1.19.1/go.mod h1:osYwY68aqK2yF7/uBKhf6TTT9PP1h2lpaHBMwku4OiA=
github.com/aws/aws-sdk-go-v2/service/xray v1.13.8 h1:dUvwdvAQT1CGzJZkM6k7WOK8DqKgHAJIPndcU6wWKMU=
github.com/aws/aws-sdk-go-v2/service/xray v1.13.8/go.mod h1:7lySrwul/Rp89ZBnZqSiALFosEFiYyLvBR32ze0DUPI=
github.com/aws/smithy-go v1.12.0 h1:gXpeZel/jPoWQ7OEmLIgCUnhkFftqNfwWUwAHSlp1v0=
github.com/aws/smithy-go v1.12.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/aws/smithy-go v1.12.1 h1:yQRC55aXN/y1W10HgwHle01DRuV9Dpf31iGkotjt3Ag=
github.com/aws/smithy-go v1.12.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/basgys/goxml2json v1.1.0 h1:4ln5i4rseYfXNd86lGEB+Vi652IsIXIvggKM/BhUKVw=
github.com/basgys/goxml2json v1.1.0/go.mod h1:wH7a5Np/Q4QoECFIU8zTQlZwZkrilY0itPfecMw41Dw=
github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y=
Expand Down
2 changes: 2 additions & 0 deletions resources/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"github.com/cloudquery/cq-provider-aws/resources/services/elbv1"
"github.com/cloudquery/cq-provider-aws/resources/services/elbv2"
"github.com/cloudquery/cq-provider-aws/resources/services/emr"
"github.com/cloudquery/cq-provider-aws/resources/services/eventbridge"
"github.com/cloudquery/cq-provider-aws/resources/services/fsx"
"github.com/cloudquery/cq-provider-aws/resources/services/glue"
"github.com/cloudquery/cq-provider-aws/resources/services/guardduty"
Expand Down Expand Up @@ -170,6 +171,7 @@ func Provider() *provider.Provider {
"elbv2.target_groups": elbv2.Elbv2TargetGroups(),
"emr.block_public_access_configs": emr.EmrBlockPublicAccessConfigs(),
"emr.clusters": emr.EmrClusters(),
"eventbridge.event_buses": eventbridge.EventBuses(),
"fsx.backups": fsx.FsxBackups(),
"glue.classifiers": glue.Classifiers(),
"glue.connections": glue.Connections(),
Expand Down
Loading