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