Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions pkg/connector/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ func newRoleResource(ctx context.Context, role string) (*v2.Resource, error) {
"name": role,
}

roleTraitOptions := []rs.RoleTraitOption{
rs.WithRoleProfile(profile),
}
roleTraitOptions := []rs.RoleTraitOption{}

@github-actions github-actions Bot Aug 7, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Suggestion: now that the profile option moved out, this empty slice literal only exists to fill the roleTraitOpts parameter. Passing nil directly (rs.NewRoleResource(role, roleResourceType, role, nil, rs.WithResourceProfile(profile))) is equivalent — WithRoleTrait() with no options still creates the role trait — and drops the variable entirely.


resource, err := rs.NewRoleResource(role, roleResourceType, role, roleTraitOptions)
resource, err := rs.NewRoleResource(role, roleResourceType, role, roleTraitOptions,
rs.WithResourceProfile(profile))
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/connector/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ func newUserResource(ctx context.Context, user *fastly.User) (*v2.Resource, erro
}

userTraits := []rs.UserTraitOption{
rs.WithUserProfile(profile),
rs.WithStatus(userStatus),
rs.WithUserLogin(user.Login),
}

resource, err := rs.NewUserResource(user.Name, userResourceType, user.ID, userTraits)
resource, err := rs.NewUserResource(user.Name, userResourceType, user.ID, userTraits,
rs.WithResourceProfile(profile),
rs.WithResourceStatus(v2.Status_ResourceStatus(userStatus), ""))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Suggestion: userStatus (line 36) is still typed as the deprecated trait enum v2.UserTrait_Status_Status and converted here. The values do line up 1:1 (UNSPECIFIED/ENABLED/DISABLED/DELETED = 0/1/2/3 in both enums), so this is correct today, but it's an unchecked cross-enum conversion that would silently produce the wrong status if the enums ever diverge. Declaring userStatus as v2.Status_ResourceStatus with v2.Status_RESOURCE_STATUS_DISABLED / ..._ENABLED drops both the cast and the last reference to the deprecated type.

if err != nil {
return nil, err
}
Expand Down
Loading