MCPcopy Index your code
hub / github.com/deepflowio/deepflow / validateSubDomainConfig

Function validateSubDomainConfig

cli/ctl/sub_domain.go:238–262  ·  view source on GitHub ↗
(body map[string]interface{}, subdomainType SubDomainType)

Source from the content-addressed store, hash-verified

236}
237
238func 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
264func deleteSubDomain(cmd *cobra.Command, args []string) error {
265 if len(args) == 0 {

Callers 2

createSubDomainFunction · 0.85
updateSubDomainFunction · 0.85

Calls 1

NewMethod · 0.80

Tested by

no test coverage detected