Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Add table turbot_notification #9

Merged
merged 29 commits into from
Dec 6, 2021
Merged

Add table turbot_notification #9

merged 29 commits into from
Dec 6, 2021

Conversation

LalitLab
Copy link
Contributor

@LalitLab LalitLab commented Oct 28, 2021

Integration test logs

Logs
Add passing integration test logs here

Example query results

Results
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;
Time: 4.601698261s
+-----------------+-----------------------+-----------------------+------------------------+----------------------+-------------------------------------------+-------------------------------------------+----------------------+---------------------------+----------------+
| 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 |
+-----------------+-----------------------+-----------------------+------------------------+----------------------+-------------------------------------------+-------------------------------------------+----------------------+---------------------------+----------------+
| 238901643745971 | active_grants_deleted | Turbot                | User                   | 2021-10-27T23:13:26Z | Turbot > Turbot Identity                  | Turbot > Google @ Turbot > Sumit Popat    | 2021-10-28T11:12:25Z | sumit@turbot.com          | Turbot         |
| 238901643745971 | active_grants_created | Turbot                | User                   | 2021-10-27T11:13:06Z | Turbot > Google @ Turbot > Lalit Bhardwaj | Turbot > Google @ Turbot > Sumit Popat    | 2021-10-28T11:12:25Z | sumit@turbot.com          | Turbot         |
| 238901331667624 | active_grants_created | Turbot                | Owner                  | 2021-10-27T11:08:01Z | Turbot > Google @ Turbot > Lalit Bhardwaj | Turbot > osborn-okta > Lalit Bhardwaj     | 2021-11-26T11:07:54Z | lalit@turbot.com          | Turbot         |
| 238888827550166 | active_grants_created | Turbot                | User                   | 2021-10-27T07:44:30Z | Turbot > Google @ Turbot > Lalit Bhardwaj | Turbot > Google @ Turbot > Lalit Bhardwaj | <null>               | lalit@turbot.com          | Turbot         |
| 231302229870086 | active_grants_deleted | Turbot                | Owner                  | 2021-10-27T07:40:28Z | Turbot > Google @ Turbot > Lalit Bhardwaj | Turbot > osborn-okta > Lalit Bhardwaj     | <null>               | lalit@turbot.com          | Turbot         |
+-----------------+-----------------------+-----------------------+------------------------+----------------------+-------------------------------------------+-------------------------------------------+----------------------+---------------------------+----------------+
 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 = 'Turbot'
order by
  create_timestamp desc,
  notification_type,
  actor_trunk_title,
  resource_title;
