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

Replace Update method with field update methods #4

Open
wants to merge 2 commits into
base: master
from

Conversation

@jakewan
Copy link
Member

commented Sep 5, 2019

This update is to help support the preferred Terraform pattern of updating resource attributes individually rather than several at once.

Includes improved unit tests.

Tests can be run locally, or in a container (see README.md).

When merged into master, I'll tag it as v2.0.0, since this breaks the previous public API.

Replace Update method with field update methods
Includes:

 - Improve unit tests

@jakewan jakewan requested review from AE9RB, joshcody and aggarwaa Sep 5, 2019

@joshcody
Copy link

left a comment

Aside from a few consistency comments, the overall PR looks good.

Expected: 200,
Got: resp.StatusCode,
}
return nil, fmt.Errorf("Unexpected HTTP response. HTTP status code: %d. Body: %s", resp.StatusCode, resp.Body)

This comment has been minimized.

Copy link
@joshcody

joshcody Sep 6, 2019

Does this line need an error level like the other errors? (like line 106?)

This comment has been minimized.

Copy link
@jakewan

jakewan Sep 6, 2019

Author Member

Good eye! Actually it's the other way around. The convention is to include the log level in calls to log.Printf and log.Println, not in the strings used to create error objects, so I will it on line 106.

return nil, &UnexpectedHTTPStatusError{
Expected: 200,
Got: resp.StatusCode}
return nil, fmt.Errorf("Unexpected HTTP response. HTTP status code: %d. Body: %s", resp.StatusCode, resp.Body)

This comment has been minimized.

Copy link
@joshcody

joshcody Sep 6, 2019

Does this need an error level?

Expected: 204,
Got: resp.StatusCode,
}
return fmt.Errorf("Unexpected HTTP response. HTTP status code: %d. Error: %s", resp.StatusCode, err)

This comment has been minimized.

Copy link
@joshcody

joshcody Sep 6, 2019

Missing error level?

Expected: 201,
Got: resp.StatusCode,
}
return nil, fmt.Errorf("Unexpected HTTP response. HTTP status code: %d. Body: %s", resp.StatusCode, resp.Body)

This comment has been minimized.

Copy link
@jakewan

jakewan Sep 6, 2019

Author Member

Removed log level for consistency (log level goes on calls to log.Printf and log.Println).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.