Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Enabled property to Organization Run Tasks #382

Merged
merged 1 commit into from Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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