Skip to content

Commit

Permalink
🌱 add: update https listener
Browse files Browse the repository at this point in the history
  • Loading branch information
anngdinh committed Oct 18, 2024
1 parent 397bee3 commit 59f7569
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 16 deletions.
4 changes: 4 additions & 0 deletions vngcloud/services/loadbalancer/v2/irequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ type IUpdateListenerRequest interface {
WithDefaultPoolId(ppoolId string) IUpdateListenerRequest
WithHeaders(pheaders ...string) IUpdateListenerRequest
ParseUserAgent() string

WithCertificateAuthorities(pca ...string) IUpdateListenerRequest
WithClientCertificate(pclientCert string) IUpdateListenerRequest
WithDefaultCertificateAuthority(pdefaultCA string) IUpdateListenerRequest
}

type IGetPoolHealthMonitorByIdRequest interface {
Expand Down
51 changes: 35 additions & 16 deletions vngcloud/services/loadbalancer/v2/listener_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ type CreateListenerRequest struct {
}

type UpdateListenerRequest struct {
AllowedCidrs string `json:"allowedCidrs"`
DefaultPoolId string `json:"defaultPoolId"`
TimeoutClient int `json:"timeoutClient"`
TimeoutConnection int `json:"timeoutConnection"`
TimeoutMember int `json:"timeoutMember"`
Headers []string `json:"headers"`
ClientCertificate *string `json:"clientCertificate"`
DefaultCertificateAuthority *string `json:"defaultCertificateAuthority"`
AllowedCidrs string `json:"allowedCidrs"`
DefaultPoolId string `json:"defaultPoolId"`
TimeoutClient int `json:"timeoutClient"`
TimeoutConnection int `json:"timeoutConnection"`
TimeoutMember int `json:"timeoutMember"`
Headers []string `json:"headers"`
CertificateAuthorities *[]string `json:"certificateAuthorities"`
ClientCertificate *string `json:"clientCertificate"`
DefaultCertificateAuthority *string `json:"defaultCertificateAuthority"`

lscommon.LoadBalancerCommon
lscommon.ListenerCommon
Expand Down Expand Up @@ -159,14 +160,17 @@ func (s *CreateListenerRequest) WithDefaultPoolId(ppoolId string) ICreateListene

func (s *CreateListenerRequest) ToMap() map[string]interface{} {
return map[string]interface{}{
"listenerName": s.ListenerName,
"listenerProtocol": s.ListenerProtocol,
"listenerProtocolPort": s.ListenerProtocolPort,
"timeoutClient": s.TimeoutClient,
"timeoutConnection": s.TimeoutConnection,
"timeoutMember": s.TimeoutMember,
"allowedCidrs": s.AllowedCidrs,
"defaultPoolId": s.DefaultPoolId,
"listenerName": s.ListenerName,
"listenerProtocol": s.ListenerProtocol,
"listenerProtocolPort": s.ListenerProtocolPort,
"timeoutClient": s.TimeoutClient,
"timeoutConnection": s.TimeoutConnection,
"timeoutMember": s.TimeoutMember,
"allowedCidrs": s.AllowedCidrs,
"defaultPoolId": s.DefaultPoolId,
"certificateAuthorities": s.CertificateAuthorities,
"clientCertificate": s.ClientCertificate,
"defaultCertificateAuthority": s.DefaultCertificateAuthority,
}
}

Expand Down Expand Up @@ -211,3 +215,18 @@ func (s *UpdateListenerRequest) WithHeaders(pheaders ...string) IUpdateListenerR
s.Headers = pheaders
return s
}

func (s *UpdateListenerRequest) WithCertificateAuthorities(pca ...string) IUpdateListenerRequest {
s.CertificateAuthorities = &pca
return s
}

func (s *UpdateListenerRequest) WithClientCertificate(pclientCert string) IUpdateListenerRequest {
s.ClientCertificate = &pclientCert
return s
}

func (s *UpdateListenerRequest) WithDefaultCertificateAuthority(pdefaultCA string) IUpdateListenerRequest {
s.DefaultCertificateAuthority = &pdefaultCA
return s
}

0 comments on commit 59f7569

Please sign in to comment.