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

Initial v2 version of GO SDK #5

Merged
merged 10 commits into from
Oct 17, 2018
Merged

Initial v2 version of GO SDK #5

merged 10 commits into from
Oct 17, 2018

Conversation

nickithewatt
Copy link

No description provided.

pegerto and others added 8 commits October 15, 2018 23:55
Initial sdk client configuration
Create README.md
Stubbing the HttpClient
Changing package name for the ci
Update README.md
Adding CI status
Ci (#3)
Added missing tests to the new files
Updated the environment resource to match the established format
Cleanup of unused dependencies
Fixing build after merge.

// String returns a string value for the passed string pointer.
// It returns the empty string if the pointer is nil.
func String(s *string) string {
Copy link

Choose a reason for hiding this comment

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

This set of functions seems gratuitous and unnecessary

Copy link

Choose a reason for hiding this comment

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

These are helper functions because we are using pointers in our structs. We are using pointers so we can support Terraform which may need to know whether a field is initialised or null. Go will assign values to unassigned variables and this might be undesirable. For example: an unassigned int will be given a 0 and Terraform might interpret this as a change where there isn't one.
There are also issues with attaining a pointer to a string literal, e.g., &"string" doesn't work. We have added a set of functions to handle this. We also added functions to go back to a value to provide null checking boiler plate. This provides some symmetry.

We can make them private so they are no exported if you wish?

Copy link

Choose a reason for hiding this comment

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

@ja6a I understand what they are. please make them private and clean up any naming conflicts.

@jchenry
Copy link

jchenry commented Oct 16, 2018

Please run the code through golint or similar.

@jchenry
Copy link

jchenry commented Oct 16, 2018

I notice there is no retry logic in the client, and only DefaultHTTPClient is used. Skytap has specific semantics around resources being busy, and even though a resource may be busy when trying to update, this is not considered a failure.

see api/api.go and api/requests.go in the original SDK for context.

@ja6a
Copy link

ja6a commented Oct 16, 2018

Please run the code through golint or similar.

ok we will add golint to the CI process.

I notice there is no retry logic in the client, and only DefaultHTTPClient is used. Skytap has specific semantics around resources being busy, and even though a resource may be busy when trying to update, this is not considered a failure.

see api/api.go and api/requests.go in the original SDK for context.

The intention is to let the terraform tooling handle these situations. Please refer to : https://www.terraform.io/docs/extend/resources.html

@jchenry
Copy link

jchenry commented Oct 16, 2018

@ja6a and while that may be true, if the SDK is to be used by things other than terraform, the retry logic should be present.

@ja6a
Copy link

ja6a commented Oct 17, 2018

@ja6a and while that may be true, if the SDK is to be used by things other than terraform, the retry logic should be present.

We have raised the issue #7 to address this. We will raise a separate PR for this.

@jchenry
Copy link

jchenry commented Oct 17, 2018

👍 LGTM

@ja6a ja6a merged commit 00911a3 into skytap:v2 Oct 17, 2018
pegerto pushed a commit that referenced this pull request Oct 25, 2018
* Add automatic Networks
pegerto pushed a commit that referenced this pull request Oct 26, 2018
pegerto pushed a commit that referenced this pull request Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants