// 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)
}