// ClusterNodeSpec converts Servers list to node spec
ClusterNodeSpec converts Servers list to node spec
// ClusterNodeSpec converts Servers list to node spec
func (s *ClusterState) ClusterNodeSpec() []ClusterNodeSpecV2 {
	mapping := map[nodeKey]ClusterNodeSpecV2{}
	for _, server := range s.Servers {
		key := nodeKey{profile: server.Role, instanceType: server.InstanceType}
		spec, ok := mapping[key]
		if !ok {
			mapping[key] = ClusterNodeSpecV2{
				Profile:      server.Role,
				Count:        1,
				InstanceType: server.InstanceType,
			}
		} else {
			spec.Count += 1
			mapping[key] = spec
		}
	}
	var out []ClusterNodeSpecV2
	for _, spec := range mapping {
		out = append(out, spec)
	}
	sort.Sort(sortedNodeSpec(out))
	return out
}
func ( s * ClusterState ) ClusterNodeSpec ( ) [ ] ClusterNodeSpecV2 { mapping := map [ nodeKey ] ClusterNodeSpecV2 { } for _ , server := range s . Servers { key := nodeKey { profile : server . Role , instanceType : server . InstanceType } spec , ok := mapping [ key ] if ! ok { mapping [ key ] = ClusterNodeSpecV2 { Profile : server . Role , Count : 1 , InstanceType : server . InstanceType , } } else { spec . Count += 1 mapping [ key ] = spec } } var out [ ] ClusterNodeSpecV2 for _ , spec := range mapping { out = append ( out , spec ) } sort . Sort ( sortedNodeSpec ( out ) ) return out }
ClusterNodeSpec converts Servers list to node spec
ClusterNodeSpec converts Servers list to node spec