From 5312cdd66e9dacb5deeff658f8b43bdd1e42d078 Mon Sep 17 00:00:00 2001 From: Lauren Leach Date: Fri, 7 Aug 2026 14:45:30 -0700 Subject: [PATCH] Migrate off deprecated trait profile/status attributes baton-sdk v0.20.6 moved `profile`, `status`, and `created_at` off the trait messages onto attributes on `Resource`, deprecating the trait-level options and getters. staticcheck flags every remaining call with `SA1019`, so `verify / lint` is red on `main`. This migrates the connector to the resource-level API: - `With{User,Group,Role,App}Profile` -> `WithResourceProfile` - `WithStatus` / `WithDetailedStatus` -> `WithResourceStatus` - `WithCreatedAt` / `WithSecretCreatedAt` -> `WithResourceCreatedAt` - trait `GetProfile()` / `GetStatus()` reads -> the equivalent read on the resource The option type changes from a `*TraitOption` to a `ResourceOption`, so the calls move out of the trait slice and into the variadic tail of the `New*Resource` call. The two status enums are numerically identical, so the values map 1:1. Non-deprecated trait data (login, aliases, emails, secret type/expiry) is untouched. No behavioural change intended: the deprecated options already populated the resource-level fields. `golangci-lint run ./...` reports 0 issues after this change, and the package tests pass. --- pkg/connector/roles.go | 7 +++---- pkg/connector/users.go | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/connector/roles.go b/pkg/connector/roles.go index ac7190c5..2b81103c 100644 --- a/pkg/connector/roles.go +++ b/pkg/connector/roles.go @@ -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{} - 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 } diff --git a/pkg/connector/users.go b/pkg/connector/users.go index dc92ca19..23e37f71 100644 --- a/pkg/connector/users.go +++ b/pkg/connector/users.go @@ -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), "")) if err != nil { return nil, err }