Skip to content

Commit

Permalink
allow IP address to be specified (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4c6565 committed Dec 2, 2022
1 parent fdc296f commit cba53e7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 422 deletions.
8 changes: 7 additions & 1 deletion cmd/ecloud/ecloud_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func ecloudInstanceCreateCmd(f factory.ClientFactory) *cobra.Command {
Use: "create",
Short: "Creates an instance",
Long: "This command creates an instance",
Example: "ans ecloud instance create --vpc vpc-abcdef12 --vcpu 2 --ram 2048 --volume 20 --image \"CentOS 7\"",
Example: "ans ecloud instance create --vpc vpc-abcdef12 --network net-abcdef12 --vcpu 2 --ram 2048 --volume 20 --image \"CentOS 7\"",
RunE: ecloudCobraRunEFunc(f, ecloudInstanceCreate),
}

Expand All @@ -135,6 +135,7 @@ func ecloudInstanceCreateCmd(f factory.ClientFactory) *cobra.Command {
cmd.Flags().StringSlice("ssh-key-pair", []string{}, "ID of SSH key pair, can be repeated")
cmd.Flags().String("host-group", "", "ID of host group to deploy to")
cmd.Flags().String("resource-tier", "", "ID of resource tier to deploy to. A default tier is chosen if not specified")
cmd.Flags().String("ip-address", "", "IP address to allocate for DHCP")
cmd.Flags().Bool("wait", false, "Specifies that the command should wait until the instance has been completely created")

return cmd
Expand All @@ -155,6 +156,11 @@ func ecloudInstanceCreate(service ecloud.ECloudService, cmd *cobra.Command, args
createRequest.SSHKeyPairIDs, _ = cmd.Flags().GetStringSlice("ssh-key-pair")
}

if cmd.Flags().Changed("ip-address") {
ipAddress, _ := cmd.Flags().GetString("ip-address")
createRequest.CustomIPAddress = connection.IPAddress(ipAddress)
}

imageFlag, _ := cmd.Flags().GetString("image")

if strings.HasPrefix(imageFlag, "img-") {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/ans-group/cli
go 1.18

require (
github.com/ans-group/sdk-go v1.16.0
github.com/ans-group/sdk-go v1.16.1
github.com/blang/semver v3.5.1+incompatible
github.com/golang/mock v1.6.0
github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/ans-group/go-durationstring v1.2.0 h1:UJIuQATkp0t1rBvZsHRwki33YHV9E+Ulro+3NbMB7MM=
github.com/ans-group/go-durationstring v1.2.0/go.mod h1:QGF9Mdpq9058QXaut8r55QWu6lcHX6i/GvF1PZVkV6o=
github.com/ans-group/sdk-go v1.16.0 h1:hHJhKaQzP3Kqa/fmrkgxR4HXLuarAYfMs4gVw52o3JQ=
github.com/ans-group/sdk-go v1.16.0/go.mod h1:Wfbz7OFd8SFIJy5Jun6AsrBnoUv9tp6H1DJhaKU01es=
github.com/ans-group/sdk-go v1.16.1 h1:6yjfc4BC1f16Ln9legoMhjlux+wX6ucRN4AhHhIuV6I=
github.com/ans-group/sdk-go v1.16.1/go.mod h1:Wfbz7OFd8SFIJy5Jun6AsrBnoUv9tp6H1DJhaKU01es=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
Expand Down
165 changes: 0 additions & 165 deletions internal/pkg/config/config.go.disabled

This file was deleted.

Loading

0 comments on commit cba53e7

Please sign in to comment.