@@ -3,19 +3,19 @@ package codefresh
33import (
44 "context"
55 "fmt"
6-
7- // model "github.com/codefresh-io/go-sdk/pkg/codefresh/model/app-proxy"
86)
97
108type (
119 IAppProxyClustersAPI interface {
12- RemoveCluster (ctx context.Context , server string , runtime string ) error
10+ CreateArgoRollouts (ctx context.Context , server string , namespace string ) error
11+ Delete (ctx context.Context , server string , runtime string ) error
1312 }
13+
1414 appProxyClusters struct {
1515 codefresh * codefresh
1616 }
1717
18- graphqlClusterRemoveResponse struct {
18+ graphqlClusterResponse struct {
1919 Errors []graphqlError
2020 }
2121)
@@ -24,7 +24,36 @@ func newAppProxyClustersAPI(c *codefresh) IAppProxyClustersAPI {
2424 return & appProxyClusters {codefresh : c }
2525}
2626
27- func (c * appProxyClusters ) RemoveCluster (ctx context.Context , server string , runtime string ) error {
27+ func (c * appProxyClusters )CreateArgoRollouts (ctx context.Context , server string , namespace string ) error {
28+ jsonData := map [string ]interface {}{
29+ "query" : `
30+ mutation createArgoRollouts($args: CreateArgoRolloutsInput!) {
31+ createArgoRollouts(args: $args)
32+ }
33+ ` ,
34+ "variables" : map [string ]interface {}{
35+ "args" : map [string ]interface {}{
36+ "destServer" : server ,
37+ "destNamespace" : namespace ,
38+ },
39+ },
40+ }
41+
42+ res := & graphqlClusterResponse {}
43+ err := c .codefresh .graphqlAPI (ctx , jsonData , res )
44+
45+ if err != nil {
46+ return fmt .Errorf ("failed making a graphql API call to add rollouts: %w" , err )
47+ }
48+
49+ if len (res .Errors ) > 0 {
50+ return graphqlErrorResponse {errors : res .Errors }
51+ }
52+
53+ return nil
54+ }
55+
56+ func (c * appProxyClusters )Delete (ctx context.Context , server string , runtime string ) error {
2857 jsonData := map [string ]interface {}{
2958 "query" : `
3059 mutation RemoveCluster($server: String!, $runtime: String!) {
@@ -37,7 +66,7 @@ func (c *appProxyClusters) RemoveCluster(ctx context.Context, server string, run
3766 },
3867 }
3968
40- res := & graphqlClusterRemoveResponse {}
69+ res := & graphqlClusterResponse {}
4170 err := c .codefresh .graphqlAPI (ctx , jsonData , res )
4271
4372 if err != nil {
0 commit comments