github.com/gophercloud/gophercloud@v1.11.0/openstack/networking/v2/extensions/agents/urls.go (about)

     1  package agents
     2  
     3  import "github.com/gophercloud/gophercloud"
     4  
     5  const resourcePath = "agents"
     6  const dhcpNetworksResourcePath = "dhcp-networks"
     7  const l3RoutersResourcePath = "l3-routers"
     8  const bgpSpeakersResourcePath = "bgp-drinstances"
     9  const bgpDRAgentSpeakersResourcePath = "bgp-speakers"
    10  const bgpDRAgentAgentResourcePath = "bgp-dragents"
    11  
    12  func resourceURL(c *gophercloud.ServiceClient, id string) string {
    13  	return c.ServiceURL(resourcePath, id)
    14  }
    15  
    16  func rootURL(c *gophercloud.ServiceClient) string {
    17  	return c.ServiceURL(resourcePath)
    18  }
    19  
    20  func listURL(c *gophercloud.ServiceClient) string {
    21  	return rootURL(c)
    22  }
    23  
    24  func getURL(c *gophercloud.ServiceClient, id string) string {
    25  	return resourceURL(c, id)
    26  }
    27  
    28  func updateURL(c *gophercloud.ServiceClient, id string) string {
    29  	return resourceURL(c, id)
    30  }
    31  
    32  func deleteURL(c *gophercloud.ServiceClient, id string) string {
    33  	return resourceURL(c, id)
    34  }
    35  
    36  func dhcpNetworksURL(c *gophercloud.ServiceClient, id string) string {
    37  	return c.ServiceURL(resourcePath, id, dhcpNetworksResourcePath)
    38  }
    39  
    40  func l3RoutersURL(c *gophercloud.ServiceClient, id string) string {
    41  	return c.ServiceURL(resourcePath, id, l3RoutersResourcePath)
    42  }
    43  
    44  func listDHCPNetworksURL(c *gophercloud.ServiceClient, id string) string {
    45  	return dhcpNetworksURL(c, id)
    46  }
    47  
    48  func listL3RoutersURL(c *gophercloud.ServiceClient, id string) string {
    49  	return l3RoutersURL(c, id)
    50  }
    51  
    52  func scheduleDHCPNetworkURL(c *gophercloud.ServiceClient, id string) string {
    53  	return dhcpNetworksURL(c, id)
    54  }
    55  
    56  func scheduleL3RouterURL(c *gophercloud.ServiceClient, id string) string {
    57  	return l3RoutersURL(c, id)
    58  }
    59  
    60  func removeDHCPNetworkURL(c *gophercloud.ServiceClient, id string, networkID string) string {
    61  	return c.ServiceURL(resourcePath, id, dhcpNetworksResourcePath, networkID)
    62  }
    63  
    64  func removeL3RouterURL(c *gophercloud.ServiceClient, id string, routerID string) string {
    65  	return c.ServiceURL(resourcePath, id, l3RoutersResourcePath, routerID)
    66  }
    67  
    68  // return /v2.0/agents/{agent-id}/bgp-drinstances
    69  func listBGPSpeakersURL(c *gophercloud.ServiceClient, agentID string) string {
    70  	return c.ServiceURL(resourcePath, agentID, bgpSpeakersResourcePath)
    71  }
    72  
    73  // return /v2.0/agents/{agent-id}/bgp-drinstances
    74  func scheduleBGPSpeakersURL(c *gophercloud.ServiceClient, id string) string {
    75  	return listBGPSpeakersURL(c, id)
    76  }
    77  
    78  // return /v2.0/agents/{agent-id}/bgp-drinstances/{bgp-speaker-id}
    79  func removeBGPSpeakersURL(c *gophercloud.ServiceClient, agentID string, speakerID string) string {
    80  	return c.ServiceURL(resourcePath, agentID, bgpSpeakersResourcePath, speakerID)
    81  }
    82  
    83  // return /v2.0/bgp-speakers/{bgp-speaker-id}/bgp-dragents
    84  func listDRAgentHostingBGPSpeakersURL(c *gophercloud.ServiceClient, speakerID string) string {
    85  	return c.ServiceURL(bgpDRAgentSpeakersResourcePath, speakerID, bgpDRAgentAgentResourcePath)
    86  }