MCPcopy Create free account
hub / github.com/cortexlabs/cortex / DeleteAPI

Function DeleteAPI

pkg/operator/resources/asyncapi/api.go:205–244  ·  view source on GitHub ↗
(apiName string, keepCache bool)

Source from the content-addressed store, hash-verified

203}
204
205func DeleteAPI(apiName string, keepCache bool) error {
206 err := parallel.RunFirstErr(
207 func() error {
208 vs, err := config.K8s.GetVirtualService(workloads.K8sName(apiName))
209 if err != nil {
210 return err
211 }
212 if vs != nil {
213 initialDeploymentTime, err := k8s.ParseInt64Label(vs, "initialDeploymentTime")
214 if err != nil {
215 return err
216 }
217 queueURL, err := getQueueURL(apiName, initialDeploymentTime)
218 if err != nil {
219 return err
220 }
221 // best effort deletion
222 _ = deleteQueueByURL(queueURL)
223 }
224 return nil
225 },
226 func() error {
227 return deleteK8sResources(apiName)
228 },
229 func() error {
230 if keepCache {
231 return nil
232 }
233 // best effort deletion, swallow errors because there could be weird error messages
234 _ = deleteBucketResources(apiName)
235 return nil
236 },
237 )
238
239 if err != nil {
240 return err
241 }
242
243 return nil
244}
245
246func GetAllAPIs(deployments []kapps.Deployment) ([]schema.APIResponse, error) {
247 asyncAPIs := make([]schema.APIResponse, 0)

Callers 1

DeleteAPIFunction · 0.92

Calls 8

RunFirstErrFunction · 0.92
K8sNameFunction · 0.92
ParseInt64LabelFunction · 0.92
getQueueURLFunction · 0.85
deleteQueueByURLFunction · 0.85
GetVirtualServiceMethod · 0.80
deleteK8sResourcesFunction · 0.70
deleteBucketResourcesFunction · 0.70

Tested by

no test coverage detected