1313 List (ctx context.Context ) ([]model.Runtime , error )
1414 ReportErrors (ctx context.Context , opts * model.ReportRuntimeErrorsArgs ) (int , error )
1515 Delete (ctx context.Context , runtimeName string ) (int , error )
16+ SetSharedConfigRepo (ctx context.Context , suggestedSharedConfigRepo string ) (string , error )
1617 }
1718
1819 argoRuntime struct {
@@ -53,6 +54,14 @@ type (
5354 }
5455 Errors []graphqlError
5556 }
57+
58+
59+ graphQlSetIscRepoResponse struct {
60+ Data struct {
61+ SetIscRepo string
62+ }
63+ Errors []graphqlError
64+ }
5665)
5766
5867func newArgoRuntimeAPI (codefresh * codefresh ) IRuntimeAPI {
@@ -234,3 +243,29 @@ func (r *argoRuntime) Delete(ctx context.Context, runtimeName string) (int, erro
234243
235244 return res .Data .DeleteRuntime , nil
236245}
246+
247+ func (r * argoRuntime ) SetSharedConfigRepo (ctx context.Context , suggestedSharedConfigRepo string ) (string , error ) {
248+ jsonData := map [string ]interface {}{
249+ "query" : `
250+ mutation setIscRepo($suggestedSharedConfigRepo: String!) {
251+ setIscRepo(suggestedSharedConfigRepo: $suggestedSharedConfigRepo)
252+ }
253+ ` ,
254+ "variables" : map [string ]interface {}{
255+ "suggestedSharedConfigRepo" : suggestedSharedConfigRepo ,
256+ },
257+ }
258+
259+ res := & graphQlSetIscRepoResponse {}
260+ err := r .codefresh .graphqlAPI (ctx , jsonData , res )
261+
262+ if err != nil {
263+ return "" , fmt .Errorf ("failed making a graphql API call while setting shared config repo: %w" , err )
264+ }
265+
266+ if len (res .Errors ) > 0 {
267+ return "nil" , graphqlErrorResponse {errors : res .Errors }
268+ }
269+
270+ return res .Data .SetIscRepo , nil
271+ }
0 commit comments