@scaleway/sdk 2.57.0 → 2.58.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,6 +1,6 @@
1
1
  import { isJSONObject } from "../../../helpers/json.js";
2
2
  import { unmarshalMoney } from "../../../scw/custom-marshalling.js";
3
- import { unmarshalDate, unmarshalArrayOfObject } from "../../../helpers/marshalling.js";
3
+ import { unmarshalArrayOfObject, unmarshalDate } from "../../../helpers/marshalling.js";
4
4
  const unmarshalDatabaseUser = (data) => {
5
5
  if (!isJSONObject(data)) {
6
6
  throw new TypeError(
@@ -45,10 +45,59 @@ const unmarshalMailAccount = (data) => {
45
45
  username: data.username
46
46
  };
47
47
  };
48
- const unmarshalHostingCpanelUrls = (data) => {
48
+ const unmarshalCheckUserOwnsDomainResponse = (data) => {
49
49
  if (!isJSONObject(data)) {
50
50
  throw new TypeError(
51
- `Unmarshalling the type 'HostingCpanelUrls' failed as data isn't a dictionary.`
51
+ `Unmarshalling the type 'CheckUserOwnsDomainResponse' failed as data isn't a dictionary.`
52
+ );
53
+ }
54
+ return {
55
+ ownsDomain: data.owns_domain
56
+ };
57
+ };
58
+ const unmarshalDnsRecord = (data) => {
59
+ if (!isJSONObject(data)) {
60
+ throw new TypeError(
61
+ `Unmarshalling the type 'DnsRecord' failed as data isn't a dictionary.`
62
+ );
63
+ }
64
+ return {
65
+ name: data.name,
66
+ priority: data.priority,
67
+ status: data.status,
68
+ ttl: data.ttl,
69
+ type: data.type,
70
+ value: data.value
71
+ };
72
+ };
73
+ const unmarshalNameserver = (data) => {
74
+ if (!isJSONObject(data)) {
75
+ throw new TypeError(
76
+ `Unmarshalling the type 'Nameserver' failed as data isn't a dictionary.`
77
+ );
78
+ }
79
+ return {
80
+ hostname: data.hostname,
81
+ isDefault: data.is_default,
82
+ status: data.status
83
+ };
84
+ };
85
+ const unmarshalDnsRecords = (data) => {
86
+ if (!isJSONObject(data)) {
87
+ throw new TypeError(
88
+ `Unmarshalling the type 'DnsRecords' failed as data isn't a dictionary.`
89
+ );
90
+ }
91
+ return {
92
+ nameServers: unmarshalArrayOfObject(data.name_servers, unmarshalNameserver),
93
+ records: unmarshalArrayOfObject(data.records, unmarshalDnsRecord),
94
+ status: data.status
95
+ };
96
+ };
97
+ const unmarshalPlatformControlPanelUrls = (data) => {
98
+ if (!isJSONObject(data)) {
99
+ throw new TypeError(
100
+ `Unmarshalling the type 'PlatformControlPanelUrls' failed as data isn't a dictionary.`
52
101
  );
53
102
  }
54
103
  return {
@@ -56,49 +105,98 @@ const unmarshalHostingCpanelUrls = (data) => {
56
105
  webmail: data.webmail
57
106
  };
58
107
  };
59
- const unmarshalHostingOption = (data) => {
108
+ const unmarshalOfferOption = (data) => {
60
109
  if (!isJSONObject(data)) {
61
110
  throw new TypeError(
62
- `Unmarshalling the type 'HostingOption' failed as data isn't a dictionary.`
111
+ `Unmarshalling the type 'OfferOption' failed as data isn't a dictionary.`
63
112
  );
64
113
  }
65
114
  return {
115
+ billingOperationPath: data.billing_operation_path,
116
+ currentValue: data.current_value,
66
117
  id: data.id,
118
+ maxValue: data.max_value,
119
+ minValue: data.min_value,
67
120
  name: data.name,
68
- quantity: data.quantity
121
+ price: data.price ? unmarshalMoney(data.price) : void 0,
122
+ quotaWarning: data.quota_warning
69
123
  };
70
124
  };
71
- const unmarshalHosting = (data) => {
125
+ const unmarshalPlatformControlPanel = (data) => {
72
126
  if (!isJSONObject(data)) {
73
127
  throw new TypeError(
74
- `Unmarshalling the type 'Hosting' failed as data isn't a dictionary.`
128
+ `Unmarshalling the type 'PlatformControlPanel' failed as data isn't a dictionary.`
129
+ );
130
+ }
131
+ return {
132
+ name: data.name,
133
+ urls: data.urls ? unmarshalPlatformControlPanelUrls(data.urls) : void 0
134
+ };
135
+ };
136
+ const unmarshalHostingUser = (data) => {
137
+ if (!isJSONObject(data)) {
138
+ throw new TypeError(
139
+ `Unmarshalling the type 'HostingUser' failed as data isn't a dictionary.`
75
140
  );
76
141
  }
77
142
  return {
78
143
  contactEmail: data.contact_email,
144
+ oneTimePassword: data.one_time_password,
145
+ username: data.username
146
+ };
147
+ };
148
+ const unmarshalOffer = (data) => {
149
+ if (!isJSONObject(data)) {
150
+ throw new TypeError(
151
+ `Unmarshalling the type 'Offer' failed as data isn't a dictionary.`
152
+ );
153
+ }
154
+ return {
155
+ available: data.available,
156
+ billingOperationPath: data.billing_operation_path,
79
157
  controlPanelName: data.control_panel_name,
80
- cpanelUrls: data.cpanel_urls ? unmarshalHostingCpanelUrls(data.cpanel_urls) : void 0,
158
+ endOfLife: data.end_of_life,
159
+ id: data.id,
160
+ options: unmarshalArrayOfObject(data.options, unmarshalOfferOption),
161
+ price: data.price ? unmarshalMoney(data.price) : void 0
162
+ };
163
+ };
164
+ const unmarshalPlatform = (data) => {
165
+ if (!isJSONObject(data)) {
166
+ throw new TypeError(
167
+ `Unmarshalling the type 'Platform' failed as data isn't a dictionary.`
168
+ );
169
+ }
170
+ return {
171
+ controlPanel: data.control_panel ? unmarshalPlatformControlPanel(data.control_panel) : void 0,
172
+ groupName: data.group_name,
173
+ hostname: data.hostname,
174
+ ipv4: data.ipv4,
175
+ ipv6: data.ipv6,
176
+ number: data.number
177
+ };
178
+ };
179
+ const unmarshalHosting = (data) => {
180
+ if (!isJSONObject(data)) {
181
+ throw new TypeError(
182
+ `Unmarshalling the type 'Hosting' failed as data isn't a dictionary.`
183
+ );
184
+ }
185
+ return {
81
186
  createdAt: unmarshalDate(data.created_at),
82
187
  dnsStatus: data.dns_status,
83
188
  domain: data.domain,
84
189
  id: data.id,
85
190
  ipv4: data.ipv4,
86
- ipv6: data.ipv6,
87
- offerEndOfLife: data.offer_end_of_life,
88
- offerId: data.offer_id,
89
- offerName: data.offer_name,
90
- oneTimePassword: data.one_time_password,
91
- options: unmarshalArrayOfObject(data.options, unmarshalHostingOption),
92
- platformGroup: data.platform_group,
93
- platformHostname: data.platform_hostname,
94
- platformNumber: data.platform_number,
191
+ offer: data.offer ? unmarshalOffer(data.offer) : void 0,
192
+ platform: data.platform ? unmarshalPlatform(data.platform) : void 0,
95
193
  projectId: data.project_id,
96
194
  protected: data.protected,
97
195
  region: data.region,
98
196
  status: data.status,
99
197
  tags: data.tags,
100
198
  updatedAt: unmarshalDate(data.updated_at),
101
- username: data.username
199
+ user: data.user ? unmarshalHostingUser(data.user) : void 0
102
200
  };
103
201
  };
104
202
  const unmarshalControlPanel = (data) => {
@@ -168,6 +266,7 @@ const unmarshalHostingSummary = (data) => {
168
266
  );
169
267
  }
170
268
  return {
269
+ createdAt: unmarshalDate(data.created_at),
171
270
  domain: data.domain,
172
271
  id: data.id,
173
272
  projectId: data.project_id,
@@ -202,38 +301,6 @@ const unmarshalListMailAccountsResponse = (data) => {
202
301
  totalCount: data.total_count
203
302
  };
204
303
  };
205
- const unmarshalOfferOption = (data) => {
206
- if (!isJSONObject(data)) {
207
- throw new TypeError(
208
- `Unmarshalling the type 'OfferOption' failed as data isn't a dictionary.`
209
- );
210
- }
211
- return {
212
- billingOperationPath: data.billing_operation_path,
213
- currentValue: data.current_value,
214
- id: data.id,
215
- maxValue: data.max_value,
216
- minValue: data.min_value,
217
- name: data.name,
218
- quotaWarning: data.quota_warning
219
- };
220
- };
221
- const unmarshalOffer = (data) => {
222
- if (!isJSONObject(data)) {
223
- throw new TypeError(
224
- `Unmarshalling the type 'Offer' failed as data isn't a dictionary.`
225
- );
226
- }
227
- return {
228
- available: data.available,
229
- billingOperationPath: data.billing_operation_path,
230
- controlPanelName: data.control_panel_name,
231
- endOfLife: data.end_of_life,
232
- id: data.id,
233
- options: unmarshalArrayOfObject(data.options, unmarshalOfferOption),
234
- price: data.price ? unmarshalMoney(data.price) : void 0
235
- };
236
- };
237
304
  const unmarshalListOffersResponse = (data) => {
238
305
  if (!isJSONObject(data)) {
239
306
  throw new TypeError(
@@ -317,6 +384,9 @@ const marshalDatabaseApiCreateDatabaseUserRequest = (request, defaults) => ({
317
384
  const marshalDatabaseApiUnassignDatabaseUserRequest = (request, defaults) => ({
318
385
  username: request.username
319
386
  });
387
+ const marshalDnsApiCheckUserOwnsDomainRequest = (request, defaults) => ({
388
+ project_id: request.projectId ?? defaults.defaultProjectId
389
+ });
320
390
  const marshalFtpAccountApiChangeFtpAccountPasswordRequest = (request, defaults) => ({
321
391
  password: request.password
322
392
  });
@@ -379,6 +449,7 @@ export {
379
449
  marshalDatabaseApiCreateDatabaseRequest,
380
450
  marshalDatabaseApiCreateDatabaseUserRequest,
381
451
  marshalDatabaseApiUnassignDatabaseUserRequest,
452
+ marshalDnsApiCheckUserOwnsDomainRequest,
382
453
  marshalFtpAccountApiChangeFtpAccountPasswordRequest,
383
454
  marshalFtpAccountApiCreateFtpAccountRequest,
384
455
  marshalHostingApiCreateHostingRequest,
@@ -386,8 +457,10 @@ export {
386
457
  marshalMailAccountApiChangeMailAccountPasswordRequest,
387
458
  marshalMailAccountApiCreateMailAccountRequest,
388
459
  marshalMailAccountApiRemoveMailAccountRequest,
460
+ unmarshalCheckUserOwnsDomainResponse,
389
461
  unmarshalDatabase,
390
462
  unmarshalDatabaseUser,
463
+ unmarshalDnsRecords,
391
464
  unmarshalFtpAccount,
392
465
  unmarshalHosting,
393
466
  unmarshalListControlPanelsResponse,
@@ -1,6 +1,8 @@
1
1
  import type { Money, Region } from '../../../bridge';
2
2
  import type { LanguageCode as StdLanguageCode } from '../../std/types.gen';
3
- export type HostingDnsStatus = 'unknown_dns_status' | 'valid' | 'invalid';
3
+ export type DnsRecordStatus = 'unknown_status' | 'valid' | 'invalid';
4
+ export type DnsRecordType = 'unknown_type' | 'a' | 'cname' | 'mx' | 'txt' | 'ns' | 'aaaa';
5
+ export type DnsRecordsStatus = 'unknown_status' | 'valid' | 'invalid';
4
6
  export type HostingStatus = 'unknown_status' | 'delivering' | 'ready' | 'deleting' | 'error' | 'locked' | 'migrating';
5
7
  export type HostingSummaryStatus = 'unknown_status' | 'delivering' | 'ready' | 'deleting' | 'error' | 'locked' | 'migrating';
6
8
  export type ListDatabaseUsersRequestOrderBy = 'username_asc' | 'username_desc';
@@ -10,8 +12,16 @@ export type ListHostingsRequestOrderBy = 'created_at_asc' | 'created_at_desc';
10
12
  export type ListMailAccountsRequestOrderBy = 'username_asc' | 'username_desc' | 'domain_asc' | 'domain_desc';
11
13
  export type ListOffersRequestOrderBy = 'price_asc';
12
14
  export type ListWebsitesRequestOrderBy = 'domain_asc' | 'domain_desc';
15
+ export type NameserverStatus = 'unknown_status' | 'valid' | 'invalid';
13
16
  export type OfferOptionName = 'unknown_name' | 'domain_count' | 'email_count' | 'storage_gb' | 'vcpu_count' | 'ram_gb' | 'backup' | 'dedicated_ip';
14
17
  export type OfferOptionWarning = 'unknown_warning' | 'quota_exceeded_warning';
18
+ export type PlatformPlatformGroup = 'unknown_group' | 'default' | 'premium';
19
+ export interface PlatformControlPanelUrls {
20
+ /** URL to connect to the hosting control panel dashboard. */
21
+ dashboard: string;
22
+ /** URL to connect to the hosting Webmail interface. */
23
+ webmail: string;
24
+ }
15
25
  export interface OfferOption {
16
26
  /** Option ID. */
17
27
  id: string;
@@ -30,6 +40,14 @@ export interface OfferOption {
30
40
  maxValue: number;
31
41
  /** Defines a warning if the maximum value for the option has been reached. */
32
42
  quotaWarning: OfferOptionWarning;
43
+ /** Price of the option for 1 value. */
44
+ price?: Money;
45
+ }
46
+ export interface PlatformControlPanel {
47
+ /** Name of the control panel. */
48
+ name: string;
49
+ /** URL to connect to cPanel dashboard and to Webmail interface. */
50
+ urls?: PlatformControlPanelUrls;
33
51
  }
34
52
  export interface CreateHostingRequestDomainConfiguration {
35
53
  updateNameservers: boolean;
@@ -43,17 +61,71 @@ export interface OfferOptionRequest {
43
61
  /** The option requested quantity to set for the Web Hosting plan. */
44
62
  quantity: number;
45
63
  }
46
- export interface HostingCpanelUrls {
47
- dashboard: string;
48
- webmail: string;
64
+ export interface DnsRecord {
65
+ /** Record name. */
66
+ name: string;
67
+ /** Record type. */
68
+ type: DnsRecordType;
69
+ /** Record time-to-live. */
70
+ ttl: number;
71
+ /** Record value. */
72
+ value: string;
73
+ /** Record priority level. */
74
+ priority?: number;
75
+ /** Record status. */
76
+ status: DnsRecordStatus;
49
77
  }
50
- export interface HostingOption {
51
- /** Option ID. */
78
+ export interface Nameserver {
79
+ /** Hostname of the nameserver. */
80
+ hostname: string;
81
+ /** Status of the nameserver. */
82
+ status: NameserverStatus;
83
+ /** Defines whether the nameserver is the default one. */
84
+ isDefault: boolean;
85
+ }
86
+ export interface HostingUser {
87
+ /** Main Web Hosting cPanel username. */
88
+ username: string;
89
+ /**
90
+ * One-time-password used for the first login or reset password, empty after
91
+ * first use.
92
+ */
93
+ oneTimePassword?: string;
94
+ /** Contact email used for the hosting. */
95
+ contactEmail: string;
96
+ }
97
+ export interface Offer {
98
+ /** Offer ID. */
52
99
  id: string;
53
- /** Option name. */
54
- name: OfferOptionName;
55
- /** Option quantity. */
56
- quantity: number;
100
+ /** Unique identifier used for billing. */
101
+ billingOperationPath: string;
102
+ /** Options available for the offer. */
103
+ options: OfferOption[];
104
+ /** Price of the offer. */
105
+ price?: Money;
106
+ /**
107
+ * If a hosting_id was specified in the call, defines whether the offer is
108
+ * available for a specified hosting plan to migrate (update) to.
109
+ */
110
+ available: boolean;
111
+ /** Name of the control panel. */
112
+ controlPanelName: string;
113
+ /** Indicates if the offer has reached its end of life. */
114
+ endOfLife: boolean;
115
+ }
116
+ export interface Platform {
117
+ /** Hostname of the host platform. */
118
+ hostname: string;
119
+ /** Number of the host platform. */
120
+ number: number;
121
+ /** Group name of the hosting's host platform. */
122
+ groupName: PlatformPlatformGroup;
123
+ /** IPv4 address of the hosting's host platform. */
124
+ ipv4: string;
125
+ /** IPv6 address of the hosting's host platform. */
126
+ ipv6: string;
127
+ /** Details of the platform control panel. */
128
+ controlPanel?: PlatformControlPanel;
57
129
  }
58
130
  export interface ControlPanel {
59
131
  /** Control panel name. */
@@ -88,6 +160,8 @@ export interface HostingSummary {
88
160
  id: string;
89
161
  /** ID of the Scaleway Project the Web Hosting plan belongs to. */
90
162
  projectId: string;
163
+ /** Date on which the Web Hosting plan was created. */
164
+ createdAt?: Date;
91
165
  /** Date on which the Web Hosting plan was last updated. */
92
166
  updatedAt?: Date;
93
167
  /** Status of the Web Hosting plan. */
@@ -105,25 +179,6 @@ export interface MailAccount {
105
179
  /** Username part address of the mail account address. */
106
180
  username: string;
107
181
  }
108
- export interface Offer {
109
- /** Offer ID. */
110
- id: string;
111
- /** Unique identifier used for billing. */
112
- billingOperationPath: string;
113
- /** Options available for the offer. */
114
- options: OfferOption[];
115
- /** Price of the offer. */
116
- price?: Money;
117
- /**
118
- * If a hosting_id was specified in the call, defines whether the offer is
119
- * available for a specified hosting plan to migrate (update) to.
120
- */
121
- available: boolean;
122
- /** Name of the control panel. */
123
- controlPanelName: string;
124
- /** Indicates if the offer has reached its end of life. */
125
- endOfLife: boolean;
126
- }
127
182
  export interface Website {
128
183
  /** The domain of the website. */
129
184
  domain: string;
@@ -132,6 +187,10 @@ export interface Website {
132
187
  /** The SSL status of the website. */
133
188
  sslStatus: boolean;
134
189
  }
190
+ export interface CheckUserOwnsDomainResponse {
191
+ /** Indicates whether the specified project owns the domain. */
192
+ ownsDomain: boolean;
193
+ }
135
194
  export type ControlPanelApiListControlPanelsRequest = {
136
195
  /**
137
196
  * Region to target. If none is passed will use default region from the
@@ -289,6 +348,34 @@ export type DatabaseApiUnassignDatabaseUserRequest = {
289
348
  /** Name of the user to unassign. */
290
349
  username: string;
291
350
  };
351
+ export type DnsApiCheckUserOwnsDomainRequest = {
352
+ /**
353
+ * Region to target. If none is passed will use default region from the
354
+ * config.
355
+ */
356
+ region?: Region;
357
+ /** Domain for which ownership is to be verified. */
358
+ domain: string;
359
+ /** ID of the project currently in use. */
360
+ projectId?: string;
361
+ };
362
+ export type DnsApiGetDomainDnsRecordsRequest = {
363
+ /**
364
+ * Region to target. If none is passed will use default region from the
365
+ * config.
366
+ */
367
+ region?: Region;
368
+ /** Domain associated with the DNS records. */
369
+ domain: string;
370
+ };
371
+ export interface DnsRecords {
372
+ /** List of DNS records. */
373
+ records: DnsRecord[];
374
+ /** List of nameservers. */
375
+ nameServers: Nameserver[];
376
+ /** Status of the records. */
377
+ status: DnsRecordsStatus;
378
+ }
292
379
  export type FtpAccountApiChangeFtpAccountPasswordRequest = {
293
380
  /**
294
381
  * Region to target. If none is passed will use default region from the
@@ -359,45 +446,22 @@ export interface Hosting {
359
446
  createdAt?: Date;
360
447
  /** Status of the Web Hosting plan. */
361
448
  status: HostingStatus;
362
- /** Hostname of the host platform. */
363
- platformHostname: string;
364
- /** Number of the host platform. */
365
- platformNumber: number;
366
- /** ID of the active offer for the Web Hosting plan. */
367
- offerId: string;
368
- /** Name of the active offer for the Web Hosting plan. */
369
- offerName: string;
370
449
  /** Main domain associated with the Web Hosting plan. */
371
450
  domain: string;
451
+ /** Details of the Web Hosting plan offer and options. */
452
+ offer?: Offer;
453
+ /** Details of the hosting platform. */
454
+ platform?: Platform;
372
455
  /** List of tags associated with the Web Hosting plan. */
373
456
  tags: string[];
374
- /** List of the Web Hosting plan options. */
375
- options: HostingOption[];
376
457
  /** DNS status of the Web Hosting plan. */
377
- dnsStatus: HostingDnsStatus;
378
- /** URL to connect to cPanel dashboard and to Webmail interface. */
379
- cpanelUrls?: HostingCpanelUrls;
380
- /** Main Web Hosting cPanel username. */
381
- username: string;
382
- /** Indicates if the hosting offer has reached its end of life. */
383
- offerEndOfLife: boolean;
384
- /** Name of the control panel. */
385
- controlPanelName: string;
386
- /** Group of the hosting's host server/platform. */
387
- platformGroup: string;
388
- /** IPv4 address of the hosting's host server. */
458
+ dnsStatus: DnsRecordsStatus;
459
+ /** Current IPv4 address of the hosting. */
389
460
  ipv4: string;
390
- /** IPv6 address of the hosting's host server. */
391
- ipv6: string;
392
461
  /** Whether the hosting is protected or not. */
393
462
  protected: boolean;
394
- /**
395
- * One-time-password used for the first login or reset password, empty after
396
- * first use.
397
- */
398
- oneTimePassword: string;
399
- /** Contact email used for the hosting. */
400
- contactEmail: string;
463
+ /** Details of the hosting user. */
464
+ user?: HostingUser;
401
465
  /** Region where the Web Hosting plan is hosted. */
402
466
  region: Region;
403
467
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const version = "v2.56.0";
3
+ const version = "v2.57.0";
4
4
  const userAgent = `scaleway-sdk-js/${version}`;
5
5
  exports.userAgent = userAgent;
6
6
  exports.version = version;
@@ -1,2 +1,2 @@
1
- export declare const version = "v2.56.0";
2
- export declare const userAgent = "scaleway-sdk-js/v2.56.0";
1
+ export declare const version = "v2.57.0";
2
+ export declare const userAgent = "scaleway-sdk-js/v2.57.0";
@@ -1,4 +1,4 @@
1
- const version = "v2.56.0";
1
+ const version = "v2.57.0";
2
2
  const userAgent = `scaleway-sdk-js/${version}`;
3
3
  export {
4
4
  userAgent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk",
3
- "version": "2.57.0",
3
+ "version": "2.58.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Scaleway SDK.",
6
6
  "keywords": [
@@ -39,5 +39,5 @@
39
39
  "bundledDependencies": [
40
40
  "@scaleway/random-name"
41
41
  ],
42
- "gitHead": "f862c338853321a98d5d14686092625862ffdf5f"
42
+ "gitHead": "62bf1f104066d4ef19d4ce5adca02b3c5f4b937e"
43
43
  }