Skip to content

Commit

Permalink
Merge pull request #182 from yunify/modify-loadbalancer-listener-scene
Browse files Browse the repository at this point in the history
support modify loadbalancer listener attributes scene
  • Loading branch information
qingcloud-cps-robot authored Nov 9, 2023
2 parents 95aa9c6 + a6700f2 commit 0645231
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions service/load_balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1444,16 +1444,18 @@ func (s *LoadBalancerService) ModifyLoadBalancerListenerAttributes(i *ModifyLoad
}

type ModifyLoadBalancerListenerAttributesInput struct {
BalanceMode *string `json:"balance_mode" name:"balance_mode" location:"params"`
Forwardfor *int `json:"forwardfor" name:"forwardfor" location:"params"`
HealthyCheckMethod *string `json:"healthy_check_method" name:"healthy_check_method" location:"params"`
HealthyCheckOption *string `json:"healthy_check_option" name:"healthy_check_option" location:"params"`
ListenerOption *int `json:"listener_option" name:"listener_option" location:"params"`
LoadBalancerListener *string `json:"loadbalancer_listener" name:"loadbalancer_listener" location:"params"` // Required
LoadBalancerListenerName *string `json:"loadbalancer_listener_name" name:"loadbalancer_listener_name" location:"params"`
ServerCertificateID []*string `json:"server_certificate_id" name:"server_certificate_id" location:"params"`
SessionSticky *string `json:"session_sticky" name:"session_sticky" location:"params"`
Timeout *int `json:"timeout" name:"timeout" location:"params"`
BalanceMode *string `json:"balance_mode" name:"balance_mode" location:"params"`
Forwardfor *int `json:"forwardfor" name:"forwardfor" location:"params"`
HealthyCheckMethod *string `json:"healthy_check_method" name:"healthy_check_method" location:"params"`
HealthyCheckOption *string `json:"healthy_check_option" name:"healthy_check_option" location:"params"`
ListenerOption *int `json:"listener_option" name:"listener_option" location:"params"`
LoadBalancerListener *string `json:"loadbalancer_listener" name:"loadbalancer_listener" location:"params"` // Required
LoadBalancerListenerName *string `json:"loadbalancer_listener_name" name:"loadbalancer_listener_name" location:"params"`
// Scene's available values: 0, 1, 11
Scene *int `json:"scene" name:"scene" location:"params"`
ServerCertificateID []*string `json:"server_certificate_id" name:"server_certificate_id" location:"params"`
SessionSticky *string `json:"session_sticky" name:"session_sticky" location:"params"`
Timeout *int `json:"timeout" name:"timeout" location:"params"`
}

func (v *ModifyLoadBalancerListenerAttributesInput) Validate() error {
Expand All @@ -1465,6 +1467,26 @@ func (v *ModifyLoadBalancerListenerAttributesInput) Validate() error {
}
}

if v.Scene != nil {
sceneValidValues := []string{"0", "1", "11"}
sceneParameterValue := fmt.Sprint(*v.Scene)

sceneIsValid := false
for _, value := range sceneValidValues {
if value == sceneParameterValue {
sceneIsValid = true
}
}

if !sceneIsValid {
return errors.ParameterValueNotAllowedError{
ParameterName: "Scene",
ParameterValue: sceneParameterValue,
AllowedValues: sceneValidValues,
}
}
}

return nil
}

Expand Down

0 comments on commit 0645231

Please sign in to comment.