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

Acl block to file #253

Merged
merged 8 commits into from
Jun 11, 2020
Merged

Acl block to file #253

merged 8 commits into from
Jun 11, 2020

Conversation

ghost
Copy link

@ghost ghost commented Jun 10, 2020

Factored out the ACL block code from fastly/resource_fastly_service_v1.go into it's own block file, as POC for factoring out all block code.

@ghost ghost added the size/L label Jun 10, 2020
@phamann phamann self-requested a review June 10, 2020 12:14
Copy link
Member

@phamann phamann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM - other than the minor nit comment. I also want to get @mccurdyc's opinion before we merge.

Copy link
Collaborator

@mccurdyc mccurdyc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! A couple comments that would make it more testable and align with logging endpoint structure, not blocking though.

Also, looks like CI is failing just due to formatting (see this). You should be able to just run make fmt to fix.

// Delete removed ACL configurations
for _, vRaw := range remove {
val := vRaw.(map[string]interface{})
opts := gofastly.DeleteACLInput{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking, but in the open logging PRs, we pulled the building of Delete*Input into a separate function (see this).

}

log.Printf("[DEBUG] Fastly ACL removal opts: %#v", opts)
err := conn.DeleteACL(&opts)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking, similar to the above comment, we pulled this block out into its own function (see this).

Comment on lines +79 to +82
_, err := conn.CreateACL(&opts)
if err != nil {
return err
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking, similar to the above comments (see this).

Pulling it out separately would make it easier to inject dependencies in tests.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this wouldn't actually help with DI in tests. But arguably improves readability and could potentially help in future refactoring.

Comment on lines +72 to +76
opts := gofastly.CreateACLInput{
Service: d.Id(),
Version: latestVersion,
Name: val["name"].(string),
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking, similar to the above comments (see this).

Pulling it out separately would make it easier to inject dependencies in tests.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this wouldn't actually help with DI in tests. But arguably improves readability and could potentially help in future refactoring.

Guy Richardson and others added 3 commits June 10, 2020 13:51
Co-authored-by: Patrick Hamann <patrick@fastly.com>
@phamann phamann merged commit 54b55f5 into fastly:master Jun 11, 2020
@ghost ghost mentioned this pull request Jun 12, 2020
@ghost ghost deleted the oc/acl_block_to_file branch June 12, 2020 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants