ctyun vpc create fix

This commit is contained in:
TangBin
2020-02-26 17:36:52 +08:00
parent 5140a0f7a6
commit bce284a4c4
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -115,6 +115,7 @@ func (self *SRegion) CreateVpc(name, cidr string) (*SVpc, error) {
return nil, err
}
vpc.ResVpcID, _ = resp.GetString("returnObj", "id")
vpc.region = self
return vpc, nil
}
+4
View File
@@ -204,6 +204,10 @@ func (self *SRegion) GetVpc(vpcId string) (*SVpc, error) {
return nil, errors.Wrap(err, "SRegion.GetVpc.DoGet")
}
if id, _ := resp.GetString("returnObj", "resVpcId"); len(id) == 0 {
return nil, errors.Wrap(cloudprovider.ErrNotFound, "SRegion.GetVpc.GetID")
}
err = resp.Unmarshal(vpc, "returnObj")
if err != nil {
return nil, errors.Wrap(err, "SRegion.GetVpc.Unmarshal")