Skip to content

Commit 74ffd8c

Browse files
authored
feat(ipam): add support for resource-id filtering (scaleway#4325)
1 parent 54b7fe9 commit 74ffd8c

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

cmd/scw/testdata/test-all-usage-ipam-ip-list-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ ARGS:
1414
[vpc-id] VPC ID to filter for.
1515
[attached] Defines whether to filter only for IPs which are attached to a resource
1616
[resource-id] Resource ID to filter for. Only IPs attached to this resource will be returned
17+
[resource-ids.{index}] Resource IDs to filter for. Only IPs attached to at least one of these resources will be returned
1718
[resource-type] Resource type to filter for. Only IPs attached to this type of resource will be returned (unknown_type | custom | instance_server | instance_ip | instance_private_nic | lb_server | fip_ip | vpc_gateway | vpc_gateway_network | k8s_node | k8s_cluster | rdb_instance | redis_cluster | baremetal_server | baremetal_private_nic | llm_deployment | mgdb_instance | apple_silicon_server | apple_silicon_private_nic)
1819
[mac-address] MAC address to filter for. Only IPs attached to a resource with this MAC address will be returned
1920
[tags.{index}] Tags to filter for, only IPs with one or more matching tags will be returned

docs/commands/ipam.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ scw ipam ip list [arg=value ...]
108108
| vpc-id | | VPC ID to filter for. |
109109
| attached | | Defines whether to filter only for IPs which are attached to a resource |
110110
| resource-id | | Resource ID to filter for. Only IPs attached to this resource will be returned |
111+
| resource-ids.{index} | | Resource IDs to filter for. Only IPs attached to at least one of these resources will be returned |
111112
| resource-type | One of: `unknown_type`, `custom`, `instance_server`, `instance_ip`, `instance_private_nic`, `lb_server`, `fip_ip`, `vpc_gateway`, `vpc_gateway_network`, `k8s_node`, `k8s_cluster`, `rdb_instance`, `redis_cluster`, `baremetal_server`, `baremetal_private_nic`, `llm_deployment`, `mgdb_instance`, `apple_silicon_server`, `apple_silicon_private_nic` | Resource type to filter for. Only IPs attached to this type of resource will be returned |
112113
| mac-address | | MAC address to filter for. Only IPs attached to a resource with this MAC address will be returned |
113114
| tags.{index} | | Tags to filter for, only IPs with one or more matching tags will be returned |

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
github.com/mattn/go-isatty v0.0.20
2727
github.com/moby/buildkit v0.13.2
2828
github.com/opencontainers/go-digest v1.0.0
29-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241128142000-730918071fbc
29+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241203133010-eced26f4687e
3030
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
3131
github.com/spf13/cobra v1.8.1
3232
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
466466
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
467467
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
468468
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
469-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241128142000-730918071fbc h1:XFg47wtUnYt+8Wbzsoke/Y9z8ozVtQiJYKUygENp0dY=
470-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241128142000-730918071fbc/go.mod h1:kAoejOVBg1E/aVAR6IwKWEmbLCEg2IXklzPAkxzAaXA=
469+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241203133010-eced26f4687e h1:53liAlyBY6iZLtDYBbWcuSQnpS6Qhb5t2wCAWM/qcb8=
470+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241203133010-eced26f4687e/go.mod h1:kAoejOVBg1E/aVAR6IwKWEmbLCEg2IXklzPAkxzAaXA=
471471
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
472472
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
473473
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=

internal/namespaces/ipam/v1/ipam_cli.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,13 @@ func ipamIPList() *core.Command {
355355
Deprecated: false,
356356
Positional: false,
357357
},
358+
{
359+
Name: "resource-ids.{index}",
360+
Short: `Resource IDs to filter for. Only IPs attached to at least one of these resources will be returned`,
361+
Required: false,
362+
Deprecated: false,
363+
Positional: false,
364+
},
358365
{
359366
Name: "resource-type",
360367
Short: `Resource type to filter for. Only IPs attached to this type of resource will be returned`,

0 commit comments

Comments
 (0)