Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email Routing Catch All does not match the API docs #1069

Closed
2 tasks done
Cyb3r-Jak3 opened this issue Aug 30, 2022 · 1 comment · Fixed by #1070
Closed
2 tasks done

Email Routing Catch All does not match the API docs #1069

Cyb3r-Jak3 opened this issue Aug 30, 2022 · 1 comment · Fixed by #1070
Milestone

Comments

@Cyb3r-Jak3
Copy link
Contributor

Cyb3r-Jak3 commented Aug 30, 2022

Confirmation

  • My issue isn't already found on the issue tracker.
  • I have replicated my issue using the latest version of the library and it is still present.

cloudflare-go version

latest

Go environment

N/A

Expected output

Expect an API response of

{
  "tag": "a7e6fb77503c41d8a7f3113c6918f10c",
  "name": "Send to user@example.net rule.",
  "enabled": true,
  "matchers": [
    {
      "type": "all"
    }
  ],
  "actions": [
    {
      "type": "forward",
      "value": [
        "destinationaddress@example.net"
      ]
    }
  ]
}

Actual output

Seeing a response of

{
  "result": {
    "tag": "dd4b8763079149b582cbe76bf86e8910",
    "name": "Send to user@example.net rule.",
    "matchers": [
      {
        "type": "all"
      }
    ],
    "actions": [
      {
        "type": "forward",
        "value": [
          "destinationaddress@example.net"
        ]
      }
    ],
    "enabled": true,
    "priority": 2147483647
  },
  "success": true,
  "errors": [],
  "messages": []
}

This causes the return values from both Get and Update to always return an empty EmailRoutingCatchAllRule.

Code demonstrating the issue

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/cloudflare/cloudflare-go"
)

func main() {
	// Construct a new API object using a global API key
	// alternatively, you can use a scoped API token
	api, err := cloudflare.NewWithAPIToken("<API TOKEN>", cloudflare.Debug(true))
	if err != nil {
		log.Fatal(err)
	}

	// Most API calls require a Context
	ctx := context.Background()

	res, err := api.GetEmailRoutingCatchAllRule(ctx, cloudflare.ZoneIdentifier("<ZONE ID>"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%#v", res)
cloudflare-go [DEBUG] REQUEST Method:GET URI:https://api.cloudflare.com/client/v4/zones/<zone id>/email/routing/rules/catch_all Headers:http.Header(nil) Body:<nil>
cloudflare-go [DEBUG] RESPONSE StatusCode:200 RayID:74296582289d3010-BOS ContentType:application/json; charset=UTF-8 Body:"{\"result\":{\"tag\":\"dd4b8763079149b582cbe76bf86e8910\",\"name\":\"\",\"matchers\":[{\"type\":\"all\"}],\"actions\":[{\"type\":\"forward\",\"value\":[\"destinationaddress@example.net\"]}],\"enabled\":true,\"priority\":2147483647},\"success\":true,\"errors\":[],\"messages\":[]}"

{"result":{"tag":"dd4b8763079149b582cbe76bf86e8910","name":"","matchers":[{"type":"all"}],"actions":[{"type":"forward","value":["destinationaddress@example.net"]}],"enabled":true,"priority":2147483647},"success":true,"errors":[],"messages":[]}

cloudflare.EmailRoutingCatchAllRule{Tag:"", Name:"", Enabled:(*bool)(nil), Matchers:[]cloudflare.EmailRoutingRuleMatcher(nil), Actions:[]cloudflare.EmailRoutingRuleAction(nil)}

Steps to reproduce

Run the code given

References

API Docs Links
https://api.cloudflare.com/#email-routing-routing-rules-get-catch-all-rule
https://api.cloudflare.com/#email-routing-routing-rules-update-catch-all-rule

@github-actions
Copy link
Contributor

This functionality has been released in v0.49.0.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant