Skip to content

Commit

Permalink
Merge pull request #53 from HewlettPackard/US25988-CMP-1
Browse files Browse the repository at this point in the history
US25988-CMP-1 GO SDK update and models added for load balancer and its configurations
  • Loading branch information
reubenur-rahman authored Jul 27, 2022
2 parents 254ea81 + dc7c774 commit b2fb2e8
Show file tree
Hide file tree
Showing 3 changed files with 841 additions and 193 deletions.
104 changes: 104 additions & 0 deletions pkg/client/load_balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@ func (lb *LoadBalancerAPIService) CreateLoadBalancer(
return loadBalancerResp, err
}

func (lb *LoadBalancerAPIService) UpdateLoadBalancer(
ctx context.Context,
lbID int,
request models.CreateLoadBalancerRequest,
) (models.CreateNetworkLoadBalancerResp, error) {
loadBalancerResp := models.CreateNetworkLoadBalancerResp{}
loadBalancerAPI := &api{
method: "PUT",
path: fmt.Sprintf("%s/%d",
consts.LoadBalancerPath, lbID),
client: lb.Client,
jsonParser: func(body []byte) error {
return json.Unmarshal(body, &loadBalancerResp)
},
}
err := loadBalancerAPI.do(ctx, request, nil)

return loadBalancerResp, err
}

func (lb *LoadBalancerAPIService) DeleteLoadBalancer(
ctx context.Context,
lbID int,
Expand Down Expand Up @@ -126,6 +146,27 @@ func (lb *LoadBalancerAPIService) CreateLBMonitor(
return LBMonitorResp, err
}

func (lb *LoadBalancerAPIService) UpdateLBMonitor(
ctx context.Context,
request models.CreateLBMonitor,
lbID int,
lbmonitorID int,
) (models.CreateLBMonitorResp, error) {
LBMonitorResp := models.CreateLBMonitorResp{}
LBMonitorAPI := &api{
method: "PUT",
path: fmt.Sprintf("%s/%d/%s/%d",
consts.LoadBalancerPath, lbID, consts.LoadBalancerMonitorPath, lbmonitorID),
client: lb.Client,
jsonParser: func(body []byte) error {
return json.Unmarshal(body, &LBMonitorResp)
},
}
err := LBMonitorAPI.do(ctx, request, nil)

return LBMonitorResp, err
}

func (lb *LoadBalancerAPIService) DeleteLBMonitor(
ctx context.Context,
lbID int,
Expand Down Expand Up @@ -205,6 +246,27 @@ func (lb *LoadBalancerAPIService) CreateLBProfile(
return LBProfileResp, err
}

func (lb *LoadBalancerAPIService) UpdateLBProfile(
ctx context.Context,
request models.CreateLBProfile,
lbID int,
lbProfileID int,
) (models.CreateLBProfileResp, error) {
LBProfileResp := models.CreateLBProfileResp{}
LBProfileAPI := &api{
method: "PUT",
path: fmt.Sprintf("%s/%d/%s/%d",
consts.LoadBalancerPath, lbID, consts.LoadBalancerProfilePath, lbProfileID),
client: lb.Client,
jsonParser: func(body []byte) error {
return json.Unmarshal(body, &LBProfileResp)
},
}
err := LBProfileAPI.do(ctx, request, nil)

return LBProfileResp, err
}

func (lb *LoadBalancerAPIService) DeleteLBProfile(
ctx context.Context,
lbID int,
Expand Down Expand Up @@ -285,6 +347,27 @@ func (lb *LoadBalancerAPIService) CreateLBPool(
return LBPoolResp, err
}

func (lb *LoadBalancerAPIService) UpdateLBPool(
ctx context.Context,
request models.CreateLBPool,
lbID int,
lbPoolID int,
) (models.CreateLBPoolResp, error) {
LBPoolResp := models.CreateLBPoolResp{}
LBPoolAPI := &api{
method: "PUT",
path: fmt.Sprintf("%s/%d/%s/%d",
consts.LoadBalancerPath, lbID, consts.LoadBalancerPoolPath, lbPoolID),
client: lb.Client,
jsonParser: func(body []byte) error {
return json.Unmarshal(body, &LBPoolResp)
},
}
err := LBPoolAPI.do(ctx, request, nil)

return LBPoolResp, err
}

func (lb *LoadBalancerAPIService) DeleteLBPool(
ctx context.Context,
lbID int,
Expand Down Expand Up @@ -364,6 +447,27 @@ func (lb *LoadBalancerAPIService) CreateLBVirtualServers(
return LBVSResp, err
}

func (lb *LoadBalancerAPIService) UpdateLBVirtualServers(
ctx context.Context,
request models.CreateLBVirtualServers,
lbID int,
lbVirtualServerID int,
) (models.LBVirtualServersResp, error) {
LBVSResp := models.LBVirtualServersResp{}
LBVSAPI := &api{
method: "PUT",
path: fmt.Sprintf("%s/%d/%s/%d",
consts.LoadBalancerPath, lbID, consts.LoadBalancerVirtualServersPath, lbVirtualServerID),
client: lb.Client,
jsonParser: func(body []byte) error {
return json.Unmarshal(body, &LBVSResp)
},
}
err := LBVSAPI.do(ctx, request, nil)

return LBVSResp, err
}

func (lb *LoadBalancerAPIService) DeleteLBVirtualServers(
ctx context.Context,
lbID int,
Expand Down
Loading

0 comments on commit b2fb2e8

Please sign in to comment.