@@ -35,6 +35,11 @@ type ServiceList struct {
3535}
3636
3737func (* ServiceList ) Execute (_ []string ) error {
38+ type serviceWithEndpoints struct {
39+ * models.Service
40+ Endpoints int `json:"in_use"`
41+ }
42+
3843 params := service .NewGetServiceParams ().
3944 WithTags (ServiceOptions .ServiceList .Tags ).
4045 WithTagsAny (ServiceOptions .ServiceList .AnyTags ).
@@ -45,8 +50,22 @@ func (*ServiceList) Execute(_ []string) error {
4550 if err != nil {
4651 return err
4752 }
48- DefaultColumns = []string {"id" , "name" , "ports" , "enabled" , "provider" , "status" , "visibility" , "availability_zone" , "project_id" }
49- return WriteTable (resp .GetPayload ().Items )
53+ DefaultColumns = []string {"id" , "name" , "ports" , "enabled" , "provider" , "status" , "visibility" , "availability_zone" , "project_id" , "in_use" }
54+ items := resp .GetPayload ().Items
55+
56+ // Build enriched list with endpoint counts
57+ enriched := make ([]serviceWithEndpoints , 0 , len (items ))
58+ for _ , svc := range items {
59+ epParams := service .NewGetServiceServiceIDEndpointsParams ().WithServiceID (svc .ID )
60+ epResp , epErr := ArcherClient .Service .GetServiceServiceIDEndpoints (epParams , nil )
61+ count := 0
62+ if epErr == nil {
63+ count = len (epResp .GetPayload ().Items )
64+ }
65+ enriched = append (enriched , serviceWithEndpoints {Service : svc , Endpoints : count })
66+ }
67+
68+ return WriteTable (enriched )
5069}
5170
5271type ServiceShow struct {
0 commit comments