Skip to content

Commit 18c37de

Browse files
authored
feat(edge_services): add status to stages (#3023)
1 parent c3cbbd9 commit 18c37de

1 file changed

Lines changed: 68 additions & 5 deletions

File tree

api/edge_services/v1beta1/edge_services_sdk.go

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,45 @@ func (enum *SearchWafStagesRequestOrderBy) UnmarshalJSON(data []byte) error {
10861086
return nil
10871087
}
10881088

1089+
type StageStatus string
1090+
1091+
const (
1092+
StageStatusUnknownStatus = StageStatus("unknown_status")
1093+
StageStatusInactive = StageStatus("inactive")
1094+
StageStatusActive = StageStatus("active")
1095+
)
1096+
1097+
func (enum StageStatus) String() string {
1098+
if enum == "" {
1099+
// return default value if empty
1100+
return string(StageStatusUnknownStatus)
1101+
}
1102+
return string(enum)
1103+
}
1104+
1105+
func (enum StageStatus) Values() []StageStatus {
1106+
return []StageStatus{
1107+
"unknown_status",
1108+
"inactive",
1109+
"active",
1110+
}
1111+
}
1112+
1113+
func (enum StageStatus) MarshalJSON() ([]byte, error) {
1114+
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
1115+
}
1116+
1117+
func (enum *StageStatus) UnmarshalJSON(data []byte) error {
1118+
tmp := ""
1119+
1120+
if err := json.Unmarshal(data, &tmp); err != nil {
1121+
return err
1122+
}
1123+
1124+
*enum = StageStatus(StageStatus(tmp).String())
1125+
return nil
1126+
}
1127+
10891128
type WafStageMode string
10901129

10911130
const (
@@ -1250,6 +1289,10 @@ type BackendStage struct {
12501289
// PipelineID: pipeline ID the backend stage belongs to.
12511290
PipelineID string `json:"pipeline_id"`
12521291

1292+
// Status: current status of the stage.
1293+
// Default value: unknown_status
1294+
Status StageStatus `json:"status"`
1295+
12531296
// CreatedAt: date the backend stage was created.
12541297
CreatedAt *time.Time `json:"created_at"`
12551298

@@ -1285,20 +1328,24 @@ type CacheStage struct {
12851328
// IncludeCookies: defines whether responses to requests with cookies must be stored in the cache.
12861329
IncludeCookies bool `json:"include_cookies"`
12871330

1331+
// Status: current status of the stage.
1332+
// Default value: unknown_status
1333+
Status StageStatus `json:"status"`
1334+
12881335
// CreatedAt: date the cache stage was created.
12891336
CreatedAt *time.Time `json:"created_at"`
12901337

12911338
// UpdatedAt: date the cache stage was last updated.
12921339
UpdatedAt *time.Time `json:"updated_at"`
12931340

1341+
// Precisely one of WafStageID, BackendStageID, RouteStageID must be set.
1342+
WafStageID *string `json:"waf_stage_id,omitempty"`
1343+
12941344
// BackendStageID: backend stage ID the cache stage is linked to.
1295-
// Precisely one of BackendStageID, WafStageID, RouteStageID must be set.
1345+
// Precisely one of WafStageID, BackendStageID, RouteStageID must be set.
12961346
BackendStageID *string `json:"backend_stage_id,omitempty"`
12971347

1298-
// Precisely one of BackendStageID, WafStageID, RouteStageID must be set.
1299-
WafStageID *string `json:"waf_stage_id,omitempty"`
1300-
1301-
// Precisely one of BackendStageID, WafStageID, RouteStageID must be set.
1348+
// Precisely one of WafStageID, BackendStageID, RouteStageID must be set.
13021349
RouteStageID *string `json:"route_stage_id,omitempty"`
13031350
}
13041351

@@ -1320,6 +1367,10 @@ type DNSStage struct {
13201367
// PipelineID: pipeline ID the DNS stage belongs to.
13211368
PipelineID string `json:"pipeline_id"`
13221369

1370+
// Status: current status of the stage.
1371+
// Default value: unknown_status
1372+
Status StageStatus `json:"status"`
1373+
13231374
// CreatedAt: date the DNS stage was created.
13241375
CreatedAt *time.Time `json:"created_at"`
13251376

@@ -1389,6 +1440,10 @@ type RouteStage struct {
13891440
// Precisely one of WafStageID, BackendStageID must be set.
13901441
BackendStageID *string `json:"backend_stage_id,omitempty"`
13911442

1443+
// Status: current status of the stage.
1444+
// Default value: unknown_status
1445+
Status StageStatus `json:"status"`
1446+
13921447
// CreatedAt: date the route stage was created.
13931448
CreatedAt *time.Time `json:"created_at"`
13941449

@@ -1413,6 +1468,10 @@ type TLSStage struct {
14131468
// CertificateExpiresAt: expiration date of the certificate.
14141469
CertificateExpiresAt *time.Time `json:"certificate_expires_at"`
14151470

1471+
// Status: current status of the stage.
1472+
// Default value: unknown_status
1473+
Status StageStatus `json:"status"`
1474+
14161475
// CreatedAt: date the TLS stage was created.
14171476
CreatedAt *time.Time `json:"created_at"`
14181477

@@ -1449,6 +1508,10 @@ type WafStage struct {
14491508
// ParanoiaLevel: sensitivity level (`1`,`2`,`3`,`4`) to use when classifying requests as malicious. With a high level, requests are more likely to be classed as malicious, and false positives are expected. With a lower level, requests are more likely to be classed as benign.
14501509
ParanoiaLevel uint32 `json:"paranoia_level"`
14511510

1511+
// Status: current status of the stage.
1512+
// Default value: unknown_status
1513+
Status StageStatus `json:"status"`
1514+
14521515
// CreatedAt: date the WAF stage was created.
14531516
CreatedAt *time.Time `json:"created_at"`
14541517

0 commit comments

Comments
 (0)