Skip to content

Commit fd740e6

Browse files
authored
feat(webhosting): add fields to backup api (#2511)
1 parent eb20ebb commit fd740e6

File tree

4 files changed

+196
-4
lines changed

4 files changed

+196
-4
lines changed

packages_generated/webhosting/src/v1/api.gen.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ import {
5454
unmarshalListHostingsResponse,
5555
unmarshalListMailAccountsResponse,
5656
unmarshalListOffersResponse,
57+
unmarshalListRecentProgressesResponse,
5758
unmarshalListWebsitesResponse,
5859
unmarshalMailAccount,
60+
unmarshalProgress,
5961
unmarshalResetHostingPasswordResponse,
6062
unmarshalResourceSummary,
6163
unmarshalRestoreBackupItemsResponse,
@@ -66,8 +68,10 @@ import {
6668
import type {
6769
Backup,
6870
BackupApiGetBackupRequest,
71+
BackupApiGetProgressRequest,
6972
BackupApiListBackupItemsRequest,
7073
BackupApiListBackupsRequest,
74+
BackupApiListRecentProgressesRequest,
7175
BackupApiRestoreBackupItemsRequest,
7276
BackupApiRestoreBackupRequest,
7377
CheckFreeDomainAvailabilityResponse,
@@ -122,13 +126,15 @@ import type {
122126
ListHostingsResponse,
123127
ListMailAccountsResponse,
124128
ListOffersResponse,
129+
ListRecentProgressesResponse,
125130
ListWebsitesResponse,
126131
MailAccount,
127132
MailAccountApiChangeMailAccountPasswordRequest,
128133
MailAccountApiCreateMailAccountRequest,
129134
MailAccountApiListMailAccountsRequest,
130135
MailAccountApiRemoveMailAccountRequest,
131136
OfferApiListOffersRequest,
137+
Progress,
132138
ResetHostingPasswordResponse,
133139
ResourceSummary,
134140
RestoreBackupItemsResponse,
@@ -277,6 +283,38 @@ export class BackupAPI extends ParentAPI {
277283
},
278284
unmarshalRestoreBackupItemsResponse,
279285
)
286+
287+
/**
288+
* Retrieve detailed information about a specific progress by its ID.. Retrieve detailed information about a specific progress by its ID.
289+
*
290+
* @param request - The request {@link BackupApiGetProgressRequest}
291+
* @returns A Promise of Progress
292+
*/
293+
getProgress = (request: Readonly<BackupApiGetProgressRequest>) =>
294+
this.client.fetch<Progress>(
295+
{
296+
method: 'GET',
297+
path: `/webhosting/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam('hostingId', request.hostingId)}/progresses/${validatePathParam('progressId', request.progressId)}`,
298+
},
299+
unmarshalProgress,
300+
)
301+
302+
/**
303+
* List recent progresses associated with a specific backup, grouped by type.. List recent progresses associated with a specific backup, grouped by type.
304+
*
305+
* @param request - The request {@link BackupApiListRecentProgressesRequest}
306+
* @returns A Promise of ListRecentProgressesResponse
307+
*/
308+
listRecentProgresses = (
309+
request: Readonly<BackupApiListRecentProgressesRequest>,
310+
) =>
311+
this.client.fetch<ListRecentProgressesResponse>(
312+
{
313+
method: 'GET',
314+
path: `/webhosting/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam('hostingId', request.hostingId)}/progresses`,
315+
},
316+
unmarshalListRecentProgressesResponse,
317+
)
280318
}
281319

282320
/**

packages_generated/webhosting/src/v1/index.gen.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ export type {
1818
AutoConfigDomainDns,
1919
Backup,
2020
BackupApiGetBackupRequest,
21+
BackupApiGetProgressRequest,
2122
BackupApiListBackupItemsRequest,
2223
BackupApiListBackupsRequest,
24+
BackupApiListRecentProgressesRequest,
2325
BackupApiRestoreBackupItemsRequest,
2426
BackupApiRestoreBackupRequest,
2527
BackupItem,
@@ -105,6 +107,7 @@ export type {
105107
ListMailAccountsResponse,
106108
ListOffersRequestOrderBy,
107109
ListOffersResponse,
110+
ListRecentProgressesResponse,
108111
ListWebsitesRequestOrderBy,
109112
ListWebsitesResponse,
110113
MailAccount,
@@ -124,6 +127,9 @@ export type {
124127
PlatformControlPanel,
125128
PlatformControlPanelUrls,
126129
PlatformPlatformGroup,
130+
Progress,
131+
ProgressStatus,
132+
ProgressSummary,
127133
ResetHostingPasswordResponse,
128134
ResourceSummary,
129135
RestoreBackupItemsResponse,

packages_generated/webhosting/src/v1/marshalling.gen.ts

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import type {
5757
ListHostingsResponse,
5858
ListMailAccountsResponse,
5959
ListOffersResponse,
60+
ListRecentProgressesResponse,
6061
ListWebsitesResponse,
6162
MailAccount,
6263
MailAccountApiChangeMailAccountPasswordRequest,
@@ -69,6 +70,8 @@ import type {
6970
Platform,
7071
PlatformControlPanel,
7172
PlatformControlPanelUrls,
73+
Progress,
74+
ProgressSummary,
7275
ResetHostingPasswordResponse,
7376
ResourceSummary,
7477
RestoreBackupItemsResponse,
@@ -671,6 +674,38 @@ export const unmarshalListOffersResponse = (
671674
} as ListOffersResponse
672675
}
673676

677+
const unmarshalProgressSummary = (data: unknown): ProgressSummary => {
678+
if (!isJSONObject(data)) {
679+
throw new TypeError(
680+
`Unmarshalling the type 'ProgressSummary' failed as data isn't a dictionary.`,
681+
)
682+
}
683+
684+
return {
685+
backupItemsCount: data.backup_items_count,
686+
id: data.id,
687+
percentage: data.percentage,
688+
status: data.status,
689+
} as ProgressSummary
690+
}
691+
692+
export const unmarshalListRecentProgressesResponse = (
693+
data: unknown,
694+
): ListRecentProgressesResponse => {
695+
if (!isJSONObject(data)) {
696+
throw new TypeError(
697+
`Unmarshalling the type 'ListRecentProgressesResponse' failed as data isn't a dictionary.`,
698+
)
699+
}
700+
701+
return {
702+
progresses: unmarshalArrayOfObject(
703+
data.progresses,
704+
unmarshalProgressSummary,
705+
),
706+
} as ListRecentProgressesResponse
707+
}
708+
674709
const unmarshalWebsite = (data: unknown): Website => {
675710
if (!isJSONObject(data)) {
676711
throw new TypeError(
@@ -700,6 +735,24 @@ export const unmarshalListWebsitesResponse = (
700735
} as ListWebsitesResponse
701736
}
702737

738+
export const unmarshalProgress = (data: unknown): Progress => {
739+
if (!isJSONObject(data)) {
740+
throw new TypeError(
741+
`Unmarshalling the type 'Progress' failed as data isn't a dictionary.`,
742+
)
743+
}
744+
745+
return {
746+
backupItemGroups: unmarshalArrayOfObject(
747+
data.backup_item_groups,
748+
unmarshalBackupItemGroup,
749+
),
750+
id: data.id,
751+
percentage: data.percentage,
752+
status: data.status,
753+
} as Progress
754+
}
755+
703756
export const unmarshalResetHostingPasswordResponse = (
704757
data: unknown,
705758
): ResetHostingPasswordResponse => {
@@ -739,7 +792,9 @@ export const unmarshalRestoreBackupItemsResponse = (
739792
)
740793
}
741794

742-
return {} as RestoreBackupItemsResponse
795+
return {
796+
progressId: data.progress_id,
797+
} as RestoreBackupItemsResponse
743798
}
744799

745800
export const unmarshalRestoreBackupResponse = (
@@ -751,7 +806,9 @@ export const unmarshalRestoreBackupResponse = (
751806
)
752807
}
753808

754-
return {} as RestoreBackupResponse
809+
return {
810+
progressId: data.progress_id,
811+
} as RestoreBackupResponse
755812
}
756813

757814
const unmarshalDomainAvailability = (data: unknown): DomainAvailability => {

packages_generated/webhosting/src/v1/types.gen.ts

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,16 @@ export type OfferOptionWarning =
142142

143143
export type PlatformPlatformGroup = 'unknown_group' | 'default' | 'premium'
144144

145+
export type ProgressStatus =
146+
| 'unknown_status'
147+
| 'pending'
148+
| 'processing'
149+
| 'completed'
150+
| 'partially_completed'
151+
| 'failed'
152+
| 'aborted'
153+
| 'never_finished'
154+
145155
export interface AutoConfigDomainDns {
146156
/**
147157
* Whether or not to synchronize domain nameservers.
@@ -601,6 +611,25 @@ export interface MailAccount {
601611
username: string
602612
}
603613

614+
export interface ProgressSummary {
615+
/**
616+
* ID of the progress.
617+
*/
618+
id: string
619+
/**
620+
* Total number of backup items included in the progress.
621+
*/
622+
backupItemsCount: number
623+
/**
624+
* Completion percentage of the progress.
625+
*/
626+
percentage: number
627+
/**
628+
* Current status of the progress operation.
629+
*/
630+
status: ProgressStatus
631+
}
632+
604633
export interface Website {
605634
/**
606635
* The domain of the website.
@@ -658,6 +687,21 @@ export type BackupApiGetBackupRequest = {
658687
backupId: string
659688
}
660689

690+
export type BackupApiGetProgressRequest = {
691+
/**
692+
* Region to target. If none is passed will use default region from the config.
693+
*/
694+
region?: ScwRegion
695+
/**
696+
* ID of the hosting associated with the progress.
697+
*/
698+
hostingId: string
699+
/**
700+
* ID of the progress to retrieve.
701+
*/
702+
progressId: string
703+
}
704+
661705
export type BackupApiListBackupItemsRequest = {
662706
/**
663707
* Region to target. If none is passed will use default region from the config.
@@ -696,6 +740,17 @@ export type BackupApiListBackupsRequest = {
696740
orderBy?: ListBackupsRequestOrderBy
697741
}
698742

743+
export type BackupApiListRecentProgressesRequest = {
744+
/**
745+
* Region to target. If none is passed will use default region from the config.
746+
*/
747+
region?: ScwRegion
748+
/**
749+
* ID of the hosting linked to the progress.
750+
*/
751+
hostingId: string
752+
}
753+
699754
export type BackupApiRestoreBackupItemsRequest = {
700755
/**
701756
* Region to target. If none is passed will use default region from the config.
@@ -1622,6 +1677,13 @@ export interface ListOffersResponse {
16221677
offers: Offer[]
16231678
}
16241679

1680+
export interface ListRecentProgressesResponse {
1681+
/**
1682+
* List of summarized progress entries.
1683+
*/
1684+
progresses: ProgressSummary[]
1685+
}
1686+
16251687
export interface ListWebsitesResponse {
16261688
/**
16271689
* Total number of websites.
@@ -1752,6 +1814,25 @@ export type OfferApiListOffersRequest = {
17521814
controlPanels?: string[]
17531815
}
17541816

1817+
export interface Progress {
1818+
/**
1819+
* ID of the progress.
1820+
*/
1821+
id: string
1822+
/**
1823+
* Groups of backup items included in this progress.
1824+
*/
1825+
backupItemGroups: BackupItemGroup[]
1826+
/**
1827+
* Completion percentage of the progress.
1828+
*/
1829+
percentage: number
1830+
/**
1831+
* Current status of the progress operation.
1832+
*/
1833+
status: ProgressStatus
1834+
}
1835+
17551836
export interface ResetHostingPasswordResponse {
17561837
/**
17571838
* @deprecated New temporary password (deprecated, use password_b64 instead).
@@ -1782,9 +1863,19 @@ export interface ResourceSummary {
17821863
websitesCount: number
17831864
}
17841865

1785-
export interface RestoreBackupItemsResponse {}
1866+
export interface RestoreBackupItemsResponse {
1867+
/**
1868+
* Identifier used to track the item restoration progress.
1869+
*/
1870+
progressId: string
1871+
}
17861872

1787-
export interface RestoreBackupResponse {}
1873+
export interface RestoreBackupResponse {
1874+
/**
1875+
* Identifier used to track the backup restoration progress.
1876+
*/
1877+
progressId: string
1878+
}
17881879

17891880
export interface SearchDomainsResponse {
17901881
/**

0 commit comments

Comments
 (0)