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

single-region cluster crud operations #7

Merged
merged 8 commits into from
Sep 23, 2022
Merged

Conversation

posriniv
Copy link
Collaborator

No description provided.

cmd/util.go Outdated
@@ -38,6 +40,23 @@ func getApiClient(ctx context.Context) (*ybmclient.APIClient, error) {
return apiClient, nil
}

func getClusterID(ctx context.Context, apiClient *ybmclient.APIClient, accountId string, projectId string, clusterName string) (clusterId string, clusterIdOk bool, errorMessage string) {
clusterResp, resp, err := apiClient.ClusterApi.ListClusters(ctx, accountId, projectId).Execute()
Copy link
Contributor

Choose a reason for hiding this comment

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

nit. you could change to apiClient.ClusterApi.ListClusters(ctx, accountId, projectId).Name(clusterName).Execute() to skip the for loop

fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
return
}
populateFlags(cmd, originalSpec, trackName)
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems weird to repopulate the flags with the data from the get request. I think it would be better to write some extra logic to validate that the get response has valid data (if not overwritten by the user).

Is there any other benefit of populating the flags?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, there is. This will allow us to re-use the createClusterSpec code.

@posriniv posriniv changed the title cluster crd operations single-region cluster crud operations Sep 23, 2022
@posriniv posriniv merged commit 978d7cc into main Sep 23, 2022
@posriniv posriniv deleted the posriniv/cluster-crud branch February 7, 2023 03:05
cdavid pushed a commit that referenced this pull request Feb 23, 2023
Former-commit-id: 8db0cea55583ab4249e86dcbdeaf05f1d8d9589e
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.

2 participants