func()

in mock/deployment.go [118:154]


func (d Deployment) GetInstanceIDs(app string, account D.AccountName, cloudProvider string, region D.RegionName, cluster D.ClusterName) (D.ASGName, []D.InstanceID, error) {
	// Return an error if the cluster doesn't exist in the region

	appInfo, ok := d.AppMap[app]
	if !ok {
		return "", nil, errors.Errorf("no app %s", app)
	}

	accountInfo, ok := appInfo[account]
	if !ok {
		return "", nil, errors.Errorf("app %s not deployed in account %s", app, account)
	}

	clusterInfo, ok := accountInfo.Clusters[cluster]
	if !ok {
		return "", nil, errors.Errorf("no cluster %s in app:%s, account:%s", cluster, app, account)
	}

	asgs, ok := clusterInfo[region]
	if !ok {
		return "", nil, errors.Errorf("cluster %s in account %s not deployed in region %s", cluster, account, region)
	}

	instances := make([]D.InstanceID, 0)

	// We assume there's only one asg, and retrieve the instances
	var asg D.ASGName
	var ids []D.InstanceID

	for asg, ids = range asgs {
		for _, id := range ids {
			instances = append(instances, id)
		}
	}

	return asg, instances, nil
}