Time: 11.562638ms
+-----------------+-----------------------+-----------------------+------------------------+----------------------+-------------------------------------------+-------------------------------------------+----------------------+---------------------------+----------------+
| 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 |
+-----------------+-----------------------+-----------------------+------------------------+----------------------+-------------------------------------------+-------------------------------------------+----------------------+---------------------------+----------------+
| 238901643745971 | active_grants_created | Turbot                | User                   | 2021-10-27T11:13:06Z | Turbot > Google @ Turbot > Lalit Bhardwaj | Turbot > Google @ Turbot > Sumit Popat    | 2021-10-28T11:12:25Z | sumit@turbot.com          | Turbot         |
| 238901331667624 | active_grants_created | Turbot                | Owner                  | 2021-10-27T11:08:01Z | Turbot > Google @ Turbot > Lalit Bhardwaj | Turbot > osborn-okta > Lalit Bhardwaj     | 2021-11-26T11:07:54Z | lalit@turbot.com          | Turbot         |
| 238888827550166 | active_grants_created | Turbot                | User                   | 2021-10-27T07:44:30Z | Turbot > Google @ Turbot > Lalit Bhardwaj | Turbot > Google @ Turbot > Lalit Bhardwaj | <null>               | lalit@turbot.com          | Turbot         |
+-----------------+-----------------------+-----------------------+------------------------+----------------------+-------------------------------------------+-------------------------------------------+----------------------+---------------------------+----------------+
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;
Time: 2.079177189s
+----------------------+-----------------+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+--------------------------------+
| create_timestamp     | resource_id     | resource_title                                                  | resource_trunk_title                                                                                    | actor_trunk_title              |
+----------------------+-----------------+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+--------------------------------+
| 2021-10-25T13:52:17Z | 238734477228306 | datadog-aws432                                                  | Turbot > aaa > osborn-aaa > us-east-1 > datadog-aws432                                                  | Turbot > Turbot Identity       |
| 2021-10-25T13:31:09Z | 238733178618627 | datadog-aws-metric-stream-backup-013122550996-us-east-2         | Turbot > aaa > osborn-aaa > us-east-2 > datadog-aws-metric-stream-backup-013122550996-us-east-2         | Turbot > Unidentified Identity |
| 2021-10-25T13:28:12Z | 238732997144889 | datadog-aws-metric-stream-backup-013122550996-us-east-1         | Turbot > aaa > osborn-aaa > us-east-1 > datadog-aws-metric-stream-backup-013122550996-us-east-1         | Turbot > Unidentified Identity |
| 2021-10-25T13:20:54Z | 238732548951639 | datadog-forwarderstack-1vwg70vhie-forwarderbucket-1ftzd70autoaf | Turbot > aaa > osborn-aaa > us-east-1 > datadog-forwarderstack-1vwg70vhie-forwarderbucket-1ftzd70autoaf | Turbot > Turbot Identity       |
| 2021-10-25T12:46:41Z | 238730446513053 | cf-templates-4kbzu7qn81qq-us-east-1                             | Turbot > aaa > osborn-aaa > us-east-1 > cf-templates-4kbzu7qn81qq-us-east-1                             | Turbot > Turbot Identity       |
| 2021-10-22T08:34:37Z | 238449538433456 | test123-654                                                     | Turbot > aaa > osborn-aaa > us-east-1 > test123-654                                                     | Turbot > Turbot Identity       |
+----------------------+-----------------+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+--------------------------------+
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;
Time: 10.561273ms
+------------------------+----------------------+-----------------+-----------------+---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| notification_type      | create_timestamp     | policy_id       | resource_id     | resource_trunk_title      | policy_value                                                                                                                                                                                                                                                                                                 |
+------------------------+----------------------+-----------------+-----------------+---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| policy_setting_created | 2021-03-03T11:15:05Z | 217845048458699 | 191382256916538 | Turbot > aaa > osborn-aaa | ["ap-northeast-1","ap-northeast-2","ap-northeast-3","ap-south-1","ap-southeast-1","ap-southeast-2","ca-central-1","eu-central-1","eu-north-1","eu-west-1","eu-west-2","eu-west-3","sa-east-1","us-east-1","us-east-2","us-west-1","us-west-2","us-gov-east-1","us-gov-west-1","cn-north-1","cn-northwest-1"] |
| policy_setting_deleted | 2021-02-26T12:20:34Z | 196773147231852 | 191382256916538 | Turbot > aaa > osborn-aaa | ["us-east-1","us-east-2","us-west-1","us-west-2","ap-south-1","ap-northeast-2","ap-northeast-1","ap-southeast-1","ap-southeast-2","eu-west-2"]                                                                                                                                                               |
| policy_setting_updated | 2020-11-04T09:30:30Z | 196773147231852 | 191382256916538 | Turbot > aaa > osborn-aaa | ["us-east-1","us-east-2","us-west-1","us-west-2","ap-south-1","ap-northeast-2","ap-northeast-1","ap-southeast-1","ap-southeast-2","eu-west-2"]                                                                                                                                                               |
| policy_setting_created | 2020-07-08T07:07:56Z | 196773147231852 | 191382256916538 | Turbot > aaa > osborn-aaa | ["us*","ap*"]                                                                                                                                                                                                                                                                                                |
+------------------------+----------------------+-----------------+-----------------+---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

