This repository has been archived by the owner on Jul 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Add table turbot_notification
#9
Merged
Merged
Changes from 16 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
55102d3
WIP
e-gineer ad3afef
Merge branch 'main' of github.com:turbot/steampipe-plugin-turbot into…
4d5c5e8
Add policy setting columns
94a5a8a
update
c88d233
Add actor info to notification table
6dc10af
add grants
c291fb1
Commit for testing FromField transform
7134d3d
Add Active grant and grants to notification table
96680be
update
f2e8a67
update
9a0449a
update
64fa131
Update column desriptions
88d6272
Add docs for turbot_notification table
bfc351e
removed unused code and formatted code
1d86d3b
Update community url
271d365
Update go version for build to 1.16 and update plugin with v1.7.0 of …
245dc9d
Merge branch 'main' of github.com:turbot/steampipe-plugin-turbot into…
204ba21
updates as per suggested reviews
24234b8
update
e8a763a
Update tables to support in clause when running query
Subhajit97 a1d4790
Add metadata { stats { total } } info to control and notifcation tab…
119b864
Resolve merge conflicts
cbruno10 843aa7e
Update notifications doc language
cbruno10 5de622a
update as per review
2648eee
Update column names, docs
aba43e1
update
e764c01
update
96c8b89
update
41e39ba
update
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
# Table: turbot_notification | ||
|
||
Notifications represent significant events in the lifecycle of turbot infrastructure, including: | ||
|
||
- History of change for a resource (e.g. my-bucket). | ||
- A log of state changes and actions performed by a control (e.g. my-bucket Tags). | ||
- Changes to policy settings, and the specific policy values they update. | ||
- Records of permission grants, activations, deactivations and revocations. | ||
|
||
Queries to this table must specify (usually in the `where` clause) at least one | ||
of these columns: `id`, `resource_id`, `notification_type`, `control_id`, `control_type_id`, | ||
`control_type_uri`, `resource_type_id`, `resource_type_uri`, `policy_type_id`, `policy_type_uri`, `actor_identity_id`, `create_timestamp` or `filter`. | ||
|
||
Please [refer](https://turbot.com/v5/docs/reference/filter/notifications#examples) for notification filter examples | ||
LalitLab marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Find all Turbot grants activations in last 1 week using `filter` | ||
|
||
```sql | ||
select | ||
grant_id, | ||
notification_type, | ||
grant_permission_type, | ||
grant_permission_level, | ||
create_timestamp, | ||
actor_trunk_title, | ||
grant_identity_trunk_title, | ||
grant_end_date, | ||
grant_identity_profile_id, | ||
resource_title | ||
from | ||
turbot_notification | ||
where | ||
filter = 'notificationType:activeGrant createTimestamp:>T-1w' | ||
and grant_permission_type = 'Turbot' | ||
order by | ||
create_timestamp desc, | ||
notification_type, | ||
actor_trunk_title, | ||
resource_title; | ||
``` | ||
|
||
### Find all AWS grants activations in last 7 days | ||
|
||
```sql | ||
select | ||
grant_id, | ||
notification_type, | ||
grant_permission_type, | ||
grant_permission_level, | ||
create_timestamp, | ||
actor_trunk_title, | ||
grant_identity_trunk_title, | ||
grant_end_date, | ||
grant_identity_profile_id, | ||
resource_title | ||
from | ||
turbot_notification | ||
where | ||
notification_type = 'active_grants_created' | ||
and create_timestamp >= (current_date - interval '7' day) | ||
and grant_permission_type = 'AWS' | ||
order by | ||
create_timestamp desc, | ||
notification_type, | ||
actor_trunk_title, | ||
resource_title; | ||
``` | ||
|
||
### Find all AWS S3 buckets created in last 7 days | ||
|
||
```sql | ||
select | ||
create_timestamp, | ||
resource_id, | ||
resource_title, | ||
resource_trunk_title, | ||
actor_trunk_title | ||
from | ||
turbot_notification | ||
where | ||
notification_type = 'resource_created' | ||
and create_timestamp >= (current_date - interval '7' day) | ||
and resource_type_uri = 'tmod:@turbot/aws-s3#/resource/types/bucket' | ||
order by | ||
create_timestamp desc; | ||
``` | ||
|
||
### All policy settings set on a given resource or below | ||
|
||
```sql | ||
select | ||
notification_type, | ||
create_timestamp, | ||
policy_id, | ||
policy_trunk_title, | ||
policy_type_uri, | ||
resource_trunk_title, | ||
resource_type_trunk_title, | ||
policy_read_only, | ||
policy_secret, | ||
policy_value | ||
from | ||
turbot_notification | ||
where | ||
resource_id = 191382256916538 | ||
and filter = 'notificationType:policySetting level:self,descendant' | ||
order by | ||
create_timestamp desc; | ||
``` | ||
|
||
### All policy settings notification for AWS > Account > Regions policy | ||
|
||
```sql | ||
select | ||
notification_type, | ||
create_timestamp, | ||
policy_id, | ||
resource_id, | ||
resource_trunk_title, | ||
policy_value | ||
from | ||
turbot_notification | ||
where | ||
policy_type_uri = 'tmod:@turbot/aws#/policy/types/regionsDefault' | ||
and filter = 'notificationType:policySetting level:self' | ||
order by | ||
create_timestamp desc; | ||
``` | ||
|
||
### All notification for AWS > Account > Budget > Budget control | ||
LalitLab marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```sql | ||
select | ||
notification_type, | ||
create_timestamp, | ||
control_id, | ||
resource_trunk_title, | ||
control_state, | ||
control_reason | ||
from | ||
turbot_notification | ||
where | ||
control_type_uri = 'tmod:@turbot/aws#/control/types/budget' | ||
and filter = 'notificationType:control level:self' | ||
order by | ||
resource_id, | ||
create_timestamp desc; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
module github.com/turbot/steampipe-plugin-turbot | ||
|
||
go 1.15 | ||
go 1.16 | ||
|
||
require ( | ||
github.com/blang/semver v3.5.1+incompatible | ||
github.com/go-yaml/yaml v2.1.0+incompatible | ||
github.com/hashicorp/terraform v0.12.0 | ||
github.com/machinebox/graphql v0.2.3-0.20180904014615-9835de6386a3 | ||
github.com/matryer/is v1.2.0 // indirect | ||
github.com/mattn/go-isatty v0.0.12 // indirect | ||
github.com/matryer/is v1.4.0 // indirect | ||
github.com/mitchellh/go-homedir v1.1.0 | ||
github.com/mitchellh/mapstructure v1.3.3 | ||
github.com/pkg/errors v0.9.1 | ||
github.com/stretchr/testify v1.6.1 | ||
github.com/turbot/go-kit v0.2.2-0.20210628165333-268ba0a30be3 | ||
github.com/turbot/steampipe-plugin-sdk v1.6.1 | ||
github.com/turbot/go-kit v0.3.0 | ||
github.com/turbot/steampipe-plugin-sdk v1.7.0 | ||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect | ||
gopkg.in/yaml.v2 v2.2.8 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use
must
, orrecommended
, since those are not required, but we can use those for faster query.