Skip to content

Commit

Permalink
Add idle_timeout to Policy of Managed Load Balancer
Browse files Browse the repository at this point in the history
  • Loading branch information
hico-horiuchi committed Feb 19, 2024
1 parent 3816098 commit c643388
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 0 deletions.
4 changes: 4 additions & 0 deletions v2/ecl/managed_load_balancer/v1/policies/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Example to create a policy
Tags: tags,
Algorithm: "round-robin",
Persistence: "cookie",
IdleTimeout: 600,
SorryPageUrl: "https://example.com/sorry",
SourceNat: "enable",
CertificateID: "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand Down Expand Up @@ -105,6 +106,7 @@ Example to create staged policy configurations
createStagedOpts := policies.CreateStagedOpts{
Algorithm: "round-robin",
Persistence: "cookie",
IdleTimeout: 600,
SorryPageUrl: "https://example.com/sorry",
SourceNat: "enable",
CertificateID: "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand Down Expand Up @@ -136,6 +138,7 @@ Example to update staged policy configurations
algorithm := "round-robin"
persistence := "cookie"
idleTimeout := 600
sorryPageUrl := "https://example.com/sorry"
sourceNat := "enable"
certificateID := "f57a98fe-d63e-4048-93a0-51fe163f30d7"
Expand All @@ -146,6 +149,7 @@ Example to update staged policy configurations
updateStagedOpts := policies.UpdateStagedOpts{
Algorithm: &algorithm,
Persistence: &persistence,
IdleTimeout: &idleTimeout,
SorryPageUrl: &sorryPageUrl,
SourceNat: &sourceNat,
CertificateID: &certificateID,
Expand Down
30 changes: 30 additions & 0 deletions v2/ecl/managed_load_balancer/v1/policies/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ type ListOpts struct {
// - Persistence setting of the policy
Persistence string `q:"persistence"`

// - The duration (in seconds) during which a session is allowed to remain inactive
IdleTimeout int `q:"idle_timeout"`

// - URL of the sorry page to which accesses are redirected if all members in the target group are down
SorryPageUrl string `q:"sorry_page_url"`

Expand Down Expand Up @@ -126,6 +129,15 @@ type CreateOpts struct {
// - If `listener.protocol` is `"http"` or `"https"`, `"cookie"` is available
Persistence string `json:"persistence,omitempty"`

// - The duration (in seconds) during which a session is allowed to remain inactive
// - There may be a time difference up to 60 seconds, between the set value and the actual timeout
// - If `listener.protocol` is `"tcp"` or `"udp"`
// - Default value is 120
// - If `listener.protocol` is `"http"` or `"https"`
// - Default value is 600
// - On session timeout, the load balancer sends TCP RST packets to both the client and the real server
IdleTimeout int `json:"idle_timeout,omitempty"`

// - URL of the sorry page to which accesses are redirected if all members in the target group are down
// - If `listener.protocol` is `"http"` or `"https"`, this parameter can be set
// - If `listener.protocol` is neither `"http"` nor `"https"`, must not set this parameter or set `""`
Expand Down Expand Up @@ -306,6 +318,15 @@ type CreateStagedOpts struct {
// - If `listener.protocol` is `"http"` or `"https"`, `"cookie"` is available
Persistence string `json:"persistence,omitempty"`

// - The duration (in seconds) during which a session is allowed to remain inactive
// - There may be a time difference up to 60 seconds, between the set value and the actual timeout
// - If `listener.protocol` is `"tcp"` or `"udp"`
// - Default value is 120
// - If `listener.protocol` is `"http"` or `"https"`
// - Default value is 600
// - On session timeout, the load balancer sends TCP RST packets to both the client and the real server
IdleTimeout int `json:"idle_timeout,omitempty"`

// - URL of the sorry page to which accesses are redirected if all members in the target group are down
// - If `listener.protocol` is `"http"` or `"https"`, this parameter can be set
// - If `listener.protocol` is neither `"http"` nor `"https"`, must not set this parameter or set `""`
Expand Down Expand Up @@ -399,6 +420,15 @@ type UpdateStagedOpts struct {
// - If `listener.protocol` is `"http"` or `"https"`, `"cookie"` is available
Persistence *string `json:"persistence,omitempty"`

// - The duration (in seconds) during which a session is allowed to remain inactive
// - There may be a time difference up to 60 seconds, between the set value and the actual timeout
// - If `listener.protocol` is `"tcp"` or `"udp"`
// - Default value is 120
// - If `listener.protocol` is `"http"` or `"https"`
// - Default value is 600
// - On session timeout, the load balancer sends TCP RST packets to both the client and the real server
IdleTimeout *int `json:"idle_timeout,omitempty"`

// - URL of the sorry page to which accesses are redirected if all members in the target group are down
// - If `listener.protocol` is `"http"` or `"https"`, this parameter can be set
// - If `listener.protocol` is neither `"http"` nor `"https"`, must not set this parameter or set `""`
Expand Down
18 changes: 18 additions & 0 deletions v2/ecl/managed_load_balancer/v1/policies/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ type ConfigurationInResponse struct {
// - If `listener.protocol` is `"http"` or `"https"`, `"cookie"` is available
Persistence string `json:"persistence,omitempty"`

// - The duration (in seconds) during which a session is allowed to remain inactive
// - There may be a time difference up to 60 seconds, between the set value and the actual timeout
// - If `listener.protocol` is `"tcp"` or `"udp"`
// - Default value is 120
// - If `listener.protocol` is `"http"` or `"https"`
// - Default value is 600
// - On session timeout, the load balancer sends TCP RST packets to both the client and the real server
IdleTimeout int `json:"idle_timeout,omitempty"`

// - URL of the sorry page to which accesses are redirected if all members in the target group are down
// - If protocol is not `"http"` or `"https"`, returns `""`
SorryPageUrl string `json:"sorry_page_url,omitempty"`
Expand Down Expand Up @@ -157,6 +166,15 @@ type Policy struct {
// - If `listener.protocol` is `"http"` or `"https"`, `"cookie"` is available
Persistence string `json:"persistence,omitempty"`

// - The duration (in seconds) during which a session is allowed to remain inactive
// - There may be a time difference up to 60 seconds, between the set value and the actual timeout
// - If `listener.protocol` is `"tcp"` or `"udp"`
// - Default value is 120
// - If `listener.protocol` is `"http"` or `"https"`
// - Default value is 600
// - On session timeout, the load balancer sends TCP RST packets to both the client and the real server
IdleTimeout int `json:"idle_timeout,omitempty"`

// - URL of the sorry page to which accesses are redirected if all members in the target group are down
// - If protocol is not `"http"` or `"https"`, returns `""`
SorryPageUrl string `json:"sorry_page_url,omitempty"`
Expand Down
19 changes: 19 additions & 0 deletions v2/ecl/managed_load_balancer/v1/policies/testing/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var listResponse = fmt.Sprintf(`
"tenant_id": "34f5c98ef430457ba81292637d0c6fd0",
"algorithm": "round-robin",
"persistence": "cookie",
"idle_timeout": 600,
"sorry_page_url": "https://example.com/sorry",
"source_nat": "enable",
"certificate_id": "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand Down Expand Up @@ -59,6 +60,7 @@ func listResult() []policies.Policy {
policy1.TenantID = "34f5c98ef430457ba81292637d0c6fd0"
policy1.Algorithm = "round-robin"
policy1.Persistence = "cookie"
policy1.IdleTimeout = 600
policy1.SorryPageUrl = "https://example.com/sorry"
policy1.SourceNat = "enable"
policy1.CertificateID = "f57a98fe-d63e-4048-93a0-51fe163f30d7"
Expand All @@ -80,6 +82,7 @@ var createRequest = fmt.Sprintf(`
},
"algorithm": "round-robin",
"persistence": "cookie",
"idle_timeout": 600,
"sorry_page_url": "https://example.com/sorry",
"source_nat": "enable",
"certificate_id": "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand All @@ -106,6 +109,7 @@ var createResponse = fmt.Sprintf(`
"tenant_id": "34f5c98ef430457ba81292637d0c6fd0",
"algorithm": null,
"persistence": null,
"idle_timeout": null,
"sorry_page_url": null,
"source_nat": null,
"certificate_id": null,
Expand Down Expand Up @@ -136,6 +140,7 @@ func createResult() *policies.Policy {
policy.TenantID = "34f5c98ef430457ba81292637d0c6fd0"
policy.Algorithm = ""
policy.Persistence = ""
policy.IdleTimeout = 0
policy.SorryPageUrl = ""
policy.SourceNat = ""
policy.CertificateID = ""
Expand All @@ -162,6 +167,7 @@ var showResponse = fmt.Sprintf(`
"tenant_id": "34f5c98ef430457ba81292637d0c6fd0",
"algorithm": "round-robin",
"persistence": "cookie",
"idle_timeout": 600,
"sorry_page_url": "https://example.com/sorry",
"source_nat": "enable",
"certificate_id": "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand All @@ -172,6 +178,7 @@ var showResponse = fmt.Sprintf(`
"current": {
"algorithm": "round-robin",
"persistence": "cookie",
"idle_timeout": 600,
"sorry_page_url": "https://example.com/sorry",
"source_nat": "enable",
"certificate_id": "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand All @@ -191,6 +198,7 @@ func showResult() *policies.Policy {
current := policies.ConfigurationInResponse{
Algorithm: "round-robin",
Persistence: "cookie",
IdleTimeout: 600,
SorryPageUrl: "https://example.com/sorry",
SourceNat: "enable",
CertificateID: "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand All @@ -217,6 +225,7 @@ func showResult() *policies.Policy {
policy.TenantID = "34f5c98ef430457ba81292637d0c6fd0"
policy.Algorithm = "round-robin"
policy.Persistence = "cookie"
policy.IdleTimeout = 600
policy.SorryPageUrl = "https://example.com/sorry"
policy.SourceNat = "enable"
policy.CertificateID = "f57a98fe-d63e-4048-93a0-51fe163f30d7"
Expand Down Expand Up @@ -256,6 +265,7 @@ var updateResponse = fmt.Sprintf(`
"tenant_id": "34f5c98ef430457ba81292637d0c6fd0",
"algorithm": null,
"persistence": null,
"idle_timeout": null,
"sorry_page_url": null,
"source_nat": null,
"certificate_id": null,
Expand Down Expand Up @@ -286,6 +296,7 @@ func updateResult() *policies.Policy {
policy.TenantID = "34f5c98ef430457ba81292637d0c6fd0"
policy.Algorithm = ""
policy.Persistence = ""
policy.IdleTimeout = 0
policy.SorryPageUrl = ""
policy.SourceNat = ""
policy.CertificateID = ""
Expand All @@ -302,6 +313,7 @@ var createStagedRequest = fmt.Sprintf(`
"policy": {
"algorithm": "round-robin",
"persistence": "cookie",
"idle_timeout": 600,
"sorry_page_url": "https://example.com/sorry",
"source_nat": "enable",
"certificate_id": "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand All @@ -317,6 +329,7 @@ var createStagedResponse = fmt.Sprintf(`
"policy": {
"algorithm": "round-robin",
"persistence": "cookie",
"idle_timeout": 600,
"sorry_page_url": "https://example.com/sorry",
"source_nat": "enable",
"certificate_id": "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand All @@ -332,6 +345,7 @@ func createStagedResult() *policies.Policy {

policy.Algorithm = "round-robin"
policy.Persistence = "cookie"
policy.IdleTimeout = 600
policy.SorryPageUrl = "https://example.com/sorry"
policy.SourceNat = "enable"
policy.CertificateID = "f57a98fe-d63e-4048-93a0-51fe163f30d7"
Expand All @@ -348,6 +362,7 @@ var showStagedResponse = fmt.Sprintf(`
"policy": {
"algorithm": "round-robin",
"persistence": "cookie",
"idle_timeout": 600,
"sorry_page_url": "https://example.com/sorry",
"source_nat": "enable",
"certificate_id": "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand All @@ -363,6 +378,7 @@ func showStagedResult() *policies.Policy {

policy.Algorithm = "round-robin"
policy.Persistence = "cookie"
policy.IdleTimeout = 600
policy.SorryPageUrl = "https://example.com/sorry"
policy.SourceNat = "enable"
policy.CertificateID = "f57a98fe-d63e-4048-93a0-51fe163f30d7"
Expand All @@ -379,6 +395,7 @@ var updateStagedRequest = fmt.Sprintf(`
"policy": {
"algorithm": "round-robin",
"persistence": "cookie",
"idle_timeout": 600,
"sorry_page_url": "https://example.com/sorry",
"source_nat": "enable",
"certificate_id": "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand All @@ -394,6 +411,7 @@ var updateStagedResponse = fmt.Sprintf(`
"policy": {
"algorithm": "round-robin",
"persistence": "cookie",
"idle_timeout": 600,
"sorry_page_url": "https://example.com/sorry",
"source_nat": "enable",
"certificate_id": "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand All @@ -409,6 +427,7 @@ func updateStagedResult() *policies.Policy {

policy.Algorithm = "round-robin"
policy.Persistence = "cookie"
policy.IdleTimeout = 600
policy.SorryPageUrl = "https://example.com/sorry"
policy.SourceNat = "enable"
policy.CertificateID = "f57a98fe-d63e-4048-93a0-51fe163f30d7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func TestCreatePolicy(t *testing.T) {
Tags: tags,
Algorithm: "round-robin",
Persistence: "cookie",
IdleTimeout: 600,
SorryPageUrl: "https://example.com/sorry",
SourceNat: "enable",
CertificateID: "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand Down Expand Up @@ -223,6 +224,7 @@ func TestCreateStagedPolicy(t *testing.T) {
createStagedOpts := policies.CreateStagedOpts{
Algorithm: "round-robin",
Persistence: "cookie",
IdleTimeout: 600,
SorryPageUrl: "https://example.com/sorry",
SourceNat: "enable",
CertificateID: "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand Down Expand Up @@ -284,6 +286,7 @@ func TestUpdateStagedPolicy(t *testing.T) {

algorithm := "round-robin"
persistence := "cookie"
idleTimeout := 600
sorryPageUrl := "https://example.com/sorry"
sourceNat := "enable"
certificateID := "f57a98fe-d63e-4048-93a0-51fe163f30d7"
Expand All @@ -294,6 +297,7 @@ func TestUpdateStagedPolicy(t *testing.T) {
updateStagedOpts := policies.UpdateStagedOpts{
Algorithm: &algorithm,
Persistence: &persistence,
IdleTimeout: &idleTimeout,
SorryPageUrl: &sorryPageUrl,
SourceNat: &sourceNat,
CertificateID: &certificateID,
Expand Down
4 changes: 4 additions & 0 deletions v3/ecl/managed_load_balancer/v1/policies/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Example to create a policy
Tags: tags,
Algorithm: "round-robin",
Persistence: "cookie",
IdleTimeout: 600,
SorryPageUrl: "https://example.com/sorry",
SourceNat: "enable",
CertificateID: "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand Down Expand Up @@ -105,6 +106,7 @@ Example to create staged policy configurations
createStagedOpts := policies.CreateStagedOpts{
Algorithm: "round-robin",
Persistence: "cookie",
IdleTimeout: 600,
SorryPageUrl: "https://example.com/sorry",
SourceNat: "enable",
CertificateID: "f57a98fe-d63e-4048-93a0-51fe163f30d7",
Expand Down Expand Up @@ -136,6 +138,7 @@ Example to update staged policy configurations
algorithm := "round-robin"
persistence := "cookie"
idleTimeout := 600
sorryPageUrl := "https://example.com/sorry"
sourceNat := "enable"
certificateID := "f57a98fe-d63e-4048-93a0-51fe163f30d7"
Expand All @@ -146,6 +149,7 @@ Example to update staged policy configurations
updateStagedOpts := policies.UpdateStagedOpts{
Algorithm: &algorithm,
Persistence: &persistence,
IdleTimeout: &idleTimeout,
SorryPageUrl: &sorryPageUrl,
SourceNat: &sourceNat,
CertificateID: &certificateID,
Expand Down
30 changes: 30 additions & 0 deletions v3/ecl/managed_load_balancer/v1/policies/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ type ListOpts struct {
// - Persistence setting of the policy
Persistence string `q:"persistence"`

// - The duration (in seconds) during which a session is allowed to remain inactive
IdleTimeout int `q:"idle_timeout"`

// - URL of the sorry page to which accesses are redirected if all members in the target group are down
SorryPageUrl string `q:"sorry_page_url"`

Expand Down Expand Up @@ -126,6 +129,15 @@ type CreateOpts struct {
// - If `listener.protocol` is `"http"` or `"https"`, `"cookie"` is available
Persistence string `json:"persistence,omitempty"`

// - The duration (in seconds) during which a session is allowed to remain inactive
// - There may be a time difference up to 60 seconds, between the set value and the actual timeout
// - If `listener.protocol` is `"tcp"` or `"udp"`
// - Default value is 120
// - If `listener.protocol` is `"http"` or `"https"`
// - Default value is 600
// - On session timeout, the load balancer sends TCP RST packets to both the client and the real server
IdleTimeout int `json:"idle_timeout,omitempty"`

// - URL of the sorry page to which accesses are redirected if all members in the target group are down
// - If `listener.protocol` is `"http"` or `"https"`, this parameter can be set
// - If `listener.protocol` is neither `"http"` nor `"https"`, must not set this parameter or set `""`
Expand Down Expand Up @@ -306,6 +318,15 @@ type CreateStagedOpts struct {
// - If `listener.protocol` is `"http"` or `"https"`, `"cookie"` is available
Persistence string `json:"persistence,omitempty"`

// - The duration (in seconds) during which a session is allowed to remain inactive
// - There may be a time difference up to 60 seconds, between the set value and the actual timeout
// - If `listener.protocol` is `"tcp"` or `"udp"`
// - Default value is 120
// - If `listener.protocol` is `"http"` or `"https"`
// - Default value is 600
// - On session timeout, the load balancer sends TCP RST packets to both the client and the real server
IdleTimeout int `json:"idle_timeout,omitempty"`

// - URL of the sorry page to which accesses are redirected if all members in the target group are down
// - If `listener.protocol` is `"http"` or `"https"`, this parameter can be set
// - If `listener.protocol` is neither `"http"` nor `"https"`, must not set this parameter or set `""`
Expand Down Expand Up @@ -399,6 +420,15 @@ type UpdateStagedOpts struct {
// - If `listener.protocol` is `"http"` or `"https"`, `"cookie"` is available
Persistence *string `json:"persistence,omitempty"`

// - The duration (in seconds) during which a session is allowed to remain inactive
// - There may be a time difference up to 60 seconds, between the set value and the actual timeout
// - If `listener.protocol` is `"tcp"` or `"udp"`
// - Default value is 120
// - If `listener.protocol` is `"http"` or `"https"`
// - Default value is 600
// - On session timeout, the load balancer sends TCP RST packets to both the client and the real server
IdleTimeout *int `json:"idle_timeout,omitempty"`

// - URL of the sorry page to which accesses are redirected if all members in the target group are down
// - If `listener.protocol` is `"http"` or `"https"`, this parameter can be set
// - If `listener.protocol` is neither `"http"` nor `"https"`, must not set this parameter or set `""`
Expand Down
Loading

0 comments on commit c643388

Please sign in to comment.