forked from railwayapp/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdown.go
More file actions
34 lines (25 loc) · 665 Bytes
/
Copy pathdown.go
File metadata and controls
34 lines (25 loc) · 665 Bytes
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
package gateway
import (
"context"
"github.com/railwayapp/cli/entity"
)
func (g *Gateway) Down(ctx context.Context, req *entity.DownRequest) error {
deployment, err := g.GetLatestDeploymentForEnvironment(ctx, req.ProjectID, req.EnvironmentID)
if err != nil {
return err
}
gqlReq, err := g.NewRequestWithAuth(`
mutation removeDeployment($projectId: ID!, $deploymentId: ID!) {
removeDeployment(projectId: $projectId, deploymentId: $deploymentId)
}
`)
if err != nil {
return err
}
gqlReq.Var("projectId", req.ProjectID)
gqlReq.Var("deploymentId", deployment.ID)
if err = gqlReq.Run(ctx, nil); err != nil {
return err
}
return nil
}