|
14 | 14 | List(ctx context.Context) ([]model.Runtime, error) |
15 | 15 | ReportErrors(ctx context.Context, opts *model.ReportRuntimeErrorsArgs) (int, error) |
16 | 16 | Delete(ctx context.Context, runtimeName string) (int, error) |
| 17 | + DeleteManaged(ctx context.Context, runtimeName string) (int, error) |
17 | 18 | SetSharedConfigRepo(ctx context.Context, suggestedSharedConfigRepo string) (string, error) |
18 | 19 | } |
19 | 20 |
|
@@ -56,6 +57,13 @@ type ( |
56 | 57 | Errors []graphqlError |
57 | 58 | } |
58 | 59 |
|
| 60 | + graphQlDeleteManagedRuntimeResponse struct { |
| 61 | + Data struct { |
| 62 | + DeleteManagedRuntime int |
| 63 | + } |
| 64 | + Errors []graphqlError |
| 65 | + } |
| 66 | + |
59 | 67 |
|
60 | 68 | graphQlSuggestIscRepoResponse struct { |
61 | 69 | Data struct { |
@@ -121,6 +129,7 @@ func (r *argoRuntime) Get(ctx context.Context, name string) (*model.Runtime, err |
121 | 129 | runtimeVersion |
122 | 130 | installationStatus |
123 | 131 | repo |
| 132 | + managed |
124 | 133 | } |
125 | 134 | } |
126 | 135 | `, |
@@ -168,6 +177,7 @@ func (r *argoRuntime) List(ctx context.Context) ([]model.Runtime, error) { |
168 | 177 | ingressHost |
169 | 178 | runtimeVersion |
170 | 179 | installationStatus |
| 180 | + managed |
171 | 181 | } |
172 | 182 | } |
173 | 183 | } |
@@ -246,6 +256,33 @@ func (r *argoRuntime) Delete(ctx context.Context, runtimeName string) (int, erro |
246 | 256 | return res.Data.DeleteRuntime, nil |
247 | 257 | } |
248 | 258 |
|
| 259 | +func (r *argoRuntime) DeleteManaged(ctx context.Context, runtimeName string) (int, error) { |
| 260 | + jsonData := map[string]interface{}{ |
| 261 | + "query": ` |
| 262 | + mutation DeleteManagedRuntime( |
| 263 | + $name: String! |
| 264 | + ) { |
| 265 | + deleteManagedRuntime(name: $name) |
| 266 | + } |
| 267 | + `, |
| 268 | + "variables": map[string]interface{}{ |
| 269 | + "name": runtimeName, |
| 270 | + }, |
| 271 | + } |
| 272 | + |
| 273 | + res := graphQlDeleteManagedRuntimeResponse{} |
| 274 | + err := r.codefresh.graphqlAPI(ctx, jsonData, &res) |
| 275 | + if err != nil { |
| 276 | + return 0, fmt.Errorf("failed making a graphql API call to deleteManagedRuntime: %w", err) |
| 277 | + } |
| 278 | + |
| 279 | + if len(res.Errors) > 0 { |
| 280 | + return 0, graphqlErrorResponse{errors: res.Errors} |
| 281 | + } |
| 282 | + |
| 283 | + return res.Data.DeleteManagedRuntime, nil |
| 284 | +} |
| 285 | + |
249 | 286 | func (r *argoRuntime) SetSharedConfigRepo(ctx context.Context, suggestedSharedConfigRepo string) (string, error) { |
250 | 287 | jsonData := map[string]interface{}{ |
251 | 288 | "query": ` |
|
0 commit comments