(body map[string]interface{}, subdomainType SubDomainType)
| 236 | } |
| 237 | |
| 238 | func validateSubDomainConfig(body map[string]interface{}, subdomainType SubDomainType) error { |
| 239 | if subdomainType == SubDomainTypeCreate { |
| 240 | _, ok := body["NAME"] |
| 241 | if !ok { |
| 242 | return errors.New("name field is required") |
| 243 | } |
| 244 | _, ok = body["DOMAIN_NAME"] |
| 245 | if !ok { |
| 246 | return errors.New("domain_name field is required") |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | config, ok := body["CONFIG"] |
| 251 | if !ok { |
| 252 | return errors.New("config field is required") |
| 253 | } |
| 254 | v, ok := config.(map[string]interface{})["vpc_uuid"] |
| 255 | if !ok { |
| 256 | return errors.New("config.vpc_uuid field is required") |
| 257 | } |
| 258 | if _, ok = v.(string); !ok { |
| 259 | return errors.New("invalid type (config.vpc_uuid), please specify as string") |
| 260 | } |
| 261 | return nil |
| 262 | } |
| 263 | |
| 264 | func deleteSubDomain(cmd *cobra.Command, args []string) error { |
| 265 | if len(args) == 0 { |
no test coverage detected