Skip to content

Commit

Permalink
Add error handling after call
Browse files Browse the repository at this point in the history
  • Loading branch information
powerkimhub committed Oct 12, 2023
1 parent 2823da2 commit a6c3d37
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions api-runtime/common-runtime/CommonManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1025,48 +1025,80 @@ func GetCSPResourceName(connectionName string, rsType string, nameID string) (st
// (1) get IID(NameId)
var iid VPCIIDInfo
err = infostore.GetByConditions(&iid, CONNECTION_NAME_COLUMN, connectionName, NAME_ID_COLUMN, nameID)
if err != nil {
cblog.Error(err)
return "", err
}
// (2) get DriverNameId and return it
return makeDriverIID(iid.NameId, iid.SystemId).NameId, nil
case rsSG:
// (1) get IID(NameId)
var iid SGIIDInfo
err = infostore.GetByConditions(&iid, CONNECTION_NAME_COLUMN, connectionName, NAME_ID_COLUMN, nameID)
if err != nil {
cblog.Error(err)
return "", err
}
// (2) get DriverNameId and return it
return makeDriverIID(iid.NameId, iid.SystemId).NameId, nil
case rsKey:
// (1) get IID(NameId)
var iid KeyIIDInfo
err = infostore.GetByConditions(&iid, CONNECTION_NAME_COLUMN, connectionName, NAME_ID_COLUMN, nameID)
if err != nil {
cblog.Error(err)
return "", err
}
// (2) get DriverNameId and return it
return makeDriverIID(iid.NameId, iid.SystemId).NameId, nil
case rsVM:
// (1) get IID(NameId)
var iid VMIIDInfo
err = infostore.GetByConditions(&iid, CONNECTION_NAME_COLUMN, connectionName, NAME_ID_COLUMN, nameID)
if err != nil {
cblog.Error(err)
return "", err
}
// (2) get DriverNameId and return it
return makeDriverIID(iid.NameId, iid.SystemId).NameId, nil
case rsNLB:
// (1) get IID(NameId)
var iid NLBIIDInfo
err = infostore.GetByConditions(&iid, CONNECTION_NAME_COLUMN, connectionName, NAME_ID_COLUMN, nameID)
if err != nil {
cblog.Error(err)
return "", err
}
// (2) get DriverNameId and return it
return makeDriverIID(iid.NameId, iid.SystemId).NameId, nil
case rsDisk:
// (1) get IID(NameId)
var iid DiskIIDInfo
err = infostore.GetByConditions(&iid, CONNECTION_NAME_COLUMN, connectionName, NAME_ID_COLUMN, nameID)
if err != nil {
cblog.Error(err)
return "", err
}
// (2) get DriverNameId and return it
return makeDriverIID(iid.NameId, iid.SystemId).NameId, nil
case rsMyImage:
// (1) get IID(NameId)
var iid MyImageIIDInfo
err = infostore.GetByConditions(&iid, CONNECTION_NAME_COLUMN, connectionName, NAME_ID_COLUMN, nameID)
if err != nil {
cblog.Error(err)
return "", err
}
// (2) get DriverNameId and return it
return makeDriverIID(iid.NameId, iid.SystemId).NameId, nil
case rsCluster:
// (1) get IID(NameId)
var iid ClusterIIDInfo
err = infostore.GetByConditions(&iid, CONNECTION_NAME_COLUMN, connectionName, NAME_ID_COLUMN, nameID)
if err != nil {
cblog.Error(err)
return "", err
}
// (2) get DriverNameId and return it
return makeDriverIID(iid.NameId, iid.SystemId).NameId, nil
default:
Expand Down

0 comments on commit a6c3d37

Please sign in to comment.