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

Add SDK workspace create and deletion commands #269

Merged
merged 9 commits into from
Nov 20, 2023
Merged

Conversation

ismirlia
Copy link
Collaborator

helpers/constants.go Outdated Show resolved Hide resolved
@ismirlia ismirlia requested a review from yussufsh November 17, 2023 17:32
johnnguyen3196
johnnguyen3196 previously approved these changes Nov 17, 2023
michaelkad
michaelkad previously approved these changes Nov 19, 2023
Copy link
Collaborator

@michaelkad michaelkad left a comment

Choose a reason for hiding this comment

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

LGTM

This was referenced Nov 20, 2023
Comment on lines +112 to +113
// Get a resourceController
func (f *IBMPIWorkspacesClient) GetRC(rcWorkspaceID string) (*resourcecontrollerv2.ResourceInstance, *core.DetailedResponse, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Get a resourceController
func (f *IBMPIWorkspacesClient) GetRC(rcWorkspaceID string) (*resourcecontrollerv2.ResourceInstance, *core.DetailedResponse, error) {
// Get a workspace
func (f *IBMPIWorkspacesClient) Get(workspaceID string) (*resourcecontrollerv2.ResourceInstance, *core.DetailedResponse, error) {

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why different Get approaches? Do they give different data with RC?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes the Get is the powervs workspace get endpoint, and the Get resource controller is the resource controller's get endpoint. They return slightly different data, and the our get endpoint is only implement in powervs not stratos.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need both versions?

return nil, nil, fmt.Errorf("workspace creation error, incorrect plan value; either \"public\" or \"private\" is allowed")
}
params := resourceController.NewCreateResourceInstanceOptions(name, location, groupID, planID)
controller, response, err := resourceController.CreateResourceInstance(params)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggest re-naming controller -> workspace or cloud_instance everywhere.


// CreateResourceControllerV2 returns a resourceControllerV2
func CreateResourceControllerV2(url string, authenticator core.Authenticator) (service *rc.ResourceControllerV2, err error) {
endpoint := url
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why using this new variable? Use url directly.

@yussufsh
Copy link
Collaborator

@ismirlia Could you also add workspace in examples as well? If this feature is urgent then it can go in a different PR (please create an issue in that case).

if err != nil {
return nil, response, fmt.Errorf("error creating workspace: controller %v response %v err %v", controller, response, err)
}
if response.StatusCode >= 400 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't we also want to use ibmpisession.SDKFailWithAPIError?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Possibly? I'm implementing calls from a different SDK, and I didn't want to introduce new potential errors. I would prefer to revise this after the break.

@ismirlia
Copy link
Collaborator Author

@michaelkad Could you open the ticket to create an example?

@yussufsh
Copy link
Collaborator

@michaelkad Could you open the ticket to create an example?

Created #273
Please address unresolved conversations and mark them resolved. No more review comments.

@michaelkad
Copy link
Collaborator

@michaelkad Could you open the ticket to create an example?

Created #273

Please address unresolved conversations and mark them resolved. No more review comments.

Yes, will do. This is urgent-- will address unresolved comments in a #273

@michaelkad michaelkad merged commit 981aecd into master Nov 20, 2023
1 check passed
@michaelkad michaelkad deleted the workspace-create branch February 26, 2024 18:01
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.

4 participants