diff --git a/appservices/appservices.go b/appservices/appservices.go index 6cc05d0..5a0bf97 100644 --- a/appservices/appservices.go +++ b/appservices/appservices.go @@ -333,3 +333,7 @@ func CheckResponse(r *http.Response) error { return errorResponse } + +func pointer[T any](x T) *T { + return &x +} diff --git a/appservices/event_triggers_test.go b/appservices/event_triggers_test.go index 63f1e22..489fd47 100644 --- a/appservices/event_triggers_test.go +++ b/appservices/event_triggers_test.go @@ -21,7 +21,6 @@ import ( "testing" "github.com/go-test/deep" - "github.com/openlyinc/pointy" ) func TestEventTriggers_List(t *testing.T) { @@ -57,7 +56,7 @@ func TestEventTriggers_List(t *testing.T) { Type: "type", FunctionID: "1", FunctionName: "name", - Disabled: pointy.Bool(false), + Disabled: pointer(false), }, } @@ -99,7 +98,7 @@ func TestEventTriggers_Get(t *testing.T) { Type: "type", FunctionID: "1", FunctionName: "name", - Disabled: pointy.Bool(false), + Disabled: pointer(false), } if diff := deep.Equal(trigger, &expected); diff != nil { @@ -118,7 +117,7 @@ func TestEventTriggers_CreateDatabase(t *testing.T) { Name: "Test event trigger", Type: "DATABASE", FunctionID: "60c2badbbd2b5c170e91292d", - Disabled: pointy.Bool(false), + Disabled: pointer(false), Config: &EventTriggerConfig{ OperationTypes: []string{"INSERT", "UPDATE", "REPLACE", "DELETE"}, Database: "database", @@ -126,12 +125,12 @@ func TestEventTriggers_CreateDatabase(t *testing.T) { ServiceID: "60c2badbbd2b5c170e91292c", Match: `{"updateDescription.updatedFields.status": {"$exists": true}}`, Project: `{"updateDescription.updatedFields.FieldA": 1, "operationType": 1}`, - FullDocument: pointy.Bool(false), - FullDocumentBeforeChange: pointy.Bool(false), - TolerateResumeErrors: pointy.Bool(true), - SkipCatchupEvents: pointy.Bool(true), - MaximumThroughput: pointy.Bool(true), - Unordered: pointy.Bool(false), + FullDocument: pointer(false), + FullDocumentBeforeChange: pointer(false), + TolerateResumeErrors: pointer(true), + SkipCatchupEvents: pointer(true), + MaximumThroughput: pointer(true), + Unordered: pointer(false), }, EventProcessors: map[string]interface{}{ "AWS_EVENTBRIDGE": map[string]interface{}{ @@ -239,7 +238,7 @@ func TestEventTriggers_CreateDatabase(t *testing.T) { Type: "DATABASE", FunctionID: "60c2badbbd2b5c170e91292d", FunctionName: "name", - Disabled: pointy.Bool(false), + Disabled: pointer(false), Config: EventTriggerConfig{ OperationTypes: []string{"INSERT", "UPDATE", "REPLACE", "DELETE"}, Database: "sample_airbnb", @@ -254,12 +253,12 @@ func TestEventTriggers_CreateDatabase(t *testing.T) { "operationType": float64(1), "updateDescription.updatedFields.FieldA": float64(1), }, - FullDocument: pointy.Bool(false), - FullDocumentBeforeChange: pointy.Bool(false), - Unordered: pointy.Bool(false), - TolerateResumeErrors: pointy.Bool(true), - SkipCatchupEvents: pointy.Bool(true), - MaximumThroughput: pointy.Bool(true), + FullDocument: pointer(false), + FullDocumentBeforeChange: pointer(false), + Unordered: pointer(false), + TolerateResumeErrors: pointer(true), + SkipCatchupEvents: pointer(true), + MaximumThroughput: pointer(true), ClusterName: "cluster name", }, EventProcessors: map[string]interface{}{ @@ -271,7 +270,7 @@ func TestEventTriggers_CreateDatabase(t *testing.T) { }, }, }, - LastModified: pointy.Int64(int64(1623793011)), + LastModified: pointer(int64(1623793011)), } if diff := deep.Equal(updatedEventTriggersServiceOp, &expected); diff != nil { @@ -290,7 +289,7 @@ func TestEventTriggers_CreateAuthentication(t *testing.T) { Name: "Test event trigger", Type: "AUTHENTICATION", FunctionID: "60c2badbbd2b5c170e91292d", - Disabled: pointy.Bool(false), + Disabled: pointer(false), Config: &EventTriggerConfig{ OperationType: "LOGIN", Providers: []string{"anon-user", "local-userpass"}, @@ -379,7 +378,7 @@ func TestEventTriggers_CreateAuthentication(t *testing.T) { Type: "AUTHENTICATION", FunctionID: "60c2badbbd2b5c170e91292d", FunctionName: "name", - Disabled: pointy.Bool(false), + Disabled: pointer(false), Config: EventTriggerConfig{ OperationType: "LOGIN", Providers: []string{"anon-user", "local-userpass"}, @@ -395,7 +394,7 @@ func TestEventTriggers_CreateAuthentication(t *testing.T) { }, }, }, - LastModified: pointy.Int64(int64(1623793011)), + LastModified: pointer(int64(1623793011)), } if diff := deep.Equal(updatedEventTriggersServiceOp, &expected); diff != nil { @@ -414,7 +413,7 @@ func TestEventTriggers_CreateScheduled(t *testing.T) { Name: "Test event trigger", Type: "SCHEDULED", FunctionID: "60c2badbbd2b5c170e91292d", - Disabled: pointy.Bool(false), + Disabled: pointer(false), Config: &EventTriggerConfig{ Schedule: "* * * * *", }, @@ -496,7 +495,7 @@ func TestEventTriggers_CreateScheduled(t *testing.T) { Type: "SCHEDULED", FunctionID: "60c2badbbd2b5c170e91292d", FunctionName: "name", - Disabled: pointy.Bool(false), + Disabled: pointer(false), Config: EventTriggerConfig{ Schedule: "* * * * *", ScheduleType: "ADVANCED", @@ -510,7 +509,7 @@ func TestEventTriggers_CreateScheduled(t *testing.T) { }, }, }, - LastModified: pointy.Int64(int64(1623793011)), + LastModified: pointer(int64(1623793011)), } if diff := deep.Equal(updatedEventTriggersServiceOp, &expected); diff != nil { @@ -530,7 +529,7 @@ func TestEventTriggers_Update(t *testing.T) { Name: "Test event trigger update", Type: "Test event trigger update", FunctionID: "1", - Disabled: pointy.Bool(false), + Disabled: pointer(false), Config: &EventTriggerConfig{ OperationTypes: []string{"INSERT", "UPDATE"}, OperationType: "CREATE", @@ -540,7 +539,7 @@ func TestEventTriggers_Update(t *testing.T) { ServiceID: "3", Match: `{"updateDescription.updatedFields.status": {"$exists": true}}`, Project: `{"updateDescription.updatedFields.FieldA": 1, "operationType": 1}`, - FullDocument: pointy.Bool(false), + FullDocument: pointer(false), Schedule: "weekday", }, EventProcessors: map[string]interface{}{ @@ -616,7 +615,7 @@ func TestEventTriggers_Update(t *testing.T) { Type: "type", FunctionID: "1", FunctionName: "name", - Disabled: pointy.Bool(false), + Disabled: pointer(false), } if diff := deep.Equal(updatedEventTriggersServiceOp, &expected); diff != nil { diff --git a/go.mod b/go.mod index e71e516..8169e8e 100644 --- a/go.mod +++ b/go.mod @@ -7,11 +7,8 @@ toolchain go1.23.1 require ( github.com/go-test/deep v1.1.1 github.com/google/go-querystring v1.1.0 - github.com/openlyinc/pointy v1.2.0 go.mongodb.org/atlas v0.37.0 ) -require github.com/stretchr/testify v1.4.0 // indirect - // Incorrect release versioning retract v1.0.0 diff --git a/go.sum b/go.sum index 026678a..5605c6a 100644 --- a/go.sum +++ b/go.sum @@ -1,21 +1,9 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U= github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -github.com/openlyinc/pointy v1.2.0 h1:vbb/WoPbshyTH8j3/XYu3enlZfv+NHxAD15qTm1zbk0= -github.com/openlyinc/pointy v1.2.0/go.mod h1:JodZOTJoBNaAQHeU0F/SwA4PL0lg4pKF7fYFpX291P0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= go.mongodb.org/atlas v0.37.0 h1:zQnO1o5+bVP9IotpAYpres4UjMD2F4nwNEFTZhNL4ck= go.mongodb.org/atlas v0.37.0/go.mod h1:DJYtM+vsEpPEMSkQzJnFHrT0sP7ev6cseZc/GGjJYG8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=