MCPcopy Index your code
hub / github.com/cortexlabs/cortex / GetAPIByID

Function GetAPIByID

pkg/operator/resources/resources.go:417–438  ·  view source on GitHub ↗
(apiName string, apiID string)

Source from the content-addressed store, hash-verified

415}
416
417func GetAPIByID(apiName string, apiID string) ([]schema.APIResponse, error) {
418 // check if the API is currently running, so that additional information can be returned
419 deployedResource, err := GetDeployedResourceByName(apiName)
420 if err == nil && deployedResource != nil && deployedResource.ID() == apiID {
421 return GetAPI(apiName)
422 }
423
424 // search for the API spec with the old ID
425 apiSpec, err := operator.DownloadAPISpec(apiName, apiID)
426 if err != nil {
427 if aws.IsGenericNotFoundErr(err) {
428 return nil, ErrorAPIIDNotFound(apiName, apiID)
429 }
430 return nil, err
431 }
432
433 return []schema.APIResponse{
434 {
435 Spec: apiSpec,
436 },
437 }, nil
438}
439
440func getPastAPIDeploys(apiName string) ([]schema.APIVersion, error) {
441 var apiVersions []schema.APIVersion

Callers 1

GetAPIByIDFunction · 0.92

Calls 6

DownloadAPISpecFunction · 0.92
IsGenericNotFoundErrFunction · 0.92
ErrorAPIIDNotFoundFunction · 0.85
GetAPIFunction · 0.70
IDMethod · 0.45

Tested by

no test coverage detected