-
Notifications
You must be signed in to change notification settings - Fork 89
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
Pass-through un-configurable options for enterprise connections #802
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## patch/enterprise-connection-options #802 +/- ##
=======================================================================
- Coverage 90.51% 90.44% -0.07%
=======================================================================
Files 99 99
Lines 13226 13350 +124
=======================================================================
+ Hits 11972 12075 +103
- Misses 889 903 +14
- Partials 365 372 +7
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely more organized than before 👍 . Only a couple small suggestions.
return err | ||
} | ||
|
||
existingOptions := existingConnection.Options.(*management.ConnectionOptionsAD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized after the initial implementation is that we should perform a nil check against existingConnection.Options
before the type assertion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious: Can an already created enterprise connection, not have any options defined? 🤔
I added a nil check in which case we'll skip over the func call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually not sure and to your point, even if it were possible it should be incredibly rare. This would only be precautionary since we've seen occasional panics with type assertions. If you are certain that it is not applicable here, we can remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't mind keeping the check for now.
existingOptions := existingConnection.Options.(*management.ConnectionOptionsAD) | ||
|
||
expandedOptions := connection.Options.(*management.ConnectionOptionsAD) | ||
expandedOptions.Thumbprints = existingOptions.Thumbprints |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -773,3 +780,173 @@ func expandConnectionOptionsScopes(data *schema.ResourceData, options scoper) { | |||
options.SetScopes(true, scope.(string)) | |||
} | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# passThroughUnconfigurableConnectionOptions maintains crucial connection options by forwarding them from the current options to the PATCH payload | |
# This is necessary because the /api/v2/connections/{id}, endpoint does not follow usual | |
# PATCH behavior, the 'options' property is entirely replaced by the payload object. | |
Or something similar.
4ea953b
to
6a3234c
Compare
🔧 Changes
This is a refactor from the fix introduced on v0.
📚 References
🔬 Testing
📝 Checklist