// Get performs request to given service and deserializes json response to struct.
// out should be pointer to resulting structure. Returns error if request or
// deserialization failed.
func Get(client *gophercloud.ServiceClient, request string, out interface{}) error {
	url := client.ServiceURL(request)
	var resp interface{}
	_, err := client.Get(url, &resp, nil)

	if err != nil {
		return fmt.Errorf("request failed: (%v)", err)
	}

	err = mapstructure.Decode(resp, out)

	if err != nil {
		return fmt.Errorf("decoding failed: (%v)", err)
	}

	return nil
}
示例#2
0
func getURL(c *gophercloud.ServiceClient, stackName, stackID, resourceName, eventID string) string {
	return c.ServiceURL("stacks", stackName, stackID, "resources", resourceName, "events", eventID)
}
示例#3
0
func insertURL(c *gophercloud.ServiceClient, id string) string {
	return c.ServiceURL(rootPath, resourcePath, id, insertPath)
}
示例#4
0
func resourceURL(c *gophercloud.ServiceClient, id string) string {
	return c.ServiceURL(secgrouppath, id)
}
示例#5
0
func resourceRuleURL(c *gophercloud.ServiceClient, id string) string {
	return c.ServiceURL(rulepath, id)
}
示例#6
0
func listByServerURL(c *gophercloud.ServiceClient, serverID string) string {
	return c.ServiceURL("servers", serverID, secgrouppath)
}
示例#7
0
func validateURL(c *gophercloud.ServiceClient) string {
	return c.ServiceURL("validate")
}
示例#8
0
func deleteURL(c *gophercloud.ServiceClient, id string) string {
	return c.ServiceURL("share-networks", id)
}
示例#9
0
func createURL(c *gophercloud.ServiceClient) string {
	return c.ServiceURL("types")
}
示例#10
0
func getExtraSpecsURL(c *gophercloud.ServiceClient, id string) string {
	return c.ServiceURL("types", id, "extra_specs")
}
示例#11
0
func getDefaultURL(c *gophercloud.ServiceClient) string {
	return c.ServiceURL("types", "default")
}
示例#12
0
func listAssignmentsURL(client *gophercloud.ServiceClient) string {
	return client.ServiceURL("role_assignments")
}
示例#13
0
func createURL(c *gophercloud.ServiceClient, container string) string {
	return c.ServiceURL(container)
}
示例#14
0
func listURL(c *gophercloud.ServiceClient, stackName, stackID string) string {
	return c.ServiceURL("stacks", stackName, stackID, "events")
}
示例#15
0
func findURL(c *gophercloud.ServiceClient, stackName string) string {
	return c.ServiceURL("stacks", stackName, "events")
}
示例#16
0
func listDetailURL(c *gophercloud.ServiceClient) string {
	return c.ServiceURL("share-networks", "detail")
}
示例#17
0
func createURL(c *gophercloud.ServiceClient) string {
	return c.ServiceURL("share-networks")
}
示例#18
0
func deleteURL(c *gophercloud.ServiceClient, id string) string {
	return c.ServiceURL("types", id)
}
示例#19
0
func getURL(c *gophercloud.ServiceClient, stackName, stackID string) string {
	return c.ServiceURL("stacks", stackName, stackID, "template")
}
示例#20
0
func resourceURL(c *gophercloud.ServiceClient, serverID string) string {
	return c.ServiceURL("servers", serverID, resourcePath)
}
示例#21
0
func rootURL(c *gophercloud.ServiceClient) string {
	return c.ServiceURL(secgrouppath)
}
示例#22
0
func instancesURL(c *gophercloud.ServiceClient, configID string) string {
	return c.ServiceURL("configurations", configID, "instances")
}
示例#23
0
func rootRuleURL(c *gophercloud.ServiceClient) string {
	return c.ServiceURL(rulepath)
}
示例#24
0
func listDSParamsURL(c *gophercloud.ServiceClient, datastoreID, versionID string) string {
	return c.ServiceURL("datastores", datastoreID, "versions", versionID, "parameters")
}
示例#25
0
func serverActionURL(c *gophercloud.ServiceClient, id string) string {
	return c.ServiceURL("servers", id, "action")
}
示例#26
0
func getGlobalParamURL(c *gophercloud.ServiceClient, versionID, paramID string) string {
	return c.ServiceURL("datastores", "versions", versionID, "parameters", paramID)
}
示例#27
0
func rootURL(c *gophercloud.ServiceClient) string {
	return c.ServiceURL(rootPath, resourcePath)
}
示例#28
0
func baseURL(c *gophercloud.ServiceClient) string {
	return c.ServiceURL("configurations")
}
示例#29
0
func removeURL(c *gophercloud.ServiceClient, id string) string {
	return c.ServiceURL(rootPath, resourcePath, id, removePath)
}
示例#30
0
func resourceURL(c *gophercloud.ServiceClient, configID string) string {
	return c.ServiceURL("configurations", configID)
}