github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/identity/v3/users/urls.go (about)

     1  package users
     2  
     3  import (
     4  	"strings"
     5  
     6  	"github.com/opentelekomcloud/gophertelekomcloud"
     7  )
     8  
     9  const (
    10  	rootPath          = "users"
    11  	openstackUserPath = "OS-USER"
    12  	groupsPath        = "groups"
    13  	projectPath       = "projects"
    14  	welcomePath       = "welcome"
    15  )
    16  
    17  func listURL(client *golangsdk.ServiceClient) string {
    18  	return client.ServiceURL(rootPath)
    19  }
    20  
    21  func getURL(client *golangsdk.ServiceClient, userID string) string {
    22  	return client.ServiceURL(rootPath, userID)
    23  }
    24  
    25  func createURL(client *golangsdk.ServiceClient) string {
    26  	return client.ServiceURL(rootPath)
    27  }
    28  
    29  func updateURL(client *golangsdk.ServiceClient, userID string) string {
    30  	return client.ServiceURL(rootPath, userID)
    31  }
    32  
    33  func updateExtendedURL(client *golangsdk.ServiceClient, userID string) string {
    34  	url := client.ServiceURL(openstackUserPath, rootPath, userID)
    35  	return v30(url)
    36  }
    37  
    38  func welcomeExtendedURL(client *golangsdk.ServiceClient, userID string) string {
    39  	url := client.ServiceURL(openstackUserPath, rootPath, userID, welcomePath)
    40  	return v30(url)
    41  }
    42  
    43  func deleteURL(client *golangsdk.ServiceClient, userID string) string {
    44  	return client.ServiceURL(rootPath, userID)
    45  }
    46  
    47  func listGroupsURL(client *golangsdk.ServiceClient, userID string) string {
    48  	return client.ServiceURL(rootPath, userID, groupsPath)
    49  }
    50  
    51  func listProjectsURL(client *golangsdk.ServiceClient, userID string) string {
    52  	return client.ServiceURL(rootPath, userID, projectPath)
    53  }
    54  
    55  func listInGroupURL(client *golangsdk.ServiceClient, groupID string) string {
    56  	return client.ServiceURL(groupsPath, groupID, rootPath)
    57  }
    58  
    59  func membershipURL(client *golangsdk.ServiceClient, groupID string, userID string) string {
    60  	return client.ServiceURL(groupsPath, groupID, rootPath, userID)
    61  }
    62  
    63  func v30(url string) string {
    64  	return strings.Replace(url, "/v3/", "/v3.0/", 1)
    65  }