Skip to content

Commit

Permalink
Add Requested Zone info to Subnet Info
Browse files Browse the repository at this point in the history
  • Loading branch information
innodreamer committed Sep 20, 2024
1 parent a4f10bb commit 7610b3d
Showing 1 changed file with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@ func init() {
}

type VPC struct {
IID IId `json:"IId"`
Cidr string `json:"IPv4_CIDR"`
Subnet_List []Subnet `json:"SubnetInfoList"`
KeyValue_List []KeyValue `json:"KeyValueList"`
IID IId `json:"IId"`
Cidr string `json:"IPv4_CIDR"`
Subnet_List []Subnet `json:"SubnetInfoList"`
KeyValue_List []KeyValue `json:"KeyValueList"`
}

type Subnet struct {
IID IId `json:"IId"`
Cidr string `json:"IPv4_CIDR"`
KeyValue_List []KeyValue `json:"KeyValueList"`
IID IId `json:"IId"`
Zone string `json:"Zone"`
Cidr string `json:"IPv4_CIDR"`
KeyValue_List []KeyValue `json:"KeyValueList"`
}

type KeyValue struct {
Expand Down Expand Up @@ -326,12 +327,13 @@ func (VPCHandler *NcpVPCHandler) CreateSubnet(subnetReqInfo irs.SubnetInfo) (irs

newSubnetInfo := irs.SubnetInfo{
IId: irs.IID{
NameId: subnetReqInfo.IId.NameId,
NameId: subnetReqInfo.IId.NameId,
// Note!! : subnetReqInfo.IId.NameId -> SystemId
SystemId: subnetReqInfo.IId.NameId,
SystemId: subnetReqInfo.IId.NameId,
},
IPv4_CIDR: subnetReqInfo.IPv4_CIDR,
KeyValueList: []irs.KeyValue{
Zone: subnetReqInfo.Zone,
IPv4_CIDR: subnetReqInfo.IPv4_CIDR,
KeyValueList: []irs.KeyValue{
{Key: "NCP-Subnet-info.", Value: "This Subnet info. is temporary."},
},
}
Expand All @@ -351,6 +353,7 @@ func (VPCHandler *NcpVPCHandler) MappingVPCInfo(vpcJSON VPC) (irs.VPCInfo, error
for i := 0; i < len(vpcJSON.Subnet_List); i++ {
subnetInfo.IId.NameId = vpcJSON.Subnet_List[i].IID.NameID
subnetInfo.IId.SystemId = vpcJSON.Subnet_List[i].IID.SystemID
subnetInfo.Zone = vpcJSON.Subnet_List[i].Zone
subnetInfo.IPv4_CIDR = vpcJSON.Subnet_List[i].Cidr

for j := 0; j < len(vpcJSON.Subnet_List[i].KeyValue_List); j++ {
Expand All @@ -369,7 +372,7 @@ func (VPCHandler *NcpVPCHandler) MappingVPCInfo(vpcJSON VPC) (irs.VPCInfo, error
}

vpcInfo := irs.VPCInfo{
//VPC 정보는 CB에서 파일로 관리되므로 SystemId는 NameId와 동일하게
// Since the VPC information is managed as a file, the systemID is the same as the nameID.
IId: irs.IID{NameId: vpcJSON.IID.NameID, SystemId: vpcJSON.IID.NameID},
IPv4_CIDR: vpcJSON.Cidr,
SubnetInfoList: subnetInfoList,
Expand Down

0 comments on commit 7610b3d

Please sign in to comment.