(deployments []kapps.Deployment)
| 244 | } |
| 245 | |
| 246 | func GetAllAPIs(deployments []kapps.Deployment) ([]schema.APIResponse, error) { |
| 247 | asyncAPIs := make([]schema.APIResponse, 0) |
| 248 | mappedAsyncAPIs := make(map[string]schema.APIResponse, 0) |
| 249 | apiNames := make([]string, 0) |
| 250 | |
| 251 | for i := range deployments { |
| 252 | apiName := deployments[i].Labels["apiName"] |
| 253 | apiNames = append(apiNames, apiName) |
| 254 | |
| 255 | metadata, err := spec.MetadataFromDeployment(&deployments[i]) |
| 256 | if err != nil { |
| 257 | return nil, errors.Wrap(err, fmt.Sprintf("api %s", apiName)) |
| 258 | } |
| 259 | mappedAsyncAPIs[apiName] = schema.APIResponse{ |
| 260 | Status: status.FromDeployment(&deployments[i]), |
| 261 | Metadata: metadata, |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | sort.Strings(apiNames) |
| 266 | for _, apiName := range apiNames { |
| 267 | asyncAPIs = append(asyncAPIs, mappedAsyncAPIs[apiName]) |
| 268 | } |
| 269 | |
| 270 | return asyncAPIs, nil |
| 271 | } |
| 272 | |
| 273 | func GetAPIByName(deployedResource *operator.DeployedResource) ([]schema.APIResponse, error) { |
| 274 | apiDeployment, err := config.K8s.GetDeployment(workloads.K8sName(deployedResource.Name)) |
no test coverage detected