func getSubnet(r *http.Request) (*SapiProvisionedSubnets, error) { var port *sjson.Json var sapiSubnet = &SapiProvisionedSubnets{} post, err := sjson.NewFromReader(r.Body) if err != nil { return nil, err } port, ok := post.CheckGet("subnet") if !ok { return nil, ErrorNoPort } b, err := port.Encode() if err != nil { return nil, err } if err = json.Unmarshal(b, sapiSubnet); err != nil { return nil, err } if err != nil { return nil, err } return sapiSubnet, nil }
func getNet(r *http.Request) (*SapiProvisionedNets, error) { var network *sjson.Json var sapiNet = &SapiProvisionedNets{} post, err := sjson.NewFromReader(r.Body) if err != nil { return nil, err } network, ok := post.CheckGet("network") if !ok { return nil, ErrorNoNet } b, err := network.Encode() if err != nil { return nil, err } if err = json.Unmarshal(b, sapiNet); err != nil { return nil, err } return sapiNet, nil }