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

ResourceRecordSet object always has a weight property even when Weighted Routing is not enabled #344

Open
appleoddity opened this issue Apr 2, 2024 · 3 comments
Labels
breaking-change This issue requires a breaking change to remediate. bug This issue is a bug. module/powershell-cmdlets needs-major-version Can only be considered for the next major release p2 This is a standard priority issue v5 vNext

Comments

@appleoddity
Copy link

Describe the bug

When I call the Get-R53ResourceRecordSet function for a hosted zone it returns a collection of ResourceRecordSet. The value of the weight property is 0 even when there is no Weighted Routing policy applied. In contrast, the documentation indicates that the weight property only applies to weighted resource record sets only. For this reason, it is impossible to determine if the exported resource is supposed to have a weighted routing policy or not.

I am using Powershell 7.

Expected Behavior

Similar to the aws cli, I expect the weight property to be null or undefined when the record does not have a weighted routing policy applied.

Current Behavior

The weight property is 0 even when no weighted routing policy is enabled. A value of 0 has special meaning and this created ambiguity. I assume because the weight property is typed to Int64 .NET is converting a null value to 0.

Reproduction Steps

(Get-R53ResourceRecordSet -HostedZoneId $zone.Id -MaxItem 1000).ResourceRecordSets

Observe the weight property on the exported resource records.

Possible Solution

No response

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

AWS Tools for PowerShell
Version 4.1.547
Copyright 2012-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Amazon Web Services SDK for .NET
Core Runtime Version 3.7.303.4
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

Targeted .NET Platform

.NET Core

Operating System and version

Ubuntu w/ Powershell 7

@appleoddity appleoddity added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 2, 2024
@bhoradc bhoradc self-assigned this Apr 2, 2024
@bhoradc bhoradc added needs-reproduction This issue needs reproduction. and removed needs-triage This issue or PR still needs to be triaged. labels Apr 2, 2024
@ashishdhingra ashishdhingra transferred this issue from aws/aws-sdk-net Apr 2, 2024
@ashishdhingra
Copy link
Contributor

@appleoddity Good morning. Thanks for reporting the issue. AWS Tools for PowerShell uses AWS .NET SDK behind the scenes. Looking at the property definition for Weight, even though it has the Nullable backing field, the getter for this property is using this._weight.GetValueOrDefault() which returns value 0 for null weight.

This is a breaking change for current version of SDK. Also, the property definition in this case is generated from service models. There is a similar issue aws/aws-sdk-net#1721 (comment) in our backlog to be queued for fix in the next version of AWS .NET SDK.

CCing @normj for visibility.

Thanks,
Ashish

@ashishdhingra ashishdhingra added breaking-change This issue requires a breaking change to remediate. needs-review needs-major-version Can only be considered for the next major release and removed needs-reproduction This issue needs reproduction. labels Apr 2, 2024
@ashishdhingra
Copy link
Contributor

@appleoddity In case you are blocked by this issue, we could do a customization to expose public Is<Property>Set property (e.g. IsWeightSet) in AWS .NET SDK, which you could then use in PowerShell CmdLet response to check if property is set. This is not a clean workaround, however, this is something which could be fully fixed only in next major version of SDK. Please advise.

Thanks,
Ashish

@appleoddity
Copy link
Author

Thank you for the fast response and explanation. If it's in the backlog, I will wait until the next release. I went ahead and worked around the problem now, because I didn't actually have any weighted records. The only thing I want to point out is I believe TTL has the same problem. If the record is an alias, there is no TTL value, yet it exports as 0. I'm assuming it is null behind the scenes.

@ashishdhingra ashishdhingra added vNext needs-review p2 This is a standard priority issue and removed needs-review labels Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This issue requires a breaking change to remediate. bug This issue is a bug. module/powershell-cmdlets needs-major-version Can only be considered for the next major release p2 This is a standard priority issue v5 vNext
Projects
None yet
Development

No branches or pull requests

3 participants