You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Started encountering an issue with one of our integrations, where we use the API to update transform rules in Cloudflare. Upon review of the API docs, I found that there are a pair of methods that can be used for updating individual transform rules, rather than the entire ruleset, and these methods do no appear to represented in the SDK:
Unrelated, but potentially relevant - the method update the entire ruleset no longer works on one of my zones, but this PATCH method does. I'm not entirely sure why.
Use cases
Updating a user-friendly URL to redirect to an updated versioned URL, without having to resubmit the entire ruleset for the phase.
Potential cloudflare-go usage
// Append to the bottom of rulesets.go// UpdateZoneRulesetRule updates an individual rule within a ruleset for a zone.//// API reference: https://developers.cloudflare.com/api/operations/zone-rulesets-update-a-zone-ruleset-rulefunc (api*API) UpdateZoneRulesetRule(ctx context.Context, zoneID, rulesetIdentifier, ruleIdentifierstring, ruleRulesetRule) (Ruleset, error) {
returnapi.updateRulesetRule(ctx, ZoneRouteRoot, zoneID, rulesetIdentifier, ruleIdentifier, rule)
}
// UpdateAccountRulesetRule updates an individual rule within a ruleset for an account.//// API reference: https://developers.cloudflare.com/api/operations/account-rulesets-update-an-account-ruleset-rulefunc (api*API) UpdateAccountRulesetRule(ctx context.Context, accountID, rulesetIdentifier, ruleIdentifierstring, ruleRulesetRule) (Ruleset, error) {
returnapi.updateRulesetRule(ctx, AccountRouteRoot, accountID, rulesetIdentifier, ruleIdentifier, rule)
}
// updateRulesetRule updates a ruleset based on the zone or account, the// identifier and the rules.func (api*API) updateRulesetRule(ctx context.Context, identifierTypeRouteRoot, identifier, rulesetIdentifier, ruleIdentifierstring, ruleRulesetRule) (Ruleset, error) {
uri:=fmt.Sprintf("/%s/%s/rulesets/%s/rules/%s", identifierType, identifier, rulesetIdentifier, ruleIdentifier)
res, err:=api.makeRequestContext(ctx, http.MethodPatch, uri, rule)
iferr!=nil {
returnRuleset{}, err
}
result:=GetRulesetResponse{}
iferr:=json.Unmarshal(res, &result); err!=nil {
returnRuleset{}, fmt.Errorf("%s: %w", errUnmarshalError, err)
}
returnresult.Result, nil
}
References
No response
The text was updated successfully, but these errors were encountered:
Current cloudflare-go version
v0.61.0
Description
Started encountering an issue with one of our integrations, where we use the API to update transform rules in Cloudflare. Upon review of the API docs, I found that there are a pair of methods that can be used for updating individual transform rules, rather than the entire ruleset, and these methods do no appear to represented in the SDK:
https://developers.cloudflare.com/api/operations/account-rulesets-update-an-account-ruleset-rule
https://developers.cloudflare.com/api/operations/zone-rulesets-update-a-zone-ruleset-rule
Unrelated, but potentially relevant - the method update the entire ruleset no longer works on one of my zones, but this PATCH method does. I'm not entirely sure why.
Use cases
Updating a user-friendly URL to redirect to an updated versioned URL, without having to resubmit the entire ruleset for the phase.
Potential cloudflare-go usage
References
No response
The text was updated successfully, but these errors were encountered: