-
Notifications
You must be signed in to change notification settings - Fork 122
direct: Add RemapState resource method #3586
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
Conversation
bc87791 to
3d288fc
Compare
|
375cd35 to
cdbd8f2
Compare
a8d9cf3 to
f6cc232
Compare
f6cc232 to
6fa9377
Compare
6fa9377 to
472d100
Compare
adef351 to
472d100
Compare
fd3df71 to
aaeeac9
Compare
5543af2 to
8afd69e
Compare
pietern
left a comment
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.
The struct copies are covered with the linter to check for completeness?
| return &input.JobSettings | ||
| } | ||
|
|
||
| func (*ResourceJob) RemapState(jobs *jobs.Job) *jobs.JobSettings { |
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.
It could be worth adding type aliases for readability. We have 3 types that we're dealing with here:
- Config type:
resources.Job - State type:
jobs.JobSettings - Remote type:
jobs.Job
If we alias each of these to e.g. JobConfig, JobState, JobRemote, then it is unambiguous in which direction the remapping happens. It's not clear without context that this function maps from the remote type to the state type.
Changes
New RemapState() method on resource that transform remote state to config type.
Why
To be used to detect remote drift.
Tests
Unit tests.