@scaleway/sdk-webhosting 1.1.3 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,18 @@
1
1
  import { resolveOneOf, isJSONObject, unmarshalArrayOfObject, unmarshalDate, unmarshalMoney } from "@scaleway/sdk-client";
2
+ const unmarshalBackup = (data) => {
3
+ if (!isJSONObject(data)) {
4
+ throw new TypeError(
5
+ `Unmarshalling the type 'Backup' failed as data isn't a dictionary.`
6
+ );
7
+ }
8
+ return {
9
+ createdAt: unmarshalDate(data.created_at),
10
+ id: data.id,
11
+ size: data.size,
12
+ status: data.status,
13
+ totalItems: data.total_items
14
+ };
15
+ };
2
16
  const unmarshalDatabaseUser = (data) => {
3
17
  if (!isJSONObject(data)) {
4
18
  throw new TypeError(
@@ -32,6 +46,65 @@ const unmarshalFtpAccount = (data) => {
32
46
  username: data.username
33
47
  };
34
48
  };
49
+ const unmarshalAutoConfigDomainDns = (data) => {
50
+ if (!isJSONObject(data)) {
51
+ throw new TypeError(
52
+ `Unmarshalling the type 'AutoConfigDomainDns' failed as data isn't a dictionary.`
53
+ );
54
+ }
55
+ return {
56
+ allRecords: data.all_records,
57
+ mailRecords: data.mail_records,
58
+ nameservers: data.nameservers,
59
+ none: data.none,
60
+ webRecords: data.web_records
61
+ };
62
+ };
63
+ const unmarshalHostingDomainCustomDomain = (data) => {
64
+ if (!isJSONObject(data)) {
65
+ throw new TypeError(
66
+ `Unmarshalling the type 'HostingDomainCustomDomain' failed as data isn't a dictionary.`
67
+ );
68
+ }
69
+ return {
70
+ autoConfigDomainDns: data.auto_config_domain_dns ? unmarshalAutoConfigDomainDns(data.auto_config_domain_dns) : void 0,
71
+ dnsStatus: data.dns_status,
72
+ domain: data.domain,
73
+ domainStatus: data.domain_status
74
+ };
75
+ };
76
+ const unmarshalHostingDomain = (data) => {
77
+ if (!isJSONObject(data)) {
78
+ throw new TypeError(
79
+ `Unmarshalling the type 'HostingDomain' failed as data isn't a dictionary.`
80
+ );
81
+ }
82
+ return {
83
+ customDomain: data.custom_domain ? unmarshalHostingDomainCustomDomain(data.custom_domain) : void 0,
84
+ subdomain: data.subdomain
85
+ };
86
+ };
87
+ const unmarshalHostingSummary = (data) => {
88
+ if (!isJSONObject(data)) {
89
+ throw new TypeError(
90
+ `Unmarshalling the type 'HostingSummary' failed as data isn't a dictionary.`
91
+ );
92
+ }
93
+ return {
94
+ createdAt: unmarshalDate(data.created_at),
95
+ dnsStatus: data.dns_status ? data.dns_status : void 0,
96
+ domain: data.domain,
97
+ domainInfo: data.domain_info ? unmarshalHostingDomain(data.domain_info) : void 0,
98
+ domainStatus: data.domain_status ? data.domain_status : void 0,
99
+ id: data.id,
100
+ offerName: data.offer_name,
101
+ projectId: data.project_id,
102
+ protected: data.protected,
103
+ region: data.region,
104
+ status: data.status,
105
+ updatedAt: unmarshalDate(data.updated_at)
106
+ };
107
+ };
35
108
  const unmarshalMailAccount = (data) => {
36
109
  if (!isJSONObject(data)) {
37
110
  throw new TypeError(
@@ -43,28 +116,37 @@ const unmarshalMailAccount = (data) => {
43
116
  username: data.username
44
117
  };
45
118
  };
46
- const unmarshalCheckUserOwnsDomainResponse = (data) => {
119
+ const unmarshalFreeDomain = (data) => {
47
120
  if (!isJSONObject(data)) {
48
121
  throw new TypeError(
49
- `Unmarshalling the type 'CheckUserOwnsDomainResponse' failed as data isn't a dictionary.`
122
+ `Unmarshalling the type 'FreeDomain' failed as data isn't a dictionary.`
50
123
  );
51
124
  }
52
125
  return {
53
- ownsDomain: data.owns_domain
126
+ rootDomain: data.root_domain,
127
+ slug: data.slug
54
128
  };
55
129
  };
56
- const unmarshalAutoConfigDomainDns = (data) => {
130
+ const unmarshalCheckFreeDomainAvailabilityResponse = (data) => {
57
131
  if (!isJSONObject(data)) {
58
132
  throw new TypeError(
59
- `Unmarshalling the type 'AutoConfigDomainDns' failed as data isn't a dictionary.`
133
+ `Unmarshalling the type 'CheckFreeDomainAvailabilityResponse' failed as data isn't a dictionary.`
60
134
  );
61
135
  }
62
136
  return {
63
- allRecords: data.all_records,
64
- mailRecords: data.mail_records,
65
- nameservers: data.nameservers,
66
- none: data.none,
67
- webRecords: data.web_records
137
+ freeDomain: data.free_domain ? unmarshalFreeDomain(data.free_domain) : void 0,
138
+ isAvailable: data.is_available,
139
+ reason: data.reason ? data.reason : void 0
140
+ };
141
+ };
142
+ const unmarshalCheckUserOwnsDomainResponse = (data) => {
143
+ if (!isJSONObject(data)) {
144
+ throw new TypeError(
145
+ `Unmarshalling the type 'CheckUserOwnsDomainResponse' failed as data isn't a dictionary.`
146
+ );
147
+ }
148
+ return {
149
+ ownsDomain: data.owns_domain
68
150
  };
69
151
  };
70
152
  const unmarshalDnsRecord = (data) => {
@@ -121,7 +203,8 @@ const unmarshalDomain = (data) => {
121
203
  availableDnsActions: data.available_dns_actions ? data.available_dns_actions : void 0,
122
204
  name: data.name,
123
205
  owner: data.owner,
124
- status: data.status
206
+ status: data.status,
207
+ zoneDomainName: data.zone_domain_name
125
208
  };
126
209
  };
127
210
  const unmarshalPlatformControlPanelUrls = (data) => {
@@ -191,7 +274,8 @@ const unmarshalOffer = (data) => {
191
274
  name: data.name,
192
275
  options: unmarshalArrayOfObject(data.options, unmarshalOfferOption),
193
276
  price: data.price ? unmarshalMoney(data.price) : void 0,
194
- quotaWarning: data.quota_warning
277
+ quotaWarning: data.quota_warning,
278
+ region: data.region
195
279
  };
196
280
  };
197
281
  const unmarshalPlatform = (data) => {
@@ -219,7 +303,8 @@ const unmarshalHosting = (data) => {
219
303
  createdAt: unmarshalDate(data.created_at),
220
304
  dnsStatus: data.dns_status ? data.dns_status : void 0,
221
305
  domain: data.domain,
222
- domainStatus: data.domain_status,
306
+ domainInfo: data.domain_info ? unmarshalHostingDomain(data.domain_info) : void 0,
307
+ domainStatus: data.domain_status ? data.domain_status : void 0,
223
308
  id: data.id,
224
309
  ipv4: data.ipv4,
225
310
  offer: data.offer ? unmarshalOffer(data.offer) : void 0,
@@ -233,6 +318,54 @@ const unmarshalHosting = (data) => {
233
318
  user: data.user ? unmarshalHostingUser(data.user) : void 0
234
319
  };
235
320
  };
321
+ const unmarshalBackupItem = (data) => {
322
+ if (!isJSONObject(data)) {
323
+ throw new TypeError(
324
+ `Unmarshalling the type 'BackupItem' failed as data isn't a dictionary.`
325
+ );
326
+ }
327
+ return {
328
+ createdAt: unmarshalDate(data.created_at),
329
+ id: data.id,
330
+ name: data.name,
331
+ size: data.size,
332
+ status: data.status,
333
+ type: data.type
334
+ };
335
+ };
336
+ const unmarshalBackupItemGroup = (data) => {
337
+ if (!isJSONObject(data)) {
338
+ throw new TypeError(
339
+ `Unmarshalling the type 'BackupItemGroup' failed as data isn't a dictionary.`
340
+ );
341
+ }
342
+ return {
343
+ items: unmarshalArrayOfObject(data.items, unmarshalBackupItem),
344
+ type: data.type
345
+ };
346
+ };
347
+ const unmarshalListBackupItemsResponse = (data) => {
348
+ if (!isJSONObject(data)) {
349
+ throw new TypeError(
350
+ `Unmarshalling the type 'ListBackupItemsResponse' failed as data isn't a dictionary.`
351
+ );
352
+ }
353
+ return {
354
+ groups: unmarshalArrayOfObject(data.groups, unmarshalBackupItemGroup),
355
+ totalCount: data.total_count
356
+ };
357
+ };
358
+ const unmarshalListBackupsResponse = (data) => {
359
+ if (!isJSONObject(data)) {
360
+ throw new TypeError(
361
+ `Unmarshalling the type 'ListBackupsResponse' failed as data isn't a dictionary.`
362
+ );
363
+ }
364
+ return {
365
+ backups: unmarshalArrayOfObject(data.backups, unmarshalBackup),
366
+ totalCount: data.total_count
367
+ };
368
+ };
236
369
  const unmarshalControlPanel = (data) => {
237
370
  if (!isJSONObject(data)) {
238
371
  throw new TypeError(
@@ -282,35 +415,26 @@ const unmarshalListDatabasesResponse = (data) => {
282
415
  totalCount: data.total_count
283
416
  };
284
417
  };
285
- const unmarshalListFtpAccountsResponse = (data) => {
418
+ const unmarshalListFreeRootDomainsResponse = (data) => {
286
419
  if (!isJSONObject(data)) {
287
420
  throw new TypeError(
288
- `Unmarshalling the type 'ListFtpAccountsResponse' failed as data isn't a dictionary.`
421
+ `Unmarshalling the type 'ListFreeRootDomainsResponse' failed as data isn't a dictionary.`
289
422
  );
290
423
  }
291
424
  return {
292
- ftpAccounts: unmarshalArrayOfObject(data.ftp_accounts, unmarshalFtpAccount),
425
+ rootDomains: data.root_domains,
293
426
  totalCount: data.total_count
294
427
  };
295
428
  };
296
- const unmarshalHostingSummary = (data) => {
429
+ const unmarshalListFtpAccountsResponse = (data) => {
297
430
  if (!isJSONObject(data)) {
298
431
  throw new TypeError(
299
- `Unmarshalling the type 'HostingSummary' failed as data isn't a dictionary.`
432
+ `Unmarshalling the type 'ListFtpAccountsResponse' failed as data isn't a dictionary.`
300
433
  );
301
434
  }
302
435
  return {
303
- createdAt: unmarshalDate(data.created_at),
304
- dnsStatus: data.dns_status ? data.dns_status : void 0,
305
- domain: data.domain,
306
- domainStatus: data.domain_status,
307
- id: data.id,
308
- offerName: data.offer_name,
309
- projectId: data.project_id,
310
- protected: data.protected,
311
- region: data.region,
312
- status: data.status,
313
- updatedAt: unmarshalDate(data.updated_at)
436
+ ftpAccounts: unmarshalArrayOfObject(data.ftp_accounts, unmarshalFtpAccount),
437
+ totalCount: data.total_count
314
438
  };
315
439
  };
316
440
  const unmarshalListHostingsResponse = (data) => {
@@ -349,6 +473,32 @@ const unmarshalListOffersResponse = (data) => {
349
473
  totalCount: data.total_count
350
474
  };
351
475
  };
476
+ const unmarshalProgressSummary = (data) => {
477
+ if (!isJSONObject(data)) {
478
+ throw new TypeError(
479
+ `Unmarshalling the type 'ProgressSummary' failed as data isn't a dictionary.`
480
+ );
481
+ }
482
+ return {
483
+ backupItemsCount: data.backup_items_count,
484
+ id: data.id,
485
+ percentage: data.percentage,
486
+ status: data.status
487
+ };
488
+ };
489
+ const unmarshalListRecentProgressesResponse = (data) => {
490
+ if (!isJSONObject(data)) {
491
+ throw new TypeError(
492
+ `Unmarshalling the type 'ListRecentProgressesResponse' failed as data isn't a dictionary.`
493
+ );
494
+ }
495
+ return {
496
+ progresses: unmarshalArrayOfObject(
497
+ data.progresses,
498
+ unmarshalProgressSummary
499
+ )
500
+ };
501
+ };
352
502
  const unmarshalWebsite = (data) => {
353
503
  if (!isJSONObject(data)) {
354
504
  throw new TypeError(
@@ -372,6 +522,22 @@ const unmarshalListWebsitesResponse = (data) => {
372
522
  websites: unmarshalArrayOfObject(data.websites, unmarshalWebsite)
373
523
  };
374
524
  };
525
+ const unmarshalProgress = (data) => {
526
+ if (!isJSONObject(data)) {
527
+ throw new TypeError(
528
+ `Unmarshalling the type 'Progress' failed as data isn't a dictionary.`
529
+ );
530
+ }
531
+ return {
532
+ backupItemGroups: unmarshalArrayOfObject(
533
+ data.backup_item_groups,
534
+ unmarshalBackupItemGroup
535
+ ),
536
+ id: data.id,
537
+ percentage: data.percentage,
538
+ status: data.status
539
+ };
540
+ };
375
541
  const unmarshalResetHostingPasswordResponse = (data) => {
376
542
  if (!isJSONObject(data)) {
377
543
  throw new TypeError(
@@ -396,6 +562,26 @@ const unmarshalResourceSummary = (data) => {
396
562
  websitesCount: data.websites_count
397
563
  };
398
564
  };
565
+ const unmarshalRestoreBackupItemsResponse = (data) => {
566
+ if (!isJSONObject(data)) {
567
+ throw new TypeError(
568
+ `Unmarshalling the type 'RestoreBackupItemsResponse' failed as data isn't a dictionary.`
569
+ );
570
+ }
571
+ return {
572
+ progressId: data.progress_id
573
+ };
574
+ };
575
+ const unmarshalRestoreBackupResponse = (data) => {
576
+ if (!isJSONObject(data)) {
577
+ throw new TypeError(
578
+ `Unmarshalling the type 'RestoreBackupResponse' failed as data isn't a dictionary.`
579
+ );
580
+ }
581
+ return {
582
+ progressId: data.progress_id
583
+ };
584
+ };
399
585
  const unmarshalDomainAvailability = (data) => {
400
586
  if (!isJSONObject(data)) {
401
587
  throw new TypeError(
@@ -434,6 +620,9 @@ const unmarshalSession = (data) => {
434
620
  url: data.url
435
621
  };
436
622
  };
623
+ const marshalBackupApiRestoreBackupItemsRequest = (request, defaults) => ({
624
+ item_ids: request.itemIds
625
+ });
437
626
  const marshalDatabaseApiAssignDatabaseUserRequest = (request, defaults) => ({
438
627
  username: request.username
439
628
  });
@@ -485,6 +674,10 @@ const marshalDnsApiSyncDomainDnsRecordsRequest = (request, defaults) => ({
485
674
  update_nameservers: request.updateNameservers,
486
675
  update_web_records: request.updateWebRecords
487
676
  });
677
+ const marshalFreeDomainApiCheckFreeDomainAvailabilityRequest = (request, defaults) => ({
678
+ root_domain: request.rootDomain,
679
+ slug: request.slug
680
+ });
488
681
  const marshalFtpAccountApiChangeFtpAccountPasswordRequest = (request, defaults) => ({
489
682
  password: request.password
490
683
  });
@@ -493,6 +686,9 @@ const marshalFtpAccountApiCreateFtpAccountRequest = (request, defaults) => ({
493
686
  path: request.path,
494
687
  username: request.username
495
688
  });
689
+ const marshalHostingApiAddCustomDomainRequest = (request, defaults) => ({
690
+ domain_name: request.domainName
691
+ });
496
692
  const marshalCreateHostingRequestDomainConfiguration = (request, defaults) => ({
497
693
  update_all_records: request.updateAllRecords,
498
694
  update_mail_record: request.updateMailRecord,
@@ -517,8 +713,12 @@ const marshalHostingApiCreateHostingRequest = (request, defaults) => ({
517
713
  ) : void 0,
518
714
  project_id: request.projectId ?? defaults.defaultProjectId,
519
715
  skip_welcome_email: request.skipWelcomeEmail,
716
+ subdomain: request.subdomain,
520
717
  tags: request.tags
521
718
  });
719
+ const marshalHostingApiRemoveCustomDomainRequest = (request, defaults) => ({
720
+ domain_name: request.domainName
721
+ });
522
722
  const marshalHostingApiUpdateHostingRequest = (request, defaults) => ({
523
723
  email: request.email,
524
724
  offer_id: request.offerId,
@@ -543,6 +743,7 @@ const marshalMailAccountApiRemoveMailAccountRequest = (request, defaults) => ({
543
743
  username: request.username
544
744
  });
545
745
  export {
746
+ marshalBackupApiRestoreBackupItemsRequest,
546
747
  marshalDatabaseApiAssignDatabaseUserRequest,
547
748
  marshalDatabaseApiChangeDatabaseUserPasswordRequest,
548
749
  marshalDatabaseApiCreateDatabaseRequest,
@@ -550,13 +751,18 @@ export {
550
751
  marshalDatabaseApiUnassignDatabaseUserRequest,
551
752
  marshalDnsApiCheckUserOwnsDomainRequest,
552
753
  marshalDnsApiSyncDomainDnsRecordsRequest,
754
+ marshalFreeDomainApiCheckFreeDomainAvailabilityRequest,
553
755
  marshalFtpAccountApiChangeFtpAccountPasswordRequest,
554
756
  marshalFtpAccountApiCreateFtpAccountRequest,
757
+ marshalHostingApiAddCustomDomainRequest,
555
758
  marshalHostingApiCreateHostingRequest,
759
+ marshalHostingApiRemoveCustomDomainRequest,
556
760
  marshalHostingApiUpdateHostingRequest,
557
761
  marshalMailAccountApiChangeMailAccountPasswordRequest,
558
762
  marshalMailAccountApiCreateMailAccountRequest,
559
763
  marshalMailAccountApiRemoveMailAccountRequest,
764
+ unmarshalBackup,
765
+ unmarshalCheckFreeDomainAvailabilityResponse,
560
766
  unmarshalCheckUserOwnsDomainResponse,
561
767
  unmarshalDatabase,
562
768
  unmarshalDatabaseUser,
@@ -564,17 +770,25 @@ export {
564
770
  unmarshalDomain,
565
771
  unmarshalFtpAccount,
566
772
  unmarshalHosting,
773
+ unmarshalHostingSummary,
774
+ unmarshalListBackupItemsResponse,
775
+ unmarshalListBackupsResponse,
567
776
  unmarshalListControlPanelsResponse,
568
777
  unmarshalListDatabaseUsersResponse,
569
778
  unmarshalListDatabasesResponse,
779
+ unmarshalListFreeRootDomainsResponse,
570
780
  unmarshalListFtpAccountsResponse,
571
781
  unmarshalListHostingsResponse,
572
782
  unmarshalListMailAccountsResponse,
573
783
  unmarshalListOffersResponse,
784
+ unmarshalListRecentProgressesResponse,
574
785
  unmarshalListWebsitesResponse,
575
786
  unmarshalMailAccount,
787
+ unmarshalProgress,
576
788
  unmarshalResetHostingPasswordResponse,
577
789
  unmarshalResourceSummary,
790
+ unmarshalRestoreBackupItemsResponse,
791
+ unmarshalRestoreBackupResponse,
578
792
  unmarshalSearchDomainsResponse,
579
793
  unmarshalSession
580
794
  };