Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for specifying reserved IP addresses #38

Merged
merged 1 commit into from
Jul 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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