Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] subscription_id column not displaying wrong value in azure_diagnostic_setting table. Closes #98 #99

Merged
merged 3 commits into from
Apr 23, 2021

Conversation

rajeshbal65
Copy link
Contributor

@rajeshbal65 rajeshbal65 commented Apr 23, 2021

Integration test logs

Logs
Add passing integration test logs here

Example query results

Results
select resource_group, subscription_id from azure_diagnostic_setting;

+----------------+--------------------------------------+
| resource_group | subscription_id                      |
+----------------+--------------------------------------+
| turbot_rg      | d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8 |
| turbot_rg      | d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8 |
| turbot_rg      | d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8 |
+----------------+--------------------------------------+

select resource_group, subscription_id from azure_diagnostic_setting;

+----------------+--------------------------------------+
| resource_group | subscription_id                      |
+----------------+--------------------------------------+
| turbot_rg      | d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8 |
| turbot_rg      | d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8 |
| turbot_rg      | d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8 |
+----------------+--------------------------------------+

@rajeshbal65
Copy link
Contributor Author

Screenshot 2021-04-23 at 1 43 36 PM

Copy link
Contributor

@LalitLab LalitLab left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 185 to 204
func getDiagnosticSettingResourceGroup(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) {
plugin.Logger(ctx).Trace("getDiagnosticSettingResourceGroup")

var resourseGroupID string
storage_account_id := h.Item.(insights.DiagnosticSettingsResource).StorageAccountID
event_hub_authorization_rule_id := h.Item.(insights.DiagnosticSettingsResource).EventHubAuthorizationRuleID
workspace_id := h.Item.(insights.DiagnosticSettingsResource).WorkspaceID

if storage_account_id != nil {
resourseGroupID = strings.Split(*storage_account_id, "/")[4]
} else if event_hub_authorization_rule_id != nil {
resourseGroupID = strings.Split(*event_hub_authorization_rule_id, "/")[4]
} else {
resourseGroupID = strings.Split(*workspace_id, "/")[4]
}

plugin.Logger(ctx).Trace("resourseGroupID", resourseGroupID)

return resourseGroupID, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this a hydrate function when we are not making any API call in here?
Please convert it to a transform function

Copy link
Contributor

@LalitLab LalitLab left a comment

Choose a reason for hiding this comment

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

@rajeshbal65 left comment on it

Copy link
Contributor

@LalitLab LalitLab left a comment

Choose a reason for hiding this comment

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

LGTM

@LalitLab LalitLab changed the title subscription_id column might displaying wrong value in azure_diagnost… [Fix] subscription_id column might displaying wrong value in azure_diagnostic_setting table. Closes #98 Apr 23, 2021
@LalitLab LalitLab changed the title [Fix] subscription_id column might displaying wrong value in azure_diagnostic_setting table. Closes #98 [Fix] subscription_id column not displaying wrong value in azure_diagnostic_setting table. Closes #98 Apr 23, 2021
@LalitLab LalitLab merged commit 6da75a1 into main Apr 23, 2021
@LalitLab LalitLab deleted the issue-98 branch April 23, 2021 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

subscription_id column might displaying wrong value in azure_diagnostic_setting table.
2 participants