Skip to content

Commit

Permalink
fix: cr
Browse files Browse the repository at this point in the history
Signed-off-by: francois  samin <[email protected]>
  • Loading branch information
fsamin committed Oct 25, 2021
1 parent 4b8b2a6 commit b43c698
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 48 deletions.
12 changes: 6 additions & 6 deletions cli/cdsctl/project_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func projectIntegrationExportFunc(v cli.Values) error {

var projectIntegrationWorkerHooksExportCmd = cli.Command{
Name: "worker-hooks-export",
Short: "Export integration worker hooks available on a project",
Short: "Export integration worker hook configuration",
Ctx: []cli.Arg{
{Name: _ProjectKey},
},
Expand All @@ -129,7 +129,7 @@ var projectIntegrationWorkerHooksExportCmd = cli.Command{
}

func projectIntegrationWorkerHooksExportFunc(v cli.Values) error {
res, err := client.ProjectIntegrationWorkerHooksList(v.GetString(_ProjectKey), v.GetString("integration"))
res, err := client.ProjectIntegrationWorkerHooksGet(v.GetString(_ProjectKey), v.GetString("integration"))
if err != nil {
return err
}
Expand All @@ -145,7 +145,7 @@ func projectIntegrationWorkerHooksExportFunc(v cli.Values) error {

var projectIntegrationWorkerHooksImportCmd = cli.Command{
Name: "worker-hooks-import",
Short: "Import integration worker hooks on a project",
Short: "Import integration worker hook configuration",
Ctx: []cli.Arg{
{Name: _ProjectKey},
},
Expand All @@ -167,12 +167,12 @@ func projectIntegrationWorkerHooksImportFunc(v cli.Values) error {
return cli.WrapError(err, "unable to read file %s", v.GetString("filename"))
}

var whs []sdk.WorkerHookProjectIntegrationModel
if err := yaml.Unmarshal(btes, &whs); err != nil {
var wh sdk.WorkerHookProjectIntegrationModel
if err := yaml.Unmarshal(btes, &wh); err != nil {
return cli.WrapError(err, "unable to parse file %s", v.GetString("filename"))
}

err = client.ProjectIntegrationWorkerHooksImport(v.GetString(_ProjectKey), v.GetString("integration"), whs)
err = client.ProjectIntegrationWorkerHooksImport(v.GetString(_ProjectKey), v.GetString("integration"), wh)
if err != nil {
return err
}
Expand Down
12 changes: 6 additions & 6 deletions sdk/cdsclient/client_project_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,18 @@ func (c *client) ProjectIntegrationImport(projectKey string, content io.Reader,
return pf, nil
}

func (c *client) ProjectIntegrationWorkerHooksList(projectKey string, integrationName string) ([]sdk.WorkerHookProjectIntegrationModel, error) {
func (c *client) ProjectIntegrationWorkerHooksGet(projectKey string, integrationName string) (*sdk.WorkerHookProjectIntegrationModel, error) {
path := fmt.Sprintf("/project/%s/integrations/%s/workerhooks", projectKey, integrationName)
var res []sdk.WorkerHookProjectIntegrationModel
var res sdk.WorkerHookProjectIntegrationModel
if _, err := c.GetJSON(context.Background(), path, &res); err != nil {
return res, err
return &res, err
}
return res, nil
return &res, nil
}

func (c *client) ProjectIntegrationWorkerHooksImport(projectKey string, integrationName string, hooks []sdk.WorkerHookProjectIntegrationModel) error {
func (c *client) ProjectIntegrationWorkerHooksImport(projectKey string, integrationName string, hook sdk.WorkerHookProjectIntegrationModel) error {
path := fmt.Sprintf("/project/%s/integrations/%s/workerhooks", projectKey, integrationName)
if _, err := c.PostJSON(context.Background(), path, &hooks, nil); err != nil {
if _, err := c.PostJSON(context.Background(), path, &hook, nil); err != nil {
return err
}
return nil
Expand Down
4 changes: 2 additions & 2 deletions sdk/cdsclient/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ type ProjectClient interface {
ProjectRepositoryManagerList(projectKey string) ([]sdk.ProjectVCSServer, error)
ProjectRepositoryManagerDelete(projectKey string, repoManagerName string, force bool) error
ProjectAccess(ctx context.Context, projectKey, sessionID string, itemType sdk.CDNItemType) error
ProjectIntegrationWorkerHooksList(projectKey string, integrationName string) ([]sdk.WorkerHookProjectIntegrationModel, error)
ProjectIntegrationWorkerHooksImport(projectKey string, integrationName string, hooks []sdk.WorkerHookProjectIntegrationModel) error
ProjectIntegrationWorkerHooksGet(projectKey string, integrationName string) (*sdk.WorkerHookProjectIntegrationModel, error)
ProjectIntegrationWorkerHooksImport(projectKey string, integrationName string, hook sdk.WorkerHookProjectIntegrationModel) error
}

// ProjectKeysClient exposes project keys related functions
Expand Down
68 changes: 34 additions & 34 deletions sdk/cdsclient/mock_cdsclient/interface_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b43c698

Please sign in to comment.