Skip to content

Commit de3183f

Browse files
authored
Merge branch 'master' into master
2 parents 14f75bd + 3d05f48 commit de3183f

14 files changed

+191
-53
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ func main() {
3737
}
3838
}
3939

40-
4140
```
41+
42+
This is not an official Codefresh project.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.4
1+
0.5.1

cmd/create_runtime_environment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var createRuntimeEnvironmentCmd = &cobra.Command{
4040
Namespace: namespace,
4141
HasAgent: true,
4242
}
43-
re, err := codefreshClient.CreateRuntimeEnvironment(opt)
43+
re, err := codefreshClient.RuntimeEnvironments().Create(opt)
4444
if err == nil {
4545
fmt.Printf("Runtime-Environment %s created\n", re.Metadata.Name)
4646
}

cmd/create_token.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var createTokenCmd = &cobra.Command{
2828
Run: func(cmd *cobra.Command, args []string) {
2929
client := viper.Get("codefresh")
3030
codefreshClient := utils.CastToCodefreshOrDie(client)
31-
token, err := codefreshClient.GenerateToken("TestToken", "hybrid/codefresh-re")
31+
token, err := codefreshClient.Tokens().Create("TestToken", "hybrid/codefresh-re")
3232
internal.DieOnError(err)
3333
table := internal.CreateTable()
3434
table.SetHeader([]string{"name", "token"})

cmd/delete.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright © 2019 Codefresh.Inc
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package cmd
16+
17+
import (
18+
"github.com/spf13/cobra"
19+
)
20+
21+
// deleteCmd represents the delete command
22+
var deleteCmd = &cobra.Command{
23+
Use: "delete",
24+
}
25+
26+
func init() {
27+
rootCmd.AddCommand(deleteCmd)
28+
}

cmd/delete_runtime_environment.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright © 2019 Codefresh.Inc
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package cmd
16+
17+
import (
18+
"errors"
19+
"fmt"
20+
21+
"github.com/codefresh-io/go-sdk/internal"
22+
"github.com/codefresh-io/go-sdk/pkg/utils"
23+
"github.com/spf13/cobra"
24+
"github.com/spf13/viper"
25+
)
26+
27+
// deleteRuntimeEnvironmentCmd represents the deleteRuntimeEnvironment command
28+
var deleteRuntimeEnvironmentCmd = &cobra.Command{
29+
Use: "runtime-environment",
30+
Example: "cfcl delete runtime-environment [name_1] [name_2] ...",
31+
Short: "Delete a runtime-environment",
32+
Args: func(cmd *cobra.Command, args []string) error {
33+
if len(args) < 1 {
34+
return errors.New("requires name of the runtime-environment")
35+
}
36+
return nil
37+
},
38+
Run: func(cmd *cobra.Command, args []string) {
39+
client := viper.Get("codefresh")
40+
codefreshClient := utils.CastToCodefreshOrDie(client)
41+
for _, name := range args {
42+
_, err := codefreshClient.RuntimeEnvironments().Delete(name)
43+
internal.DieOnError(err)
44+
fmt.Printf("Runtime-environment %s deleted", name)
45+
}
46+
},
47+
}
48+
49+
func init() {
50+
deleteCmd.AddCommand(deleteRuntimeEnvironmentCmd)
51+
}

cmd/get_pipeline.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var getPipelineCmd = &cobra.Command{
3939
table := internal.CreateTable()
4040
table.SetHeader([]string{"Pipeline Name", "Created At", "Updated At"})
4141
table.Append([]string{"", "", ""})
42-
pipelines, err := codefreshClient.GetPipelines()
42+
pipelines, err := codefreshClient.Pipelines().List()
4343
internal.DieOnError(err)
4444
for _, p := range pipelines {
4545
table.Append([]string{

cmd/get_runtime_environment.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ var getRuntimeEnvironmentCmd = &cobra.Command{
2929
Run: func(cmd *cobra.Command, args []string) {
3030
client := viper.Get("codefresh")
3131
codefreshClient, _ := client.(codefresh.Codefresh)
32+
api := codefreshClient.RuntimeEnvironments()
3233
if len(args) > 0 {
33-
re, _ := codefreshClient.GetRuntimeEnvironment(args[0])
34+
re, _ := api.Get(args[0])
3435
fmt.Printf(re.Metadata.Name)
3536
} else {
36-
res, _ := codefreshClient.GetRuntimeEnvironments()
37+
res, _ := api.List()
3738
for _, re := range res {
3839
fmt.Println(re.Metadata.Name)
3940
}

cmd/get_tokens.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var getTokensCmd = &cobra.Command{
3434
table := internal.CreateTable()
3535
table.SetHeader([]string{"Created", "ID", "Name", "Reference Subject", "Reference Type", "Token"})
3636
table.Append([]string{"", "", ""})
37-
tokens, err := codefreshClient.GetTokens()
37+
tokens, err := codefreshClient.Tokens().List()
3838
internal.DieOnError(err)
3939
for _, t := range tokens {
4040
table.Append([]string{

cmd/run_pipeline.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var runPipelineCmd = &cobra.Command{
4040
client := viper.Get("codefresh")
4141
codefreshClient := utils.CastToCodefreshOrDie(client)
4242
for _, name := range args {
43-
build, err := codefreshClient.RunPipeline(name)
43+
build, err := codefreshClient.Pipelines().Run(name)
4444
internal.DieOnError(err)
4545
fmt.Printf("Pipeline started with ID: %s\n", build)
4646
}

0 commit comments

Comments
 (0)