()
| 184 | } |
| 185 | |
| 186 | func getAPIsInAllEnvironments() (string, error) { |
| 187 | cliConfig, err := readCLIConfig() |
| 188 | if err != nil { |
| 189 | return "", err |
| 190 | } |
| 191 | |
| 192 | var allRealtimeAPIs []schema.APIResponse |
| 193 | var allRealtimeAPIEnvs []string |
| 194 | var allAsyncAPIs []schema.APIResponse |
| 195 | var allAsyncAPIEnvs []string |
| 196 | var allBatchAPIs []schema.APIResponse |
| 197 | var allBatchAPIEnvs []string |
| 198 | var allTaskAPIs []schema.APIResponse |
| 199 | var allTaskAPIEnvs []string |
| 200 | var allTrafficSplitters []schema.APIResponse |
| 201 | var allTrafficSplitterEnvs []string |
| 202 | |
| 203 | type getAPIsOutput struct { |
| 204 | EnvName string `json:"env_name"` |
| 205 | APIs []schema.APIResponse `json:"apis"` |
| 206 | Error string `json:"error"` |
| 207 | } |
| 208 | |
| 209 | allAPIsOutput := []getAPIsOutput{} |
| 210 | |
| 211 | errorsMap := map[string]error{} |
| 212 | // get apis from both environments |
| 213 | for _, env := range cliConfig.Environments { |
| 214 | apisRes, err := cluster.GetAPIs(MustGetOperatorConfig(env.Name)) |
| 215 | |
| 216 | apisOutput := getAPIsOutput{ |
| 217 | EnvName: env.Name, |
| 218 | APIs: apisRes, |
| 219 | } |
| 220 | |
| 221 | if err == nil { |
| 222 | for _, api := range apisRes { |
| 223 | switch api.Metadata.Kind { |
| 224 | case userconfig.BatchAPIKind: |
| 225 | allBatchAPIEnvs = append(allBatchAPIEnvs, env.Name) |
| 226 | allBatchAPIs = append(allBatchAPIs, api) |
| 227 | case userconfig.RealtimeAPIKind: |
| 228 | allRealtimeAPIEnvs = append(allRealtimeAPIEnvs, env.Name) |
| 229 | allRealtimeAPIs = append(allRealtimeAPIs, api) |
| 230 | case userconfig.AsyncAPIKind: |
| 231 | allAsyncAPIEnvs = append(allAsyncAPIEnvs, env.Name) |
| 232 | allAsyncAPIs = append(allAsyncAPIs, api) |
| 233 | case userconfig.TaskAPIKind: |
| 234 | allTaskAPIEnvs = append(allTaskAPIEnvs, env.Name) |
| 235 | allTaskAPIs = append(allTaskAPIs, api) |
| 236 | case userconfig.TrafficSplitterKind: |
| 237 | allTrafficSplitterEnvs = append(allTrafficSplitterEnvs, env.Name) |
| 238 | allTrafficSplitters = append(allTrafficSplitters, api) |
| 239 | } |
| 240 | } |
| 241 | } else { |
| 242 | apisOutput.Error = err.Error() |
| 243 | errorsMap[env.Name] = err |
no test coverage detected