-
Notifications
You must be signed in to change notification settings - Fork 27
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// Get a resourceController | ||
func (f *IBMPIWorkspacesClient) GetRC(rcWorkspaceID string) (*resourcecontrollerv2.ResourceInstance, *core.DetailedResponse, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
ibmpisession/utils.go
Outdated
|
||
// CreateResourceControllerV2 returns a resourceControllerV2 | ||
func CreateResourceControllerV2(url string, authenticator core.Authenticator) (service *rc.ResourceControllerV2, err error) { | ||
endpoint := url |
There was a problem hiding this comment.
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.
@ismirlia Could you also add workspace in |
if err != nil { | ||
return nil, response, fmt.Errorf("error creating workspace: controller %v response %v err %v", controller, response, err) | ||
} | ||
if response.StatusCode >= 400 { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
@michaelkad Could you open the ticket to create an example? |
Created #273 |
Yes, will do. This is urgent-- will address unresolved comments in a #273 |
JIRA: https://jsw.ibm.com/browse/PPC-3726