Exemplo n.º 1
0
func AddCatalog(network *net.Network, resource string) (map[string]models.CatalogEntitySummary, error) {
	url := "/v1/catalog"
	var entities map[string]models.CatalogEntitySummary
	body, err := network.SendPostResourceRequest(url, resource, "application/json")
	if err != nil {
		return nil, err
	}
	err = json.Unmarshal(body, &entities)
	return entities, nil
}
Exemplo n.º 2
0
func Create(network *net.Network, resource string) (models.TaskSummary, error) {
	url := "/v1/applications"
	var response models.TaskSummary
	body, err := network.SendPostResourceRequest(url, resource, "application/json")
	if err != nil {
		return response, err
	}
	err = json.Unmarshal(body, &response)
	return response, err
}
Exemplo n.º 3
0
func AddChildren(network *net.Network, application, entity, resource string) (models.TaskSummary, error) {
	urlStr := fmt.Sprintf("/v1/applications/%s/entities/%s/children", application, entity)
	var response models.TaskSummary
	body, err := network.SendPostResourceRequest(urlStr, resource, "application/json")
	if err != nil {
		return response, err
	}

	err = json.Unmarshal(body, &response)
	return response, err
}