-
Notifications
You must be signed in to change notification settings - Fork 3
Fix linter errors caused by deprecated attributes. #130
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,17 +99,15 @@ func accountType(s string) v2.UserTrait_AccountType { | |
| } | ||
| } | ||
|
|
||
| func userResource(u *client.User, parentResourceID *v2.ResourceId) (*v2.Resource, error) { | ||
| // Determine the user status based on the enabled field | ||
| var status v2.UserTrait_Status_Status | ||
| var statusMessage string | ||
| if u.Enabled { | ||
| status = v2.UserTrait_Status_STATUS_ENABLED | ||
| statusMessage = "Enabled" | ||
| } else { | ||
| status = v2.UserTrait_Status_STATUS_DISABLED | ||
| statusMessage = "Disabled" | ||
| func userStatus(enabled bool) (v2.Status_ResourceStatus, string) { | ||
| if enabled { | ||
| return v2.Status_RESOURCE_STATUS_ENABLED, "Enabled" | ||
| } | ||
| return v2.Status_RESOURCE_STATUS_DISABLED, "Disabled" | ||
| } | ||
|
|
||
| func userResource(u *client.User, parentResourceID *v2.ResourceId) (*v2.Resource, error) { | ||
| status, statusMessage := userStatus(u.Enabled) | ||
|
|
||
| attrs := make(map[string]any) | ||
| for k, v := range u.Attrs { | ||
|
|
@@ -120,21 +118,21 @@ func userResource(u *client.User, parentResourceID *v2.ResourceId) (*v2.Resource | |
| attrs["created_at"] = u.CreatedAt.Format(time.RFC3339) | ||
| attrs["updated_at"] = u.UpdatedAt.Format(time.RFC3339) | ||
|
|
||
| traits := []resource.UserTraitOption{ | ||
| userOpts := []resource.UserTraitOption{ | ||
| resource.WithEmail(u.Email, true), | ||
| resource.WithUserLogin(u.Id), | ||
| resource.WithDetailedStatus(status, statusMessage), | ||
| resource.WithEmployeeID(u.Id), | ||
| resource.WithAccountType(accountType(u.AccountType)), | ||
| resource.WithUserProfile(attrs), | ||
| resource.WithCreatedAt(u.CreatedAt), | ||
| } | ||
| return resource.NewUserResource( | ||
| return resource.NewResource( | ||
| u.Name, | ||
| userResourceType, | ||
| u.Id, | ||
| traits, | ||
| resource.WithUserTrait(userOpts...), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Suggestion: Dropping |
||
| resource.WithParentResourceID(parentResourceID), | ||
| resource.WithResourceStatus(status, statusMessage), | ||
| resource.WithResourceProfile(attrs), | ||
| resource.WithResourceCreatedAt(u.CreatedAt), | ||
| ) | ||
| } | ||
|
|
||
|
|
||
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.
🟡 Suggestion: The bulk of this PR moves
profileoff the user/group/role/app traits ontoResource.profile, but the only new assertions cover agent status and secretcreated_at. Nothing assertsr.GetProfile()is populated for users, groups, roles, or NHIs, so a dropped profile in that migration would pass CI silently. Consider adding arequire.NotNil(t, r.GetProfile())(plus a key spot-check) in the user/group/role/NHI tests.