blob: cca5a745b6ae0ba6774e1cad80e55b62e59f220a [file] [log] [blame]
Ash Wilson6425a412014-08-29 12:30:35 -04001package gophercloud
2
3import "strings"
4
5// ServiceClient stores details required to interact with a specific service API implemented by a provider.
6// Generally, you'll acquire these by calling the appropriate `New` method on a ProviderClient.
7type ServiceClient struct {
Ash Wilsonc6372fe2014-09-03 11:24:52 -04008 // Provider is a reference to the provider that implements this service.
9 Provider *ProviderClient
Ash Wilson6425a412014-08-29 12:30:35 -040010
11 // Endpoint is the base URL of the service's API, acquired from a service catalog.
Ash Wilsonc6372fe2014-09-03 11:24:52 -040012 // It should NOT end with a /.
Ash Wilson6425a412014-08-29 12:30:35 -040013 Endpoint string
14}
15
16// ServiceURL constructs a URL for a resource belonging to this provider.
17func (client *ServiceClient) ServiceURL(parts ...string) string {
Ash Wilsonc6372fe2014-09-03 11:24:52 -040018 return client.Endpoint + "/" + strings.Join(parts, "/")
Ash Wilson6425a412014-08-29 12:30:35 -040019}