Skip to content

Commit

Permalink
Allow configuring the auto resolve setting (#4)
Browse files Browse the repository at this point in the history
It allows to automatically resolve an issue if it hasn't been seen for this amount of time.
  • Loading branch information
johanneswuerbach authored and jianyuan committed Sep 29, 2016
1 parent 2a227f4 commit a355a34
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
24 changes: 17 additions & 7 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,32 @@ func (c *Client) DeleteTeam(organizationSlug, slug string) (*http.Response, erro
return resp, relevantError(err, apiErr)
}

type ProjectOptions struct {
ResolveAge int `json:"sentry:resolve_age"`
}

type Project struct {
Organization Organization `json:"organization"`
Team Team `json:"team"`
ID string `json:"id"`
Slug string `json:"slug"`
Name string `json:"name"`
Organization Organization `json:"organization"`
Team Team `json:"team"`
ID string `json:"id"`
Slug string `json:"slug"`
Name string `json:"name"`
Options ProjectOptions `json:"options"`
}

type CreateProjectParams struct {
Name string `json:"name"`
Slug string `json:"slug,omitempty"`
}

type UpdateProjectOptionsParams struct {
ResolveAge int `json:"sentry:resolve_age,omitempty"`
}

type UpdateProjectParams struct {
Name string `json:"name"`
Slug string `json:"slug,omitempty"`
Name string `json:"name"`
Slug string `json:"slug,omitempty"`
Options UpdateProjectOptionsParams `json:"options,omitempty"`
}

func (c *Client) GetProject(organizationSlug, slug string) (*Project, *http.Response, error) {
Expand Down
6 changes: 6 additions & 0 deletions resource_sentry_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ func resourceSentryProject() *schema.Resource {
Description: "The optional slug for this project",
Computed: true,
},
"resolve_age": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Description: "Number of hours after issues are automatically resolved",
},
},
}
}
Expand Down Expand Up @@ -81,6 +86,7 @@ func resourceSentryProjectRead(d *schema.ResourceData, meta interface{}) error {
d.Set("slug", proj.Slug)
d.Set("organization", proj.Organization.Slug)
d.Set("team", proj.Team.Slug)
d.Set("resolve_age", proj.Options.ResolveAge)
return nil
}

Expand Down

0 comments on commit a355a34

Please sign in to comment.