Ejemplo n.º 1
0
func readBody(d *schema.ResourceData, resp map[string]interface{}) []error {
	// pull out services ids because the request body
	// is different than the response body
	services := resp["services"].([]interface{})
	serviceIds := make([]int, 0)
	for _, serviceI := range services {
		service := serviceI.(map[string]interface{})

		// not sure why this is introspecting as a float64
		serviceIds = append(serviceIds, int(service["id"].(float64)))
	}

	data := map[string]interface{}{
		"name":          resp["name"],
		"version":       resp["version"],
		"description":   resp["description"],
		"active":        resp["active"],
		"rearm_seconds": resp["rearm_seconds"],
		"conditions":    resp["conditions"],
		"attributes":    resp["attributes"],
		"services":      serviceIds,
	}

	return request.SetAll(d, data)
}
Ejemplo n.º 2
0
func readBody(d *schema.ResourceData, resp map[string]interface{}) []error {
	data := map[string]interface{}{
		"name": resp["name"],
	}

	return request.SetAll(d, data)
}
Ejemplo n.º 3
0
func readBody(d *schema.ResourceData, resp map[string]interface{}) []error {
	data := map[string]interface{}{
		"type":     resp["type"],
		"title":    resp["title"],
		"settings": resp["settings"],
	}

	return request.SetAll(d, data)
}
Ejemplo n.º 4
0
func readBody(d *schema.ResourceData, resp map[string]interface{}) []error {
	// if a user blanks out max in the ui it is not
	// returned at all in the GET body
	max := resp["max"]
	if max == nil {
		max = 0
	}

	data := map[string]interface{}{
		"name":          resp["name"],
		"type":          resp["type"],
		"min":           resp["min"],
		"max":           max,
		"label":         resp["label"],
		"related_space": resp["related_space"],
		"stream":        resp["streams"],
	}

	return request.SetAll(d, data)
}