-
Notifications
You must be signed in to change notification settings - Fork 38
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
Code cleanup #659
Code cleanup #659
Conversation
return nil, errors.ToError(err) | ||
} | ||
return resp.Payload, nil | ||
return c.client.GetAll() |
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.
A definition for GetAll() exists in power-go-client. The same has been re-used as the functionality is indifferent from the current implementation.
params := p_cloud_volumes.NewPcloudCloudinstancesVolumesGetallParams().
WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).
WithCloudInstanceID(f.cloudInstanceID)
resp, err := f.session.Power.PCloudVolumes.PcloudCloudinstancesVolumesGetall(params, f.session.AuthInfo(f.cloudInstanceID))
if err != nil {
return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get all Volumes for Cloud Instance %s: %w", f.cloudInstanceID, err))
}
if resp == nil || resp.Payload == nil {
return nil, fmt.Errorf("failed to Get all Volumes for Cloud Instance %s", f.cloudInstanceID)
}
return resp.Payload, nil
@@ -27,13 +27,6 @@ type ResourceControllerV2 struct { | |||
ResourceControllerV2 *rcv2.ResourceControllerV2 | |||
} | |||
|
|||
func NewResourceControllerV2(r *rcv2.ResourceControllerV2Options) (*ResourceControllerV2, 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.
Unused definiton.
@@ -52,22 +47,14 @@ func (c *Client) GetAllPublic() (*models.Networks, error) { | |||
} | |||
|
|||
func (c *Client) GetAll() (*models.Networks, error) { | |||
params := p_cloud_networks.NewPcloudNetworksGetallParamsWithTimeout(pkg.TIMEOUT).WithCloudInstanceID(c.instanceID) |
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.
An existing definition exists in power-go-client. The definition is indifferent from the one in the imported package.
func (f *IBMPINetworkClient) GetAll() (*models.Networks, error) {
params := p_cloud_networks.NewPcloudNetworksGetallParams().
WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).
WithCloudInstanceID(f.cloudInstanceID)
resp, err := f.session.Power.PCloudNetworks.PcloudNetworksGetall(params, f.session.AuthInfo(f.cloudInstanceID))
if err != nil {
return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get Network for cloud instance %s with error %w", f.cloudInstanceID, err))
}
if resp == nil || resp.Payload == nil {
return nil, fmt.Errorf("failed to Get Network for cloud instance %s", f.cloudInstanceID)
}
return resp.Payload, nil
}
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.
let us split into two PRs..
/hold for #660 |
workspace name
and cleanup code.335bab8
to
a6d940c
Compare
/unhold |
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kishen-v, mkumatag The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Includes definitions to reuse code, removes unused definitions and redundant declarations.