forked from superfly/flyctl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresource_vms.go
51 lines (44 loc) · 911 Bytes
/
resource_vms.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package api
import "context"
func (client *Client) RestartAllocation(ctx context.Context, appName string, allocId string) error {
query := `
mutation($input: RestartAllocationInput!) {
restartAllocation(input: $input) {
app {
name
}
allocation {
id
}
}
}
`
req := client.NewRequest(query)
req.Var("input", map[string]string{
"appId": appName,
"allocId": allocId,
})
_, err := client.RunWithContext(ctx, req)
return err
}
func (client *Client) StopAllocation(ctx context.Context, appName string, allocId string) error {
query := `
mutation($input: StopAllocationInput!) {
stopAllocation(input: $input) {
app {
name
}
allocation {
id
}
}
}
`
req := client.NewRequest(query)
req.Var("input", map[string]string{
"appId": appName,
"allocId": allocId,
})
_, err := client.RunWithContext(ctx, req)
return err
}