GetAPIByName retrieves the metadata, in the form of schema.APIResponse, of a single traffic splitter API
(deployedResource *operator.DeployedResource)
| 162 | |
| 163 | // GetAPIByName retrieves the metadata, in the form of schema.APIResponse, of a single traffic splitter API |
| 164 | func GetAPIByName(deployedResource *operator.DeployedResource) ([]schema.APIResponse, error) { |
| 165 | metadata, err := spec.MetadataFromVirtualService(deployedResource.VirtualService) |
| 166 | if err != nil { |
| 167 | return nil, err |
| 168 | } |
| 169 | |
| 170 | api, err := operator.DownloadAPISpec(deployedResource.Name, metadata.APIID) |
| 171 | if err != nil { |
| 172 | return nil, err |
| 173 | } |
| 174 | |
| 175 | endpoint, err := operator.APIEndpoint(api) |
| 176 | if err != nil { |
| 177 | return nil, err |
| 178 | } |
| 179 | |
| 180 | return []schema.APIResponse{ |
| 181 | { |
| 182 | Spec: api, |
| 183 | Metadata: metadata, |
| 184 | Endpoint: &endpoint, |
| 185 | }, |
| 186 | }, nil |
| 187 | } |
| 188 | |
| 189 | func deleteK8sResources(apiName string) error { |
| 190 | _, err := config.K8s.DeleteVirtualService(workloads.K8sName(apiName)) |
no test coverage detected