Skip to content

Commit 8be4a80

Browse files
chore: updating go-cfclient version
1 parent 670baeb commit 8be4a80

13 files changed

Lines changed: 38 additions & 28 deletions

File tree

go.mod

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
module github.com/SAP/crossplane-provider-cloudfoundry
22

3-
go 1.21
3+
go 1.23.0
4+
5+
toolchain go1.23.9
46

57
require (
6-
github.com/cloudfoundry/go-cfclient/v3 v3.0.0-alpha.9
8+
github.com/cloudfoundry/go-cfclient/v3 v3.0.0-alpha.12
79
github.com/crossplane-contrib/xp-testing v1.3.4
810
github.com/crossplane/crossplane-runtime v1.16.0-rc.1.0.20240424114634-8641eb2ba384
911
github.com/crossplane/crossplane-tools v0.0.0-20240522174801-1ad3d4c87f21
@@ -107,7 +109,7 @@ require (
107109
go.uber.org/zap v1.26.0 // indirect
108110
golang.org/x/mod v0.14.0 // indirect
109111
golang.org/x/net v0.23.0 // indirect
110-
golang.org/x/oauth2 v0.21.0 // indirect
112+
golang.org/x/oauth2 v0.28.0 // indirect
111113
golang.org/x/sync v0.6.0 // indirect
112114
golang.org/x/sys v0.18.0 // indirect
113115
golang.org/x/term v0.18.0 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqy
2020
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
2121
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
2222
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
23-
github.com/cloudfoundry/go-cfclient/v3 v3.0.0-alpha.9 h1:HK3+nJEPgwlhc5H74aw/V4mVowqWaTKGjHONdVQQ2Vw=
24-
github.com/cloudfoundry/go-cfclient/v3 v3.0.0-alpha.9/go.mod h1:eUjFfpsU3lRv388wKlXMmkQfsJ9pveUHZEia7AoBCPY=
23+
github.com/cloudfoundry/go-cfclient/v3 v3.0.0-alpha.12 h1:6ejqaobIjUY+HJWrwUW1dqiGz7s4PlG/fIDznCZwlS8=
24+
github.com/cloudfoundry/go-cfclient/v3 v3.0.0-alpha.12/go.mod h1:JmRWZTZEEup+5BlR+YYhzPUfJABidYEpIBNS10KjXqk=
2525
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q=
2626
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM=
2727
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
@@ -262,8 +262,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL
262262
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
263263
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
264264
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
265-
golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
266-
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
265+
golang.org/x/oauth2 v0.28.0 h1:CrgCKl8PPAVtLnU3c+EDw6x11699EWlsDeWNWKdIOkc=
266+
golang.org/x/oauth2 v0.28.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
267267
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
268268
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
269269
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

internal/clients/members/roles.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ import (
66

77
cfv3 "github.com/cloudfoundry/go-cfclient/v3/client"
88
"github.com/cloudfoundry/go-cfclient/v3/resource"
9+
"k8s.io/utils/ptr"
910

1011
"github.com/SAP/crossplane-provider-cloudfoundry/apis/resources/v1alpha1"
1112
"github.com/SAP/crossplane-provider-cloudfoundry/internal/clients"
1213
)
1314

1415
func toMemberKey(u *resource.User) string {
15-
user := v1alpha1.Member{Username: u.Username, Origin: u.Origin}
16+
user := v1alpha1.Member{Username: ptr.Deref(u.Username, ""), Origin: ptr.Deref(u.Origin, "")}
1617
return user.Key()
1718
}
1819

internal/clients/org/org.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func GenerateObservation(o *resource.Organization) v1alpha1.OrgObservation {
5656
ID: ptr.To(o.GUID),
5757
CreatedAt: ptr.To(o.CreatedAt.Format(time.RFC3339)),
5858
UpdatedAt: ptr.To(o.UpdatedAt.Format(time.RFC3339)),
59-
Suspended: o.Suspended,
59+
Suspended: ptr.To(o.Suspended),
6060
}
6161

6262
if o.Metadata != nil {
@@ -78,7 +78,7 @@ func LateInitialize(spec *v1alpha1.OrgParameters, from *resource.Organization) {
7878
}
7979

8080
if spec.Suspended == nil {
81-
spec.Suspended = from.Suspended
81+
spec.Suspended = ptr.To(from.Suspended)
8282
}
8383
// TODO: ADD labels and annotations
8484
}

internal/clients/orgquota/orgquota.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func intpToFloatp(in *int) *float64 {
9191
// and returns an OrgQuotaObservation.
9292
func GenerateObservation(o *resource.OrganizationQuota) v1alpha1.OrgQuotaObservation {
9393
obs := v1alpha1.OrgQuotaObservation{
94-
AllowPaidServicePlans: o.Services.PaidServicesAllowed,
94+
AllowPaidServicePlans: ptr.To(o.Services.PaidServicesAllowed),
9595
CreatedAt: ptr.To(o.CreatedAt.Format(time.RFC3339)),
9696
ID: ptr.To(o.GUID),
9797
InstanceMemory: intpToFloatp(o.Apps.PerProcessMemoryInMB),
@@ -207,7 +207,7 @@ func LateInitialize(spec *v1alpha1.OrgQuotaParameters, from *resource.Organizati
207207
changed = true
208208
}
209209
if spec.AllowPaidServicePlans == nil {
210-
spec.AllowPaidServicePlans = ptrDef(from.Services.PaidServicesAllowed, true)
210+
spec.AllowPaidServicePlans = ptr.To(from.Services.PaidServicesAllowed)
211211
changed = true
212212
}
213213
if spec.InstanceMemory == nil {

internal/clients/role/user.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
cfv3 "github.com/cloudfoundry/go-cfclient/v3/client"
77
"github.com/cloudfoundry/go-cfclient/v3/resource"
8+
"k8s.io/utils/ptr"
89
)
910

1011
// Member identifies a user by name and origin
@@ -19,7 +20,7 @@ type Member struct {
1920
func findRole(roles []*resource.Role, users []*resource.User, username, origin, roleType string) (*resource.Role, error) {
2021
var userGUID string
2122
for _, u := range users {
22-
if strings.EqualFold(u.Username, username) && strings.EqualFold(u.Origin, origin) {
23+
if strings.EqualFold(ptr.Deref(u.Username, ""), username) && strings.EqualFold(ptr.Deref(u.Origin, ""), origin) {
2324
userGUID = u.GUID
2425
break
2526
}

internal/clients/role/user_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/cloudfoundry/go-cfclient/v3/resource"
77
"github.com/stretchr/testify/assert"
88
"github.com/stretchr/testify/require"
9+
"k8s.io/utils/ptr"
910
)
1011

1112
// unit test for findRole
@@ -37,13 +38,13 @@ func TestFindRole(t *testing.T) {
3738
users := []*resource.User{
3839
{
3940
Resource: resource.Resource{GUID: "338b0d04-d537-4e4e-8c6f-f09ca0e7f56a"},
40-
Username: "user1",
41-
Origin: "sap.ids",
41+
Username: ptr.To("user1"),
42+
Origin: ptr.To("sap.ids"),
4243
},
4344
{
4445
Resource: resource.Resource{GUID: "338b0d04-d537-4e4e-8c6f-f09ca0e7f56b"},
45-
Username: "user2",
46-
Origin: "sap.ids",
46+
Username: ptr.To("user2"),
47+
Origin: ptr.To("sap.ids"),
4748
},
4849
}
4950

internal/controller/org/controller_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/crossplane/crossplane-runtime/pkg/reconciler/managed"
1414
"github.com/crossplane/crossplane-runtime/pkg/test"
1515
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
16+
"k8s.io/utils/ptr"
1617

1718
"github.com/SAP/crossplane-provider-cloudfoundry/apis/resources/v1alpha1"
1819
"github.com/SAP/crossplane-provider-cloudfoundry/internal/clients/fake"
@@ -46,7 +47,9 @@ func fakeOrg(m ...modifier) *v1alpha1.Organization {
4647
Annotations: map[string]string{},
4748
},
4849
Spec: v1alpha1.OrgSpec{
49-
ForProvider: v1alpha1.OrgParameters{},
50+
ForProvider: v1alpha1.OrgParameters{
51+
Suspended: ptr.To(false),
52+
},
5053
},
5154
}
5255

internal/controller/orgrole/controller_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/crossplane/crossplane-runtime/pkg/reconciler/managed"
1616
"github.com/crossplane/crossplane-runtime/pkg/test"
1717
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
18+
"k8s.io/utils/ptr"
1819

1920
"github.com/SAP/crossplane-provider-cloudfoundry/apis/resources/v1alpha1"
2021
"github.com/SAP/crossplane-provider-cloudfoundry/internal/clients/fake"
@@ -50,8 +51,8 @@ var (
5051
GUID: guidNoRefUser}}}}
5152

5253
healthyUser = &cfresource.User{
53-
Username: "user1",
54-
Origin: "sap.ids",
54+
Username: ptr.To("user1"),
55+
Origin: ptr.To("sap.ids"),
5556
Resource: cfresource.Resource{
5657
GUID: guidHealthyUser}}
5758
)

internal/controller/spacequota/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func isUpToDate(ctx context.Context,
152152
resp *cfresource.SpaceQuota) (bool, error) {
153153
spec := &cr.Spec.ForProvider
154154
if v := spec.AllowPaidServicePlans; v != nil {
155-
if !ptr.Equal(v, resp.Services.PaidServicesAllowed) {
155+
if *v != resp.Services.PaidServicesAllowed {
156156
return false, nil
157157
}
158158
}

0 commit comments

Comments
 (0)