func UpExtended(network *net.Network) (string, error) {
	url := "/v1/server/up/extended"
	body, err := network.SendGetRequest(url)
	if err != nil {
		return "", err
	}
	return string(body), nil
}
func GetConfigValue(network *net.Network, application, entity, policy, config string) (string, error) {
	url := fmt.Sprintf("/v1/applications/%s/entities/%s/policies/%s/config/%s", application, entity, policy, config)
	body, err := network.SendGetRequest(url)
	if nil != err {
		return "", err
	}
	return string(body), nil
}
func ActivityStream(network *net.Network, activity, streamId string) (string, error) {
	url := fmt.Sprintf("/v1/activities/%s/stream/%s", activity, streamId)
	body, err := network.SendGetRequest(url)
	if nil != err {
		return "", err
	}
	return string(body), nil
}
func CurrentState(network *net.Network, application, entity string) (string, error) {
	url := fmt.Sprintf("/v1/applications/%s/entities/%s/policies/current-state", application, entity)
	body, err := network.SendGetRequest(url)
	if nil != err {
		return "", err
	}
	return string(body), nil
}
Exemple #5
0
func Machines(network *net.Network) (string, error) {
	url := fmt.Sprintf("/v1/usage/machines")
	body, err := network.SendGetRequest(url)
	if err != nil {
		return "", err
	}
	return string(body), nil
}
Exemple #6
0
func Application(network *net.Network, application string) (string, error) {
	url := fmt.Sprintf("/v1/usage/applications/%s", application)
	body, err := network.SendGetRequest(url)
	if err != nil {
		return "", err
	}
	return string(body), nil
}
func States(network *net.Network) (string, error) {
	url := "/v1/server/ha/states"
	body, err := network.SendGetRequest(url)
	if err != nil {
		return "", nil
	}
	return string(body)
}
func Metrics(network *net.Network) (string, error) {
	url := "/v1/server/ha/metrics"
	body, err := network.SendGetRequest(url)
	if err != nil {
		return "", err
	}
	return string(body), nil
}
func GetConfig(network *net.Network, configKey string) (string, error) {
	url := fmt.Sprintf("/v1/server/config/%s", configKey)
	body, err := network.SendGetRequest(url)
	if err != nil {
		return "", err
	}
	return string(body), nil
}
Exemple #10
0
func Export(network *net.Network) (string, error) {
	url := "/v1/server/ha/persist/export"
	body, err := network.SendGetRequest(url)
	if err != nil {
		return "", nil
	}
	return string(body), nil
}
Exemple #11
0
func ShuttingDown(network *net.Network) (string, error) {
	url := "/v1/server/shuttingDown"
	body, err := network.SendGetRequest(url)
	if err != nil {
		return "", err
	}
	return string(body), nil
}
Exemple #12
0
func Healthy(network *net.Network) (string, error) {
	url := "/v1/server/healthy"
	body, err := network.SendGetRequest(url)
	if err != nil {
		return "", err
	}
	return string(body), nil
}
func LocatedLocations(network *net.Network) (string, error) {
	url := "/v1/locations/usage/LocatedLocations"
	body, err := network.SendGetRequest(url)
	if err != nil {
		return "", err
	}
	return string(body), nil
}
func Spec(network *net.Network, application, entity string) (string, error) {
	urlStr := fmt.Sprintf("/v1/applications/%s/entities/%s/spec", application, entity)
	body, err := network.SendGetRequest(urlStr)
	if nil != err {
		return "", err
	}
	return string(body), nil
}
//WIP
func Fetch(network *net.Network) (string, error) {
	url := "/v1/applications/fetch"
	body, err := network.SendGetRequest(url)
	if err != nil {
		return "", err
	}
	// TODO return model
	return string(body), nil
}
//WIP
func GetTask(network *net.Network, application, entity, task string) (string, error) {
	url := fmt.Sprintf("/v1/applications/%s/entities/%s/activities/%s", application, entity, task)
	body, err := network.SendGetRequest(url)
	// TODO return model
	if nil != err {
		return "", err
	}
	return string(body), nil
}
Exemple #17
0
func ConfigValueAsBytes(network *net.Network, application, entity, config string) ([]byte, error) {
	url := fmt.Sprintf("/v1/applications/%s/entities/%s/config/%s", application, entity, config)
	body, err := network.SendGetRequest(url)
	if err != nil {
		return []byte{}, err
	}

	return body, nil
}
//WIP
func GetDescendants(network *net.Network, application, entity string) (string, error) {
	url := fmt.Sprintf("/v1/applications/%s/entities/%s/descendants", application, entity)
	body, err := network.SendGetRequest(url)
	// TODO return model
	if nil != err {
		return "", err
	}
	return string(body), nil
}
// WIP
func DescendantsSensor(network *net.Network, app, sensor string) (string, error) {
	url := fmt.Sprintf("/v1/applications/%s/descendants/sensor/%s", app, sensor)

	body, err := network.SendGetRequest(url)
	// TODO return model
	if nil != err {
		return "", err
	}
	return string(body), nil
}
func GetApplicationWithVersion(network *net.Network, applicationId, version string) (models.CatalogEntitySummary, error) {
	url := fmt.Sprintf("/v1/catalog/applications/%s/%s", applicationId, version)
	var catalogEntity models.CatalogEntitySummary
	body, err := network.SendGetRequest(url)
	if err != nil {
		return catalogEntity, err
	}
	err = json.Unmarshal(body, &catalogEntity)
	return catalogEntity, err
}
func Policies(network *net.Network) ([]models.CatalogItemSummary, error) {
	url := "/v1/catalog/policies?allVersions"
	var policies []models.CatalogItemSummary
	body, err := network.SendGetRequest(url)
	if err != nil {
		return policies, err
	}
	err = json.Unmarshal(body, &policies)
	return policies, err
}
func GetLocationWithVersion(network *net.Network, locationId, version string) (models.CatalogItemSummary, error) {
	url := fmt.Sprintf("/v1/catalog/locations/%s/%s", locationId, version)
	var catalogLocation models.CatalogItemSummary
	body, err := network.SendGetRequest(url)
	if err != nil {
		return catalogLocation, err
	}
	err = json.Unmarshal(body, &catalogLocation)
	return catalogLocation, err
}
func Entities(network *net.Network) ([]models.CatalogItemSummary, error) {
	url := "/v1/catalog/entities?allVersions=true"
	var entities []models.CatalogItemSummary
	body, err := network.SendGetRequest(url)
	if err != nil {
		return entities, err
	}
	err = json.Unmarshal(body, &entities)
	return entities, err
}
func Catalog(network *net.Network) ([]models.CatalogItemSummary, error) {
	url := "/v1/catalog/applications?allVersions=true"
	var applications []models.CatalogItemSummary
	body, err := network.SendGetRequest(url)
	if err != nil {
		return applications, err
	}
	err = json.Unmarshal(body, &applications)
	return applications, err
}
func GetEntity(network *net.Network, entityId string) (models.CatalogEntitySummary, error) {
	url := fmt.Sprintf("/v1/catalog/entities/%s", entityId)
	var catalogEntity models.CatalogEntitySummary
	body, err := network.SendGetRequest(url)
	if err != nil {
		return catalogEntity, err
	}
	err = json.Unmarshal(body, &catalogEntity)
	return catalogEntity, err
}
func GetPolicyWithVersion(network *net.Network, policyId, version string) (models.CatalogItemSummary, error) {
	url := fmt.Sprintf("/v1/catalog/policies/%s/%s", policyId, version)
	var catalogItem models.CatalogItemSummary
	body, err := network.SendGetRequest(url)
	if err != nil {
		return catalogItem, err
	}
	err = json.Unmarshal(body, &catalogItem)
	return catalogItem, err
}
func Version(network *net.Network) (models.VersionSummary, error) {
	url := "/v1/server/version"
	var versionSummary models.VersionSummary
	body, err := network.SendGetRequest(url)
	if err != nil {
		return versionSummary, err
	}
	err = json.Unmarshal(body, &versionSummary)
	return versionSummary, err
}
func GetLocation(network *net.Network, locationId string) (models.LocationSummary, error) {
	url := fmt.Sprintf("/v1/locations/%s", locationId)
	var locationDetail models.LocationSummary
	body, err := network.SendGetRequest(url)
	if err != nil {
		return locationDetail, err
	}
	err = json.Unmarshal(body, &locationDetail)
	return locationDetail, err
}
Exemple #29
0
func GetAllConfigValues(network *net.Network, application, entity, policy string) ([]models.PolicyConfigList, error) {
	url := fmt.Sprintf("/v1/applications/%s/entities/%s/policies/%s/config", application, entity, policy)
	var policyConfigList []models.PolicyConfigList
	body, err := network.SendGetRequest(url)
	if nil != err {
		return policyConfigList, err
	}
	err = json.Unmarshal(body, &policyConfigList)
	return policyConfigList, err
}
Exemple #30
0
func ConfigCurrentState(network *net.Network, application, entity string) (map[string]interface{}, error) {
	url := fmt.Sprintf("/v1/applications/%s/entities/%s/config/current-state", application, entity)
	var currentState map[string]interface{}
	body, err := network.SendGetRequest(url)
	if err != nil {
		return currentState, err
	}
	err = json.Unmarshal(body, &currentState)
	return currentState, err
}