Skip to content

Commit 6b6d432

Browse files
new mutation
1 parent 7988706 commit 6b6d432

File tree

1 file changed

+2
-40
lines changed

1 file changed

+2
-40
lines changed

pkg/codefresh/argo_runtime.go

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import (
99

1010
type (
1111
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)
1513
Get(ctx context.Context, name string) (*model.Runtime, error)
1614
List(ctx context.Context) ([]model.Runtime, error)
1715
Delete(ctx context.Context, runtimeName string) (int, error)
@@ -54,41 +52,7 @@ func newArgoRuntimeAPI(codefresh *codefresh) IRuntimeAPI {
5452
return &argoRuntime{codefresh: codefresh}
5553
}
5654

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) {
9256
jsonData := map[string]interface{}{
9357
"query": `
9458
mutation CreateRuntime($installationArgs: RuntimeInstallationArgs!) {
@@ -116,8 +80,6 @@ func (r *argoRuntime) CreateUsingNewMutation(ctx context.Context, opts *model.Ru
11680
return &res.Data.Runtime, nil
11781
}
11882

119-
120-
12183
func (r *argoRuntime) Get(ctx context.Context, name string) (*model.Runtime, error) {
12284
jsonData := map[string]interface{}{
12385
"query": `

0 commit comments

Comments
 (0)