Skip to content

Commit 8984366

Browse files
authored
feat: add support for the RetryStrategy OnlyOn property (limit to network failures) (#143)
1 parent 5a5624c commit 8984366

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

types.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -932,20 +932,22 @@ type SSLCertificates struct {
932932
}
933933

934934
type RetryStrategy struct {
935-
Type string `json:"type"`
936-
BaseBackoffSeconds int `json:"baseBackoffSeconds"`
937-
MaxRetries int `json:"maxRetries"`
938-
MaxDurationSeconds int `json:"maxDurationSeconds"`
939-
SameRegion bool `json:"sameRegion"`
935+
Type string `json:"type"`
936+
BaseBackoffSeconds int `json:"baseBackoffSeconds"`
937+
MaxRetries int `json:"maxRetries"`
938+
MaxDurationSeconds int `json:"maxDurationSeconds"`
939+
SameRegion bool `json:"sameRegion"`
940+
OnlyOn []string `json:"onlyOn,omitempty"`
940941
}
941942

942943
func (s RetryStrategy) MarshalJSON() ([]byte, error) {
943944
type flexibleRetryStrategy struct {
944-
Type string `json:"type"`
945-
BaseBackoffSeconds *int `json:"baseBackoffSeconds,omitempty"`
946-
MaxRetries *int `json:"maxRetries,omitempty"`
947-
MaxDurationSeconds *int `json:"maxDurationSeconds,omitempty"`
948-
SameRegion *bool `json:"sameRegion,omitempty"`
945+
Type string `json:"type"`
946+
BaseBackoffSeconds *int `json:"baseBackoffSeconds,omitempty"`
947+
MaxRetries *int `json:"maxRetries,omitempty"`
948+
MaxDurationSeconds *int `json:"maxDurationSeconds,omitempty"`
949+
SameRegion *bool `json:"sameRegion,omitempty"`
950+
OnlyOn []string `json:"onlyOn,omitempty"`
949951
}
950952

951953
switch s.Type {
@@ -957,6 +959,7 @@ func (s RetryStrategy) MarshalJSON() ([]byte, error) {
957959
Type: s.Type,
958960
BaseBackoffSeconds: &s.BaseBackoffSeconds,
959961
SameRegion: &s.SameRegion,
962+
OnlyOn: s.OnlyOn,
960963
})
961964
default:
962965
return json.Marshal(flexibleRetryStrategy{
@@ -965,6 +968,7 @@ func (s RetryStrategy) MarshalJSON() ([]byte, error) {
965968
MaxRetries: &s.MaxRetries,
966969
MaxDurationSeconds: &s.MaxDurationSeconds,
967970
SameRegion: &s.SameRegion,
971+
OnlyOn: s.OnlyOn,
968972
})
969973
}
970974
}

0 commit comments

Comments
 (0)