Ejemplo n.º 1
0
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
}
Ejemplo n.º 2
0
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
}
Ejemplo n.º 3
0
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
}
Ejemplo n.º 4
0
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
}
Ejemplo n.º 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
}
Ejemplo n.º 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
}
Ejemplo n.º 7
0
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)
}
Ejemplo n.º 8
0
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
}
Ejemplo n.º 9
0
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
}
Ejemplo n.º 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
}
Ejemplo n.º 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
}
Ejemplo n.º 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
}
Ejemplo n.º 13
0
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
}
Ejemplo n.º 14
0
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
}
Ejemplo n.º 15
0
//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
}
Ejemplo n.º 16
0
//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
}
Ejemplo n.º 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
}
Ejemplo n.º 18
0
//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
}
Ejemplo n.º 19
0
// 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
}
Ejemplo n.º 20
0
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
}
Ejemplo n.º 21
0
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
}
Ejemplo n.º 22
0
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
}
Ejemplo n.º 23
0
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
}
Ejemplo n.º 24
0
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
}
Ejemplo n.º 25
0
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
}
Ejemplo n.º 26
0
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
}
Ejemplo n.º 27
0
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
}
Ejemplo n.º 28
0
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
}
Ejemplo n.º 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
}
Ejemplo n.º 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
}