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

US25988-CMP-1 GO SDK update and models added for load balancer and its configurations #53

Merged
merged 4 commits into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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