-
Notifications
You must be signed in to change notification settings - Fork 142
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
OC Migrate Blocks to using AttributeHandlers #267
Conversation
…d). No Read function for ElasticSearch and FTP to align with master
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.
LGTM! This is amazing! This pattern will certainly improve maintainability and adding new resources.
The only action items:
- Consider making
MustProcess
method more dynamic by having a more general param thaninitialVersion bool
- Use
GetKey
pattern ubiquitously in logging endpoints versus the hardcoded string. - Move test fixtures to a
test-fixtures
sub-directory. - Update test helper for reading test fixtures to include a
*testing.T
param and callt.Fatal
instead ofpanic
.
func (h *DefaultServiceAttributeHandler) HasChange(d *schema.ResourceData) bool { | ||
return d.HasChange(h.key) | ||
} | ||
|
||
func (h *DefaultServiceAttributeHandler) MustProcess(d *schema.ResourceData, initialVersion bool) bool { | ||
return h.HasChange(d) | ||
} |
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.
Not blocking.
Comments on these two functions would be really appreciated because they are very similar and it might not be clear when to use one or the other.
@@ -230,3 +94,7 @@ func TestEscapePercentSign(t *testing.T) { | |||
}) | |||
} | |||
} | |||
|
|||
func appendNewLine(s string) 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.
If this isn't used anymore (I don't think it should be), we can delete it.
Resolves: |
Resolves: |
Resolves: |
} | ||
|
||
func processGooglePubSub(d *schema.ResourceData, conn *gofastly.Client, latestVersion int) error { | ||
func (h *GooglePubSubServiceAttributeHandler) Process(d *schema.ResourceData, latestVersion int, conn *gofastly.Client) error { | ||
serviceID := d.Id() | ||
oldLogCfg, newLogCfg := d.GetChange("logging_googlepubsub") |
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.
oldLogCfg, newLogCfg := d.GetChange("logging_googlepubsub") | |
oldLogCfg, newLogCfg := d.GetChange(h.GetKey()) |
} | ||
|
||
func processScalyr(d *schema.ResourceData, conn *gofastly.Client, latestVersion int) error { | ||
func (h *ScalyrServiceAttributeHandler) Process(d *schema.ResourceData, latestVersion int, conn *gofastly.Client) error { | ||
serviceID := d.Id() | ||
oldLogCfg, newLogCfg := d.GetChange("logging_scalyr") |
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.
oldLogCfg, newLogCfg := d.GetChange("logging_scalyr") | |
oldLogCfg, newLogCfg := d.GetChange(h.GetKey()) |
@@ -0,0 +1,53 @@ | |||
-----BEGIN PGP PUBLIC KEY BLOCK----- |
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.
You may have to update this file once you rebase master.
Everything looks good to me! I saw that googlepubsub and scalyr did still need to be updated in one place to use the |
No description provided.