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

Route53 HostedZone id handling is a bit odd. #318

Closed
markhibberd opened this issue Oct 6, 2016 · 3 comments · Fixed by #336
Closed

Route53 HostedZone id handling is a bit odd. #318

markhibberd opened this issue Oct 6, 2016 · 3 comments · Fixed by #336

Comments

@markhibberd
Copy link

Not sure if there is a sensible way to deal with it, but the ids that are returned from API calls, can't be used on subsequent API calls without warping, example:

  1. Call createHostedZone, extract out the ID, will be a string something like /hostedzone/ABC123
  2. Attempt to call changeResourceRecordSets using that ID results in signature error (presumably because of incorrect escaping around /s). Stripping off the /hostedzone/ component and setting ID to just ABC123 works.

Would be good to be able to add a transformation that parses IDs correctly, or in lieu of that do something so the error isn't obscured by the auth failure. Are there any similar transformations done elsewhere? I could have a look at replicating for this, the main issue is it would break compat for anyone working around it at the moment.

@brendanhay
Copy link
Owner

brendanhay commented Oct 10, 2016

It's odd indeed - completely agreed!

I'll look at how it could be transparently handled. Another example of custom types are in S3 for Bucket/Key etc: https://github.com/brendanhay/amazonka/blob/develop/amazonka-s3/src/Network/AWS/S3/Internal.hs

A newtype for HostedZoneId could be introduced in the non-generated code of amazonka-route53 with appropriate de/serialisation instances.

@brendanhay
Copy link
Owner

FYI I'm going to implement this in a manner similar to how the AWS CLI and botocore have handled it.

See: boto/botocore#398

brendanhay added a commit that referenced this issue Nov 27, 2016
brendanhay added a commit that referenced this issue Nov 27, 2016
@brendanhay
Copy link
Owner

Unlike the botocore fix I linked above where they strip prefixes during serialisation to the parameter format, I've actually stripped any prefix during deserialisation from XML. I'm hoping this is sufficient as it keeps the class instances sane, specifically ensuring that decodeXML . encodeXML == Right . id holds.

brendanhay added a commit that referenced this issue Dec 2, 2016
brendanhay added a commit that referenced this issue Dec 2, 2016
Regenerating Route53 with ResourceId usage

Fixes #318
brendanhay added a commit that referenced this issue Dec 2, 2016
brendanhay added a commit that referenced this issue Dec 2, 2016
brendanhay added a commit that referenced this issue Dec 2, 2016
brendanhay added a commit that referenced this issue Dec 3, 2016
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.

2 participants