From 83bb013bc31e41daaffa8b97191185ff0b9cb095 Mon Sep 17 00:00:00 2001 From: Glenn Sarti Date: Wed, 20 Apr 2022 16:26:15 +0800 Subject: [PATCH] Add Enabled property to Organization Run Tasks The Organizationl level run tasks have been updated with an `enabled` property in the API. This commit adds this new property to the Run Tasks interfaces. --- run_task.go | 7 +++++++ run_task_integration_test.go | 2 ++ 2 files changed, 9 insertions(+) diff --git a/run_task.go b/run_task.go index c38c09a98..ffbaf0d17 100644 --- a/run_task.go +++ b/run_task.go @@ -48,6 +48,7 @@ type RunTask struct { URL string `jsonapi:"attr,url"` Category string `jsonapi:"attr,category"` HMACKey *string `jsonapi:"attr,hmac-key,omitempty"` + Enabled bool `jsonapi:"attr,enabled"` Organization *Organization `jsonapi:"relation,organization"` WorkspaceRunTasks []*WorkspaceRunTask `jsonapi:"relation,workspace-tasks"` @@ -102,6 +103,9 @@ type RunTaskCreateOptions struct { // Optional: An HMAC key to verify the run task HMACKey *string `jsonapi:"attr,hmac-key,omitempty"` + + // Optional: Whether the task should be enabled + Enabled *bool `jsonapi:"attr,enabled,omitempty"` } // RunTaskUpdateOptions represents the set of options for updating an organization's run task @@ -123,6 +127,9 @@ type RunTaskUpdateOptions struct { // Optional: An HMAC key to verify the run task HMACKey *string `jsonapi:"attr,hmac-key,omitempty"` + + // Optional: Whether the task should be enabled + Enabled *bool `jsonapi:"attr,enabled,omitempty"` } // Create is used to create a new run task for an organization diff --git a/run_task_integration_test.go b/run_task_integration_test.go index 7a1daafff..e9d08a4d3 100644 --- a/run_task_integration_test.go +++ b/run_task_integration_test.go @@ -33,6 +33,7 @@ func TestRunTasksCreate(t *testing.T) { Name: runTaskName, URL: runTaskServerURL, Category: "task", + Enabled: Bool(true), }) require.NoError(t, err) @@ -93,6 +94,7 @@ func TestRunTasksRead(t *testing.T) { assert.Equal(t, runTaskTest.URL, r.URL) assert.Equal(t, runTaskTest.Category, r.Category) assert.Equal(t, runTaskTest.HMACKey, r.HMACKey) + assert.Equal(t, runTaskTest.Enabled, r.Enabled) }) t.Run("with options", func(t *testing.T) {