|
7 | 7 | "fmt" |
8 | 8 | "strconv" |
9 | 9 | "strings" |
| 10 | + "time" |
10 | 11 |
|
11 | 12 | "github.com/incubator4/go-resty-expr/expr" |
12 | 13 | ) |
@@ -500,3 +501,45 @@ type RedirectConfig struct { |
500 | 501 | URI string `json:"uri,omitempty" yaml:"uri,omitempty"` |
501 | 502 | RetCode int `json:"ret_code,omitempty" yaml:"ret_code,omitempty"` |
502 | 503 | } |
| 504 | + |
| 505 | +const ( |
| 506 | + StatusSuccess = "success" |
| 507 | + StatusFailed = "failed" |
| 508 | + StatusPartialFailed = "partial_failed" |
| 509 | +) |
| 510 | + |
| 511 | +type SyncResult struct { |
| 512 | + Status string `json:"status"` |
| 513 | + TotalResources int `json:"total_resources"` |
| 514 | + SuccessCount int `json:"success_count"` |
| 515 | + FailedCount int `json:"failed_count"` |
| 516 | + Success []SyncStatus `json:"success"` |
| 517 | + Failed []SyncStatus `json:"failed"` |
| 518 | +} |
| 519 | + |
| 520 | +type SyncStatus struct { |
| 521 | + Event StatusEvent `json:"event"` |
| 522 | + FailedAt time.Time `json:"failed_at,omitempty"` |
| 523 | + SyncedAt time.Time `json:"synced_at,omitempty"` |
| 524 | + Reason string `json:"reason,omitempty"` |
| 525 | + Response ResponseDetails `json:"response,omitempty"` |
| 526 | +} |
| 527 | + |
| 528 | +type StatusEvent struct { |
| 529 | + ResourceType string `json:"resourceType"` |
| 530 | + Type string `json:"type"` |
| 531 | + ResourceID string `json:"resourceId"` |
| 532 | + ResourceName string `json:"resourceName"` |
| 533 | + ParentID string `json:"parentId,omitempty"` |
| 534 | +} |
| 535 | + |
| 536 | +type ResponseDetails struct { |
| 537 | + Status int `json:"status"` |
| 538 | + Headers map[string]string `json:"headers"` |
| 539 | + Data ResponseData `json:"data"` |
| 540 | +} |
| 541 | + |
| 542 | +type ResponseData struct { |
| 543 | + Value map[string]interface{} `json:"value"` |
| 544 | + ErrorMsg string `json:"error_msg"` |
| 545 | +} |
0 commit comments