MCPcopy
hub / github.com/cortexlabs/cortex / getPastAPIDeploys

Function getPastAPIDeploys

pkg/operator/resources/resources.go:440–460  ·  view source on GitHub ↗
(apiName string)

Source from the content-addressed store, hash-verified

438}
439
440func getPastAPIDeploys(apiName string) ([]schema.APIVersion, error) {
441 var apiVersions []schema.APIVersion
442
443 apiIDs, err := config.AWS.ListS3DirOneLevel(config.ClusterConfig.Bucket, spec.KeysPrefix(apiName, config.ClusterConfig.ClusterUID), pointer.Int64(10), nil)
444 if err != nil {
445 return nil, err
446 }
447
448 for _, apiID := range apiIDs {
449 lastUpdated, err := spec.TimeFromAPIID(apiID)
450 if err != nil {
451 return nil, err
452 }
453 apiVersions = append(apiVersions, schema.APIVersion{
454 APIID: apiID,
455 LastUpdated: lastUpdated.Unix(),
456 })
457 }
458
459 return apiVersions, nil
460}
461
462//checkIfUsedByTrafficSplitter checks if api is used by a deployed TrafficSplitter
463func checkIfUsedByTrafficSplitter(apiName string) error {

Callers 1

GetAPIFunction · 0.85

Calls 4

KeysPrefixFunction · 0.92
Int64Function · 0.92
TimeFromAPIIDFunction · 0.92
ListS3DirOneLevelMethod · 0.80

Tested by

no test coverage detected