Skip to content

Commit

Permalink
Merge pull request #52 from surajsub/master
Browse files Browse the repository at this point in the history
Updated code for Detach Port
  • Loading branch information
surajsub authored Aug 19, 2020
2 parents 878a0c9 + e457736 commit f89b92f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions clients/instance/ibm-pi-network.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,13 @@ func (f *IBMPINetworkClient) AttachPort(powerinstanceid, network_id, port_id, de

func (f *IBMPINetworkClient) DetachPort(powerinstanceid, network_id, port_id string, timeout time.Duration) (*models.NetworkPort, error) {
log.Printf("Calling the detach port ")
var body = models.NetworkPortUpdate{}
body.PvmInstanceID = nil

params := p_cloud_networks.NewPcloudNetworksPortsPutParamsWithTimeout(timeout).WithCloudInstanceID(powerinstanceid).WithNetworkID(network_id).WithPortID(port_id).WithBody(&body)
emptyPVM := ""
body := &models.NetworkPortUpdate{
PvmInstanceID: &emptyPVM,
}

params := p_cloud_networks.NewPcloudNetworksPortsPutParamsWithTimeout(timeout).WithCloudInstanceID(powerinstanceid).WithNetworkID(network_id).WithPortID(port_id).WithBody(body)
resp, err := f.session.Power.PCloudNetworks.PcloudNetworksPortsPut(params, ibmpisession.NewAuth(f.session, powerinstanceid))

if err != nil {
Expand Down

0 comments on commit f89b92f

Please sign in to comment.