Skip to content

Commit

Permalink
Rename ID_TRANSFORM_MODE Attribute to IDTransformMode
Browse files Browse the repository at this point in the history
  • Loading branch information
powerkimhub committed May 9, 2024
1 parent 75c7183 commit efc6c73
Show file tree
Hide file tree
Showing 17 changed files with 57 additions and 57 deletions.
4 changes: 2 additions & 2 deletions api-runtime/common-runtime/ClusterManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func registerNodeGroupList(connectionName string, info *cres.ClusterInfo) error
// (5) insert spiderIID
// (6) create userIID
// (7) set used Resources's userIID
func CreateCluster(connectionName string, rsType string, reqInfo cres.ClusterInfo, ID_TRANSFORM_MODE string) (*cres.ClusterInfo, error) {
func CreateCluster(connectionName string, rsType string, reqInfo cres.ClusterInfo, IDTransformMode string) (*cres.ClusterInfo, error) {
cblog.Info("call CreateCluster()")

// check empty and trim user inputs
Expand Down Expand Up @@ -425,7 +425,7 @@ func CreateCluster(connectionName string, rsType string, reqInfo cres.ClusterInf
}

spUUID := ""
if GetID_MGMT(ID_TRANSFORM_MODE) == "ON" { // Use IID Management
if GetID_MGMT(IDTransformMode) == "ON" { // Use IID Management
// (2) generate SP-XID and create reqIID, driverIID
// ex) SP-XID {"vm-01-9m4e2mr0ui3e8a215n4g"}
//
Expand Down
4 changes: 2 additions & 2 deletions api-runtime/common-runtime/DiskManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func RegisterDisk(connectionName string, zoneId string, userIID cres.IID) (*cres
// (4) create spiderIID: {reqNameID, "driverNameID:driverSystemID"}
// (5) insert spiderIID
// (6) create userIID
func CreateDisk(connectionName string, rsType string, reqInfo cres.DiskInfo, ID_TRANSFORM_MODE string) (*cres.DiskInfo, error) {
func CreateDisk(connectionName string, rsType string, reqInfo cres.DiskInfo, IDTransformMode string) (*cres.DiskInfo, error) {
cblog.Info("call CreateDisk()")

// check empty and trim user inputs
Expand Down Expand Up @@ -179,7 +179,7 @@ func CreateDisk(connectionName string, rsType string, reqInfo cres.DiskInfo, ID_
}

spUUID := ""
if GetID_MGMT(ID_TRANSFORM_MODE) == "ON" { // Use IID Management
if GetID_MGMT(IDTransformMode) == "ON" { // Use IID Management
// (2) generate SP-XID and create reqIID, driverIID
// ex) SP-XID {"vm-01-9m4e2mr0ui3e8a215n4g"}
//
Expand Down
4 changes: 2 additions & 2 deletions api-runtime/common-runtime/KeyPairManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func RegisterKey(connectionName string, userIID cres.IID) (*cres.KeyPairInfo, er
// (4) create spiderIID: {reqNameID, "driverNameID:driverSystemID"}
// (5) insert spiderIID
// (6) create userIID
func CreateKey(connectionName string, rsType string, reqInfo cres.KeyPairReqInfo, ID_TRANSFORM_MODE string) (*cres.KeyPairInfo, error) {
func CreateKey(connectionName string, rsType string, reqInfo cres.KeyPairReqInfo, IDTransformMode string) (*cres.KeyPairInfo, error) {
cblog.Info("call CreateKey()")

// check empty and trim user inputs
Expand Down Expand Up @@ -178,7 +178,7 @@ func CreateKey(connectionName string, rsType string, reqInfo cres.KeyPairReqInfo
}

spUUID := ""
if GetID_MGMT(ID_TRANSFORM_MODE) == "ON" { // Use IID Management
if GetID_MGMT(IDTransformMode) == "ON" { // Use IID Management
// (2) generate SP-XID and create reqIID, driverIID
// ex) SP-XID {"vm-01-9m4e2mr0ui3e8a215n4g"}
//
Expand Down
4 changes: 2 additions & 2 deletions api-runtime/common-runtime/MyImageManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func RegisterMyImage(connectionName string, userIID cres.IID) (*cres.MyImageInfo
// (4) create spiderIID: {reqNameID, "driverNameID:driverSystemID"}
// (5) insert spiderIID
// (6) create userIID
func SnapshotVM(connectionName string, rsType string, reqInfo cres.MyImageInfo, ID_TRANSFORM_MODE string) (*cres.MyImageInfo, error) {
func SnapshotVM(connectionName string, rsType string, reqInfo cres.MyImageInfo, IDTransformMode string) (*cres.MyImageInfo, error) {
cblog.Info("call SnapshotVM()")

// check empty and trim user inputs
Expand Down Expand Up @@ -178,7 +178,7 @@ func SnapshotVM(connectionName string, rsType string, reqInfo cres.MyImageInfo,
}

spUUID := ""
if GetID_MGMT(ID_TRANSFORM_MODE) == "ON" { // Use IID Management
if GetID_MGMT(IDTransformMode) == "ON" { // Use IID Management
// (2) generate SP-XID and create reqIID, driverIID
// ex) SP-XID {"vm-01-9m4e2mr0ui3e8a215n4g"}
//
Expand Down
4 changes: 2 additions & 2 deletions api-runtime/common-runtime/NLBManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func RegisterNLB(connectionName string, vpcUserID string, userIID cres.IID) (*cr
// (4) create spiderIID: {reqNameID, "driverNameID:driverSystemID"}
// (5) insert spiderIID
// (6) create userIID
func CreateNLB(connectionName string, rsType string, reqInfo cres.NLBInfo, ID_TRANSFORM_MODE string) (*cres.NLBInfo, error) {
func CreateNLB(connectionName string, rsType string, reqInfo cres.NLBInfo, IDTransformMode string) (*cres.NLBInfo, error) {
cblog.Info("call CreateNLB()")

// check empty and trim user inputs
Expand Down Expand Up @@ -368,7 +368,7 @@ func CreateNLB(connectionName string, rsType string, reqInfo cres.NLBInfo, ID_TR
}

spUUID := ""
if GetID_MGMT(ID_TRANSFORM_MODE) == "ON" { // Use IID Management
if GetID_MGMT(IDTransformMode) == "ON" { // Use IID Management
// (2) generate SP-XID and create reqIID, driverIID
// ex) SP-XID {"vm-01-9m4e2mr0ui3e8a215n4g"}
//
Expand Down
4 changes: 2 additions & 2 deletions api-runtime/common-runtime/SecurityGroupManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func RegisterSecurity(connectionName string, vpcUserID string, userIID cres.IID)
// (4) create spiderIID: {reqNameID, "driverNameID:driverSystemID"}
// (5) insert spiderIID
// (6) create userIID
func CreateSecurity(connectionName string, rsType string, reqInfo cres.SecurityReqInfo, ID_TRANSFORM_MODE string) (*cres.SecurityInfo, error) {
func CreateSecurity(connectionName string, rsType string, reqInfo cres.SecurityReqInfo, IDTransformMode string) (*cres.SecurityInfo, error) {
cblog.Info("call CreateSecurity()")

// check empty and trim user inputs
Expand Down Expand Up @@ -347,7 +347,7 @@ func CreateSecurity(connectionName string, rsType string, reqInfo cres.SecurityR
}

spUUID := ""
if GetID_MGMT(ID_TRANSFORM_MODE) == "ON" { // Use IID Management
if GetID_MGMT(IDTransformMode) == "ON" { // Use IID Management
// (2) generate SP-XID and create reqIID, driverIID
// ex) SP-XID {"vm-01-9m4e2mr0ui3e8a215n4g"}
//
Expand Down
4 changes: 2 additions & 2 deletions api-runtime/common-runtime/VMManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ func RegisterVM(connectionName string, userIID cres.IID) (*cres.VMInfo, error) {
// (5) create spiderIID: {reqNameID, "driverNameID:driverSystemID"}
// (6) insert spiderIID
// (7) create userIID
func StartVM(connectionName string, rsType string, reqInfo cres.VMReqInfo, ID_TRANSFORM_MODE string) (*cres.VMInfo, error) {
func StartVM(connectionName string, rsType string, reqInfo cres.VMReqInfo, IDTransformMode string) (*cres.VMInfo, error) {
cblog.Info("call StartVM()")

// check empty and trim user inputs
Expand Down Expand Up @@ -454,7 +454,7 @@ func StartVM(connectionName string, rsType string, reqInfo cres.VMReqInfo, ID_TR
}

spUUID := ""
if GetID_MGMT(ID_TRANSFORM_MODE) == "ON" { // Use IID Management
if GetID_MGMT(IDTransformMode) == "ON" { // Use IID Management
// (3) generate SP-XID and create reqIID, driverIID
// ex) SP-XID {"vm-01-9m4e2mr0ui3e8a215n4g"}
//
Expand Down
10 changes: 5 additions & 5 deletions api-runtime/common-runtime/VPC-SubnetManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func UnregisterSubnet(connectionName string, vpcName string, nameId string) (boo
// (4) create spiderIID: {reqNameID, "driverNameID:driverSystemID"}
// (5) insert spiderIID
// (6) create userIID
func CreateVPC(connectionName string, rsType string, reqInfo cres.VPCReqInfo, ID_TRANSFORM_MODE string) (*cres.VPCInfo, error) {
func CreateVPC(connectionName string, rsType string, reqInfo cres.VPCReqInfo, IDTransformMode string) (*cres.VPCInfo, error) {
cblog.Info("call CreateVPC()")

// check empty and trim user inputs
Expand Down Expand Up @@ -378,7 +378,7 @@ func CreateVPC(connectionName string, rsType string, reqInfo cres.VPCReqInfo, ID
}

spUUID := ""
if GetID_MGMT(ID_TRANSFORM_MODE) == "ON" { // Use IID Management
if GetID_MGMT(IDTransformMode) == "ON" { // Use IID Management
// (2) generate SP-XID and create reqIID, driverIID
// ex) SP-XID {"vm-01-9m4e2mr0ui3e8a215n4g"}
//
Expand Down Expand Up @@ -413,7 +413,7 @@ func CreateVPC(connectionName string, rsType string, reqInfo cres.VPCReqInfo, ID
subnetInfoList := []cres.SubnetInfo{}
for _, info := range reqInfo.SubnetInfoList {
subnetUUID := ""
if GetID_MGMT(ID_TRANSFORM_MODE) == "ON" { // Use IID Management
if GetID_MGMT(IDTransformMode) == "ON" { // Use IID Management
subnetUUID, err = iidm.New(connectionName, rsSubnet, info.IId.NameId)
if err != nil {
cblog.Error(err)
Expand Down Expand Up @@ -748,7 +748,7 @@ func GetVPC(connectionName string, rsType string, nameID string) (*cres.VPCInfo,
// (1) check exist(NameID)
// (2) create Resource
// (3) insert IID
func AddSubnet(connectionName string, rsType string, vpcName string, reqInfo cres.SubnetInfo, ID_TRANSFORM_MODE string) (*cres.VPCInfo, error) {
func AddSubnet(connectionName string, rsType string, vpcName string, reqInfo cres.SubnetInfo, IDTransformMode string) (*cres.VPCInfo, error) {
cblog.Info("call AddSubnet()")

// check empty and trim user inputs
Expand Down Expand Up @@ -799,7 +799,7 @@ func AddSubnet(connectionName string, rsType string, vpcName string, reqInfo cre
}

subnetUUID := ""
if GetID_MGMT(ID_TRANSFORM_MODE) == "ON" { // Use IID Management
if GetID_MGMT(IDTransformMode) == "ON" { // Use IID Management
subnetUUID, err = iidm.New(connectionName, rsType, reqInfo.IId.NameId)
if err != nil {
cblog.Error(err)
Expand Down
10 changes: 5 additions & 5 deletions api-runtime/rest-runtime/ClusterRest.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ func UnregisterCluster(c echo.Context) error {
}

type ClusterReq struct {
NameSpace string
ConnectionName string
ID_TRANSFORM_MODE string // ON | OFF, default is ON
ReqInfo struct {
NameSpace string
ConnectionName string
IDTransformMode string // ON | OFF, default is ON
ReqInfo struct {
// (1) Cluster Info
Name string
Version string
Expand Down Expand Up @@ -169,7 +169,7 @@ func CreateCluster(c echo.Context) error {
}

// Call common-runtime API
result, err := cmrt.CreateCluster(req.ConnectionName, rsCluster, reqInfo, req.ID_TRANSFORM_MODE)
result, err := cmrt.CreateCluster(req.ConnectionName, rsCluster, reqInfo, req.IDTransformMode)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}
Expand Down
8 changes: 4 additions & 4 deletions api-runtime/rest-runtime/DiskRest.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ func UnregisterDisk(c echo.Context) error {
}

type DiskReq struct {
ConnectionName string
ID_TRANSFORM_MODE string // ON | OFF, default is ON
ReqInfo struct {
ConnectionName string
IDTransformMode string // ON | OFF, default is ON
ReqInfo struct {
Name string
Zone string

Expand All @@ -109,7 +109,7 @@ func CreateDisk(c echo.Context) error {
}

// Call common-runtime API
result, err := cmrt.CreateDisk(req.ConnectionName, rsDisk, reqInfo, req.ID_TRANSFORM_MODE)
result, err := cmrt.CreateDisk(req.ConnectionName, rsDisk, reqInfo, req.IDTransformMode)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}
Expand Down
8 changes: 4 additions & 4 deletions api-runtime/rest-runtime/KeyPairRest.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ func CreateKey(c echo.Context) error {
cblog.Info("call CreateKey()")

var req struct {
ConnectionName string
ID_TRANSFORM_MODE string // ON | OFF, default is ON
ReqInfo struct {
ConnectionName string
IDTransformMode string // ON | OFF, default is ON
ReqInfo struct {
Name string
}
}
Expand All @@ -124,7 +124,7 @@ func CreateKey(c echo.Context) error {
}

// Call common-runtime API
result, err := cmrt.CreateKey(req.ConnectionName, rsKey, reqInfo, req.ID_TRANSFORM_MODE)
result, err := cmrt.CreateKey(req.ConnectionName, rsKey, reqInfo, req.IDTransformMode)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}
Expand Down
8 changes: 4 additions & 4 deletions api-runtime/rest-runtime/MyImageRest.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ func UnregisterMyImage(c echo.Context) error {
}

type MyImageReq struct {
ConnectionName string
ID_TRANSFORM_MODE string // ON | OFF, default is ON
ReqInfo struct {
ConnectionName string
IDTransformMode string // ON | OFF, default is ON
ReqInfo struct {
Name string

SourceVM string
Expand All @@ -105,7 +105,7 @@ func SnapshotVM(c echo.Context) error {
}

// Call common-runtime API
result, err := cmrt.SnapshotVM(req.ConnectionName, rsMyImage, reqInfo, req.ID_TRANSFORM_MODE)
result, err := cmrt.SnapshotVM(req.ConnectionName, rsMyImage, reqInfo, req.IDTransformMode)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}
Expand Down
8 changes: 4 additions & 4 deletions api-runtime/rest-runtime/NLBRest.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ func UnregisterNLB(c echo.Context) error {
}

type NLBReq struct {
ConnectionName string
ID_TRANSFORM_MODE string // ON | OFF, default is ON
ReqInfo struct {
ConnectionName string
IDTransformMode string // ON | OFF, default is ON
ReqInfo struct {
Name string
VPCName string
Type string // PUBLIC(V) | INTERNAL
Expand Down Expand Up @@ -163,7 +163,7 @@ func CreateNLB(c echo.Context) error {
reqInfo.HealthChecker = healthChecker

// Call common-runtime API
result, err := cmrt.CreateNLB(req.ConnectionName, rsNLB, reqInfo, req.ID_TRANSFORM_MODE)
result, err := cmrt.CreateNLB(req.ConnectionName, rsNLB, reqInfo, req.IDTransformMode)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}
Expand Down
8 changes: 4 additions & 4 deletions api-runtime/rest-runtime/SecurityGroupRest.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ func UnregisterSecurity(c echo.Context) error {
}

type securityGroupCreateReq struct {
ConnectionName string
ID_TRANSFORM_MODE string // ON | OFF, default is ON
ReqInfo struct {
ConnectionName string
IDTransformMode string // ON | OFF, default is ON
ReqInfo struct {
Name string
VPCName string
Direction string
Expand Down Expand Up @@ -123,7 +123,7 @@ func CreateSecurity(c echo.Context) error {
}

// Call common-runtime API
result, err := cmrt.CreateSecurity(req.ConnectionName, rsSG, reqInfo, req.ID_TRANSFORM_MODE)
result, err := cmrt.CreateSecurity(req.ConnectionName, rsSG, reqInfo, req.IDTransformMode)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}
Expand Down
8 changes: 4 additions & 4 deletions api-runtime/rest-runtime/VMRest.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ func StartVM(c echo.Context) error {
cblog.Info("call StartVM()")

var req struct {
ConnectionName string
ID_TRANSFORM_MODE string // ON | OFF, default is ON
ReqInfo struct {
ConnectionName string
IDTransformMode string // ON | OFF, default is ON
ReqInfo struct {
Name string
ImageType string
ImageName string
Expand Down Expand Up @@ -171,7 +171,7 @@ func StartVM(c echo.Context) error {
}

// Call common-runtime API
result, err := cmrt.StartVM(req.ConnectionName, rsVM, reqInfo, req.ID_TRANSFORM_MODE)
result, err := cmrt.StartVM(req.ConnectionName, rsVM, reqInfo, req.IDTransformMode)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}
Expand Down
16 changes: 8 additions & 8 deletions api-runtime/rest-runtime/VPC-SubnetRest.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ func UnregisterVPC(c echo.Context) error {
}

type vpcCreateReq struct {
ConnectionName string
ID_TRANSFORM_MODE string // ON | OFF, default is ON
ReqInfo struct {
ConnectionName string
IDTransformMode string // ON | OFF, default is ON
ReqInfo struct {
Name string
IPv4_CIDR string
SubnetInfoList []struct {
Expand Down Expand Up @@ -182,7 +182,7 @@ func CreateVPC(c echo.Context) error {
}

// Call common-runtime API
result, err := cmrt.CreateVPC(req.ConnectionName, rsVPC, reqInfo, req.ID_TRANSFORM_MODE)
result, err := cmrt.CreateVPC(req.ConnectionName, rsVPC, reqInfo, req.IDTransformMode)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}
Expand Down Expand Up @@ -335,9 +335,9 @@ func AddSubnet(c echo.Context) error {
cblog.Info("call AddSubnet()")

var req struct {
ConnectionName string
ID_TRANSFORM_MODE string // ON | OFF, default is ON
ReqInfo struct {
ConnectionName string
IDTransformMode string // ON | OFF, default is ON
ReqInfo struct {
Name string
Zone string
IPv4_CIDR string
Expand All @@ -352,7 +352,7 @@ func AddSubnet(c echo.Context) error {
reqSubnetInfo := cres.SubnetInfo{IId: cres.IID{req.ReqInfo.Name, ""}, IPv4_CIDR: req.ReqInfo.IPv4_CIDR, Zone: req.ReqInfo.Zone}

// Call common-runtime API
result, err := cmrt.AddSubnet(req.ConnectionName, rsSubnet, c.Param("VPCName"), reqSubnetInfo, req.ID_TRANSFORM_MODE)
result, err := cmrt.AddSubnet(req.ConnectionName, rsSubnet, c.Param("VPCName"), reqSubnetInfo, req.IDTransformMode)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion setup.env
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export PLUGIN_SW=OFF

## If the value is OFF, Spider does not perform ID transformation.
# default: ON
export ID_TRANSFORM_MODE=ON
export IDTransformMode=ON

# root path of cb-log
export CBLOG_ROOT=$CBSPIDER_ROOT
Expand Down

0 comments on commit efc6c73

Please sign in to comment.