Skip to content

feat: uc: implement inspectAll for machines and volumes#339

Closed
miekg wants to merge 3 commits into
psviderski:mainfrom
miekg:miek/26/apr28di/11
Closed

feat: uc: implement inspectAll for machines and volumes#339
miekg wants to merge 3 commits into
psviderski:mainfrom
miekg:miek/26/apr28di/11

Conversation

@miekg

@miekg miekg commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

This implements 'machine inspect' with the possiblity to list all machines.

% uc machine inspect machine-1

{
  "machine": {
    "id": "69d30595b7516a2b61034d270ea663e7",
    "name": "machine-1",
    "network": {
      "subnet": {
        "ip": "10.210.0.0",
        "bits": 24
      },
      "management_ip": "fdcc:c2f7:e155:c8d9:2b3:da5f:2237:2732",
      "endpoints": [
        "172.21.0.2:51820"
      ],
      "public_key": "wvfhVcjZArPaXyI3JzIhWgDRW1tuF2KbbMD0L2XMqSE="
    }
  },
  "state": 1
}

all machines (as an array)

{
  "machines": [
    {
      "machine": {
        "id": "69d30595b7516a2b61034d270ea663e7",
        "name": "machine-1",
        "network": {
          "subnet": {
            "ip": "10.210.0.0",
            "bits": 24
          },
          "management_ip": "fdcc:c2f7:e155:c8d9:2b3:da5f:2237:2732",
          "endpoints": [
            "172.21.0.2:51820"
          ],
          "public_key": "wvfhVcjZArPaXyI3JzIhWgDRW1tuF2KbbMD0L2XMqSE="
        }
      },
      "state": 1
    }
  ]
}

For IP and IPPort MarshalJSON method are added to generate the correct JSON. ls.go use cmp.Or to make the code even smaller.

This implements 'machine inspect' with the possiblity to list all
machines.

% uc machine inspect machine-1
```json
{
  "machine": {
    "id": "69d30595b7516a2b61034d270ea663e7",
    "name": "machine-1",
    "network": {
      "subnet": {
        "ip": "10.210.0.0",
        "bits": 24
      },
      "management_ip": "fdcc:c2f7:e155:c8d9:2b3:da5f:2237:2732",
      "endpoints": [
        "172.21.0.2:51820"
      ],
      "public_key": "wvfhVcjZArPaXyI3JzIhWgDRW1tuF2KbbMD0L2XMqSE="
    }
  },
  "state": 1
}
```

all machines (as an array)

```json
{
  "machines": [
    {
      "machine": {
        "id": "69d30595b7516a2b61034d270ea663e7",
        "name": "machine-1",
        "network": {
          "subnet": {
            "ip": "10.210.0.0",
            "bits": 24
          },
          "management_ip": "fdcc:c2f7:e155:c8d9:2b3:da5f:2237:2732",
          "endpoints": [
            "172.21.0.2:51820"
          ],
          "public_key": "wvfhVcjZArPaXyI3JzIhWgDRW1tuF2KbbMD0L2XMqSE="
        }
      },
      "state": 1
    }
  ]
}

```

For IP and IPPort MarshalJSON method are added to generate the correct
JSON. ls.go use cmp.Or to make the code even smaller.

Signed-off-by: Miek Gieben <miek@miek.nl>
@miekg

miekg commented Apr 28, 2026

Copy link
Copy Markdown
Contributor Author

See #335 and #338. If OKed, I'll work through the rest

@miekg miekg changed the title feat: implement machine inspect feat: uc: implement inspect that can list + ls argument fixes Apr 29, 2026
@miekg miekg changed the title feat: uc: implement inspect that can list + ls argument fixes feat: uc: implement inspectAll for machines and volumes Apr 29, 2026
miekg added 2 commits April 29, 2026 08:10
Signed-off-by: Miek Gieben <miek@miek.nl>
Signed-off-by: Miek Gieben <miek@miek.nl>
@miekg

miekg commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author

Fixies: #337 #338

@miekg

miekg commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author

superseded by #342

@miekg miekg closed this Apr 29, 2026
@miekg miekg deleted the miek/26/apr28di/11 branch April 29, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant