Closed laurensknoll closed 6 months ago
@misraved , @madhushreeray30 Could you review this PR?
Great to see the PR @laurensknoll 🎉 !!
Thank you so much for the contribution 👍.
@laurensknoll the changes look good 👍!!
Few questions before we move forward with the PR:
@laurensknoll the changes look good 👍!!
Few questions before we move forward with the PR:
- Do the updated SDK dependencies have any effect on the pre-existing tables?
From the SDK CHANGELOG, it is important to note the following points:
- Has the authentication mechanism changed?
- Has any column/response parameter been removed?
- Has the datatype of any column changed?
Happy to hear that @misraved . The SDK update did not affect the authentication mechanism, remove/rename columns or change data types.
PS. It would be useful to support a unit test to verify that with stub data or by supporting a transform.FromModel[model](func(m) { return m.GetId() })
-kind of method to guard this changes. Do you know if anything like that is planned?
@laurensknoll thank you for the answers 👍.
Apologies, but we do not have a strong unit test to verify the changes.
Could you please explain the usage of transform.FromModel[model](func(m) { return m.GetId() })
in more detail? We could consider integrating it into our plugin and would like to understand its functionality and potential benefits better.
@laurensknoll thank you for the answers 👍.
Apologies, but we do not have a strong unit test to verify the changes.
Could you please explain the usage of
transform.FromModel[model](func(m) { return m.GetId() })
in more detail? We could consider integrating it into our plugin and would like to understand its functionality and potential benefits better.
Hi @misraved ,
Sure, the transform.FromModel
takes a function instead of a string. This allows you to pass the interface method as ADUserInfo.GetId
. As a result, the method reference is checked at compile-time.
Example table definition:
func tableAzureAdUser(_ context.Context) *plugin.Table {
return &plugin.Table{
Name: "azuread_user",
...
Columns: []*plugin.Column{
{Name: "display_name", Transform: FromModel(ADUserInfo.GetDisplayName)},
{Name: "id", Transform: FromModel(ADUserInfo.GetId)},
{Name: "user_principal_name", Transform: FromModel(ADUserInfo.GetUserPrincipalName)},
...
},
}
}
Example FromModel implementation:
func FromModel[V interface{}, R interface{}](f func(obj V) R) *transform.ColumnTransforms {
fun := func(_ context.Context, d *transform.TransformData) (interface{}, error) {
item := d.HydrateItem.(*V)
if item == nil {
return nil, fmt.Errorf("failed to cast hyradeItem %T to model %T", d.HydrateItem, *new(V))
}
return f(*item), nil
}
return transform.From(fun)
}
Thanks @laurensknoll for the insight 👍!!
Apologies for the delay on this PR @laurensknoll
I have tested the changes and they look good. Could you please resolve the merge conflicts in the PR so that we can proceed with the release?
Thanks!!
Apologies for the delay on this PR @laurensknoll
I have tested the changes and they look good. Could you please resolve the merge conflicts in the PR so that we can proceed with the release?
Thanks!!
Thanks for the update @misraved . I've resolved the merge conflicts such that you can proceed with a final review.
This change adds support for querying appRoleAssignments: Assignments recording that a user, group, or service principal is assigned an app role for an app.
Because the appRoleAssignments are accessible via multiple entry points, the following tables are added:
Example queries
I've included a couple example queries, if needed, I can add more.
azuread_user_app_role_assignment get
azuread_user_app_role_assignment list
azuread_application_app_role_assigned_to get
azuread_application_app_role_assigned_to list