All alarm notification for AWS > Account > Budget > Budget control

 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' and control_state = 'alarm'
order by
  resource_id,
  create_timestamp desc;
Time: 1.979941191s
+-------------------+----------------------+-----------------+---------------------------+---------------+--------------------------------------------------------------------------+
| notification_type | create_timestamp     | control_id      | resource_trunk_title      | control_state | control_reason                                                           |
+-------------------+----------------------+-----------------+---------------------------+---------------+--------------------------------------------------------------------------+
| control_updated   | 2021-10-11T11:04:27Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2021-07-17T05:01:32Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2021-05-16T05:42:28Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2021-05-11T05:38:32Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2021-05-07T22:47:28Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2021-05-06T16:26:32Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2021-03-19T05:44:34Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2021-02-16T17:18:31Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2021-02-15T00:57:28Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2021-02-14T00:33:31Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2020-09-25T02:43:25Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Shutdown" state |
| control_updated   | 2020-09-04T09:09:49Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2020-09-04T01:57:40Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2020-07-07T18:41:24Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2020-07-04T19:31:46Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2020-07-01T21:05:54Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2020-06-20T09:22:42Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2020-05-20T01:56:52Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Over" state     |
| control_updated   | 2020-05-19T01:45:51Z | 191382257998362 | Turbot > aaa > osborn-aaa | alarm         | Account Spending is over the budget and has entered the "Critical" state |
+-------------------+----------------------+-----------------+---------------------------+---------------+--------------------------------------------------------------------------+

@LalitLab LalitLab self-assigned this Oct 28, 2021
- 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use must, or recommended, since those are not required, but we can use those for faster query.

Copy link
Contributor

@Subhajit97 Subhajit97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Subhajit97 Subhajit97 linked an issue Oct 29, 2021 that may be closed by this pull request
@cbruno10 cbruno10 removed the request for review from ParthaI November 29, 2021 17:45
@cbruno10 cbruno10 self-requested a review November 29, 2021 18:00
Copy link
Contributor

@cbruno10 cbruno10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LalitTurbot Please see comments/suggestions in the review.

In general, the changes requested are:

  • Ensure column names match the path, even if coming across something like grant_valid_to_timestamp. The only time we should deviate from this is not including the word turbot, since that's redundant, e.g., Turbot.Id is just Id, and for active grants, not including the word grant twice, e.g., ActiveGrant.Grant.Field would become active_grant_field.
  • Update all policy columns to start with policy_setting
  • Split grant and active grant columns to make it simpler

{Name: "filter", Type: proto.ColumnType_STRING, Transform: transform.FromQual("filter"), Description: "Filter used to search for notifications."},

// Actor info for the notification
{Name: "actor_trunk_title", Type: proto.ColumnType_STRING, Transform: transform.FromField("Actor.Identity.Trunk.Title").NullIfZero(), Description: "Title hierarchy of the actor from the root down to the actor of this event."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Name: "actor_trunk_title", Type: proto.ColumnType_STRING, Transform: transform.FromField("Actor.Identity.Trunk.Title").NullIfZero(), Description: "Title hierarchy of the actor from the root down to the actor of this event."},
{Name: "actor_identity_trunk_title", Type: proto.ColumnType_STRING, Transform: transform.FromField("Actor.Identity.Trunk.Title").NullIfZero(), Description: "Title hierarchy of the actor from the root down to the actor of this event."},

{Name: "resource_tags", Type: proto.ColumnType_JSON, Transform: transform.FromField("Resource.Turbot.Tags"), Description: "Tags attached to this resource."},

