Skip to content

Commit

Permalink
Add Enabled property to Organization Run Tasks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
glennsarti committed Apr 27, 2022
1 parent 8aefc33 commit 83bb013
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions run_task.go
Expand Up @@ -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"`
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions run_task_integration_test.go
Expand Up @@ -33,6 +33,7 @@ func TestRunTasksCreate(t *testing.T) {
Name: runTaskName,
URL: runTaskServerURL,
Category: "task",
Enabled: Bool(true),
})
require.NoError(t, err)

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 83bb013

Please sign in to comment.