blob: 2363d20331c5d29ed75ee8e78dc1a634800c72de [file] [log] [blame]
Jamie Hannaford924c09d2014-11-19 12:05:38 +01001package secgroups
2
Jamie Hannaford558572f2014-11-24 14:31:57 +01003import (
4 "strconv"
5
6 "github.com/rackspace/gophercloud"
7)
Jamie Hannaford924c09d2014-11-19 12:05:38 +01008
9const (
10 secgrouppath = "os-security-groups"
Jamie Hannaford8badf1e2014-11-19 14:39:26 +010011 rulepath = "os-security-group-rules"
Jamie Hannaford924c09d2014-11-19 12:05:38 +010012)
13
Jamie Hannaford558572f2014-11-24 14:31:57 +010014func resourceURL(c *gophercloud.ServiceClient, id int) string {
15 return c.ServiceURL(secgrouppath, strconv.Itoa(id))
Jamie Hannaford924c09d2014-11-19 12:05:38 +010016}
17
18func rootURL(c *gophercloud.ServiceClient) string {
19 return c.ServiceURL(secgrouppath)
20}
Jamie Hannaford19151792014-11-19 12:46:47 +010021
22func listByServerURL(c *gophercloud.ServiceClient, serverID string) string {
23 return c.ServiceURL(secgrouppath, "servers", serverID, secgrouppath)
24}
Jamie Hannaford8badf1e2014-11-19 14:39:26 +010025
26func rootRuleURL(c *gophercloud.ServiceClient) string {
27 return c.ServiceURL(rulepath)
28}
Jamie Hannaford61f81ca2014-11-19 14:44:33 +010029
Jamie Hannaford558572f2014-11-24 14:31:57 +010030func resourceRuleURL(c *gophercloud.ServiceClient, id int) string {
31 return c.ServiceURL(rulepath, strconv.Itoa(id))
Jamie Hannaford61f81ca2014-11-19 14:44:33 +010032}
Jamie Hannaford740e4a32014-11-19 16:13:30 +010033
34func serverActionURL(c *gophercloud.ServiceClient, id string) string {
35 return c.ServiceURL("servers", id, "action")
36}