Skip to content

Commit

Permalink
Merge pull request #38 from furious-luke/master
Browse files Browse the repository at this point in the history
Allow for specifying reserved IP addresses
  • Loading branch information
JamesClonk authored Jul 11, 2017
2 parents 52e1d36 + 19f3546 commit 743eb4a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/commands_servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func serversCreate(cmd *cli.Cmd) {
hostname := cmd.StringOpt("hostname", "", "Hostname to assign to this server")
tag := cmd.StringOpt("tag", "", "Tag to assign to this server")
appID := cmd.StringOpt("a app", "", "If launching an application (OSID 186), this is the APPID to launch")
reservedIP := cmd.StringOpt("ip", "", "IP address of the floating IP to use as the main IP of this server")
ipv6 := cmd.BoolOpt("ipv6", false, "Assign an IPv6 subnet to this virtual machine (where available)")
privateNetworking := cmd.BoolOpt("private-networking", false, "Add private networking support for this virtual machine")
autoBackups := cmd.BoolOpt("autobackups", false, "Enable automatic backups for this virtual machine")
Expand All @@ -41,6 +42,7 @@ func serversCreate(cmd *cli.Cmd) {
Script: *script,
Snapshot: *snapshot,
SSHKey: *sshkey,
ReservedIP: *reservedIP,
IPV6: *ipv6,
PrivateNetworking: *privateNetworking,
AutoBackups: *autoBackups,
Expand Down
5 changes: 5 additions & 0 deletions lib/servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type ServerOptions struct {
UserData string
Snapshot string
SSHKey string
ReservedIP string
IPV6 bool
PrivateNetworking bool
AutoBackups bool
Expand Down Expand Up @@ -288,6 +289,10 @@ func (c *Client) CreateServer(name string, regionID, planID, osID int, options *
values.Add("SSHKEYID", options.SSHKey)
}

if options.ReservedIP != "" {
values.Add("reserved_ip_v4", options.ReservedIP)
}

values.Add("enable_ipv6", "no")
if options.IPV6 {
values.Set("enable_ipv6", "yes")
Expand Down

0 comments on commit 743eb4a

Please sign in to comment.