@@ -1137,6 +1137,63 @@ func (enum *PlatformPlatformGroup) UnmarshalJSON(data []byte) error {
11371137 return nil
11381138}
11391139
1140+ type ProgressStatus string
1141+
1142+ const (
1143+ // Default status returned when no specific progress status is defined.
1144+ ProgressStatusUnknownStatus = ProgressStatus ("unknown_status" )
1145+ // Progress item currently in the pending queue.
1146+ ProgressStatusPending = ProgressStatus ("pending" )
1147+ // Progress item that is being processed.
1148+ ProgressStatusProcessing = ProgressStatus ("processing" )
1149+ // Progress item fully completed.
1150+ ProgressStatusCompleted = ProgressStatus ("completed" )
1151+ // Progress item partially completed.
1152+ ProgressStatusPartiallyCompleted = ProgressStatus ("partially_completed" )
1153+ // Progress item that failed during execution.
1154+ ProgressStatusFailed = ProgressStatus ("failed" )
1155+ // Progress item manually or automatically aborted.
1156+ ProgressStatusAborted = ProgressStatus ("aborted" )
1157+ // Progress item that did not reach completion.
1158+ ProgressStatusNeverFinished = ProgressStatus ("never_finished" )
1159+ )
1160+
1161+ func (enum ProgressStatus ) String () string {
1162+ if enum == "" {
1163+ // return default value if empty
1164+ return string (ProgressStatusUnknownStatus )
1165+ }
1166+ return string (enum )
1167+ }
1168+
1169+ func (enum ProgressStatus ) Values () []ProgressStatus {
1170+ return []ProgressStatus {
1171+ "unknown_status" ,
1172+ "pending" ,
1173+ "processing" ,
1174+ "completed" ,
1175+ "partially_completed" ,
1176+ "failed" ,
1177+ "aborted" ,
1178+ "never_finished" ,
1179+ }
1180+ }
1181+
1182+ func (enum ProgressStatus ) MarshalJSON () ([]byte , error ) {
1183+ return []byte (fmt .Sprintf (`"%s"` , enum )), nil
1184+ }
1185+
1186+ func (enum * ProgressStatus ) UnmarshalJSON (data []byte ) error {
1187+ tmp := ""
1188+
1189+ if err := json .Unmarshal (data , & tmp ); err != nil {
1190+ return err
1191+ }
1192+
1193+ * enum = ProgressStatus (ProgressStatus (tmp ).String ())
1194+ return nil
1195+ }
1196+
11401197// AutoConfigDomainDNS: auto config domain dns.
11411198type AutoConfigDomainDNS struct {
11421199 // Nameservers: whether or not to synchronize domain nameservers.
@@ -1527,6 +1584,22 @@ type MailAccount struct {
15271584 Username string `json:"username"`
15281585}
15291586
1587+ // ProgressSummary: progress summary.
1588+ type ProgressSummary struct {
1589+ // ID: ID of the progress.
1590+ ID string `json:"id"`
1591+
1592+ // BackupItemsCount: total number of backup items included in the progress.
1593+ BackupItemsCount uint64 `json:"backup_items_count"`
1594+
1595+ // Percentage: completion percentage of the progress.
1596+ Percentage uint64 `json:"percentage"`
1597+
1598+ // Status: current status of the progress operation.
1599+ // Default value: unknown_status
1600+ Status ProgressStatus `json:"status"`
1601+ }
1602+
15301603// Website: website.
15311604type Website struct {
15321605 // Domain: the domain of the website.
@@ -1573,6 +1646,18 @@ type BackupAPIGetBackupRequest struct {
15731646 BackupID string `json:"-"`
15741647}
15751648
1649+ // BackupAPIGetProgressRequest: backup api get progress request.
1650+ type BackupAPIGetProgressRequest struct {
1651+ // Region: region to target. If none is passed will use default region from the config.
1652+ Region scw.Region `json:"-"`
1653+
1654+ // HostingID: ID of the hosting associated with the progress.
1655+ HostingID string `json:"-"`
1656+
1657+ // ProgressID: ID of the progress to retrieve.
1658+ ProgressID string `json:"-"`
1659+ }
1660+
15761661// BackupAPIListBackupItemsRequest: backup api list backup items request.
15771662type BackupAPIListBackupItemsRequest struct {
15781663 // Region: region to target. If none is passed will use default region from the config.
@@ -1604,6 +1689,15 @@ type BackupAPIListBackupsRequest struct {
16041689 OrderBy ListBackupsRequestOrderBy `json:"-"`
16051690}
16061691
1692+ // BackupAPIListRecentProgressesRequest: backup api list recent progresses request.
1693+ type BackupAPIListRecentProgressesRequest struct {
1694+ // Region: region to target. If none is passed will use default region from the config.
1695+ Region scw.Region `json:"-"`
1696+
1697+ // HostingID: ID of the hosting linked to the progress.
1698+ HostingID string `json:"-"`
1699+ }
1700+
16071701// BackupAPIRestoreBackupItemsRequest: backup api restore backup items request.
16081702type BackupAPIRestoreBackupItemsRequest struct {
16091703 // Region: region to target. If none is passed will use default region from the config.
@@ -2537,6 +2631,12 @@ func (r *ListOffersResponse) UnsafeAppend(res any) (uint64, error) {
25372631 return uint64 (len (results .Offers )), nil
25382632}
25392633
2634+ // ListRecentProgressesResponse: list recent progresses response.
2635+ type ListRecentProgressesResponse struct {
2636+ // Progresses: list of summarized progress entries.
2637+ Progresses []* ProgressSummary `json:"progresses"`
2638+ }
2639+
25402640// ListWebsitesResponse: list websites response.
25412641type ListWebsitesResponse struct {
25422642 // TotalCount: total number of websites.
@@ -2660,6 +2760,22 @@ type OfferAPIListOffersRequest struct {
26602760 ControlPanels []string `json:"-"`
26612761}
26622762
2763+ // Progress: progress.
2764+ type Progress struct {
2765+ // ID: ID of the progress.
2766+ ID string `json:"id"`
2767+
2768+ // BackupItemGroups: groups of backup items included in this progress.
2769+ BackupItemGroups []* BackupItemGroup `json:"backup_item_groups"`
2770+
2771+ // Percentage: completion percentage of the progress.
2772+ Percentage uint64 `json:"percentage"`
2773+
2774+ // Status: current status of the progress operation.
2775+ // Default value: unknown_status
2776+ Status ProgressStatus `json:"status"`
2777+ }
2778+
26632779// ResetHostingPasswordResponse: reset hosting password response.
26642780type ResetHostingPasswordResponse struct {
26652781 // Deprecated: OneTimePassword: new temporary password (deprecated, use password_b64 instead).
@@ -2685,10 +2801,16 @@ type ResourceSummary struct {
26852801}
26862802
26872803// RestoreBackupItemsResponse: restore backup items response.
2688- type RestoreBackupItemsResponse struct {}
2804+ type RestoreBackupItemsResponse struct {
2805+ // ProgressID: identifier used to track the item restoration progress.
2806+ ProgressID string `json:"progress_id"`
2807+ }
26892808
26902809// RestoreBackupResponse: restore backup response.
2691- type RestoreBackupResponse struct {}
2810+ type RestoreBackupResponse struct {
2811+ // ProgressID: identifier used to track the backup restoration progress.
2812+ ProgressID string `json:"progress_id"`
2813+ }
26922814
26932815// SearchDomainsResponse: search domains response.
26942816type SearchDomainsResponse struct {
@@ -2925,6 +3047,72 @@ func (s *BackupAPI) RestoreBackupItems(req *BackupAPIRestoreBackupItemsRequest,
29253047 return & resp , nil
29263048}
29273049
3050+ // GetProgress: Retrieve detailed information about a specific progress by its ID.
3051+ func (s * BackupAPI ) GetProgress (req * BackupAPIGetProgressRequest , opts ... scw.RequestOption ) (* Progress , error ) {
3052+ var err error
3053+
3054+ if req .Region == "" {
3055+ defaultRegion , _ := s .client .GetDefaultRegion ()
3056+ req .Region = defaultRegion
3057+ }
3058+
3059+ if fmt .Sprint (req .Region ) == "" {
3060+ return nil , errors .New ("field Region cannot be empty in request" )
3061+ }
3062+
3063+ if fmt .Sprint (req .HostingID ) == "" {
3064+ return nil , errors .New ("field HostingID cannot be empty in request" )
3065+ }
3066+
3067+ if fmt .Sprint (req .ProgressID ) == "" {
3068+ return nil , errors .New ("field ProgressID cannot be empty in request" )
3069+ }
3070+
3071+ scwReq := & scw.ScalewayRequest {
3072+ Method : "GET" ,
3073+ Path : "/webhosting/v1/regions/" + fmt .Sprint (req .Region ) + "/hostings/" + fmt .Sprint (req .HostingID ) + "/progresses/" + fmt .Sprint (req .ProgressID ) + "" ,
3074+ }
3075+
3076+ var resp Progress
3077+
3078+ err = s .client .Do (scwReq , & resp , opts ... )
3079+ if err != nil {
3080+ return nil , err
3081+ }
3082+ return & resp , nil
3083+ }
3084+
3085+ // ListRecentProgresses: List recent progresses associated with a specific backup, grouped by type.
3086+ func (s * BackupAPI ) ListRecentProgresses (req * BackupAPIListRecentProgressesRequest , opts ... scw.RequestOption ) (* ListRecentProgressesResponse , error ) {
3087+ var err error
3088+
3089+ if req .Region == "" {
3090+ defaultRegion , _ := s .client .GetDefaultRegion ()
3091+ req .Region = defaultRegion
3092+ }
3093+
3094+ if fmt .Sprint (req .Region ) == "" {
3095+ return nil , errors .New ("field Region cannot be empty in request" )
3096+ }
3097+
3098+ if fmt .Sprint (req .HostingID ) == "" {
3099+ return nil , errors .New ("field HostingID cannot be empty in request" )
3100+ }
3101+
3102+ scwReq := & scw.ScalewayRequest {
3103+ Method : "GET" ,
3104+ Path : "/webhosting/v1/regions/" + fmt .Sprint (req .Region ) + "/hostings/" + fmt .Sprint (req .HostingID ) + "/progresses" ,
3105+ }
3106+
3107+ var resp ListRecentProgressesResponse
3108+
3109+ err = s .client .Do (scwReq , & resp , opts ... )
3110+ if err != nil {
3111+ return nil , err
3112+ }
3113+ return & resp , nil
3114+ }
3115+
29283116// This API allows you to manage your Web Hosting services.
29293117type ControlPanelAPI struct {
29303118 client * scw.Client
0 commit comments