func recordMachineInState( client *api.Client, machineParams params.AddMachineParams) (machineId string, err error) { // Note: we explicitly use AddMachines1dot18 rather than AddMachines to preserve // backwards compatibility; we do not require any of the new features of AddMachines // here. results, err := client.AddMachines1dot18([]params.AddMachineParams{machineParams}) if err != nil { return "", err } // Currently, only one machine is added, but in future there may be several added in one call. machineInfo := results[0] if machineInfo.Error != nil { return "", machineInfo.Error } return machineInfo.Machine, nil }