Skip to content

Commit 14c43ec

Browse files
authored
Merge pull request #9 from yoanbernabeu/add-swap
πŸ“¦ NEW: Add Swap Ext ips
2 parents cd45242 + 0e701b4 commit 14c43ec

27 files changed

+104
-25
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/spf13/cobra"
7+
)
8+
9+
func init() {
10+
rootCmd.AddCommand(swapExtIpsCmd)
11+
swapExtIpsCmd.Flags().String("envName", "", "An envName is required")
12+
swapExtIpsCmd.MarkFlagRequired("envName")
13+
swapExtIpsCmd.Flags().String("sourceNodeId", "", "An sourceNodeId is required")
14+
swapExtIpsCmd.MarkFlagRequired("sourceNodeId")
15+
swapExtIpsCmd.Flags().String("targetNodeId", "", "An targetNodeId is required")
16+
swapExtIpsCmd.MarkFlagRequired("targetNodeId")
17+
18+
rootCmd.AddGroup(&cobra.Group{ID: "Environment/Binder", Title: "Environment/Binder"})
19+
}
20+
21+
var swapExtIpsCmd = &cobra.Command{
22+
Use: "swapExtIps",
23+
Short: "Swaps external IP addresses between source and target nodes",
24+
Long: "Swaps external IP addresses between source and target nodes (just moves IP if the target node does not have one).",
25+
GroupID: "Environment/Binder",
26+
Example: `GoJelastic swapExtIps --token=token --url=url --envName=envName --sourceNodeId=sourceNodeId --targetNodeId=targetNodeId`,
27+
Run: func(cmd *cobra.Command, args []string) {
28+
token, _ := cmd.Flags().GetString("token")
29+
url, _ := cmd.Flags().GetString("url")
30+
envName, _ := cmd.Flags().GetString("envName")
31+
sourceNodeId, _ := cmd.Flags().GetString("sourceNodeId")
32+
targetNodeId, _ := cmd.Flags().GetString("targetNodeId")
33+
34+
finalUrl := url + "/environment/binder/rest/swapextips" + "?session=" + token + "&envName=" + envName + "&sourceNodeId=" + sourceNodeId + "&targetNodeId=" + targetNodeId
35+
36+
response := makeRequest(finalUrl, "GET", "")
37+
fmt.Println(response)
38+
},
39+
}

β€Ždocs/documentation/GoJelastic.mdβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ An Alternative and not official CLI for Jelastic
3636
* [GoJelastic redeployContainerById](GoJelastic_redeployContainerById.md) - Redeploy a container by id
3737
* [GoJelastic startEnv](GoJelastic_startEnv.md) - Start one environment
3838
* [GoJelastic stopEnv](GoJelastic_stopEnv.md) - Stop one environment
39+
* [GoJelastic swapExtIps](GoJelastic_swapExtIps.md) - Swaps external IP addresses between source and target nodes
3940

40-
###### Auto generated by spf13/cobra on 17-Jan-2023
41+
###### Auto generated by spf13/cobra on 4-Oct-2023

β€Ždocs/documentation/GoJelastic_completion.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ See each sub-command's help for details on how to use the generated script.
2929
* [GoJelastic completion powershell](GoJelastic_completion_powershell.md) - Generate the autocompletion script for powershell
3030
* [GoJelastic completion zsh](GoJelastic_completion_zsh.md) - Generate the autocompletion script for zsh
3131

32-
##### Auto generated by spf13/cobra on 17-Jan-2023
32+
##### Auto generated by spf13/cobra on 4-Oct-2023

β€Ždocs/documentation/GoJelastic_completion_bash.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ GoJelastic completion bash
4848

4949
* [GoJelastic completion](GoJelastic_completion.md) - Generate the autocompletion script for the specified shell
5050

51-
##### Auto generated by spf13/cobra on 17-Jan-2023
51+
##### Auto generated by spf13/cobra on 4-Oct-2023

β€Ždocs/documentation/GoJelastic_completion_fish.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ GoJelastic completion fish [flags]
3939

4040
* [GoJelastic completion](GoJelastic_completion.md) - Generate the autocompletion script for the specified shell
4141

42-
##### Auto generated by spf13/cobra on 17-Jan-2023
42+
##### Auto generated by spf13/cobra on 4-Oct-2023

β€Ždocs/documentation/GoJelastic_completion_powershell.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ GoJelastic completion powershell [flags]
3636

3737
* [GoJelastic completion](GoJelastic_completion.md) - Generate the autocompletion script for the specified shell
3838

39-
##### Auto generated by spf13/cobra on 17-Jan-2023
39+
##### Auto generated by spf13/cobra on 4-Oct-2023

β€Ždocs/documentation/GoJelastic_completion_zsh.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ GoJelastic completion zsh [flags]
5050

5151
* [GoJelastic completion](GoJelastic_completion.md) - Generate the autocompletion script for the specified shell
5252

53-
##### Auto generated by spf13/cobra on 17-Jan-2023
53+
##### Auto generated by spf13/cobra on 4-Oct-2023

β€Ždocs/documentation/GoJelastic_configure.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ GoJelastic configure --token=token --url=url
2828

2929
* [GoJelastic](GoJelastic.md) - An Alternative CLI for Jelastic
3030

31-
##### Auto generated by spf13/cobra on 17-Jan-2023
31+
##### Auto generated by spf13/cobra on 4-Oct-2023

β€Ždocs/documentation/GoJelastic_documentation.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ GoJelastic documentation
3333

3434
* [GoJelastic](GoJelastic.md) - An Alternative CLI for Jelastic
3535

36-
##### Auto generated by spf13/cobra on 17-Jan-2023
36+
##### Auto generated by spf13/cobra on 4-Oct-2023

β€Ždocs/documentation/GoJelastic_getAccount.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ GoJelastic billing/account getAccount --token=token --url=url --appid=appid
3434

3535
* [GoJelastic](GoJelastic.md) - An Alternative CLI for Jelastic
3636

37-
##### Auto generated by spf13/cobra on 17-Jan-2023
37+
##### Auto generated by spf13/cobra on 4-Oct-2023

0 commit comments

Comments
Β (0)