| 115 | } |
| 116 | |
| 117 | func (c *Client) QueryMachineByID(ctx context.Context, machineID string) (*ent.Machine, error) { |
| 118 | machine, err := c.Ent.Machine. |
| 119 | Query(). |
| 120 | Where(machine.MachineIdEQ(machineID)). |
| 121 | Only(ctx) |
| 122 | if err != nil { |
| 123 | c.Log.Warningf("QueryMachineByID : %s", err) |
| 124 | return &ent.Machine{}, fmt.Errorf("user '%s': %w", machineID, UserNotExists) |
| 125 | } |
| 126 | |
| 127 | return machine, nil |
| 128 | } |
| 129 | |
| 130 | func (c *Client) ListMachines(ctx context.Context) ([]*ent.Machine, error) { |
| 131 | machines, err := c.Ent.Machine.Query().All(ctx) |