github.com/gophercloud/gophercloud@v1.11.0/openstack/messaging/v2/queues/urls.go (about)

     1  package queues
     2  
     3  import (
     4  	"net/url"
     5  
     6  	"github.com/gophercloud/gophercloud"
     7  )
     8  
     9  const (
    10  	apiVersion = "v2"
    11  	apiName    = "queues"
    12  )
    13  
    14  func commonURL(client *gophercloud.ServiceClient) string {
    15  	return client.ServiceURL(apiVersion, apiName)
    16  }
    17  
    18  func createURL(client *gophercloud.ServiceClient, queueName string) string {
    19  	return client.ServiceURL(apiVersion, apiName, queueName)
    20  }
    21  
    22  func listURL(client *gophercloud.ServiceClient) string {
    23  	return commonURL(client)
    24  }
    25  
    26  func updateURL(client *gophercloud.ServiceClient, queueName string) string {
    27  	return client.ServiceURL(apiVersion, apiName, queueName)
    28  }
    29  
    30  func getURL(client *gophercloud.ServiceClient, queueName string) string {
    31  	return client.ServiceURL(apiVersion, apiName, queueName)
    32  }
    33  
    34  func deleteURL(client *gophercloud.ServiceClient, queueName string) string {
    35  	return client.ServiceURL(apiVersion, apiName, queueName)
    36  }
    37  
    38  func statURL(client *gophercloud.ServiceClient, queueName string) string {
    39  	return client.ServiceURL(apiVersion, apiName, queueName, "stats")
    40  }
    41  
    42  func shareURL(client *gophercloud.ServiceClient, queueName string) string {
    43  	return client.ServiceURL(apiVersion, apiName, queueName, "share")
    44  }
    45  
    46  func purgeURL(client *gophercloud.ServiceClient, queueName string) string {
    47  	return client.ServiceURL(apiVersion, apiName, queueName, "purge")
    48  }
    49  
    50  // builds next page full url based on current url
    51  func nextPageURL(currentURL string, next string) (string, error) {
    52  	base, err := url.Parse(currentURL)
    53  	if err != nil {
    54  		return "", err
    55  	}
    56  	rel, err := url.Parse(next)
    57  	if err != nil {
    58  		return "", err
    59  	}
    60  	return base.ResolveReference(rel).String(), nil
    61  }