Skip to content

Update *ListResponse structs to match API responses#425

Merged
patryk merged 2 commits intocloudflare:masterfrom
jacobbednarz:update-idp-response-for-messages
Mar 9, 2020
Merged

Update *ListResponse structs to match API responses#425
patryk merged 2 commits intocloudflare:masterfrom
jacobbednarz:update-idp-response-for-messages

Conversation

@jacobbednarz
Copy link
Copy Markdown
Contributor

@jacobbednarz jacobbednarz commented Mar 8, 2020

When the work for
terraform-providers/terraform-provider-cloudflare#597 was started,
the messages object was either empty array or a single string (per
the original cloudflare.Response struct) but the API response is
now spitting out an array of message objects inside of the current
array.

old

{
  "result": {
    "id": "566f1f64-3b1e-40b3-ae1b-807396f1a107",
    "type": "github",
    "uid": "566f1f64-3b1e-40b3-ae1b-807396f1a107",
    "name": "ytypfrkona",
    "config": {
      "client_id": "test",
      "client_secret": "**********************************",
      "redirect_url": "https://my-domain.cloudflareaccess.com/cdn-cgi/access/callback"
    },
    "version": "267eb3e7f2fc57dae9792a2315895d69"
  },
  "success": true,
  "errors": [],
  "messages": []
}

new

{
  "result": {
    "id": "e0d1a74b-5b19-4dc8-823c-d1f2d42b01b3",
    "type": "github",
    "uid": "e0d1a74b-5b19-4dc8-823c-d1f2d42b01b3",
    "name": "iumxxidzao-updated",
    "config": {
      "client_id": "test",
      "client_secret": "**********************************",
      "redirect_url": "https://my-domain.cloudflareaccess.com/cdn-cgi/access/callback"
    },
    "version": "413f20d9ecce0e7b361843841764492a"
  },
  "success": true,
  "errors": [],
  "messages": [
    {
      "message": "Finish enterprise enablement by going to https://my-domain.cloudflareaccess.com/cdn-cgi/access/enterprise-setup/ZTBkMWE3NGItNWIxOS00ZGM4LTgyM2MtZDFmMmQ0MmIwMWIz246b90e12e49a1ed82f16be7f4433da49b7bd15ad7cea7fd96ee9cef81e571f45e6554b7"
    }
  ]
}

To fix the issue, the two structs have been updated to conform to the
required objects.

When the work for
terraform-providers/terraform-provider-cloudflare#597 was started,
the `messages` object was either empty array or a single string (per
the original `cloudflare.Response`[1] struct) but the API response is
now spitting out an array of `message` objects inside of the current
array.

To fix the issue, the two structs have been updated to conform to the
required objects.

[1]: https://github.com/cloudflare/cloudflare-go/blob/master/cloudflare.go#L363
@patryk patryk merged commit 79e96c5 into cloudflare:master Mar 9, 2020
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 this pull request may close these issues.

2 participants