|
9 | 9 |
|
10 | 10 | type ( |
11 | 11 | IRuntimeAPI interface { |
12 | | - CreateUsingOldMutation(ctx context.Context, runtimeName, cluster, runtimeVersion, ingressHost string, componentNames []string) (*model.RuntimeCreationResponse, error) |
13 | | - CreateUsingNewMutation(ctx context.Context, opts *model.RuntimeInstallationArgs) (*model.RuntimeCreationResponse, error) |
14 | | - |
| 12 | + Create(ctx context.Context, opts *model.RuntimeInstallationArgs) (*model.RuntimeCreationResponse, error) |
15 | 13 | Get(ctx context.Context, name string) (*model.Runtime, error) |
16 | 14 | List(ctx context.Context) ([]model.Runtime, error) |
17 | 15 | Delete(ctx context.Context, runtimeName string) (int, error) |
@@ -54,41 +52,7 @@ func newArgoRuntimeAPI(codefresh *codefresh) IRuntimeAPI { |
54 | 52 | return &argoRuntime{codefresh: codefresh} |
55 | 53 | } |
56 | 54 |
|
57 | | -func (r *argoRuntime) CreateUsingOldMutation(ctx context.Context, runtimeName, cluster, runtimeVersion, ingressHost string, componentNames []string) (*model.RuntimeCreationResponse, error) { |
58 | | - jsonData := map[string]interface{}{ |
59 | | - "query": ` |
60 | | - mutation CreateRuntime( |
61 | | - $runtimeName: String!, $cluster: String!, $runtimeVersion: String!, $ingressHost: String, $componentNames: [String]! |
62 | | - ) { |
63 | | - runtime(runtimeName: $runtimeName, cluster: $cluster, runtimeVersion: $runtimeVersion, ingressHost: $ingressHost, componentNames: $componentNames) { |
64 | | - name |
65 | | - newAccessToken |
66 | | - } |
67 | | - } |
68 | | - `, |
69 | | - "variables": map[string]interface{}{ |
70 | | - "runtimeName": runtimeName, |
71 | | - "cluster": cluster, |
72 | | - "runtimeVersion": runtimeVersion, |
73 | | - "ingressHost": ingressHost, |
74 | | - "componentNames": componentNames, |
75 | | - }, |
76 | | - } |
77 | | - |
78 | | - res := &graphQlRuntimeCreationResponse{} |
79 | | - err := r.codefresh.graphqlAPI(ctx, jsonData, res) |
80 | | - if err != nil { |
81 | | - return nil, fmt.Errorf("failed making a graphql API call while creating runtime: %w", err) |
82 | | - } |
83 | | - |
84 | | - if len(res.Errors) > 0 { |
85 | | - return nil, graphqlErrorResponse{errors: res.Errors} |
86 | | - } |
87 | | - |
88 | | - return &res.Data.Runtime, nil |
89 | | -} |
90 | | - |
91 | | -func (r *argoRuntime) CreateUsingNewMutation(ctx context.Context, opts *model.RuntimeInstallationArgs) (*model.RuntimeCreationResponse, error) { |
| 55 | +func (r *argoRuntime) Create(ctx context.Context, opts *model.RuntimeInstallationArgs) (*model.RuntimeCreationResponse, error) { |
92 | 56 | jsonData := map[string]interface{}{ |
93 | 57 | "query": ` |
94 | 58 | mutation CreateRuntime($installationArgs: RuntimeInstallationArgs!) { |
@@ -116,8 +80,6 @@ func (r *argoRuntime) CreateUsingNewMutation(ctx context.Context, opts *model.Ru |
116 | 80 | return &res.Data.Runtime, nil |
117 | 81 | } |
118 | 82 |
|
119 | | - |
120 | | - |
121 | 83 | func (r *argoRuntime) Get(ctx context.Context, name string) (*model.Runtime, error) { |
122 | 84 | jsonData := map[string]interface{}{ |
123 | 85 | "query": ` |
|
0 commit comments