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

Allow editing team for OnCall resources #864

Merged
merged 7 commits into from
Jun 26, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/grafana/amixr-api-go-client v0.0.7
github.com/grafana/amixr-api-go-client v0.0.9
github.com/grafana/grafana-api-golang-client v0.23.0
github.com/grafana/machine-learning-go-client v0.5.0
github.com/grafana/synthetic-monitoring-agent v0.16.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grafana/amixr-api-go-client v0.0.7 h1:U6W6yKxMMybI+Qz4zl+Vih48o6CczLaU/vjk2m7omvU=
github.com/grafana/amixr-api-go-client v0.0.7/go.mod h1:N6x26XUrM5zGtK5zL5vNJnAn2JFMxLFPPLTw/6pDkFE=
github.com/grafana/amixr-api-go-client v0.0.9 h1:yFlD40Qs4yZjdi/4acDJ0MeOuxO8rZCN9qFDTnbndDo=
github.com/grafana/amixr-api-go-client v0.0.9/go.mod h1:N6x26XUrM5zGtK5zL5vNJnAn2JFMxLFPPLTw/6pDkFE=
github.com/grafana/grafana-api-golang-client v0.23.0 h1:Uta0dSkxWYf1D83/E7MRLCG69387FiUc+k9U/35nMhY=
github.com/grafana/grafana-api-golang-client v0.23.0/go.mod h1:24W29gPe9yl0/3A9X624TPkAOR8DpHno490cPwnkv8E=
github.com/grafana/machine-learning-go-client v0.5.0 h1:Q1K+MPSy8vfMm2jsk3WQ7O77cGr2fM5hxwtPSoPc5NU=
Expand Down
4 changes: 3 additions & 1 deletion internal/resources/oncall/resource_escalation_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ func ResourceEscalationChainUpdate(ctx context.Context, d *schema.ResourceData,
client := m.(*common.Client).OnCallClient

nameData := d.Get("name").(string)
teamIDData := d.Get("team_id").(string)

updateOptions := &onCallAPI.UpdateEscalationChainOptions{
Name: nameData,
Name: nameData,
TeamId: teamIDData,
}

escalationChain, _, err := client.EscalationChains.UpdateEscalationChain(d.Id(), updateOptions)
Expand Down
2 changes: 2 additions & 0 deletions internal/resources/oncall/resource_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,13 @@ func ResourceIntegrationUpdate(ctx context.Context, d *schema.ResourceData, m in
client := m.(*common.Client).OnCallClient

nameData := d.Get("name").(string)
teamIDData := d.Get("team_id").(string)
templateData := d.Get("templates").([]interface{})
defaultRouteData := d.Get("default_route").([]interface{})

updateOptions := &onCallAPI.UpdateIntegrationOptions{
Name: nameData,
TeamId: teamIDData,
Templates: expandTemplates(templateData),
DefaultRoute: expandDefaultRoute(defaultRouteData),
}
Expand Down
2 changes: 2 additions & 0 deletions internal/resources/oncall/resource_outgoing_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,13 @@ func ResourceOutgoingWebhookUpdate(ctx context.Context, d *schema.ResourceData,
client := m.(*common.Client).OnCallClient

name := d.Get("name").(string)
teamID := d.Get("team_id").(string)
url := d.Get("url").(string)
forwardWholePayload := d.Get("forward_whole_payload").(bool)

updateOptions := &onCallAPI.UpdateCustomActionOptions{
Name: name,
TeamId: teamID,
Url: url,
ForwardWholePayload: forwardWholePayload,
}
Expand Down
6 changes: 4 additions & 2 deletions internal/resources/oncall/resource_schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,14 @@ func resourceScheduleUpdate(ctx context.Context, d *schema.ResourceData, m inter
client := m.(*common.Client).OnCallClient

nameData := d.Get("name").(string)
teamIDData := d.Get("team_id").(string)
slackData := d.Get("slack").([]interface{})
typeData := d.Get("type").(string)

updateOptions := &onCallAPI.UpdateScheduleOptions{
Name: nameData,
Slack: expandScheduleSlack(slackData),
Name: nameData,
TeamId: teamIDData,
Slack: expandScheduleSlack(slackData),
}

iCalURLPrimaryData, iCalURLPrimaryOk := d.GetOk("ical_url_primary")
Expand Down
2 changes: 2 additions & 0 deletions internal/resources/oncall/resource_shift.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,14 @@ func ResourceOnCallShiftUpdate(ctx context.Context, d *schema.ResourceData, m in

typeData := d.Get("type").(string)
nameData := d.Get("name").(string)
teamIDData := d.Get("team_id").(string)
startData := d.Get("start").(string)
durationData := d.Get("duration").(int)

updateOptions := &onCallAPI.UpdateOnCallShiftOptions{
Type: typeData,
Name: nameData,
TeamId: teamIDData,
Start: startData,
Duration: durationData,
Source: sourceTerraform,
Expand Down