@@ -27,8 +27,8 @@ type Config struct {
2727 Organization string
2828 // CacheConfigFile is the path to the cache configuration YAML file
2929 CacheConfigFile string
30- // Ids is a comma-separated list of cache IDs (if empty, processes all caches)
31- Ids string
30+ // Ids is a list of cache IDs (if empty, processes all caches)
31+ Ids [] string
3232 // APIEndpoint is the Agent API endpoint
3333 APIEndpoint string
3434 // APIToken is the access token used to authenticate
@@ -128,18 +128,15 @@ func setupCacheClient(ctx context.Context, l logger.Logger, cfg Config) (*zstash
128128 }
129129
130130 // Determine which cache IDs to process
131- var cacheIDs []string
132- if cfg .Ids != "" {
133- cacheIDs = strings .Split (cfg .Ids , "," )
134-
131+ if len (cfg .Ids ) > 0 {
135132 // Validate that specified cache IDs exist
136133 validIDs := make (map [string ]bool )
137134 for _ , cache := range cacheClient .ListCaches () {
138135 validIDs [cache .ID ] = true
139136 }
140137
141138 var invalidIDs []string
142- for _ , id := range cacheIDs {
139+ for _ , id := range cfg . Ids {
143140 if ! validIDs [id ] {
144141 invalidIDs = append (invalidIDs , id )
145142 }
@@ -148,14 +145,16 @@ func setupCacheClient(ctx context.Context, l logger.Logger, cfg Config) (*zstash
148145 if len (invalidIDs ) > 0 {
149146 return nil , nil , fmt .Errorf ("cache IDs not found in configuration: %s" , strings .Join (invalidIDs , ", " ))
150147 }
151- } else {
152- // Process all caches configured in the client
153- for _ , cache := range cacheClient .ListCaches () {
154- cacheIDs = append (cacheIDs , cache .ID )
155- }
148+
149+ return cacheClient , cfg .Ids , nil
150+ }
151+
152+ var cacheDs []string
153+ for _ , cache := range cacheClient .ListCaches () {
154+ cacheDs = append (cacheDs , cache .ID )
156155 }
157156
158- return cacheClient , cacheIDs , nil
157+ return cacheClient , cacheDs , nil
159158}
160159
161160// restoreWithClient performs the restore operation for the given cache IDs using the provided client
0 commit comments