(deployedResource *operator.DeployedResource)
| 271 | } |
| 272 | |
| 273 | func GetAPIByName(deployedResource *operator.DeployedResource) ([]schema.APIResponse, error) { |
| 274 | apiDeployment, err := config.K8s.GetDeployment(workloads.K8sName(deployedResource.Name)) |
| 275 | if err != nil { |
| 276 | return nil, err |
| 277 | } |
| 278 | |
| 279 | if apiDeployment == nil { |
| 280 | return nil, errors.ErrorUnexpected("unable to find api deployment", deployedResource.Name) |
| 281 | } |
| 282 | |
| 283 | apiStatus := status.FromDeployment(apiDeployment) |
| 284 | apiMetadata, err := spec.MetadataFromDeployment(apiDeployment) |
| 285 | if err != nil { |
| 286 | return nil, errors.ErrorUnexpected("unable to obtain metadata", deployedResource.Name) |
| 287 | } |
| 288 | |
| 289 | api, err := operator.DownloadAPISpec(apiMetadata.Name, apiMetadata.APIID) |
| 290 | if err != nil { |
| 291 | return nil, err |
| 292 | } |
| 293 | |
| 294 | apiEndpoint, err := operator.APIEndpoint(api) |
| 295 | if err != nil { |
| 296 | return nil, err |
| 297 | } |
| 298 | |
| 299 | dashboardURL := pointer.String(getDashboardURL(api.Name)) |
| 300 | |
| 301 | return []schema.APIResponse{ |
| 302 | { |
| 303 | Spec: api, |
| 304 | Metadata: apiMetadata, |
| 305 | Status: apiStatus, |
| 306 | Endpoint: &apiEndpoint, |
| 307 | DashboardURL: dashboardURL, |
| 308 | }, |
| 309 | }, nil |
| 310 | } |
| 311 | |
| 312 | func DescribeAPIByName(deployedResource *operator.DeployedResource) ([]schema.APIResponse, error) { |
| 313 | var apiDeployment *kapps.Deployment |
no test coverage detected