func (a *API) FetchRuleSetGroup(cid CIDType) (*RuleSetGroup, error) {
	if cid == nil || *cid == "" {
		return nil, fmt.Errorf("Invalid rule set group CID [none]")
	}

	groupCID := string(*cid)

	matched, err := regexp.MatchString(config.RuleSetGroupCIDRegex, groupCID)
	if err != nil {
		return nil, err
	}
	if !matched {
		return nil, fmt.Errorf("Invalid rule set group CID [%s]", groupCID)
	}

	result, err := a.Get(groupCID)
	if err != nil {
		return nil, err
	}

	if a.Debug {
		a.Log.Printf("[DEBUG] fetch rule set group, received JSON: %s", string(result))
	}

	rulesetGroup := &RuleSetGroup{}
	if err := json.Unmarshal(result, rulesetGroup); err != nil {
		return nil, err
	}

	return rulesetGroup, nil
}
func (a *API) FetchRuleSetGroup(cid CIDType) (*RuleSetGroup, error) {
	if cid == nil || *cid == "" {
		return nil, fmt.Errorf("Invalid rule set group CID [none]")
	}

	groupCID := string(*cid)

	matched, err := regexp.MatchString(config.RuleSetGroupCIDRegex, groupCID)
	if err != nil {
		return nil, err
	}
	if !matched {
		return nil, fmt.Errorf("Invalid rule set group CID [%s]", groupCID)
	}

	result, err := a.Get(groupCID)
	if err != nil {
		return nil, err
	}

	if a.Debug {
		a.Log.Printf("[DEBUG] fetch rule set group, received JSON: %s", string(result))
	}

	rulesetGroup := &RuleSetGroup{}
	if err := json.Unmarshal(result, rulesetGroup); err != nil {
		return nil, err
	}

	return rulesetGroup, nil
}
func ( a * API ) FetchRuleSetGroup ( cid CIDType ) ( * RuleSetGroup , error ) { if cid == nil || * cid == " " { return nil , fmt . Errorf ( " " ) } groupCID := string ( * cid ) matched , err := regexp . MatchString ( config . RuleSetGroupCIDRegex , groupCID ) if err != nil { return nil , err } if ! matched { return nil , fmt . Errorf ( " " , groupCID ) } result , err := a . Get ( groupCID ) if err != nil { return nil , err } if a . Debug { a . Log . Printf ( " " , string ( result ) ) } rulesetGroup := & RuleSetGroup { } if err := json . Unmarshal ( result , rulesetGroup ) ; err != nil { return nil , err } return rulesetGroup , nil }
// FetchRuleSetGroup retrieves rule set group with passed cid.
FetchRuleSetGroup retrieves rule set group with passed cid .