@scaleway/sdk 1.1.0 → 1.2.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.
@@ -20,6 +20,12 @@ class API extends API$1 {
20
20
  var _this;
21
21
  super(...arguments);
22
22
  _this = this;
23
+ /**
24
+ * Activate a cockpit associated with the given project ID.
25
+ *
26
+ * @param request - The request {@link ActivateCockpitRequest}
27
+ * @returns A Promise of Cockpit
28
+ */
23
29
  this.activateCockpit = function (request) {
24
30
  if (request === void 0) {
25
31
  request = {};
@@ -60,6 +66,12 @@ class API extends API$1 {
60
66
  }
61
67
  return waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!COCKPIT_TRANSIENT_STATUSES.includes(res.status))), _this.getCockpit, request, options);
62
68
  };
69
+ /**
70
+ * Deactivate a cockpit associated with the given project ID.
71
+ *
72
+ * @param request - The request {@link DeactivateCockpitRequest}
73
+ * @returns A Promise of Cockpit
74
+ */
63
75
  this.deactivateCockpit = function (request) {
64
76
  if (request === void 0) {
65
77
  request = {};
@@ -72,7 +84,7 @@ class API extends API$1 {
72
84
  }, unmarshalCockpit);
73
85
  };
74
86
  /**
75
- * Reset the Grafana your cockpit associated with the given project ID.
87
+ * Reset the Grafana of your cockpit associated with the given project ID.
76
88
  *
77
89
  * @param request - The request {@link ResetCockpitGrafanaRequest}
78
90
  * @returns A Promise of Cockpit
@@ -89,7 +101,7 @@ class API extends API$1 {
89
101
  }, unmarshalCockpit);
90
102
  };
91
103
  /**
92
- * Create token associated with the given project ID.
104
+ * Create a token associated with the given project ID.
93
105
  *
94
106
  * @param request - The request {@link CreateTokenRequest}
95
107
  * @returns A Promise of Token
@@ -1,7 +1,7 @@
1
1
  import { API as API$1 } from '../../../scw/api.js';
2
2
  import { urlParams, validatePathParam, resolveOneOf } from '../../../helpers/marshalling.js';
3
3
  import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
- import { unmarshalListSSHKeysResponse, marshalCreateSSHKeyRequest, unmarshalSSHKey, marshalUpdateSSHKeyRequest, unmarshalListUsersResponse, unmarshalUser, unmarshalListApplicationsResponse, marshalCreateApplicationRequest, unmarshalApplication, marshalUpdateApplicationRequest, unmarshalListGroupsResponse, marshalCreateGroupRequest, unmarshalGroup, marshalUpdateGroupRequest, marshalSetGroupMembersRequest, marshalAddGroupMemberRequest, marshalRemoveGroupMemberRequest, unmarshalListPoliciesResponse, marshalCreatePolicyRequest, unmarshalPolicy, marshalUpdatePolicyRequest, marshalSetRulesRequest, unmarshalSetRulesResponse, unmarshalListRulesResponse, unmarshalListPermissionSetsResponse, unmarshalListAPIKeysResponse, marshalCreateAPIKeyRequest, unmarshalAPIKey, marshalUpdateAPIKeyRequest } from './marshalling.gen.js';
4
+ import { unmarshalListSSHKeysResponse, marshalCreateSSHKeyRequest, unmarshalSSHKey, marshalUpdateSSHKeyRequest, unmarshalListUsersResponse, unmarshalUser, unmarshalListApplicationsResponse, marshalCreateApplicationRequest, unmarshalApplication, marshalUpdateApplicationRequest, unmarshalListGroupsResponse, marshalCreateGroupRequest, unmarshalGroup, marshalUpdateGroupRequest, marshalSetGroupMembersRequest, marshalAddGroupMemberRequest, marshalRemoveGroupMemberRequest, unmarshalListPoliciesResponse, marshalCreatePolicyRequest, unmarshalPolicy, marshalUpdatePolicyRequest, marshalSetRulesRequest, unmarshalSetRulesResponse, unmarshalListRulesResponse, unmarshalListPermissionSetsResponse, unmarshalListAPIKeysResponse, marshalCreateAPIKeyRequest, unmarshalAPIKey, marshalUpdateAPIKeyRequest, unmarshalListQuotaResponse, unmarshalQuotum, unmarshalListJWTsResponse, unmarshalJWT } from './marshalling.gen.js';
5
5
 
6
6
  // This file was automatically generated. DO NOT EDIT.
7
7
  const jsonContentHeaders = {
@@ -474,6 +474,70 @@ class API extends API$1 {
474
474
  method: 'DELETE',
475
475
  path: `/iam/v1alpha1/api-keys/${validatePathParam('accessKey', request.accessKey)}`
476
476
  });
477
+ this.pageOfListQuota = function (request) {
478
+ if (request === void 0) {
479
+ request = {};
480
+ }
481
+ return _this.client.fetch({
482
+ method: 'GET',
483
+ path: `/iam/v1alpha1/quota`,
484
+ urlParams: urlParams(['order_by', request.orderBy ?? 'name_asc'], ['organization_id', request.organizationId ?? _this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize])
485
+ }, unmarshalListQuotaResponse);
486
+ };
487
+ /**
488
+ * List all quota in the organization with the associated limit
489
+ *
490
+ * @param request - The request {@link ListQuotaRequest}
491
+ * @returns A Promise of ListQuotaResponse
492
+ */
493
+ this.listQuota = function (request) {
494
+ if (request === void 0) {
495
+ request = {};
496
+ }
497
+ return enrichForPagination('quota', _this.pageOfListQuota, request);
498
+ };
499
+ /**
500
+ * Get a quotum in the organization with the associated limit
501
+ *
502
+ * @param request - The request {@link GetQuotumRequest}
503
+ * @returns A Promise of Quotum
504
+ */
505
+ this.getQuotum = request => this.client.fetch({
506
+ method: 'GET',
507
+ path: `/iam/v1alpha1/quota/${validatePathParam('quotumName', request.quotumName)}`,
508
+ urlParams: urlParams(['organization_id', request.organizationId ?? this.client.settings.defaultOrganizationId])
509
+ }, unmarshalQuotum);
510
+ this.pageOfListJWTs = request => this.client.fetch({
511
+ method: 'GET',
512
+ path: `/iam/v1alpha1/jwts`,
513
+ urlParams: urlParams(['audience_id', request.audienceId], ['expired', request.expired], ['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
514
+ }, unmarshalListJWTsResponse);
515
+ /**
516
+ * List JWTs
517
+ *
518
+ * @param request - The request {@link ListJWTsRequest}
519
+ * @returns A Promise of ListJWTsResponse
520
+ */
521
+ this.listJWTs = request => enrichForPagination('jwts', this.pageOfListJWTs, request);
522
+ /**
523
+ * Get a JWT
524
+ *
525
+ * @param request - The request {@link GetJWTRequest}
526
+ * @returns A Promise of JWT
527
+ */
528
+ this.getJWT = request => this.client.fetch({
529
+ method: 'GET',
530
+ path: `/iam/v1alpha1/jwts/${validatePathParam('jti', request.jti)}`
531
+ }, unmarshalJWT);
532
+ /**
533
+ * Delete a JWT
534
+ *
535
+ * @param request - The request {@link DeleteJWTRequest}
536
+ */
537
+ this.deleteJWT = request => this.client.fetch({
538
+ method: 'DELETE',
539
+ path: `/iam/v1alpha1/jwts/${validatePathParam('jti', request.jti)}`
540
+ });
477
541
  }
478
542
  }
