Skip to content

Commit 6115f9e

Browse files
authored
feat(k8s): add resiliency and sla to cluster types (#1773)
1 parent b73e88c commit 6115f9e

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

api/k8s/v1/k8s_sdk.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,39 @@ func (enum *ClusterTypeAvailability) UnmarshalJSON(data []byte) error {
228228
return nil
229229
}
230230

231+
type ClusterTypeResiliency string
232+
233+
const (
234+
ClusterTypeResiliencyUnknownResiliency = ClusterTypeResiliency("unknown_resiliency")
235+
// The control plane is rescheduled on other machines in case of failure of a lower layer
236+
ClusterTypeResiliencyStandard = ClusterTypeResiliency("standard")
237+
// The control plane has replicas to ensure service continuity in case of failure of a lower layer.
238+
ClusterTypeResiliencyHighAvailability = ClusterTypeResiliency("high_availability")
239+
)
240+
241+
func (enum ClusterTypeResiliency) String() string {
242+
if enum == "" {
243+
// return default value if empty
244+
return "unknown_resiliency"
245+
}
246+
return string(enum)
247+
}
248+
249+
func (enum ClusterTypeResiliency) MarshalJSON() ([]byte, error) {
250+
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
251+
}
252+
253+
func (enum *ClusterTypeResiliency) UnmarshalJSON(data []byte) error {
254+
tmp := ""
255+
256+
if err := json.Unmarshal(data, &tmp); err != nil {
257+
return err
258+
}
259+
260+
*enum = ClusterTypeResiliency(ClusterTypeResiliency(tmp).String())
261+
return nil
262+
}
263+
231264
type Ingress string
232265

233266
const (
@@ -678,6 +711,11 @@ type ClusterType struct {
678711
MaxNodes uint32 `json:"max_nodes"`
679712
// CommitmentDelay: time period during which you can no longer switch to a lower offer.
680713
CommitmentDelay *scw.Duration `json:"commitment_delay"`
714+
// SLA: value of the Service Level Agreement of the offer.
715+
SLA float32 `json:"sla"`
716+
// Resiliency: resiliency offered by the offer.
717+
// Default value: unknown_resiliency
718+
Resiliency ClusterTypeResiliency `json:"resiliency"`
681719
}
682720

683721
// CreateClusterRequestAutoUpgrade: create cluster request. auto upgrade.

0 commit comments

Comments
 (0)