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

Add azuread_conditional_access_named_location table #191

Conversation

TheRealHouseMouse
Copy link
Contributor

Example query results

Resolving issue - #190

Results
select * from azuread_conditional_access_named_location
![table_named_location](https://github.com/user-attachments/assets/7ce5963a-1017-4de9-bf46-8c4e97c3a16c)

@ParthaI
Copy link
Contributor

ParthaI commented Aug 5, 2024

Hi @TheRealHouseMouse, thank you for raising the PR. Could you please address the linting issues before we proceed?

@misraved
Copy link
Contributor

misraved commented Aug 6, 2024

@TheRealHouseMouse could you also add the missing table docs as well?

Thanks!!

@TheRealHouseMouse
Copy link
Contributor Author

Fixed the linting errors and added table docs 👍

Copy link
Contributor

@ParthaI ParthaI left a comment

Choose a reason for hiding this comment

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

Hi @TheRealHouseMouse, I have left a few review comments. Please have a look.

Additionally, It would be great if we could add more example queries in this table doc

Thanks!

azuread/plugin.go Show resolved Hide resolved
Get: &plugin.GetConfig{
Hydrate: getAdConditionalAccessNamedLocation,
IgnoreConfig: &plugin.IgnoreConfig{
ShouldIgnoreErrorFunc: isIgnorableErrorPredicate([]string{"Request_ResourceNotFound", "Invalid object identifier"}),
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 treat the Invalid object identifier error as a "not found" error? It appears that this error occurs when the input provided is incorrect. In my opinion, it would be better to notify the user to provide the correct input instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is the same error as in:
table_azuread_conditional_access_policy
table_azuread_user
table_azuread_group
And other tables in the plugin...
I can change them all to "Request_ResourceInvalidIdentifier" but I think it is better to keep it that way and not change the other tables.

List: &plugin.ListConfig{
Hydrate: listAdConditionalAccessNamedLocations,
IgnoreConfig: &plugin.IgnoreConfig{
ShouldIgnoreErrorFunc: isIgnorableErrorPredicate([]string{"Request_UnsupportedQuery"}),
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we are constructing the query parameter using the key qualifiers provided as query parameters. Are there any specific query parameter combinations where we encounter the Request_UnsupportedQuery error?

Additionally, I noticed that we only build the query parameter when the display_name is included in the WHERE clause.

Instead of adding this to the ignore configuration, it would be better if we could handle it directly in our table code by building the query parameter based on the API's behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm sorry I don't think I fully understand you. I copied this part from the other tables in the plugin. I changed the type column to location_type because type is a reserved in SQL. I can't think about a specific query parameter combinations where we encounter the Request_UnsupportedQuery.
Added support for id, location_type to be handled by our table code. Is it alright now?

azuread/table_azuread_conditional_access_named_location.go Outdated Show resolved Hide resolved
Comment on lines 103 to 106
case *models.IpNamedLocation:
d.StreamListItem(ctx, &ADIpNamedLocationInfo{t})
case *models.CountryNamedLocation:
d.StreamListItem(ctx, &ADCountryNamedLocationInfo{t})
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be ideal if we could use StreamList to structure the items in a generic structure rather than basing StreamList results on the response type.

This approach would be beneficial if this table is used as a parent for other tables in the future when retrieving parent table data.

For reference:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I managed to change it, but tool me a lot of time and the results isn't elegant at all. I'm not sure at all this is better than before. If you have a suggestion how to make it better please tell me. I think it might be better before this change.

azuread/table_azuread_conditional_access_named_location.go Outdated Show resolved Hide resolved
azuread/transforms.go Outdated Show resolved Hide resolved
azuread/table_azuread_conditional_access_named_location.go Outdated Show resolved Hide resolved
@misraved misraved changed the title Named locations table Add azuread_conditional_access_named_location table Aug 26, 2024
@ParthaI ParthaI changed the base branch from main to add-tabel-azuread-conditional-access-named-location September 4, 2024 08:50
@ParthaI ParthaI merged commit 17fdaaf into turbot:add-tabel-azuread-conditional-access-named-location Sep 4, 2024
1 check passed
misraved pushed a commit that referenced this pull request Sep 20, 2024

Co-authored-by: TheRealHouseMouse <[email protected]>
Co-authored-by: anon4mouse <[email protected]>
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.

Add table azuread_conditional_access_named_location
3 participants