Skip to content

Commit

Permalink
CR-11030 (#421)
Browse files Browse the repository at this point in the history
* bump

* wip

* refactor gsEdit for include exclude

* removed comments
  • Loading branch information
elad-codefresh authored Apr 20, 2022
1 parent 4462ab5 commit 98097c2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.42.0
0.43.0
34 changes: 19 additions & 15 deletions pkg/codefresh/ap_git-sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (

type (
IAppProxyGitSourcesAPI interface {
Create(ctx context.Context, appName, appSpecifier, destServer, destNamespace string, isInternal bool) error
Create(ctx context.Context, opts *appProxyModel.CreateGitSourceInput) error
Delete(ctx context.Context, appName string) error
Edit(ctx context.Context, appName, appSpecifier string) error
Edit(ctx context.Context, opts *appProxyModel.EditGitSourceInput) error
}

appProxyGitSources struct {
Expand All @@ -37,27 +37,29 @@ type (
graphqlGitSourceEditResponse struct {
Errors []graphqlError
}

)

func newAppProxyGitSourcesAPI(c *codefresh) IAppProxyGitSourcesAPI {
return &appProxyGitSources{codefresh: c}
}

func (c *appProxyGitSources) Create(ctx context.Context, appName, appSpecifier, destServer, destNamespace string, isInternal bool) error {

func (c *appProxyGitSources) Create(ctx context.Context, opts *appProxyModel.CreateGitSourceInput) error {
jsonData := map[string]interface{}{
"query": `
mutation CreateGitSource($args: CreateGitSourceInput!) {
createGitSource(args: $args)
}
`,
`,
"variables": map[string]interface{}{
"args": appProxyModel.CreateGitSourceInput{
AppName: appName,
AppSpecifier: appSpecifier,
DestServer: destServer,
DestNamespace: destNamespace,
IsInternal: &isInternal,
AppName: opts.AppName,
AppSpecifier: opts.AppSpecifier,
DestServer: opts.DestServer,
DestNamespace: opts.DestNamespace,
IsInternal: opts.IsInternal,
Include: opts.Include,
Exclude: opts.Exclude,
},
},
}
Expand All @@ -82,7 +84,7 @@ func (c *appProxyGitSources) Delete(ctx context.Context, appName string) error {
mutation DeleteApplication($args: DeleteApplicationInput!) {
deleteApplication(args: $args)
}
`,
`,
"variables": map[string]interface{}{
"args": appProxyModel.DeleteApplicationInput{
AppName: appName,
Expand All @@ -104,17 +106,19 @@ func (c *appProxyGitSources) Delete(ctx context.Context, appName string) error {
return nil
}

func (c *appProxyGitSources) Edit(ctx context.Context, appName, appSpecifier string) error {
func (c *appProxyGitSources) Edit(ctx context.Context, opts *appProxyModel.EditGitSourceInput) error {
jsonData := map[string]interface{}{
"query": `
mutation EditGitSource($args: EditGitSourceInput!) {
editGitSource(args: $args)
}
`,
`,
"variables": map[string]interface{}{
"args": appProxyModel.EditGitSourceInput{
AppName: appName,
AppSpecifier: appSpecifier,
AppName: opts.AppName,
AppSpecifier: opts.AppSpecifier,
Include: opts.Include,
Exclude: opts.Exclude,
},
},
}
Expand Down

0 comments on commit 98097c2

Please sign in to comment.