479
543
 
@@ -51,6 +51,21 @@ const unmarshalGroup = data => {
51
51
  userIds: data.user_ids
52
52
  };
53
53
  };
54
+ const unmarshalJWT = data => {
55
+ if (!isJSONObject(data)) {
56
+ throw new TypeError(`Unmarshalling the type 'JWT' failed as data isn't a dictionary.`);
57
+ }
58
+ return {
59
+ audienceId: data.audience_id,
60
+ createdAt: unmarshalDate(data.created_at),
61
+ expiresAt: unmarshalDate(data.expires_at),
62
+ ip: data.ip,
63
+ issuerId: data.issuer_id,
64
+ jti: data.jti,
65
+ updatedAt: unmarshalDate(data.updated_at),
66
+ userAgent: data.user_agent
67
+ };
68
+ };
54
69
  const unmarshalPermissionSet = data => {
55
70
  if (!isJSONObject(data)) {
56
71
  throw new TypeError(`Unmarshalling the type 'PermissionSet' failed as data isn't a dictionary.`);
@@ -84,6 +99,16 @@ const unmarshalPolicy = data => {
84
99
  userId: data.user_id
85
100
  };
86
101
  };
102
+ const unmarshalQuotum = data => {
103
+ if (!isJSONObject(data)) {
104
+ throw new TypeError(`Unmarshalling the type 'Quotum' failed as data isn't a dictionary.`);
105
+ }
106
+ return {
107
+ limit: data.limit,
108
+ name: data.name,
109
+ unlimited: data.unlimited
110
+ };
111
+ };
87
112
  const unmarshalRule = data => {
88
113
  if (!isJSONObject(data)) {
89
114
  throw new TypeError(`Unmarshalling the type 'Rule' failed as data isn't a dictionary.`);
@@ -157,6 +182,15 @@ const unmarshalListGroupsResponse = data => {
157
182
  totalCount: data.total_count
158
183
  };
159
184
  };
185
+ const unmarshalListJWTsResponse = data => {
186
+ if (!isJSONObject(data)) {
187
+ throw new TypeError(`Unmarshalling the type 'ListJWTsResponse' failed as data isn't a dictionary.`);
188
+ }
189
+ return {
190
+ jwts: unmarshalArrayOfObject(data.jwts, unmarshalJWT),
191
+ totalCount: data.total_count
192
+ };
193
+ };
160
194
  const unmarshalListPermissionSetsResponse = data => {
161
195
  if (!isJSONObject(data)) {
162
196
  throw new TypeError(`Unmarshalling the type 'ListPermissionSetsResponse' failed as data isn't a dictionary.`);
@@ -175,6 +209,15 @@ const unmarshalListPoliciesResponse = data => {
175
209
  totalCount: data.total_count
176
210
  };
177
211
  };
212
+ const unmarshalListQuotaResponse = data => {
213
+ if (!isJSONObject(data)) {
214
+ throw new TypeError(`Unmarshalling the type 'ListQuotaResponse' failed as data isn't a dictionary.`);
215
+ }
216
+ return {
217
+ quota: unmarshalArrayOfObject(data.quota, unmarshalQuotum),
218
+ totalCount: data.total_count
219
+ };
220
+ };
178
221
  const unmarshalListRulesResponse = data => {
179
222
  if (!isJSONObject(data)) {
180
223
  throw new TypeError(`Unmarshalling the type 'ListRulesResponse' failed as data isn't a dictionary.`);
@@ -326,4 +369,4 @@ const marshalUpdateSSHKeyRequest = (request, defaults) => ({
326
369
  name: request.name
327
370
  });
328
371
 
329
- export { marshalAddGroupMemberRequest, marshalCreateAPIKeyRequest, marshalCreateApplicationRequest, marshalCreateGroupRequest, marshalCreatePolicyRequest, marshalCreateSSHKeyRequest, marshalRemoveGroupMemberRequest, marshalSetGroupMembersRequest, marshalSetRulesRequest, marshalUpdateAPIKeyRequest, marshalUpdateApplicationRequest, marshalUpdateGroupRequest, marshalUpdatePolicyRequest, marshalUpdateSSHKeyRequest, unmarshalAPIKey, unmarshalApplication, unmarshalGroup, unmarshalListAPIKeysResponse, unmarshalListApplicationsResponse, unmarshalListGroupsResponse, unmarshalListPermissionSetsResponse, unmarshalListPoliciesResponse, unmarshalListRulesResponse, unmarshalListSSHKeysResponse, unmarshalListUsersResponse, unmarshalPolicy, unmarshalSSHKey, unmarshalSetRulesResponse, unmarshalUser };
372
+ export { marshalAddGroupMemberRequest, marshalCreateAPIKeyRequest, marshalCreateApplicationRequest, marshalCreateGroupRequest, marshalCreatePolicyRequest, marshalCreateSSHKeyRequest, marshalRemoveGroupMemberRequest, marshalSetGroupMembersRequest, marshalSetRulesRequest, marshalUpdateAPIKeyRequest, marshalUpdateApplicationRequest, marshalUpdateGroupRequest, marshalUpdatePolicyRequest, marshalUpdateSSHKeyRequest, unmarshalAPIKey, unmarshalApplication, unmarshalGroup, unmarshalJWT, unmarshalListAPIKeysResponse, unmarshalListApplicationsResponse, unmarshalListGroupsResponse, unmarshalListJWTsResponse, unmarshalListPermissionSetsResponse, unmarshalListPoliciesResponse, unmarshalListQuotaResponse, unmarshalListRulesResponse, unmarshalListSSHKeysResponse, unmarshalListUsersResponse, unmarshalPolicy, unmarshalQuotum, unmarshalSSHKey, unmarshalSetRulesResponse, unmarshalUser };
@@ -50,6 +50,11 @@ const CreateSSHKeyRequest = {
50
50
  minLength: 1
51
51
  }
52
52
  };
53
+ const GetQuotumRequest = {
54
+ quotumName: {
55
+ minLength: 1
56
+ }
57
+ };
53
58
  const ListAPIKeysRequest = {
54
59
  description: {
55
60
  maxLength: 200
@@ -88,6 +93,15 @@ const ListGroupsRequest = {
88
93
  lessThanOrEqual: 100
89
94
  }
90
95
  };
96
+ const ListJWTsRequest = {
97
+ page: {
98
+ greaterThanOrEqual: 1
99
+ },
100
+ pageSize: {
101
+ greaterThanOrEqual: 1,
102
+ lessThanOrEqual: 100
103
+ }
104
+ };
91
105
  const ListPermissionSetsRequest = {
92
106
  page: {
93
107
  greaterThanOrEqual: 1
@@ -109,6 +123,15 @@ const ListPoliciesRequest = {
109
123
  minLength: 1
110
124
  }
111
125
  };
126
+ const ListQuotaRequest = {
127
+ page: {
128
+ greaterThanOrEqual: 1
129
+ },
130
+ pageSize: {
131
+ greaterThanOrEqual: 1,
132
+ lessThanOrEqual: 100
133
+ }
134
+ };
112
135
  const ListRulesRequest = {
113
136
  page: {
114
137
  greaterThanOrEqual: 1
@@ -181,4 +204,4 @@ const UpdateSSHKeyRequest = {
181
204
  }
182
205
  };
183
206
 
184
- export { CreateAPIKeyRequest, CreateApplicationRequest, CreateGroupRequest, CreatePolicyRequest, CreateSSHKeyRequest, ListAPIKeysRequest, ListApplicationsRequest, ListGroupsRequest, ListPermissionSetsRequest, ListPoliciesRequest, ListRulesRequest, ListSSHKeysRequest, ListUsersRequest, UpdateAPIKeyRequest, UpdateApplicationRequest, UpdateGroupRequest, UpdatePolicyRequest, UpdateSSHKeyRequest };
207
+ export { CreateAPIKeyRequest, CreateApplicationRequest, CreateGroupRequest, CreatePolicyRequest, CreateSSHKeyRequest, GetQuotumRequest, ListAPIKeysRequest, ListApplicationsRequest, ListGroupsRequest, ListJWTsRequest, ListPermissionSetsRequest, ListPoliciesRequest, ListQuotaRequest, ListRulesRequest, ListSSHKeysRequest, ListUsersRequest, UpdateAPIKeyRequest, UpdateApplicationRequest, UpdateGroupRequest, UpdatePolicyRequest, UpdateSSHKeyRequest };
@@ -1,2 +1,2 @@
1
- import * as index_gen from './v1/index.gen.js';
2
- export { index_gen as v1 };
1
+ import * as index$1 from './v1/index.js';
2
+ export { index$1 as v1 };
@@ -0,0 +1,16 @@
1
+ import { API } from './api.gen.js';
2
+
3
+ class K8SUtilsAPI extends API {
4
+ constructor() {
5
+ super(...arguments);
6
+ /**
7
+ * Get configuration of a kube cluster.
8
+ *
9
+ * @param request - The request {@link GetClusterKubeConfigRequest}
10
+ * @returns A Promise of Blob
11
+ */
12
+ this.getClusterKubeConfig = request => this._getClusterKubeConfig(request);
13
+ }
14
+ }
15
+
16
+ export { K8SUtilsAPI };
@@ -1,6 +1,4 @@
1
- export { API } from './api.gen.js';
1
+ export { K8SUtilsAPI as API } from './api.utils.js';
2
2
  export { CLUSTER_TRANSIENT_STATUSES, NODE_TRANSIENT_STATUSES, POOL_TRANSIENT_STATUSES } from './content.gen.js';
3
3
  import * as validationRules_gen from './validation-rules.gen.js';
4
4
  export { validationRules_gen as ValidationRules };
5
-
6
- // This file was automatically generated. DO NOT EDIT.
@@ -265,6 +265,12 @@ const unmarshalPrivateNetworkDHCPConfig = data => {
265
265
  }
266
266
  return {};
267
267
  };
268
+ const unmarshalPrivateNetworkIpamConfig = data => {
269
+ if (!isJSONObject(data)) {
270
+ throw new TypeError(`Unmarshalling the type 'PrivateNetworkIpamConfig' failed as data isn't a dictionary.`);
271
+ }
272
+ return {};
273
+ };
268
274
  const unmarshalPrivateNetworkStaticConfig = data => {
269
275
  if (!isJSONObject(data)) {
270
276
  throw new TypeError(`Unmarshalling the type 'PrivateNetworkStaticConfig' failed as data isn't a dictionary.`);
@@ -330,6 +336,7 @@ const unmarshalPrivateNetwork = data => {
330
336
  return {
331
337
  createdAt: unmarshalDate(data.created_at),
332
338
  dhcpConfig: data.dhcp_config ? unmarshalPrivateNetworkDHCPConfig(data.dhcp_config) : undefined,
339
+ ipamConfig: data.ipam_config ? unmarshalPrivateNetworkIpamConfig(data.ipam_config) : undefined,
333
340
  lb: data.lb ? unmarshalLb(data.lb) : undefined,
334
341
  privateNetworkId: data.private_network_id,
335
342
  staticConfig: data.static_config ? unmarshalPrivateNetworkStaticConfig(data.static_config) : undefined,
@@ -548,6 +555,7 @@ const marshalHealthCheck = (request, defaults) => ({
548
555
  }])
549
556
  });
550
557
  const marshalPrivateNetworkDHCPConfig = (request, defaults) => ({});
558
+ const marshalPrivateNetworkIpamConfig = (request, defaults) => ({});
551
559
  const marshalPrivateNetworkStaticConfig = (request, defaults) => ({
552
560
  ip_address: request.ipAddress
553
561
  });
@@ -576,6 +584,9 @@ const marshalAttachPrivateNetworkRequest = (request, defaults) => ({
576
584
  }, {
577
585
  param: 'dhcp_config',
578
586
  value: request.dhcpConfig ? marshalPrivateNetworkDHCPConfig(request.dhcpConfig) : undefined
587
+ }, {
588
+ param: 'ipam_config',
589
+ value: request.ipamConfig ? marshalPrivateNetworkIpamConfig(request.ipamConfig) : undefined
579
590
  }])
580
591
  });
581
592
  const marshalCreateAclRequest = (request, defaults) => ({
@@ -786,6 +797,9 @@ const marshalZonedApiAttachPrivateNetworkRequest = (request, defaults) => ({
786
797
  }, {
787
798
  param: 'dhcp_config',
788
799
  value: request.dhcpConfig ? marshalPrivateNetworkDHCPConfig(request.dhcpConfig) : undefined
800
+ }, {
801
+ param: 'ipam_config',
802
+ value: request.ipamConfig ? marshalPrivateNetworkIpamConfig(request.ipamConfig) : undefined
789
803
  }])
790
804
  });
791
805
  const marshalZonedApiCreateAclRequest = (request, defaults) => ({
@@ -3,7 +3,7 @@ import { API as API$1 } from '../../../scw/api.js';
3
3
  import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
4
4
  import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
5
5
  import { DATABASE_BACKUP_TRANSIENT_STATUSES, INSTANCE_TRANSIENT_STATUSES, READ_REPLICA_TRANSIENT_STATUSES, INSTANCE_LOG_TRANSIENT_STATUSES, SNAPSHOT_TRANSIENT_STATUSES } from './content.gen.js';
6
- import { unmarshalListDatabaseEnginesResponse, unmarshalListNodeTypesResponse, unmarshalListDatabaseBackupsResponse, marshalCreateDatabaseBackupRequest, unmarshalDatabaseBackup, marshalUpdateDatabaseBackupRequest, marshalRestoreDatabaseBackupRequest, marshalUpgradeInstanceRequest, unmarshalInstance, unmarshalListInstancesResponse, marshalCreateInstanceRequest, marshalUpdateInstanceRequest, marshalCloneInstanceRequest, unmarshalInstanceMetrics, marshalCreateReadReplicaRequest, unmarshalReadReplica, marshalCreateReadReplicaEndpointRequest, marshalPrepareInstanceLogsRequest, unmarshalPrepareInstanceLogsResponse, unmarshalListInstanceLogsResponse, unmarshalInstanceLog, marshalPurgeInstanceLogsRequest, unmarshalListInstanceLogsDetailsResponse, marshalAddInstanceSettingsRequest, unmarshalAddInstanceSettingsResponse, marshalDeleteInstanceSettingsRequest, unmarshalDeleteInstanceSettingsResponse, marshalSetInstanceSettingsRequest, unmarshalSetInstanceSettingsResponse, unmarshalListInstanceACLRulesResponse, marshalAddInstanceACLRulesRequest, unmarshalAddInstanceACLRulesResponse, marshalSetInstanceACLRulesRequest, unmarshalSetInstanceACLRulesResponse, marshalDeleteInstanceACLRulesRequest, unmarshalDeleteInstanceACLRulesResponse, unmarshalListUsersResponse, marshalCreateUserRequest, unmarshalUser, marshalUpdateUserRequest, unmarshalListDatabasesResponse, marshalCreateDatabaseRequest, unmarshalDatabase, unmarshalListPrivilegesResponse, marshalSetPrivilegeRequest, unmarshalPrivilege, unmarshalListSnapshotsResponse, unmarshalSnapshot, marshalCreateSnapshotRequest, marshalUpdateSnapshotRequest, marshalCreateInstanceFromSnapshotRequest, marshalCreateEndpointRequest, unmarshalEndpoint } from './marshalling.gen.js';
6
+ import { unmarshalListDatabaseEnginesResponse, unmarshalListNodeTypesResponse, unmarshalListDatabaseBackupsResponse, marshalCreateDatabaseBackupRequest, unmarshalDatabaseBackup, marshalUpdateDatabaseBackupRequest, marshalRestoreDatabaseBackupRequest, marshalUpgradeInstanceRequest, unmarshalInstance, unmarshalListInstancesResponse, marshalCreateInstanceRequest, marshalUpdateInstanceRequest, marshalCloneInstanceRequest, unmarshalInstanceMetrics, marshalCreateReadReplicaRequest, unmarshalReadReplica, marshalCreateReadReplicaEndpointRequest, marshalPrepareInstanceLogsRequest, unmarshalPrepareInstanceLogsResponse, unmarshalListInstanceLogsResponse, unmarshalInstanceLog, marshalPurgeInstanceLogsRequest, unmarshalListInstanceLogsDetailsResponse, marshalAddInstanceSettingsRequest, unmarshalAddInstanceSettingsResponse, marshalDeleteInstanceSettingsRequest, unmarshalDeleteInstanceSettingsResponse, marshalSetInstanceSettingsRequest, unmarshalSetInstanceSettingsResponse, unmarshalListInstanceACLRulesResponse, marshalAddInstanceACLRulesRequest, unmarshalAddInstanceACLRulesResponse, marshalSetInstanceACLRulesRequest, unmarshalSetInstanceACLRulesResponse, marshalDeleteInstanceACLRulesRequest, unmarshalDeleteInstanceACLRulesResponse, unmarshalListUsersResponse, marshalCreateUserRequest, unmarshalUser, marshalUpdateUserRequest, unmarshalListDatabasesResponse, marshalCreateDatabaseRequest, unmarshalDatabase, unmarshalListPrivilegesResponse, marshalSetPrivilegeRequest, unmarshalPrivilege, unmarshalListSnapshotsResponse, unmarshalSnapshot, marshalCreateSnapshotRequest, marshalUpdateSnapshotRequest, marshalCreateInstanceFromSnapshotRequest, marshalCreateEndpointRequest, unmarshalEndpoint, marshalMigrateEndpointRequest } from './marshalling.gen.js';
7
7
 
8
8
  // This file was automatically generated. DO NOT EDIT.
9
9
  const jsonContentHeaders = {
@@ -727,6 +727,18 @@ class API extends API$1 {
727
727
  method: 'GET',
728
728
  path: `/rdb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam('endpointId', request.endpointId)}`
729
729
  }, unmarshalEndpoint);
730
+ /**
731
+ * Migrate an existing instance endpoint to another instance
732
+ *
733
+ * @param request - The request {@link MigrateEndpointRequest}
734
+ * @returns A Promise of Endpoint
735
+ */
736
+ this.migrateEndpoint = request => this.client.fetch({
737
+ body: JSON.stringify(marshalMigrateEndpointRequest(request, this.client.settings)),
738
+ headers: jsonContentHeaders,
739
+ method: 'POST',
740
+ path: `/rdb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam('endpointId', request.endpointId)}/migrate`
741
+ }, unmarshalEndpoint);
730
742
  }
731
743
  }
732
744
  /** Lists the available regions of the API. */
@@ -604,6 +604,9 @@ const marshalDeleteInstanceACLRulesRequest = (request, defaults) => ({
604
604
  const marshalDeleteInstanceSettingsRequest = (request, defaults) => ({
605
605
  setting_names: request.settingNames
606
606
  });
607
+ const marshalMigrateEndpointRequest = (request, defaults) => ({
608
+ instance_id: request.instanceId
609
+ });
607
610
  const marshalPrepareInstanceLogsRequest = (request, defaults) => ({
608
611
  end_date: request.endDate,
609
612
  start_date: request.startDate
@@ -666,4 +669,4 @@ const marshalUpgradeInstanceRequest = (request, defaults) => ({
666
669
  }])
667
670
  });
668
671
 
669
- export { marshalAddInstanceACLRulesRequest, marshalAddInstanceSettingsRequest, marshalCloneInstanceRequest, marshalCreateDatabaseBackupRequest, marshalCreateDatabaseRequest, marshalCreateEndpointRequest, marshalCreateInstanceFromSnapshotRequest, marshalCreateInstanceRequest, marshalCreateReadReplicaEndpointRequest, marshalCreateReadReplicaRequest, marshalCreateSnapshotRequest, marshalCreateUserRequest, marshalDeleteInstanceACLRulesRequest, marshalDeleteInstanceSettingsRequest, marshalPrepareInstanceLogsRequest, marshalPurgeInstanceLogsRequest, marshalRestoreDatabaseBackupRequest, marshalSetInstanceACLRulesRequest, marshalSetInstanceSettingsRequest, marshalSetPrivilegeRequest, marshalUpdateDatabaseBackupRequest, marshalUpdateInstanceRequest, marshalUpdateSnapshotRequest, marshalUpdateUserRequest, marshalUpgradeInstanceRequest, unmarshalAddInstanceACLRulesResponse, unmarshalAddInstanceSettingsResponse, unmarshalDatabase, unmarshalDatabaseBackup, unmarshalDeleteInstanceACLRulesResponse, unmarshalDeleteInstanceSettingsResponse, unmarshalEndpoint, unmarshalInstance, unmarshalInstanceLog, unmarshalInstanceMetrics, unmarshalListDatabaseBackupsResponse, unmarshalListDatabaseEnginesResponse, unmarshalListDatabasesResponse, unmarshalListInstanceACLRulesResponse, unmarshalListInstanceLogsDetailsResponse, unmarshalListInstanceLogsResponse, unmarshalListInstancesResponse, unmarshalListNodeTypesResponse, unmarshalListPrivilegesResponse, unmarshalListSnapshotsResponse, unmarshalListUsersResponse, unmarshalPrepareInstanceLogsResponse, unmarshalPrivilege, unmarshalReadReplica, unmarshalSetInstanceACLRulesResponse, unmarshalSetInstanceSettingsResponse, unmarshalSnapshot, unmarshalUser };
672
+ export { marshalAddInstanceACLRulesRequest, marshalAddInstanceSettingsRequest, marshalCloneInstanceRequest, marshalCreateDatabaseBackupRequest, marshalCreateDatabaseRequest, marshalCreateEndpointRequest, marshalCreateInstanceFromSnapshotRequest, marshalCreateInstanceRequest, marshalCreateReadReplicaEndpointRequest, marshalCreateReadReplicaRequest, marshalCreateSnapshotRequest, marshalCreateUserRequest, marshalDeleteInstanceACLRulesRequest, marshalDeleteInstanceSettingsRequest, marshalMigrateEndpointRequest, marshalPrepareInstanceLogsRequest, marshalPurgeInstanceLogsRequest, marshalRestoreDatabaseBackupRequest, marshalSetInstanceACLRulesRequest, marshalSetInstanceSettingsRequest, marshalSetPrivilegeRequest, marshalUpdateDatabaseBackupRequest, marshalUpdateInstanceRequest, marshalUpdateSnapshotRequest, marshalUpdateUserRequest, marshalUpgradeInstanceRequest, unmarshalAddInstanceACLRulesResponse, unmarshalAddInstanceSettingsResponse, unmarshalDatabase, unmarshalDatabaseBackup, unmarshalDeleteInstanceACLRulesResponse, unmarshalDeleteInstanceSettingsResponse, unmarshalEndpoint, unmarshalInstance, unmarshalInstanceLog, unmarshalInstanceMetrics, unmarshalListDatabaseBackupsResponse, unmarshalListDatabaseEnginesResponse, unmarshalListDatabasesResponse, unmarshalListInstanceACLRulesResponse, unmarshalListInstanceLogsDetailsResponse, unmarshalListInstanceLogsResponse, unmarshalListInstancesResponse, unmarshalListNodeTypesResponse, unmarshalListPrivilegesResponse, unmarshalListSnapshotsResponse, unmarshalListUsersResponse, unmarshalPrepareInstanceLogsResponse, unmarshalPrivilege, unmarshalReadReplica, unmarshalSetInstanceACLRulesResponse, unmarshalSetInstanceSettingsResponse, unmarshalSnapshot, unmarshalUser };
@@ -0,0 +1,2 @@
1
+ import * as index_gen from './v1alpha1/index.gen.js';
2
+ export { index_gen as v1alpha1 };
@@ -0,0 +1,131 @@
1
+ import { waitForResource } from '../../../internal/async/interval-retrier.js';
2
+ import { API as API$1 } from '../../../scw/api.js';
3
+ import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
4
+ import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
5
+ import { HOSTING_TRANSIENT_STATUSES } from './content.gen.js';
6
+ import { marshalCreateHostingRequest, unmarshalHosting, unmarshalListHostingsResponse, marshalUpdateHostingRequest, unmarshalDnsRecords, unmarshalListOffersResponse } from './marshalling.gen.js';
7
+
8
+ // This file was automatically generated. DO NOT EDIT.
9
+ const jsonContentHeaders = {
10
+ 'Content-Type': 'application/json; charset=utf-8'
11
+ };
12
+
13
+ /** Webhosting API. */
14
+ class API extends API$1 {
15
+ constructor() {
16
+ var _this;
17
+ super(...arguments);
18
+ _this = this;
19
+ /**
20
+ * Create a hosting
21
+ *
22
+ * @param request - The request {@link CreateHostingRequest}
23
+ * @returns A Promise of Hosting
24
+ */
25
+ this.createHosting = request => this.client.fetch({
26
+ body: JSON.stringify(marshalCreateHostingRequest(request, this.client.settings)),
27
+ headers: jsonContentHeaders,
28
+ method: 'POST',
29
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings`
30
+ }, unmarshalHosting);
31
+ this.pageOfListHostings = function (request) {
32
+ if (request === void 0) {
33
+ request = {};
34
+ }
35
+ return _this.client.fetch({
36
+ method: 'GET',
37
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/hostings`,
38
+ urlParams: urlParams(['domain', request.domain], ['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId], ['statuses', request.statuses], ['tags', request.tags])
39
+ }, unmarshalListHostingsResponse);
40
+ };
41
+ /**
42
+ * List all hostings
43
+ *
44
+ * @param request - The request {@link ListHostingsRequest}
45
+ * @returns A Promise of ListHostingsResponse
46
+ */
47
+ this.listHostings = function (request) {
48
+ if (request === void 0) {
49
+ request = {};
50
+ }
51
+ return enrichForPagination('hostings', _this.pageOfListHostings, request);
52
+ };
53
+ /**
54
+ * Get the details of a Hosting with the given ID.
55
+ *
56
+ * @param request - The request {@link GetHostingRequest}
57
+ * @returns A Promise of Hosting
58
+ */
59
+ this.getHosting = request => this.client.fetch({
60
+ method: 'GET',
61
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam('hostingId', request.hostingId)}`
62
+ }, unmarshalHosting);
63
+ /**
64
+ * Waits for {@link Hosting} to be in a final state.
65
+ *
66
+ * @param request - The request {@link GetHostingRequest}
67
+ * @param options - The waiting options
68
+ * @returns A Promise of Hosting
69
+ */
70
+ this.waitForHosting = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!HOSTING_TRANSIENT_STATUSES.includes(res.status))), this.getHosting, request, options);
71
+ /**
72
+ * Update a hosting
73
+ *
74
+ * @param request - The request {@link UpdateHostingRequest}
75
+ * @returns A Promise of Hosting
76
+ */
77
+ this.updateHosting = request => this.client.fetch({
78
+ body: JSON.stringify(marshalUpdateHostingRequest(request, this.client.settings)),
79
+ headers: jsonContentHeaders,
80
+ method: 'PATCH',
81
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam('hostingId', request.hostingId)}`
82
+ }, unmarshalHosting);
83
+ /**
84
+ * Delete a hosting with the given ID.
85
+ *
86
+ * @param request - The request {@link DeleteHostingRequest}
87
+ * @returns A Promise of Hosting
88
+ */
89
+ this.deleteHosting = request => this.client.fetch({
90
+ method: 'DELETE',
91
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam('hostingId', request.hostingId)}`
92
+ }, unmarshalHosting);
93
+ /**
94
+ * Restore a hosting with the given ID.
95
+ *
96
+ * @param request - The request {@link RestoreHostingRequest}
97
+ * @returns A Promise of Hosting
98
+ */
99
+ this.restoreHosting = request => this.client.fetch({
100
+ body: '{}',
101
+ headers: jsonContentHeaders,
102
+ method: 'POST',
103
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam('hostingId', request.hostingId)}/restore`
104
+ }, unmarshalHosting);
105
+ /**
106
+ * Get the DNS records of a specified domain.
107
+ *
108
+ * @param request - The request {@link GetDomainDnsRecordsRequest}
109
+ * @returns A Promise of DnsRecords
110
+ */
111
+ this.getDomainDnsRecords = request => this.client.fetch({
112
+ method: 'GET',
113
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam('domain', request.domain)}/dns-records`
114
+ }, unmarshalDnsRecords);
115
+ /**
116
+ * List all offers
117
+ *
118
+ * @param request - The request {@link ListOffersRequest}
119
+ * @returns A Promise of ListOffersResponse
120
+ */
121
+ this.listOffers = request => this.client.fetch({
122
+ method: 'GET',
123
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/offers`,
124
+ urlParams: urlParams(['only_options', request.onlyOptions], ['order_by', request.orderBy ?? 'price_asc'], ['without_options', request.withoutOptions])
125
+ }, unmarshalListOffersResponse);
126
+ }
127
+ }
128
+ /** Lists the available regions of the API. */
129
+ API.LOCALITIES = ['fr-par'];
130
+
131
+ export { API };
@@ -0,0 +1,7 @@
1
+ // This file was automatically generated. DO NOT EDIT.
2
+ // If you have any remark or suggestion do not hesitate to open an issue.
3
+
4
+ /** Lists transient statutes of the enum {@link HostingStatus}. */
5
+ const HOSTING_TRANSIENT_STATUSES = ['delivering', 'deleting'];
6
+
7
+ export { HOSTING_TRANSIENT_STATUSES };
@@ -0,0 +1,6 @@
1
+ export { API } from './api.gen.js';
2
+ export { HOSTING_TRANSIENT_STATUSES } from './content.gen.js';
3
+ import * as validationRules_gen from './validation-rules.gen.js';
4
+ export { validationRules_gen as ValidationRules };
5
+
6
+ // This file was automatically generated. DO NOT EDIT.