// Policy settings notification details
{Name: "policy_id", Type: proto.ColumnType_INT, Transform: transform.FromField("Turbot.PolicySettingID"), Description: "ID of the policy setting for this notification."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Name: "policy_id", Type: proto.ColumnType_INT, Transform: transform.FromField("Turbot.PolicySettingID"), Description: "ID of the policy setting for this notification."},
{Name: "policy_setting_id", Type: proto.ColumnType_INT, Transform: transform.FromField("Turbot.PolicySettingID"), Description: "ID of the policy setting for this notification."},

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these column names should start with policy_setting_, since there are policy settings and values within Turbot (even if there aren't notifications on policy values), so it will help users know we are specifically returning policy setting notifications.


// Policy settings notification details
{Name: "policy_id", Type: proto.ColumnType_INT, Transform: transform.FromField("Turbot.PolicySettingID"), Description: "ID of the policy setting for this notification."},
{Name: "policy_new_version_id", Type: proto.ColumnType_INT, Transform: transform.FromField("Turbot.PolicySettingNewVersionID"), Description: "Version ID of the policy setting after the event."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Name: "policy_new_version_id", Type: proto.ColumnType_INT, Transform: transform.FromField("Turbot.PolicySettingNewVersionID"), Description: "Version ID of the policy setting after the event."},
{Name: "policy_setting_new_version_id", Type: proto.ColumnType_INT, Transform: transform.FromField("Turbot.PolicySettingNewVersionID"), Description: "Version ID of the policy setting after the event."},

{Name: "policy_is_calculated", Type: proto.ColumnType_BOOL, Transform: transform.FromField("PolicySetting.isCalculated"), Description: "If true this setting contains calculated inputs e.g. templateInput and template."},
{Name: "policy_template", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.DefaultTemplate"), Description: "The Nunjucks template if this setting is for a calculated value."},
{Name: "policy_template_input", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.DefaultTemplateInput").Transform(formatPolicyFieldsValue), Description: "The GraphQL input query if this setting is for a calculated value."},
{Name: "policy_read_only", Type: proto.ColumnType_BOOL, Transform: transform.FromField("PolicySetting.Type.ReadOnly"), Description: "If true user-defined policy settings are blocked from being created."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Name: "policy_read_only", Type: proto.ColumnType_BOOL, Transform: transform.FromField("PolicySetting.Type.ReadOnly"), Description: "If true user-defined policy settings are blocked from being created."},
{Name: "policy_setting_type_read_only", Type: proto.ColumnType_BOOL, Transform: transform.FromField("PolicySetting.Type.ReadOnly"), Description: "If true user-defined policy settings are blocked from being created."},

{Name: "policy_trunk_title", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.Type.Trunk.Title"), Description: "This is the title of hierarchy from the root down to this policy type."},
{Name: "policy_is_calculated", Type: proto.ColumnType_BOOL, Transform: transform.FromField("PolicySetting.isCalculated"), Description: "If true this setting contains calculated inputs e.g. templateInput and template."},
{Name: "policy_template", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.DefaultTemplate"), Description: "The Nunjucks template if this setting is for a calculated value."},
{Name: "policy_template_input", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.DefaultTemplateInput").Transform(formatPolicyFieldsValue), Description: "The GraphQL input query if this setting is for a calculated value."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Name: "policy_template_input", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.DefaultTemplateInput").Transform(formatPolicyFieldsValue), Description: "The GraphQL input query if this setting is for a calculated value."},
{Name: "policy_setting_default_template_input", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.DefaultTemplateInput").Transform(formatPolicyFieldsValue), Description: "The GraphQL input query if this setting is for a calculated value."},

{Name: "grant_id", Type: proto.ColumnType_INT, Transform: fromField("Turbot.GrantID", "Turbot.ActiveGrantsID"), Description: "ID of the grant for this notification."},
{Name: "grant_new_version_id", Type: proto.ColumnType_INT, Transform: fromField("Turbot.GrantNewVersionID", "Turbot.ActiveGrantsNewVersionID"), Description: "Version ID of the grant after the event."},
{Name: "grant_old_version_id", Type: proto.ColumnType_INT, Transform: fromField("Turbot.GrantOldVersionID", "Turbot.ActiveGrantsOldVersionID"), Description: "Version ID of the grant before the event."},
{Name: "grant_end_date", Type: proto.ColumnType_TIMESTAMP, Transform: fromField("Grant.ValidToTimestamp", "ActiveGrant.Grant.ValidToTimestamp"), Description: "Optional end date for the grant."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Name: "grant_end_date", Type: proto.ColumnType_TIMESTAMP, Transform: fromField("Grant.ValidToTimestamp", "ActiveGrant.Grant.ValidToTimestamp"), Description: "Optional end date for the grant."},
{Name: "grant_valid_to_timestamp", Type: proto.ColumnType_TIMESTAMP, Transform: fromField("Grant.ValidToTimestamp"), Description: "Optional end date for the grant."},

We should keep the column name consistent with the GraphQL paths to make overall naming easier across this table, and all tables.

We should also have another column for active grants (but we exclude the second Grant since it's redundant):

			{Name: "active_grant_valid_to_timestamp", Type: proto.ColumnType_TIMESTAMP, Transform: fromField("Grant.ValidToTimestamp", "ActiveGrant.Grant.ValidToTimestamp"), Description: "Optional end date for the grant."},

{Name: "control_type_uri", Type: proto.ColumnType_STRING, Transform: transform.FromField("Control.Type.URI"), Description: "URI of the control type for this control."},
{Name: "control_type_trunk_title", Type: proto.ColumnType_STRING, Transform: transform.FromField("Control.Type.Trunk.Title"), Description: "This is the title of hierarchy from the root down to this control type."},

// ActiveGrants and Grants details
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please split all of the columns below into 2 sets of columns, 1 for grants, and 1 for active grants? I understand why you combined them and then suggesting to users they filter based on the grant type, but I think it's worth having 2 sets of columns to lay it out in the simplest way possible.

Columns: []*plugin.Column{
// Top columns
{Name: "id", Type: proto.ColumnType_INT, Transform: transform.FromField("Turbot.ID"), Description: "Unique identifier of the notification."},
{Name: "notifications_count", Type: proto.ColumnType_INT, Transform: transform.FromField("Count"), Description: "Total number of notification matching the searched filter in query. It will be same for all the records in the table for a query."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please remove this column? I think we'll add the ability to get counts but probably in a separate table.

@@ -30,6 +30,7 @@ func tableTurbotControl(ctx context.Context) *plugin.Table {
Columns: []*plugin.Column{
// Top columns
{Name: "id", Type: proto.ColumnType_INT, Transform: transform.FromField("Turbot.ID"), Description: "Unique identifier of the control."},
{Name: "controls_count", Type: proto.ColumnType_INT, Transform: transform.FromField("Count"), Description: "Total number of controls matching the searched filter in query. It will be same for all the records in the table for a query."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please remove this column? I think we'll add the ability to get counts but probably in a separate table.

Copy link
Contributor

@cbruno10 cbruno10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LalitTurbot I found some columns that still don't match up with the path, I made a few suggestions for ones that didn't match up, but didn't look at all of the column names. Can you please do another sweep and ensure that 100% of the columns are named correctly, and update any examples that reference them as well? Thanks!

{Name: "policy_setting_type_uri", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.Type.URI"), Description: "URI of the policy setting type for this notification."},
{Name: "policy_setting_trunk_title", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.Type.Trunk.Title"), Description: "This is the title of hierarchy from the root down to this policy type."},
{Name: "policy_setting_is_calculated", Type: proto.ColumnType_BOOL, Transform: transform.FromField("PolicySetting.isCalculated"), Description: "If true this setting contains calculated inputs e.g. templateInput and template."},
{Name: "policy_setting_template", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.DefaultTemplate"), Description: "The Nunjucks template if this setting is for a calculated value."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Name: "policy_setting_template", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.DefaultTemplate"), Description: "The Nunjucks template if this setting is for a calculated value."},
{Name: "policy_setting_default_template", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.DefaultTemplate"), Description: "The Nunjucks template if this setting is for a calculated value."},

{Name: "policy_setting_template", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.DefaultTemplate"), Description: "The Nunjucks template if this setting is for a calculated value."},
{Name: "policy_setting_default_template_input", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.DefaultTemplateInput").Transform(formatPolicyFieldsValue), Description: "The GraphQL input query if this setting is for a calculated value."},
{Name: "policy_setting_read_only", Type: proto.ColumnType_BOOL, Transform: transform.FromField("PolicySetting.Type.ReadOnly"), Description: "If true user-defined policy settings are blocked from being created."},
{Name: "policy_setting_secret", Type: proto.ColumnType_BOOL, Transform: transform.FromField("PolicySetting.Type.Secret"), Description: "If true policy value will be encrypted."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Name: "policy_setting_secret", Type: proto.ColumnType_BOOL, Transform: transform.FromField("PolicySetting.Type.Secret"), Description: "If true policy value will be encrypted."},
{Name: "policy_setting_type_secret", Type: proto.ColumnType_BOOL, Transform: transform.FromField("PolicySetting.Type.Secret"), Description: "If true policy value will be encrypted."},

{Name: "policy_setting_is_calculated", Type: proto.ColumnType_BOOL, Transform: transform.FromField("PolicySetting.isCalculated"), Description: "If true this setting contains calculated inputs e.g. templateInput and template."},
{Name: "policy_setting_template", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.DefaultTemplate"), Description: "The Nunjucks template if this setting is for a calculated value."},
{Name: "policy_setting_default_template_input", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.DefaultTemplateInput").Transform(formatPolicyFieldsValue), Description: "The GraphQL input query if this setting is for a calculated value."},
{Name: "policy_setting_read_only", Type: proto.ColumnType_BOOL, Transform: transform.FromField("PolicySetting.Type.ReadOnly"), Description: "If true user-defined policy settings are blocked from being created."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Name: "policy_setting_read_only", Type: proto.ColumnType_BOOL, Transform: transform.FromField("PolicySetting.Type.ReadOnly"), Description: "If true user-defined policy settings are blocked from being created."},
{Name: "policy_setting_type_read_only", Type: proto.ColumnType_BOOL, Transform: transform.FromField("PolicySetting.Type.ReadOnly"), Description: "If true user-defined policy settings are blocked from being created."},

{Name: "policy_setting_old_version_id", Type: proto.ColumnType_INT, Transform: transform.FromField("Turbot.PolicySettingOldVersionID"), Description: "Version ID of the policy setting before the event."},
{Name: "policy_setting_type_id", Type: proto.ColumnType_INT, Transform: transform.FromField("PolicySetting.Type.Turbot.ID").NullIfZero(), Description: "ID of the policy setting type for this notification."},
{Name: "policy_setting_type_uri", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.Type.URI"), Description: "URI of the policy setting type for this notification."},
{Name: "policy_setting_trunk_title", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.Type.Trunk.Title"), Description: "This is the title of hierarchy from the root down to this policy type."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Name: "policy_setting_trunk_title", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.Type.Trunk.Title"), Description: "This is the title of hierarchy from the root down to this policy type."},
{Name: "policy_setting_type_trunk_title", Type: proto.ColumnType_STRING, Transform: transform.FromField("PolicySetting.Type.Trunk.Title"), Description: "This is the title of hierarchy from the root down to this policy type."},

{Name: "active_grant_valid_to_timestamp", Type: proto.ColumnType_TIMESTAMP, Transform: fromField("ActiveGrant.Grant.ValidToTimestamp"), Description: "Optional end date for the grant."},
{Name: "active_grant_role_name", Type: proto.ColumnType_STRING, Transform: fromField("ActiveGrant.Grant.RoleName"), Description: "Optional custom roleName for this grant, when using existing roles rather than Turbot-managed ones."},
{Name: "active_grant_permission_type_id", Type: proto.ColumnType_INT, Transform: fromField("ActiveGrant.Grant.PermissionTypeID"), Description: "The unique identifier for the permission type."},
{Name: "active_grant_permission_type", Type: proto.ColumnType_STRING, Transform: fromField("ActiveGrant.Grant.Type.Title"), Description: "The name of the permission type."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Name: "active_grant_permission_type", Type: proto.ColumnType_STRING, Transform: fromField("ActiveGrant.Grant.Type.Title"), Description: "The name of the permission type."},
{Name: "active_grant_type_title", Type: proto.ColumnType_STRING, Transform: fromField("ActiveGrant.Grant.Type.Title"), Description: "The name of the permission type."},

{Name: "active_grant_permission_type_id", Type: proto.ColumnType_INT, Transform: fromField("ActiveGrant.Grant.PermissionTypeID"), Description: "The unique identifier for the permission type."},
{Name: "active_grant_permission_type", Type: proto.ColumnType_STRING, Transform: fromField("ActiveGrant.Grant.Type.Title"), Description: "The name of the permission type."},
{Name: "active_grant_permission_level_id", Type: proto.ColumnType_INT, Transform: fromField("ActiveGrant.Grant.PermissionLevelId"), Description: "The unique identifier for the permission level."},
{Name: "active_grant_permission_level", Type: proto.ColumnType_STRING, Transform: fromField("ActiveGrant.Grant.Level.Title"), Description: "The name of the permission level."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Name: "active_grant_permission_level", Type: proto.ColumnType_STRING, Transform: fromField("ActiveGrant.Grant.Level.Title"), Description: "The name of the permission level."},
{Name: "active_grant_level_title", Type: proto.ColumnType_STRING, Transform: fromField("ActiveGrant.Grant.Level.Title"), Description: "The name of the permission level."},

{Name: "grant_valid_to_timestamp", Type: proto.ColumnType_TIMESTAMP, Transform: fromField("Grant.ValidToTimestamp"), Description: "Optional end date for the grant."},
{Name: "grant_role_name", Type: proto.ColumnType_STRING, Transform: fromField("Grant.RoleName"), Description: "Optional custom roleName for this grant, when using existing roles rather than Turbot-managed ones."},
{Name: "grant_permission_type_id", Type: proto.ColumnType_INT, Transform: fromField("Grant.PermissionTypeID"), Description: "The unique identifier for the permission type."},
{Name: "grant_permission_type", Type: proto.ColumnType_STRING, Transform: fromField("Grant.Type.Title"), Description: "The name of the permission type."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Name: "grant_permission_type", Type: proto.ColumnType_STRING, Transform: fromField("Grant.Type.Title"), Description: "The name of the permission type."},
{Name: "grant_type_title", Type: proto.ColumnType_STRING, Transform: fromField("Grant.Type.Title"), Description: "The name of the permission type."},

{Name: "grant_permission_type_id", Type: proto.ColumnType_INT, Transform: fromField("Grant.PermissionTypeID"), Description: "The unique identifier for the permission type."},
{Name: "grant_permission_type", Type: proto.ColumnType_STRING, Transform: fromField("Grant.Type.Title"), Description: "The name of the permission type."},
{Name: "grant_permission_level_id", Type: proto.ColumnType_INT, Transform: fromField("Grant.PermissionLevelId"), Description: "The unique identifier for the permission level."},
{Name: "grant_permission_level", Type: proto.ColumnType_STRING, Transform: fromField("Grant.Level.Title"), Description: "The name of the permission level."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Name: "grant_permission_level", Type: proto.ColumnType_STRING, Transform: fromField("Grant.Level.Title"), Description: "The name of the permission level."},
{Name: "grant_level_title", Type: proto.ColumnType_STRING, Transform: fromField("Grant.Level.Title"), Description: "The name of the permission level."},

@cbruno10 cbruno10 merged commit f79d50b into main Dec 6, 2021
@cbruno10 cbruno10 deleted the turbot_notification branch December 6, 2021 16:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add table turbot_notifications
4 participants