예제 #1
0
func AddCatalog(network *net.Network, filePath string) (string, error) {
	url := "/v1/catalog"
	body, err := network.SendPostFileRequest(url, filePath, "application/json")
	if err != nil {
		return "", err
	}
	return string(body), nil
}
예제 #2
0
func Create(network *net.Network, filePath string) (models.TaskSummary, error) {
	url := "/v1/applications"
	var response models.TaskSummary
	body, err := network.SendPostFileRequest(url, filePath, "application/json")
	if err != nil {
		return response, err
	}
	err = json.Unmarshal(body, &response)
	return response, err
}
예제 #3
0
func AddChildren(network *net.Network, application, entity, filePath string) (models.TaskSummary, error) {
	urlStr := fmt.Sprintf("/v1/applications/%s/entities/%s/children", application, entity)
	var response models.TaskSummary
	body, err := network.SendPostFileRequest(urlStr, filePath, "application/json")
	if err != nil {
		return response, err
	}

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