@scaleway/sdk 1.20.0 → 1.22.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.
package/dist/index.cjs CHANGED
@@ -497,7 +497,7 @@ const assertValidSettings = obj => {
497
497
  }
498
498
  };
499
499
 
500
- const version = 'v1.19.0';
500
+ const version = 'v1.21.0';
501
501
  const userAgent = `scaleway-sdk-js/${version}`;
502
502
 
503
503
  const isBrowser = () => typeof window !== 'undefined' && typeof window.document !== 'undefined';
@@ -2033,7 +2033,7 @@ const randomName = function () {
2033
2033
 
2034
2034
  // This file was automatically generated. DO NOT EDIT.
2035
2035
  // If you have any remark or suggestion do not hesitate to open an issue.
2036
- const unmarshalProject = data => {
2036
+ const unmarshalProject$1 = data => {
2037
2037
  if (!isJSONObject(data)) {
2038
2038
  throw new TypeError(`Unmarshalling the type 'Project' failed as data isn't a dictionary.`);
2039
2039
  }
@@ -2046,12 +2046,12 @@ const unmarshalProject = data => {
2046
2046
  updatedAt: unmarshalDate(data.updated_at)
2047
2047
  };
2048
2048
  };
2049
- const unmarshalListProjectsResponse = data => {
2049
+ const unmarshalListProjectsResponse$1 = data => {
2050
2050
  if (!isJSONObject(data)) {
2051
2051
  throw new TypeError(`Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary.`);
2052
2052
  }
2053
2053
  return {
2054
- projects: unmarshalArrayOfObject(data.projects, unmarshalProject),
2054
+ projects: unmarshalArrayOfObject(data.projects, unmarshalProject$1),
2055
2055
  totalCount: data.total_count
2056
2056
  };
2057
2057
  };
@@ -2067,7 +2067,7 @@ const marshalUpdateProjectRequest = (request, defaults) => ({
2067
2067
 
2068
2068
  // This file was automatically generated. DO NOT EDIT.
2069
2069
  // If you have any remark or suggestion do not hesitate to open an issue.
2070
- const jsonContentHeaders$o = {
2070
+ const jsonContentHeaders$p = {
2071
2071
  'Content-Type': 'application/json; charset=utf-8'
2072
2072
  };
2073
2073
 
@@ -2078,31 +2078,166 @@ const jsonContentHeaders$o = {
2078
2078
  */
2079
2079
  let API$r = class API extends API$s {
2080
2080
  /**
2081
- * Create a new Project for an Organization. Generate a new Project for an
2082
- * Organization, specifying its configuration including name and description.
2081
+ * Create a new Project for an Organization. Deprecated in favor of Account
2082
+ * API v3. Generate a new Project for an Organization, specifying its
2083
+ * configuration including name and description.
2083
2084
  *
2085
+ * @deprecated
2084
2086
  * @param request - The request {@link CreateProjectRequest}
2085
2087
  * @returns A Promise of Project
2086
2088
  */
2087
2089
  createProject = (request = {}) => this.client.fetch({
2088
2090
  body: JSON.stringify(marshalCreateProjectRequest(request, this.client.settings)),
2089
- headers: jsonContentHeaders$o,
2091
+ headers: jsonContentHeaders$p,
2090
2092
  method: 'POST',
2091
2093
  path: `/account/v2/projects`
2092
- }, unmarshalProject);
2094
+ }, unmarshalProject$1);
2093
2095
  pageOfListProjects = (request = {}) => this.client.fetch({
2094
2096
  method: 'GET',
2095
2097
  path: `/account/v2/projects`,
2096
2098
  urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId ?? this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_ids', request.projectIds])
2099
+ }, unmarshalListProjectsResponse$1);
2100
+
2101
+ /**
2102
+ * List all Projects of an Organization. Deprecated in favor of Account API
2103
+ * v3. List all Projects of an Organization. The response will include the
2104
+ * total number of Projects as well as their associated Organizations, names
2105
+ * and IDs. Other information include the creation and update date of the
2106
+ * Project.
2107
+ *
2108
+ * @deprecated
2109
+ * @param request - The request {@link ListProjectsRequest}
2110
+ * @returns A Promise of ListProjectsResponse
2111
+ */
2112
+ listProjects = (request = {}) => enrichForPagination('projects', this.pageOfListProjects, request);
2113
+
2114
+ /**
2115
+ * Get an existing Project. Deprecated in favor of Account API v3. Retrieve
2116
+ * information about an existing Project, specified by its Project ID. Its
2117
+ * full details, including ID, name and description, are returned in the
2118
+ * response object.
2119
+ *
2120
+ * @deprecated
2121
+ * @param request - The request {@link GetProjectRequest}
2122
+ * @returns A Promise of Project
2123
+ */
2124
+ getProject = (request = {}) => this.client.fetch({
2125
+ method: 'GET',
2126
+ path: `/account/v2/projects/${validatePathParam('projectId', request.projectId ?? this.client.settings.defaultProjectId)}`
2127
+ }, unmarshalProject$1);
2128
+
2129
+ /**
2130
+ * Delete an existing Project. Deprecated in favor of Account API v3. Delete
2131
+ * an existing Project, specified by its Project ID. The Project needs to be
2132
+ * empty (meaning there are no resources left in it) to be deleted
2133
+ * effectively. Note that deleting a Project is permanent, and cannot be
2134
+ * undone.
2135
+ *
2136
+ * @deprecated
2137
+ * @param request - The request {@link DeleteProjectRequest}
2138
+ */
2139
+ deleteProject = (request = {}) => this.client.fetch({
2140
+ method: 'DELETE',
2141
+ path: `/account/v2/projects/${validatePathParam('projectId', request.projectId ?? this.client.settings.defaultProjectId)}`
2142
+ });
2143
+
2144
+ /**
2145
+ * Update Project. Deprecated in favor of Account API v3. Update the
2146
+ * parameters of an existing Project, specified by its Project ID. These
2147
+ * parameters include the name and description.
2148
+ *
2149
+ * @deprecated
2150
+ * @param request - The request {@link UpdateProjectRequest}
2151
+ * @returns A Promise of Project
2152
+ */
2153
+ updateProject = (request = {}) => this.client.fetch({
2154
+ body: JSON.stringify(marshalUpdateProjectRequest(request, this.client.settings)),
2155
+ headers: jsonContentHeaders$p,
2156
+ method: 'PATCH',
2157
+ path: `/account/v2/projects/${validatePathParam('projectId', request.projectId ?? this.client.settings.defaultProjectId)}`
2158
+ }, unmarshalProject$1);
2159
+ };
2160
+
2161
+ // This file was automatically generated. DO NOT EDIT.
2162
+ // If you have any remark or suggestion do not hesitate to open an issue.
2163
+
2164
+ var index_gen$o = /*#__PURE__*/Object.freeze({
2165
+ __proto__: null,
2166
+ API: API$r
2167
+ });
2168
+
2169
+ // This file was automatically generated. DO NOT EDIT.
2170
+ // If you have any remark or suggestion do not hesitate to open an issue.
2171
+ const unmarshalProject = data => {
2172
+ if (!isJSONObject(data)) {
2173
+ throw new TypeError(`Unmarshalling the type 'Project' failed as data isn't a dictionary.`);
2174
+ }
2175
+ return {
2176
+ createdAt: unmarshalDate(data.created_at),
2177
+ description: data.description,
2178
+ id: data.id,
2179
+ name: data.name,
2180
+ organizationId: data.organization_id,
2181
+ updatedAt: unmarshalDate(data.updated_at)
2182
+ };
2183
+ };
2184
+ const unmarshalListProjectsResponse = data => {
2185
+ if (!isJSONObject(data)) {
2186
+ throw new TypeError(`Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary.`);
2187
+ }
2188
+ return {
2189
+ projects: unmarshalArrayOfObject(data.projects, unmarshalProject),
2190
+ totalCount: data.total_count
2191
+ };
2192
+ };
2193
+ const marshalProjectApiCreateProjectRequest = (request, defaults) => ({
2194
+ description: request.description,
2195
+ name: request.name || randomName('proj'),
2196
+ organization_id: request.organizationId ?? defaults.defaultOrganizationId
2197
+ });
2198
+ const marshalProjectApiUpdateProjectRequest = (request, defaults) => ({
2199
+ description: request.description,
2200
+ name: request.name
2201
+ });
2202
+
2203
+ // This file was automatically generated. DO NOT EDIT.
2204
+ // If you have any remark or suggestion do not hesitate to open an issue.
2205
+ const jsonContentHeaders$o = {
2206
+ 'Content-Type': 'application/json; charset=utf-8'
2207
+ };
2208
+
2209
+ /**
2210
+ * Account API.
2211
+ *
2212
+ * This API allows you to manage projects.
2213
+ */
2214
+ class ProjectAPI extends API$s {
2215
+ /**
2216
+ * Create a new Project for an Organization. Generate a new Project for an
2217
+ * Organization, specifying its configuration including name and description.
2218
+ *
2219
+ * @param request - The request {@link ProjectApiCreateProjectRequest}
2220
+ * @returns A Promise of Project
2221
+ */
2222
+ createProject = request => this.client.fetch({
2223
+ body: JSON.stringify(marshalProjectApiCreateProjectRequest(request, this.client.settings)),
2224
+ headers: jsonContentHeaders$o,
2225
+ method: 'POST',
2226
+ path: `/account/v3/projects`
2227
+ }, unmarshalProject);
2228
+ pageOfListProjects = (request = {}) => this.client.fetch({
2229
+ method: 'GET',
2230
+ path: `/account/v3/projects`,
2231
+ urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId ?? this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_ids', request.projectIds])
2097
2232
  }, unmarshalListProjectsResponse);
2098
2233
 
2099
2234
  /**
2100
2235
  * List all Projects of an Organization. List all Projects of an Organization.
2101
2236
  * The response will include the total number of Projects as well as their
2102
- * associated Organizations, names and IDs. Other information include the
2237
+ * associated Organizations, names, and IDs. Other information includes the
2103
2238
  * creation and update date of the Project.
2104
2239
  *
2105
- * @param request - The request {@link ListProjectsRequest}
2240
+ * @param request - The request {@link ProjectApiListProjectsRequest}
2106
2241
  * @returns A Promise of ListProjectsResponse
2107
2242
  */
2108
2243
  listProjects = (request = {}) => enrichForPagination('projects', this.pageOfListProjects, request);
@@ -2112,12 +2247,12 @@ let API$r = class API extends API$s {
2112
2247
  * specified by its Project ID. Its full details, including ID, name and
2113
2248
  * description, are returned in the response object.
2114
2249
  *
2115
- * @param request - The request {@link GetProjectRequest}
2250
+ * @param request - The request {@link ProjectApiGetProjectRequest}
2116
2251
  * @returns A Promise of Project
2117
2252
  */
2118
2253
  getProject = (request = {}) => this.client.fetch({
2119
2254
  method: 'GET',
2120
- path: `/account/v2/projects/${validatePathParam('projectId', request.projectId ?? this.client.settings.defaultProjectId)}`
2255
+ path: `/account/v3/projects/${validatePathParam('projectId', request.projectId ?? this.client.settings.defaultProjectId)}`
2121
2256
  }, unmarshalProject);
2122
2257
 
2123
2258
  /**
@@ -2126,39 +2261,86 @@ let API$r = class API extends API$s {
2126
2261
  * left in it) to be deleted effectively. Note that deleting a Project is
2127
2262
  * permanent, and cannot be undone.
2128
2263
  *
2129
- * @param request - The request {@link DeleteProjectRequest}
2264
+ * @param request - The request {@link ProjectApiDeleteProjectRequest}
2130
2265
  */
2131
2266
  deleteProject = (request = {}) => this.client.fetch({
2132
2267
  method: 'DELETE',
2133
- path: `/account/v2/projects/${validatePathParam('projectId', request.projectId ?? this.client.settings.defaultProjectId)}`
2268
+ path: `/account/v3/projects/${validatePathParam('projectId', request.projectId ?? this.client.settings.defaultProjectId)}`
2134
2269
  });
2135
2270
 
2136
2271
  /**
2137
2272
  * Update Project. Update the parameters of an existing Project, specified by
2138
2273
  * its Project ID. These parameters include the name and description.
2139
2274
  *
2140
- * @param request - The request {@link UpdateProjectRequest}
2275
+ * @param request - The request {@link ProjectApiUpdateProjectRequest}
2141
2276
  * @returns A Promise of Project
2142
2277
  */
2143
2278
  updateProject = (request = {}) => this.client.fetch({
2144
- body: JSON.stringify(marshalUpdateProjectRequest(request, this.client.settings)),
2279
+ body: JSON.stringify(marshalProjectApiUpdateProjectRequest(request, this.client.settings)),
2145
2280
  headers: jsonContentHeaders$o,
2146
2281
  method: 'PATCH',
2147
- path: `/account/v2/projects/${validatePathParam('projectId', request.projectId ?? this.client.settings.defaultProjectId)}`
2282
+ path: `/account/v3/projects/${validatePathParam('projectId', request.projectId ?? this.client.settings.defaultProjectId)}`
2148
2283
  }, unmarshalProject);
2284
+ }
2285
+
2286
+ // This file was automatically generated. DO NOT EDIT.
2287
+ // If you have any remark or suggestion do not hesitate to open an issue.
2288
+
2289
+ const ProjectApiCreateProjectRequest = {
2290
+ description: {
2291
+ maxLength: 200
2292
+ },
2293
+ name: {
2294
+ maxLength: 64,
2295
+ minLength: 1,
2296
+ pattern: /^[a-zA-Z0-9\._\- ]+$/
2297
+ }
2298
+ };
2299
+ const ProjectApiListProjectsRequest = {
2300
+ name: {
2301
+ maxLength: 64,
2302
+ minLength: 1,
2303
+ pattern: /^[a-zA-Z0-9\._\- ]+$/
2304
+ },
2305
+ page: {
2306
+ greaterThan: 0
2307
+ },
2308
+ pageSize: {
2309
+ greaterThanOrEqual: 1,
2310
+ lessThanOrEqual: 100
2311
+ }
2312
+ };
2313
+ const ProjectApiUpdateProjectRequest = {
2314
+ description: {
2315
+ maxLength: 200
2316
+ },
2317
+ name: {
2318
+ maxLength: 64,
2319
+ minLength: 1,
2320
+ pattern: /^[a-zA-Z0-9\._\- ]+$/
2321
+ }
2149
2322
  };
2150
2323
 
2324
+ var validationRules_gen$6 = /*#__PURE__*/Object.freeze({
2325
+ __proto__: null,
2326
+ ProjectApiCreateProjectRequest: ProjectApiCreateProjectRequest,
2327
+ ProjectApiListProjectsRequest: ProjectApiListProjectsRequest,
2328
+ ProjectApiUpdateProjectRequest: ProjectApiUpdateProjectRequest
2329
+ });
2330
+
2151
2331
  // This file was automatically generated. DO NOT EDIT.
2152
2332
  // If you have any remark or suggestion do not hesitate to open an issue.
2153
2333
 
2154
2334
  var index_gen$n = /*#__PURE__*/Object.freeze({
2155
2335
  __proto__: null,
2156
- API: API$r
2336
+ ProjectAPI: ProjectAPI,
2337
+ ValidationRules: validationRules_gen$6
2157
2338
  });
2158
2339
 
2159
2340
  var index$t = /*#__PURE__*/Object.freeze({
2160
2341
  __proto__: null,
2161
- v2: index_gen$n
2342
+ v2: index_gen$o,
2343
+ v3: index_gen$n
2162
2344
  });
2163
2345
 
2164
2346
  // This file was automatically generated. DO NOT EDIT.
@@ -8429,6 +8611,10 @@ const marshalCreateSSHKeyRequest = (request, defaults) => ({
8429
8611
  project_id: request.projectId ?? defaults.defaultProjectId,
8430
8612
  public_key: request.publicKey
8431
8613
  });
8614
+ const marshalCreateUserRequest$1 = (request, defaults) => ({
8615
+ email: request.email,
8616
+ organization_id: request.organizationId ?? defaults.defaultOrganizationId
8617
+ });
8432
8618
  const marshalRemoveGroupMemberRequest = (request, defaults) => ({
8433
8619
  ...resolveOneOf([{
8434
8620
  param: 'user_id',
@@ -8601,6 +8787,20 @@ let API$i = class API extends API$s {
8601
8787
  method: 'DELETE',
8602
8788
  path: `/iam/v1alpha1/users/${validatePathParam('userId', request.userId)}`
8603
8789
  });
8790
+
8791
+ /**
8792
+ * Create a new user. Create a new user. You must define the `organization_id`
8793
+ * and the `email` in your request.
8794
+ *
8795
+ * @param request - The request {@link CreateUserRequest}
8796
+ * @returns A Promise of User
8797
+ */
8798
+ createUser = request => this.client.fetch({
8799
+ body: JSON.stringify(marshalCreateUserRequest$1(request, this.client.settings)),
8800
+ headers: jsonContentHeaders$g,
8801
+ method: 'POST',
8802
+ path: `/iam/v1alpha1/users`
8803
+ }, unmarshalUser$1);
8604
8804
  pageOfListApplications = (request = {}) => this.client.fetch({
8605
8805
  method: 'GET',
8606
8806
  path: `/iam/v1alpha1/applications`,
@@ -10749,7 +10949,7 @@ let API$h = class API extends API$s {
10749
10949
  pageOfListServers = (request = {}) => this.client.fetch({
10750
10950
  method: 'GET',
10751
10951
  path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`,
10752
- urlParams: urlParams(['commercial_type', request.commercialType], ['name', request.name], ['order', request.order], ['organization', request.organization], ['page', request.page], ['per_page', request.perPage ?? this.client.settings.defaultPageSize], ['private_ip', request.privateIp], ['private_network', request.privateNetwork], ['project', request.project], ['state', request.state], ['tags', request.tags && request.tags.length > 0 ? request.tags.join(',') : undefined], ['without_ip', request.withoutIp])
10952
+ urlParams: urlParams(['commercial_type', request.commercialType], ['name', request.name], ['order', request.order], ['organization', request.organization], ['page', request.page], ['per_page', request.perPage ?? this.client.settings.defaultPageSize], ['private_ip', request.privateIp], ['private_network', request.privateNetwork], ['private_networks', request.privateNetworks && request.privateNetworks.length > 0 ? request.privateNetworks.join(',') : undefined], ['project', request.project], ['state', request.state], ['tags', request.tags && request.tags.length > 0 ? request.tags.join(',') : undefined], ['without_ip', request.withoutIp])
10753
10953
  }, unmarshalListServersResponse);
10754
10954
 
10755
10955
  /**
@@ -13303,7 +13503,9 @@ const unmarshalClusterType = data => {
13303
13503
  return {
13304
13504
  availability: data.availability,
13305
13505
  commitmentDelay: data.commitment_delay,
13506
+ dedicated: data.dedicated,
13306
13507
  maxNodes: data.max_nodes,
13508
+ memory: data.memory,
13307
13509
  name: data.name,
13308
13510
  resiliency: data.resiliency,
13309
13511
  sla: data.sla
@@ -17450,7 +17652,7 @@ const INSTANCE_TRANSIENT_STATUSES = ['provisioning', 'configuring', 'deleting',
17450
17652
  const MAINTENANCE_TRANSIENT_STATUSES = ['pending'];
17451
17653
 
17452
17654
  /** Lists transient statutes of the enum {@link ReadReplicaStatus}. */
17453
- const READ_REPLICA_TRANSIENT_STATUSES = ['provisioning', 'initializing', 'deleting', 'configuring'];
17655
+ const READ_REPLICA_TRANSIENT_STATUSES = ['provisioning', 'initializing', 'deleting', 'configuring', 'promoting'];
17454
17656
 
17455
17657
  /** Lists transient statutes of the enum {@link SnapshotStatus}. */
17456
17658
  const SNAPSHOT_TRANSIENT_STATUSES = ['creating', 'restoring', 'deleting'];
@@ -18536,6 +18738,20 @@ let API$9 = class API extends API$s {
18536
18738
  path: `/rdb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/read-replicas/${validatePathParam('readReplicaId', request.readReplicaId)}/reset`
18537
18739
  }, unmarshalReadReplica);
18538
18740
 
18741
+ /**
18742
+ * Promote a Read Replica. Promote a Read Replica to Database Instance
18743
+ * automatically.
18744
+ *
18745
+ * @param request - The request {@link PromoteReadReplicaRequest}
18746
+ * @returns A Promise of Instance
18747
+ */
18748
+ promoteReadReplica = request => this.client.fetch({
18749
+ body: '{}',
18750
+ headers: jsonContentHeaders$9,
18751
+ method: 'POST',
18752
+ path: `/rdb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/read-replicas/${validatePathParam('readReplicaId', request.readReplicaId)}/promote`
18753
+ }, unmarshalInstance);
18754
+
18539
18755
  /**
18540
18756
  * Create an endpoint for a Read Replica. Create a new endpoint for a Read
18541
18757
  * Replica. Read Replicas can have at most one direct access and one Private
@@ -20832,6 +21048,7 @@ const unmarshalEmail = data => {
20832
21048
  }
20833
21049
  return {
20834
21050
  createdAt: unmarshalDate(data.created_at),
21051
+ flags: data.flags,
20835
21052
  id: data.id,
20836
21053
  lastTries: unmarshalArrayOfObject(data.last_tries, unmarshalEmailTry),
20837
21054
  mailFrom: data.mail_from,
@@ -20974,7 +21191,7 @@ let API$4 = class API extends API$s {
20974
21191
  pageOfListEmails = (request = {}) => this.client.fetch({
20975
21192
  method: 'GET',
20976
21193
  path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/emails`,
20977
- urlParams: urlParams(['domain_id', request.domainId], ['mail_from', request.mailFrom], ['mail_rcpt', request.mailRcpt], ['mail_to', request.mailTo], ['message_id', request.messageId], ['order_by', request.orderBy ?? 'created_at_desc'], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId], ['search', request.search], ['since', request.since], ['statuses', request.statuses], ['subject', request.subject], ['until', request.until])
21194
+ urlParams: urlParams(['domain_id', request.domainId], ['flags', request.flags], ['mail_from', request.mailFrom], ['mail_rcpt', request.mailRcpt], ['mail_to', request.mailTo], ['message_id', request.messageId], ['order_by', request.orderBy ?? 'created_at_desc'], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId], ['search', request.search], ['since', request.since], ['statuses', request.statuses], ['subject', request.subject], ['until', request.until])
20978
21195
  }, unmarshalListEmailsResponse);
20979
21196
 
20980
21197
  /**