Jamie Hannaford | 924c09d | 2014-11-19 12:05:38 +0100 | [diff] [blame] | 1 | package secgroups |
| 2 | |
Jamie Hannaford | 558572f | 2014-11-24 14:31:57 +0100 | [diff] [blame] | 3 | import ( |
| 4 | "strconv" |
| 5 | |
| 6 | "github.com/rackspace/gophercloud" |
| 7 | ) |
Jamie Hannaford | 924c09d | 2014-11-19 12:05:38 +0100 | [diff] [blame] | 8 | |
| 9 | const ( |
| 10 | secgrouppath = "os-security-groups" |
Jamie Hannaford | 8badf1e | 2014-11-19 14:39:26 +0100 | [diff] [blame] | 11 | rulepath = "os-security-group-rules" |
Jamie Hannaford | 924c09d | 2014-11-19 12:05:38 +0100 | [diff] [blame] | 12 | ) |
| 13 | |
Jamie Hannaford | 558572f | 2014-11-24 14:31:57 +0100 | [diff] [blame] | 14 | func resourceURL(c *gophercloud.ServiceClient, id int) string { |
| 15 | return c.ServiceURL(secgrouppath, strconv.Itoa(id)) |
Jamie Hannaford | 924c09d | 2014-11-19 12:05:38 +0100 | [diff] [blame] | 16 | } |
| 17 | |
| 18 | func rootURL(c *gophercloud.ServiceClient) string { |
| 19 | return c.ServiceURL(secgrouppath) |
| 20 | } |
Jamie Hannaford | 1915179 | 2014-11-19 12:46:47 +0100 | [diff] [blame] | 21 | |
| 22 | func listByServerURL(c *gophercloud.ServiceClient, serverID string) string { |
| 23 | return c.ServiceURL(secgrouppath, "servers", serverID, secgrouppath) |
| 24 | } |
Jamie Hannaford | 8badf1e | 2014-11-19 14:39:26 +0100 | [diff] [blame] | 25 | |
| 26 | func rootRuleURL(c *gophercloud.ServiceClient) string { |
| 27 | return c.ServiceURL(rulepath) |
| 28 | } |
Jamie Hannaford | 61f81ca | 2014-11-19 14:44:33 +0100 | [diff] [blame] | 29 | |
Jamie Hannaford | 558572f | 2014-11-24 14:31:57 +0100 | [diff] [blame] | 30 | func resourceRuleURL(c *gophercloud.ServiceClient, id int) string { |
| 31 | return c.ServiceURL(rulepath, strconv.Itoa(id)) |
Jamie Hannaford | 61f81ca | 2014-11-19 14:44:33 +0100 | [diff] [blame] | 32 | } |
Jamie Hannaford | 740e4a3 | 2014-11-19 16:13:30 +0100 | [diff] [blame] | 33 | |
| 34 | func serverActionURL(c *gophercloud.ServiceClient, id string) string { |
| 35 | return c.ServiceURL("servers", id, "action") |
| 36 | } |