Skip to content

Commit 202828b

Browse files
Ildar IskhakovInnokentii Konstantinov
andauthored
Allow editing team for OnCall resources (#864)
* Allow editing team for OnCall resources * Fix typo * Fix typo * Upgrade oncall go api client * Update go.mod * Format code --------- Co-authored-by: Innokentii Konstantinov <[email protected]>
1 parent 6870bae commit 202828b

File tree

7 files changed

+16
-6
lines changed

7 files changed

+16
-6
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.20
44

55
require (
66
github.com/Masterminds/semver/v3 v3.2.1
7-
github.com/grafana/amixr-api-go-client v0.0.7
7+
github.com/grafana/amixr-api-go-client v0.0.9
88
github.com/grafana/grafana-api-golang-client v0.23.0
99
github.com/grafana/machine-learning-go-client v0.5.0
1010
github.com/grafana/synthetic-monitoring-agent v0.16.3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
5959
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
6060
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
6161
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
62-
github.com/grafana/amixr-api-go-client v0.0.7 h1:U6W6yKxMMybI+Qz4zl+Vih48o6CczLaU/vjk2m7omvU=
63-
github.com/grafana/amixr-api-go-client v0.0.7/go.mod h1:N6x26XUrM5zGtK5zL5vNJnAn2JFMxLFPPLTw/6pDkFE=
62+
github.com/grafana/amixr-api-go-client v0.0.9 h1:yFlD40Qs4yZjdi/4acDJ0MeOuxO8rZCN9qFDTnbndDo=
63+
github.com/grafana/amixr-api-go-client v0.0.9/go.mod h1:N6x26XUrM5zGtK5zL5vNJnAn2JFMxLFPPLTw/6pDkFE=
6464
github.com/grafana/grafana-api-golang-client v0.23.0 h1:Uta0dSkxWYf1D83/E7MRLCG69387FiUc+k9U/35nMhY=
6565
github.com/grafana/grafana-api-golang-client v0.23.0/go.mod h1:24W29gPe9yl0/3A9X624TPkAOR8DpHno490cPwnkv8E=
6666
github.com/grafana/machine-learning-go-client v0.5.0 h1:Q1K+MPSy8vfMm2jsk3WQ7O77cGr2fM5hxwtPSoPc5NU=

internal/resources/oncall/resource_escalation_chain.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,11 @@ func ResourceEscalationChainUpdate(ctx context.Context, d *schema.ResourceData,
8383
client := m.(*common.Client).OnCallClient
8484

8585
nameData := d.Get("name").(string)
86+
teamIDData := d.Get("team_id").(string)
8687

8788
updateOptions := &onCallAPI.UpdateEscalationChainOptions{
88-
Name: nameData,
89+
Name: nameData,
90+
TeamId: teamIDData,
8991
}
9092

9193
escalationChain, _, err := client.EscalationChains.UpdateEscalationChain(d.Id(), updateOptions)

internal/resources/oncall/resource_integration.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,13 @@ func ResourceIntegrationUpdate(ctx context.Context, d *schema.ResourceData, m in
275275
client := m.(*common.Client).OnCallClient
276276

277277
nameData := d.Get("name").(string)
278+
teamIDData := d.Get("team_id").(string)
278279
templateData := d.Get("templates").([]interface{})
279280
defaultRouteData := d.Get("default_route").([]interface{})
280281

281282
updateOptions := &onCallAPI.UpdateIntegrationOptions{
282283
Name: nameData,
284+
TeamId: teamIDData,
283285
Templates: expandTemplates(templateData),
284286
DefaultRoute: expandDefaultRoute(defaultRouteData),
285287
}

internal/resources/oncall/resource_outgoing_webhook.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,13 @@ func ResourceOutgoingWebhookUpdate(ctx context.Context, d *schema.ResourceData,
145145
client := m.(*common.Client).OnCallClient
146146

147147
name := d.Get("name").(string)
148+
teamID := d.Get("team_id").(string)
148149
url := d.Get("url").(string)
149150
forwardWholePayload := d.Get("forward_whole_payload").(bool)
150151

151152
updateOptions := &onCallAPI.UpdateCustomActionOptions{
152153
Name: name,
154+
TeamId: teamID,
153155
Url: url,
154156
ForwardWholePayload: forwardWholePayload,
155157
}

internal/resources/oncall/resource_schedule.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,14 @@ func resourceScheduleUpdate(ctx context.Context, d *schema.ResourceData, m inter
160160
client := m.(*common.Client).OnCallClient
161161

162162
nameData := d.Get("name").(string)
163+
teamIDData := d.Get("team_id").(string)
163164
slackData := d.Get("slack").([]interface{})
164165
typeData := d.Get("type").(string)
165166

166167
updateOptions := &onCallAPI.UpdateScheduleOptions{
167-
Name: nameData,
168-
Slack: expandScheduleSlack(slackData),
168+
Name: nameData,
169+
TeamId: teamIDData,
170+
Slack: expandScheduleSlack(slackData),
169171
}
170172

171173
iCalURLPrimaryData, iCalURLPrimaryOk := d.GetOk("ical_url_primary")

internal/resources/oncall/resource_shift.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,14 @@ func ResourceOnCallShiftUpdate(ctx context.Context, d *schema.ResourceData, m in
304304

305305
typeData := d.Get("type").(string)
306306
nameData := d.Get("name").(string)
307+
teamIDData := d.Get("team_id").(string)
307308
startData := d.Get("start").(string)
308309
durationData := d.Get("duration").(int)
309310

310311
updateOptions := &onCallAPI.UpdateOnCallShiftOptions{
311312
Type: typeData,
312313
Name: nameData,
314+
TeamId: teamIDData,
313315
Start: startData,
314316
Duration: durationData,
315317
Source: sourceTerraform,

0 commit comments

Comments
 (0)