Skip to content

Commit 8e87d47

Browse files
Merge pull request #102 from codefresh-io/installation-input-type-backwards-compatibility
installation-input-type-backwards-compatibility
2 parents f084dd2 + 6c739a0 commit 8e87d47

File tree

3 files changed

+154
-21
lines changed

3 files changed

+154
-21
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.34.9
1+
0.34.10

pkg/codefresh/argo_runtime.go

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ package codefresh
33
import (
44
"context"
55
"fmt"
6-
76
"github.com/codefresh-io/go-sdk/pkg/codefresh/model"
87
)
98

109
type (
1110
IRuntimeAPI interface {
12-
Create(ctx context.Context, runtimeName, cluster, runtimeVersion, ingressHost string, componentNames []string) (*model.RuntimeCreationResponse, error)
11+
Create(ctx context.Context, opts *model.RuntimeInstallationArgs) (*model.RuntimeCreationResponse, error)
1312
Get(ctx context.Context, name string) (*model.Runtime, error)
1413
List(ctx context.Context) ([]model.Runtime, error)
1514
Delete(ctx context.Context, runtimeName string) (int, error)
@@ -35,7 +34,7 @@ type (
3534

3635
graphQlRuntimeCreationResponse struct {
3736
Data struct {
38-
Runtime model.RuntimeCreationResponse
37+
CreateRuntime model.RuntimeCreationResponse
3938
}
4039
Errors []graphqlError
4140
}
@@ -52,29 +51,24 @@ func newArgoRuntimeAPI(codefresh *codefresh) IRuntimeAPI {
5251
return &argoRuntime{codefresh: codefresh}
5352
}
5453

55-
func (r *argoRuntime) Create(ctx context.Context, runtimeName, cluster, runtimeVersion, ingressHost string, componentNames []string) (*model.RuntimeCreationResponse, error) {
54+
func (r *argoRuntime) Create(ctx context.Context, opts *model.RuntimeInstallationArgs) (*model.RuntimeCreationResponse, error) {
5655
jsonData := map[string]interface{}{
5756
"query": `
58-
mutation CreateRuntime(
59-
$runtimeName: String!, $cluster: String!, $runtimeVersion: String!, $ingressHost: String, $componentNames: [String]!
60-
) {
61-
runtime(runtimeName: $runtimeName, cluster: $cluster, runtimeVersion: $runtimeVersion, ingressHost: $ingressHost, componentNames: $componentNames) {
57+
mutation CreateRuntime($installationArgs: RuntimeInstallationArgs!) {
58+
createRuntime(installationArgs: $installationArgs) {
6259
name
6360
newAccessToken
6461
}
6562
}
6663
`,
6764
"variables": map[string]interface{}{
68-
"runtimeName": runtimeName,
69-
"cluster": cluster,
70-
"runtimeVersion": runtimeVersion,
71-
"ingressHost": ingressHost,
72-
"componentNames": componentNames,
65+
"installationArgs": opts,
7366
},
7467
}
7568

7669
res := &graphQlRuntimeCreationResponse{}
7770
err := r.codefresh.graphqlAPI(ctx, jsonData, res)
71+
7872
if err != nil {
7973
return nil, fmt.Errorf("failed making a graphql API call while creating runtime: %w", err)
8074
}
@@ -83,7 +77,7 @@ func (r *argoRuntime) Create(ctx context.Context, runtimeName, cluster, runtimeV
8377
return nil, graphqlErrorResponse{errors: res.Errors}
8478
}
8579

86-
return &res.Data.Runtime, nil
80+
return &res.Data.CreateRuntime, nil
8781
}
8882

8983
func (r *argoRuntime) Get(ctx context.Context, name string) (*model.Runtime, error) {

pkg/codefresh/model/models_gen.go

Lines changed: 145 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)