@scaleway/sdk 0.1.0-beta.8 → 1.0.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.
Files changed (173) hide show
  1. package/README.md +1 -1
  2. package/dist/api/account/index.js +2 -2
  3. package/dist/api/account/v2/api.gen.js +5 -18
  4. package/dist/api/account/v2/index.gen.js +3 -0
  5. package/dist/api/account/v2/marshalling.gen.js +0 -2
  6. package/dist/api/account/v2alpha1/api.gen.js +3 -13
  7. package/dist/api/account/v2alpha1/marshalling.gen.js +0 -5
  8. package/dist/api/applesilicon/index.js +2 -2
  9. package/dist/api/applesilicon/v1alpha1/api.gen.js +7 -27
  10. package/dist/api/applesilicon/v1alpha1/index.gen.js +4 -0
  11. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +1 -14
  12. package/dist/api/baremetal/v1/api.gen.js +47 -49
  13. package/dist/api/baremetal/v1/api.utils.js +2 -10
  14. package/dist/api/baremetal/v1/content.gen.js +6 -3
  15. package/dist/api/baremetal/v1/index.js +4 -1
  16. package/dist/api/baremetal/v1/marshalling.gen.js +44 -45
  17. package/dist/api/baremetal/v1/validation-rules.gen.js +109 -0
  18. package/dist/api/container/index.js +2 -2
  19. package/dist/api/container/v1beta1/api.gen.js +5 -51
  20. package/dist/api/container/v1beta1/content.gen.js +4 -4
  21. package/dist/api/container/v1beta1/{index.js → index.gen.js} +3 -1
  22. package/dist/api/container/v1beta1/marshalling.gen.js +12 -26
  23. package/dist/api/domain/index.js +2 -2
  24. package/dist/api/domain/v2beta1/api.gen.js +55 -85
  25. package/dist/api/domain/v2beta1/content.gen.js +22 -1
  26. package/dist/api/domain/v2beta1/index.gen.js +4 -0
  27. package/dist/api/domain/v2beta1/marshalling.gen.js +47 -165
  28. package/dist/api/flexibleip/index.js +2 -2
  29. package/dist/api/flexibleip/v1alpha1/api.gen.js +5 -22
  30. package/dist/api/flexibleip/v1alpha1/content.gen.js +1 -1
  31. package/dist/api/flexibleip/v1alpha1/index.gen.js +6 -0
  32. package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +0 -7
  33. package/dist/api/flexibleip/v1alpha1/validation-rules.gen.js +14 -0
  34. package/dist/api/function/index.js +2 -2
  35. package/dist/api/function/v1beta1/api.gen.js +54 -57
  36. package/dist/api/function/v1beta1/content.gen.js +8 -5
  37. package/dist/api/function/v1beta1/index.gen.js +4 -0
  38. package/dist/api/function/v1beta1/marshalling.gen.js +125 -33
  39. package/dist/api/iam/index.js +2 -2
  40. package/dist/api/iam/v1alpha1/api.gen.js +15 -62
  41. package/dist/api/iam/v1alpha1/index.gen.js +5 -0
  42. package/dist/api/iam/v1alpha1/marshalling.gen.js +7 -29
  43. package/dist/api/iam/v1alpha1/validation-rules.gen.js +184 -0
  44. package/dist/api/instance/v1/api.gen.js +38 -118
  45. package/dist/api/instance/v1/api.utils.js +59 -51
  46. package/dist/api/instance/v1/content.gen.js +7 -7
  47. package/dist/api/instance/v1/marshalling.gen.js +46 -168
  48. package/dist/api/instance/v1/marshalling.utils.js +63 -0
  49. package/dist/api/iot/index.js +2 -2
  50. package/dist/api/iot/v1/api.gen.js +5 -56
  51. package/dist/api/iot/v1/index.gen.js +4 -0
  52. package/dist/api/iot/v1/marshalling.gen.js +2 -51
  53. package/dist/api/k8s/index.js +2 -2
  54. package/dist/api/k8s/v1/api.gen.js +17 -43
  55. package/dist/api/k8s/v1/content.gen.js +2 -2
  56. package/dist/api/k8s/v1/index.gen.js +6 -0
  57. package/dist/api/k8s/v1/marshalling.gen.js +18 -36
  58. package/dist/api/k8s/v1/validation-rules.gen.js +92 -0
  59. package/dist/api/lb/v1/api.gen.js +8 -163
  60. package/dist/api/lb/v1/api.utils.js +3 -9
  61. package/dist/api/lb/v1/content.gen.js +3 -3
  62. package/dist/api/lb/v1/marshalling.gen.js +74 -101
  63. package/dist/api/marketplace/index.js +4 -2
  64. package/dist/api/marketplace/v1/api.gen.js +3 -13
  65. package/dist/api/marketplace/v1/index.gen.js +3 -0
  66. package/dist/api/marketplace/v1/marshalling.gen.js +0 -13
  67. package/dist/api/marketplace/v2/api.gen.js +85 -0
  68. package/dist/api/marketplace/v2/index.gen.js +3 -0
  69. package/dist/api/marketplace/v2/marshalling.gen.js +92 -0
  70. package/dist/api/mnq/index.js +2 -2
  71. package/dist/api/mnq/v1alpha1/api.gen.js +7 -25
  72. package/dist/api/mnq/v1alpha1/index.gen.js +3 -0
  73. package/dist/api/mnq/v1alpha1/marshalling.gen.js +7 -46
  74. package/dist/api/rdb/index.js +2 -2
  75. package/dist/api/rdb/v1/api.gen.js +15 -89
  76. package/dist/api/rdb/v1/content.gen.js +10 -4
  77. package/dist/api/rdb/v1/index.gen.js +4 -0
  78. package/dist/api/rdb/v1/marshalling.gen.js +25 -81
  79. package/dist/api/redis/index.js +2 -2
  80. package/dist/api/redis/{v1alpha1 → v1}/api.gen.js +45 -77
  81. package/dist/api/redis/{v1alpha1 → v1}/content.gen.js +1 -1
  82. package/dist/api/redis/v1/index.gen.js +4 -0
  83. package/dist/api/redis/{v1alpha1 → v1}/marshalling.gen.js +42 -59
  84. package/dist/api/registry/index.js +2 -2
  85. package/dist/api/registry/v1/api.gen.js +5 -29
  86. package/dist/api/registry/v1/content.gen.js +2 -2
  87. package/dist/api/registry/v1/{index.js → index.gen.js} +3 -1
  88. package/dist/api/registry/v1/marshalling.gen.js +2 -8
  89. package/dist/api/secret/index.js +2 -0
  90. package/dist/api/secret/v1alpha1/api.gen.js +135 -0
  91. package/dist/api/secret/v1alpha1/index.gen.js +3 -0
  92. package/dist/api/secret/v1alpha1/marshalling.gen.js +82 -0
  93. package/dist/api/tem/index.js +2 -0
  94. package/dist/api/tem/v1alpha1/api.gen.js +109 -0
  95. package/dist/api/tem/v1alpha1/content.gen.js +10 -0
  96. package/dist/api/tem/v1alpha1/index.gen.js +4 -0
  97. package/dist/api/tem/v1alpha1/marshalling.gen.js +132 -0
  98. package/dist/api/test/index.js +2 -2
  99. package/dist/api/test/v1/api.gen.js +6 -20
  100. package/dist/api/test/v1/index.gen.js +4 -0
  101. package/dist/api/test/v1/marshalling.gen.js +2 -5
  102. package/dist/api/vpc/index.js +2 -2
  103. package/dist/api/vpc/v1/api.gen.js +6 -17
  104. package/dist/api/vpc/v1/index.gen.js +3 -0
  105. package/dist/api/vpc/v1/marshalling.gen.js +1 -3
  106. package/dist/api/vpcgw/index.js +2 -2
  107. package/dist/api/vpcgw/v1/api.gen.js +5 -64
  108. package/dist/api/vpcgw/v1/content.gen.js +2 -2
  109. package/dist/api/vpcgw/v1/{index.js → index.gen.js} +3 -1
  110. package/dist/api/vpcgw/v1/marshalling.gen.js +3 -24
  111. package/dist/helpers/json.js +1 -2
  112. package/dist/helpers/marshalling.js +7 -20
  113. package/dist/index.cjs +3870 -2948
  114. package/dist/index.d.ts +7218 -4335
  115. package/dist/index.js +10 -6
  116. package/dist/internal/async/interval-retrier.js +10 -16
  117. package/dist/internal/interceptors/interceptor.js +3 -1
  118. package/dist/internal/interceptors/request.js +1 -3
  119. package/dist/internal/logger/console-logger.js +3 -5
  120. package/dist/internal/logger/index.js +3 -5
  121. package/dist/internal/logger/level-resolver.js +0 -3
  122. package/dist/internal/validations/string-validation.js +8 -10
  123. package/dist/node_modules/.pnpm/@scaleway_random-name@4.0.1/node_modules/@scaleway/random-name/dist/index.js +13 -0
  124. package/dist/scw/api.js +3 -4
  125. package/dist/scw/auth.js +3 -5
  126. package/dist/scw/client-ini-factory.js +32 -15
  127. package/dist/scw/client-ini-profile.js +10 -4
  128. package/dist/scw/client-settings.js +32 -15
  129. package/dist/scw/client.js +5 -6
  130. package/dist/scw/constants.js +1 -1
  131. package/dist/scw/custom-marshalling.js +8 -14
  132. package/dist/scw/errors/error-parser.js +2 -21
  133. package/dist/scw/errors/non-standard/invalid-request-mapper.js +17 -15
  134. package/dist/scw/errors/non-standard/unknown-resource-mapper.js +7 -6
  135. package/dist/scw/errors/scw-error.js +20 -20
  136. package/dist/scw/errors/standard/already-exists-error.js +3 -4
  137. package/dist/scw/errors/standard/denied-authentication-error.js +4 -11
  138. package/dist/scw/errors/standard/invalid-arguments-error.js +1 -10
  139. package/dist/scw/errors/standard/out-of-stock-error.js +0 -3
  140. package/dist/scw/errors/standard/permissions-denied-error.js +1 -4
  141. package/dist/scw/errors/standard/precondition-failed-error.js +4 -8
  142. package/dist/scw/errors/standard/quotas-exceeded-error.js +14 -14
  143. package/dist/scw/errors/standard/resource-expired-error.js +3 -4
  144. package/dist/scw/errors/standard/resource-locked-error.js +3 -4
  145. package/dist/scw/errors/standard/resource-not-found-error.js +3 -4
  146. package/dist/scw/errors/standard/too-many-requests-error.js +3 -16
  147. package/dist/scw/errors/standard/transient-state-error.js +3 -4
  148. package/dist/scw/errors/types.js +0 -3
  149. package/dist/scw/fetch/build-fetcher.js +1 -9
  150. package/dist/scw/fetch/http-dumper.js +4 -7
  151. package/dist/scw/fetch/http-interceptors.js +9 -12
  152. package/dist/scw/fetch/resource-paginator.js +18 -16
  153. package/dist/scw/fetch/response-parser.js +17 -23
  154. package/node_modules/@scaleway/random-name/CHANGELOG.md +42 -63
  155. package/node_modules/@scaleway/random-name/dist/index.js +5 -246
  156. package/node_modules/@scaleway/random-name/package.json +6 -5
  157. package/package.json +4 -5
  158. package/dist/api/account/v2/index.js +0 -1
  159. package/dist/api/applesilicon/v1alpha1/index.js +0 -2
  160. package/dist/api/domain/v2beta1/index.js +0 -2
  161. package/dist/api/flexibleip/v1alpha1/index.js +0 -2
  162. package/dist/api/function/v1beta1/index.js +0 -2
  163. package/dist/api/iam/v1alpha1/index.js +0 -1
  164. package/dist/api/iot/v1/index.js +0 -2
  165. package/dist/api/k8s/v1/index.js +0 -2
  166. package/dist/api/marketplace/v1/index.js +0 -1
  167. package/dist/api/mnq/v1alpha1/index.js +0 -1
  168. package/dist/api/rdb/v1/index.js +0 -2
  169. package/dist/api/redis/v1alpha1/index.js +0 -2
  170. package/dist/api/test/v1/index.js +0 -1
  171. package/dist/api/vpc/v1/index.js +0 -1
  172. package/dist/node_modules/.pnpm/@scaleway_random-name@3.0.2/node_modules/@scaleway/random-name/dist/index.js +0 -254
  173. package/node_modules/@scaleway/random-name/dist/index.browser.js +0 -256
@@ -1,4 +1,4 @@
1
- import { API } from '../../../scw/api.js';
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
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';
@@ -7,281 +7,241 @@ import { unmarshalListSSHKeysResponse, marshalCreateSSHKeyRequest, unmarshalSSHK
7
7
  const jsonContentHeaders = {
8
8
  'Content-Type': 'application/json; charset=utf-8'
9
9
  };
10
- /** IAM API. */
11
10
 
12
- class IamV1Alpha1GenAPI extends API {
11
+ /** IAM API. */
12
+ class API extends API$1 {
13
13
  constructor() {
14
14
  var _this;
15
-
16
15
  super(...arguments);
17
16
  _this = this;
18
-
19
17
  this.pageOfListSSHKeys = function (request) {
20
18
  if (request === void 0) {
21
19
  request = {};
22
20
  }
23
-
24
21
  return _this.client.fetch({
25
22
  method: 'GET',
26
23
  path: `/iam/v1alpha1/ssh-keys`,
27
24
  urlParams: urlParams(['disabled', request.disabled], ['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_id', request.projectId ?? _this.client.settings.defaultProjectId])
28
25
  }, unmarshalListSSHKeysResponse);
29
26
  };
30
-
31
27
  this.listSSHKeys = function (request) {
32
28
  if (request === void 0) {
33
29
  request = {};
34
30
  }
35
-
36
31
  return enrichForPagination('sshKeys', _this.pageOfListSSHKeys, request);
37
32
  };
38
-
39
33
  this.createSSHKey = request => this.client.fetch({
40
34
  body: JSON.stringify(marshalCreateSSHKeyRequest(request, this.client.settings)),
41
35
  headers: jsonContentHeaders,
42
36
  method: 'POST',
43
37
  path: `/iam/v1alpha1/ssh-keys`
44
38
  }, unmarshalSSHKey);
45
-
46
39
  this.getSSHKey = request => this.client.fetch({
47
40
  method: 'GET',
48
41
  path: `/iam/v1alpha1/ssh-keys/${validatePathParam('sshKeyId', request.sshKeyId)}`
49
42
  }, unmarshalSSHKey);
50
-
51
43
  this.updateSSHKey = request => this.client.fetch({
52
44
  body: JSON.stringify(marshalUpdateSSHKeyRequest(request, this.client.settings)),
53
45
  headers: jsonContentHeaders,
54
46
  method: 'PATCH',
55
47
  path: `/iam/v1alpha1/ssh-keys/${validatePathParam('sshKeyId', request.sshKeyId)}`
56
48
  }, unmarshalSSHKey);
57
-
58
49
  this.deleteSSHKey = request => this.client.fetch({
59
50
  method: 'DELETE',
60
51
  path: `/iam/v1alpha1/ssh-keys/${validatePathParam('sshKeyId', request.sshKeyId)}`
61
52
  });
62
-
63
53
  this.pageOfListUsers = function (request) {
64
54
  if (request === void 0) {
65
55
  request = {};
66
56
  }
67
-
68
57
  return _this.client.fetch({
69
58
  method: 'GET',
70
59
  path: `/iam/v1alpha1/users`,
71
60
  urlParams: urlParams(['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], ['user_ids', request.userIds])
72
61
  }, unmarshalListUsersResponse);
73
62
  };
74
-
75
63
  this.listUsers = function (request) {
76
64
  if (request === void 0) {
77
65
  request = {};
78
66
  }
79
-
80
67
  return enrichForPagination('users', _this.pageOfListUsers, request);
81
68
  };
82
-
83
69
  this.getUser = request => this.client.fetch({
84
70
  method: 'GET',
85
71
  path: `/iam/v1alpha1/users/${validatePathParam('userId', request.userId)}`
86
72
  }, unmarshalUser);
87
-
73
+ this.deleteUser = request => this.client.fetch({
74
+ method: 'DELETE',
75
+ path: `/iam/v1alpha1/users/${validatePathParam('userId', request.userId)}`
76
+ });
88
77
  this.pageOfListApplications = function (request) {
89
78
  if (request === void 0) {
90
79
  request = {};
91
80
  }
92
-
93
81
  return _this.client.fetch({
94
82
  method: 'GET',
95
83
  path: `/iam/v1alpha1/applications`,
96
84
  urlParams: urlParams(['application_ids', request.applicationIds], ['editable', request.editable], ['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])
97
85
  }, unmarshalListApplicationsResponse);
98
86
  };
99
-
100
87
  this.listApplications = function (request) {
101
88
  if (request === void 0) {
102
89
  request = {};
103
90
  }
104
-
105
91
  return enrichForPagination('applications', _this.pageOfListApplications, request);
106
92
  };
107
-
108
93
  this.createApplication = request => this.client.fetch({
109
94
  body: JSON.stringify(marshalCreateApplicationRequest(request, this.client.settings)),
110
95
  headers: jsonContentHeaders,
111
96
  method: 'POST',
112
97
  path: `/iam/v1alpha1/applications`
113
98
  }, unmarshalApplication);
114
-
115
99
  this.getApplication = request => this.client.fetch({
116
100
  method: 'GET',
117
101
  path: `/iam/v1alpha1/applications/${validatePathParam('applicationId', request.applicationId)}`
118
102
  }, unmarshalApplication);
119
-
120
103
  this.updateApplication = request => this.client.fetch({
121
104
  body: JSON.stringify(marshalUpdateApplicationRequest(request, this.client.settings)),
122
105
  headers: jsonContentHeaders,
123
106
  method: 'PATCH',
124
107
  path: `/iam/v1alpha1/applications/${validatePathParam('applicationId', request.applicationId)}`
125
108
  }, unmarshalApplication);
126
-
127
109
  this.deleteApplication = request => this.client.fetch({
128
110
  method: 'DELETE',
129
111
  path: `/iam/v1alpha1/applications/${validatePathParam('applicationId', request.applicationId)}`
130
112
  });
131
-
132
113
  this.pageOfListGroups = function (request) {
133
114
  if (request === void 0) {
134
115
  request = {};
135
116
  }
136
-
137
117
  return _this.client.fetch({
138
118
  method: 'GET',
139
119
  path: `/iam/v1alpha1/groups`,
140
120
  urlParams: urlParams(['application_ids', request.applicationIds], ['group_ids', request.groupIds], ['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], ['user_ids', request.userIds])
141
121
  }, unmarshalListGroupsResponse);
142
122
  };
143
-
144
123
  this.listGroups = function (request) {
145
124
  if (request === void 0) {
146
125
  request = {};
147
126
  }
148
-
149
127
  return enrichForPagination('groups', _this.pageOfListGroups, request);
150
128
  };
151
-
152
129
  this.createGroup = request => this.client.fetch({
153
130
  body: JSON.stringify(marshalCreateGroupRequest(request, this.client.settings)),
154
131
  headers: jsonContentHeaders,
155
132
  method: 'POST',
156
133
  path: `/iam/v1alpha1/groups`
157
134
  }, unmarshalGroup);
158
-
159
135
  this.getGroup = request => this.client.fetch({
160
136
  method: 'GET',
161
137
  path: `/iam/v1alpha1/groups/${validatePathParam('groupId', request.groupId)}`
162
138
  }, unmarshalGroup);
163
-
164
139
  this.updateGroup = request => this.client.fetch({
165
140
  body: JSON.stringify(marshalUpdateGroupRequest(request, this.client.settings)),
166
141
  headers: jsonContentHeaders,
167
142
  method: 'PATCH',
168
143
  path: `/iam/v1alpha1/groups/${validatePathParam('groupId', request.groupId)}`
169
144
  }, unmarshalGroup);
170
-
171
145
  this.setGroupMembers = request => this.client.fetch({
172
146
  body: JSON.stringify(marshalSetGroupMembersRequest(request, this.client.settings)),
173
147
  headers: jsonContentHeaders,
174
148
  method: 'PUT',
175
149
  path: `/iam/v1alpha1/groups/${validatePathParam('groupId', request.groupId)}/members`
176
150
  }, unmarshalGroup);
177
-
178
151
  this.addGroupMember = request => this.client.fetch({
179
152
  body: JSON.stringify(marshalAddGroupMemberRequest(request, this.client.settings)),
180
153
  headers: jsonContentHeaders,
181
154
  method: 'POST',
182
155
  path: `/iam/v1alpha1/groups/${validatePathParam('groupId', request.groupId)}/add-member`
183
156
  }, unmarshalGroup);
184
-
185
157
  this.removeGroupMember = request => this.client.fetch({
186
158
  body: JSON.stringify(marshalRemoveGroupMemberRequest(request, this.client.settings)),
187
159
  headers: jsonContentHeaders,
188
160
  method: 'POST',
189
161
  path: `/iam/v1alpha1/groups/${validatePathParam('groupId', request.groupId)}/remove-member`
190
162
  }, unmarshalGroup);
191
-
192
163
  this.deleteGroup = request => this.client.fetch({
193
164
  method: 'DELETE',
194
165
  path: `/iam/v1alpha1/groups/${validatePathParam('groupId', request.groupId)}`
195
166
  });
196
-
197
167
  this.pageOfListPolicies = function (request) {
198
168
  if (request === void 0) {
199
169
  request = {};
200
170
  }
201
-
202
171
  return _this.client.fetch({
203
172
  method: 'GET',
204
173
  path: `/iam/v1alpha1/policies`,
205
174
  urlParams: urlParams(['application_ids', request.applicationIds], ['editable', request.editable], ['group_ids', request.groupIds], ['no_principal', request.noPrincipal], ['order_by', request.orderBy ?? 'policy_name_asc'], ['organization_id', request.organizationId ?? _this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['policy_name', request.policyName], ['user_ids', request.userIds])
206
175
  }, unmarshalListPoliciesResponse);
207
176
  };
208
-
209
177
  this.listPolicies = function (request) {
210
178
  if (request === void 0) {
211
179
  request = {};
212
180
  }
213
-
214
181
  return enrichForPagination('policies', _this.pageOfListPolicies, request);
215
182
  };
216
-
217
183
  this.createPolicy = request => this.client.fetch({
218
184
  body: JSON.stringify(marshalCreatePolicyRequest(request, this.client.settings)),
219
185
  headers: jsonContentHeaders,
220
186
  method: 'POST',
221
187
  path: `/iam/v1alpha1/policies`
222
188
  }, unmarshalPolicy);
223
-
224
189
  this.getPolicy = request => this.client.fetch({
225
190
  method: 'GET',
226
191
  path: `/iam/v1alpha1/policies/${validatePathParam('policyId', request.policyId)}`
227
192
  }, unmarshalPolicy);
228
-
229
193
  this.updatePolicy = request => this.client.fetch({
230
194
  body: JSON.stringify(marshalUpdatePolicyRequest(request, this.client.settings)),
231
195
  headers: jsonContentHeaders,
232
196
  method: 'PATCH',
233
197
  path: `/iam/v1alpha1/policies/${validatePathParam('policyId', request.policyId)}`
234
198
  }, unmarshalPolicy);
235
-
236
199
  this.deletePolicy = request => this.client.fetch({
237
200
  method: 'DELETE',
238
201
  path: `/iam/v1alpha1/policies/${validatePathParam('policyId', request.policyId)}`
239
202
  });
240
-
203
+ this.clonePolicy = request => this.client.fetch({
204
+ body: '{}',
205
+ headers: jsonContentHeaders,
206
+ method: 'POST',
207
+ path: `/iam/v1alpha1/policies/${validatePathParam('policyId', request.policyId)}/clone`
208
+ }, unmarshalPolicy);
241
209
  this.setRules = request => this.client.fetch({
242
210
  body: JSON.stringify(marshalSetRulesRequest(request, this.client.settings)),
243
211
  headers: jsonContentHeaders,
244
212
  method: 'PUT',
245
213
  path: `/iam/v1alpha1/rules`
246
214
  }, unmarshalSetRulesResponse);
247
-
248
215
  this.pageOfListRules = request => this.client.fetch({
249
216
  method: 'GET',
250
217
  path: `/iam/v1alpha1/rules`,
251
218
  urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['policy_id', request.policyId])
252
219
  }, unmarshalListRulesResponse);
253
-
254
220
  this.listRules = request => enrichForPagination('rules', this.pageOfListRules, request);
255
-
256
221
  this.pageOfListPermissionSets = function (request) {
257
222
  if (request === void 0) {
258
223
  request = {};
259
224
  }
260
-
261
225
  return _this.client.fetch({
262
226
  method: 'GET',
263
227
  path: `/iam/v1alpha1/permission-sets`,
264
228
  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])
265
229
  }, unmarshalListPermissionSetsResponse);
266
230
  };
267
-
268
231
  this.listPermissionSets = function (request) {
269
232
  if (request === void 0) {
270
233
  request = {};
271
234
  }
272
-
273
235
  return enrichForPagination('permissionSets', _this.pageOfListPermissionSets, request);
274
236
  };
275
-
276
237
  this.pageOfListAPIKeys = function (request) {
277
238
  if (request === void 0) {
278
239
  request = {};
279
240
  }
280
-
281
241
  return _this.client.fetch({
282
242
  method: 'GET',
283
243
  path: `/iam/v1alpha1/api-keys`,
284
- urlParams: urlParams(['editable', request.editable], ['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], ...Object.entries(resolveOneOf([{
244
+ urlParams: urlParams(['access_key', request.accessKey], ['bearer_id', request.bearerId], ['bearer_type', request.bearerType ?? 'unknown_bearer_type'], ['description', request.description], ['editable', request.editable], ['expired', request.expired], ['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], ...Object.entries(resolveOneOf([{
285
245
  param: 'application_id',
286
246
  value: request.applicationId
287
247
  }, {
@@ -290,40 +250,33 @@ class IamV1Alpha1GenAPI extends API {
290
250
  }])))
291
251
  }, unmarshalListAPIKeysResponse);
292
252
  };
293
-
294
253
  this.listAPIKeys = function (request) {
295
254
  if (request === void 0) {
296
255
  request = {};
297
256
  }
298
-
299
257
  return enrichForPagination('apiKeys', _this.pageOfListAPIKeys, request);
300
258
  };
301
-
302
259
  this.createAPIKey = request => this.client.fetch({
303
260
  body: JSON.stringify(marshalCreateAPIKeyRequest(request, this.client.settings)),
304
261
  headers: jsonContentHeaders,
305
262
  method: 'POST',
306
263
  path: `/iam/v1alpha1/api-keys`
307
264
  }, unmarshalAPIKey);
308
-
309
265
  this.getAPIKey = request => this.client.fetch({
310
266
  method: 'GET',
311
267
  path: `/iam/v1alpha1/api-keys/${validatePathParam('accessKey', request.accessKey)}`
312
268
  }, unmarshalAPIKey);
313
-
314
269
  this.updateAPIKey = request => this.client.fetch({
315
270
  body: JSON.stringify(marshalUpdateAPIKeyRequest(request, this.client.settings)),
316
271
  headers: jsonContentHeaders,
317
272
  method: 'PATCH',
318
273
  path: `/iam/v1alpha1/api-keys/${validatePathParam('accessKey', request.accessKey)}`
319
274
  }, unmarshalAPIKey);
320
-
321
275
  this.deleteAPIKey = request => this.client.fetch({
322
276
  method: 'DELETE',
323
277
  path: `/iam/v1alpha1/api-keys/${validatePathParam('accessKey', request.accessKey)}`
324
278
  });
325
279
  }
326
-
327
280
  }
328
281
 
329
- export { IamV1Alpha1GenAPI };
282
+ export { API };
@@ -0,0 +1,5 @@
1
+ export { API } from './api.gen.js';
2
+ import * as validationRules_gen from './validation-rules.gen.js';
3
+ export { validationRules_gen as ValidationRules };
4
+
5
+ // This file was automatically generated. DO NOT EDIT.
@@ -1,4 +1,4 @@
1
- import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@3.0.2/node_modules/@scaleway/random-name/dist/index.js';
1
+ import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.1/node_modules/@scaleway/random-name/dist/index.js';
2
2
  import { isJSONObject } from '../../../helpers/json.js';
3
3
  import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
4
4
 
@@ -7,7 +7,6 @@ const unmarshalAPIKey = data => {
7
7
  if (!isJSONObject(data)) {
8
8
  throw new TypeError(`Unmarshalling the type 'APIKey' failed as data isn't a dictionary.`);
9
9
  }
10
-
11
10
  return {
12
11
  accessKey: data.access_key,
13
12
  applicationId: data.application_id,
@@ -26,7 +25,6 @@ const unmarshalApplication = data => {
26
25
  if (!isJSONObject(data)) {
27
26
  throw new TypeError(`Unmarshalling the type 'Application' failed as data isn't a dictionary.`);
28
27
  }
29
-
30
28
  return {
31
29
  createdAt: unmarshalDate(data.created_at),
32
30
  description: data.description,
@@ -42,7 +40,6 @@ const unmarshalGroup = data => {
42
40
  if (!isJSONObject(data)) {
43
41
  throw new TypeError(`Unmarshalling the type 'Group' failed as data isn't a dictionary.`);
44
42
  }
45
-
46
43
  return {
47
44
  applicationIds: data.application_ids,
48
45
  createdAt: unmarshalDate(data.created_at),
@@ -54,12 +51,10 @@ const unmarshalGroup = data => {
54
51
  userIds: data.user_ids
55
52
  };
56
53
  };
57
-
58
54
  const unmarshalPermissionSet = data => {
59
55
  if (!isJSONObject(data)) {
60
56
  throw new TypeError(`Unmarshalling the type 'PermissionSet' failed as data isn't a dictionary.`);
61
57
  }
62
-
63
58
  return {
64
59
  categories: data.categories,
65
60
  description: data.description,
@@ -68,12 +63,10 @@ const unmarshalPermissionSet = data => {
68
63
  scopeType: data.scope_type
69
64
  };
70
65
  };
71
-
72
66
  const unmarshalPolicy = data => {
73
67
  if (!isJSONObject(data)) {
74
68
  throw new TypeError(`Unmarshalling the type 'Policy' failed as data isn't a dictionary.`);
75
69
  }
76
-
77
70
  return {
78
71
  applicationId: data.application_id,
79
72
  createdAt: unmarshalDate(data.created_at),
@@ -91,12 +84,10 @@ const unmarshalPolicy = data => {
91
84
  userId: data.user_id
92
85
  };
93
86
  };
94
-
95
87
  const unmarshalRule = data => {
96
88
  if (!isJSONObject(data)) {
97
89
  throw new TypeError(`Unmarshalling the type 'Rule' failed as data isn't a dictionary.`);
98
90
  }
99
-
100
91
  return {
101
92
  accountRootUserId: data.account_root_user_id,
102
93
  id: data.id,
@@ -106,12 +97,10 @@ const unmarshalRule = data => {
106
97
  projectIds: data.project_ids
107
98
  };
108
99
  };
109
-
110
100
  const unmarshalSSHKey = data => {
111
101
  if (!isJSONObject(data)) {
112
102
  throw new TypeError(`Unmarshalling the type 'SSHKey' failed as data isn't a dictionary.`);
113
103
  }
114
-
115
104
  return {
116
105
  createdAt: unmarshalDate(data.created_at),
117
106
  disabled: data.disabled,
@@ -128,7 +117,6 @@ const unmarshalUser = data => {
128
117
  if (!isJSONObject(data)) {
129
118
  throw new TypeError(`Unmarshalling the type 'User' failed as data isn't a dictionary.`);
130
119
  }
131
-
132
120
  return {
133
121
  createdAt: unmarshalDate(data.created_at),
134
122
  deletable: data.deletable,
@@ -146,7 +134,6 @@ const unmarshalListAPIKeysResponse = data => {
146
134
  if (!isJSONObject(data)) {
147
135
  throw new TypeError(`Unmarshalling the type 'ListAPIKeysResponse' failed as data isn't a dictionary.`);
148
136
  }
149
-
150
137
  return {
151
138
  apiKeys: unmarshalArrayOfObject(data.api_keys, unmarshalAPIKey),
152
139
  totalCount: data.total_count
@@ -156,7 +143,6 @@ const unmarshalListApplicationsResponse = data => {
156
143
  if (!isJSONObject(data)) {
157
144
  throw new TypeError(`Unmarshalling the type 'ListApplicationsResponse' failed as data isn't a dictionary.`);
158
145
  }
159
-
160
146
  return {
161
147
  applications: unmarshalArrayOfObject(data.applications, unmarshalApplication),
162
148
  totalCount: data.total_count
@@ -166,7 +152,6 @@ const unmarshalListGroupsResponse = data => {
166
152
  if (!isJSONObject(data)) {
167
153
  throw new TypeError(`Unmarshalling the type 'ListGroupsResponse' failed as data isn't a dictionary.`);
168
154
  }
169
-
170
155
  return {
171
156
  groups: unmarshalArrayOfObject(data.groups, unmarshalGroup),
172
157
  totalCount: data.total_count
@@ -176,7 +161,6 @@ const unmarshalListPermissionSetsResponse = data => {
176
161
  if (!isJSONObject(data)) {
177
162
  throw new TypeError(`Unmarshalling the type 'ListPermissionSetsResponse' failed as data isn't a dictionary.`);
178
163
  }
179
-
180
164
  return {
181
165
  permissionSets: unmarshalArrayOfObject(data.permission_sets, unmarshalPermissionSet),
182
166
  totalCount: data.total_count
@@ -186,7 +170,6 @@ const unmarshalListPoliciesResponse = data => {
186
170
  if (!isJSONObject(data)) {
187
171
  throw new TypeError(`Unmarshalling the type 'ListPoliciesResponse' failed as data isn't a dictionary.`);
188
172
  }
189
-
190
173
  return {
191
174
  policies: unmarshalArrayOfObject(data.policies, unmarshalPolicy),
192
175
  totalCount: data.total_count
@@ -196,7 +179,6 @@ const unmarshalListRulesResponse = data => {
196
179
  if (!isJSONObject(data)) {
197
180
  throw new TypeError(`Unmarshalling the type 'ListRulesResponse' failed as data isn't a dictionary.`);
198
181
  }
199
-
200
182
  return {
201
183
  rules: unmarshalArrayOfObject(data.rules, unmarshalRule),
202
184
  totalCount: data.total_count
@@ -206,7 +188,6 @@ const unmarshalListSSHKeysResponse = data => {
206
188
  if (!isJSONObject(data)) {
207
189
  throw new TypeError(`Unmarshalling the type 'ListSSHKeysResponse' failed as data isn't a dictionary.`);
208
190
  }
209
-
210
191
  return {
211
192
  sshKeys: unmarshalArrayOfObject(data.ssh_keys, unmarshalSSHKey),
212
193
  totalCount: data.total_count
@@ -216,7 +197,6 @@ const unmarshalListUsersResponse = data => {
216
197
  if (!isJSONObject(data)) {
217
198
  throw new TypeError(`Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`);
218
199
  }
219
-
220
200
  return {
221
201
  totalCount: data.total_count,
222
202
  users: unmarshalArrayOfObject(data.users, unmarshalUser)
@@ -226,25 +206,22 @@ const unmarshalSetRulesResponse = data => {
226
206
  if (!isJSONObject(data)) {
227
207
  throw new TypeError(`Unmarshalling the type 'SetRulesResponse' failed as data isn't a dictionary.`);
228
208
  }
229
-
230
209
  return {
231
210
  rules: unmarshalArrayOfObject(data.rules, unmarshalRule)
232
211
  };
233
212
  };
234
-
235
213
  const marshalRuleSpecs = (request, defaults) => ({
236
214
  permission_set_names: request.permissionSetNames,
237
215
  ...resolveOneOf([{
238
216
  param: 'project_ids',
239
217
  value: request.projectIds
240
218
  }, {
241
- default: defaults.defaultOrganizationId,
242
219
  param: 'organization_id',
243
220
  value: request.organizationId
244
221
  }])
245
222
  });
246
-
247
- const marshalAddGroupMemberRequest = (request, defaults) => ({ ...resolveOneOf([{
223
+ const marshalAddGroupMemberRequest = (request, defaults) => ({
224
+ ...resolveOneOf([{
248
225
  param: 'user_id',
249
226
  value: request.userId
250
227
  }, {
@@ -278,7 +255,7 @@ const marshalCreatePolicyRequest = (request, defaults) => ({
278
255
  description: request.description,
279
256
  name: request.name || randomName('pol'),
280
257
  organization_id: request.organizationId ?? defaults.defaultOrganizationId,
281
- rules: request.rules ? request.rules.map(elt => marshalRuleSpecs(elt, defaults)) : undefined,
258
+ rules: request.rules ? request.rules.map(elt => marshalRuleSpecs(elt)) : undefined,
282
259
  ...resolveOneOf([{
283
260
  param: 'user_id',
284
261
  value: request.userId
@@ -298,7 +275,8 @@ const marshalCreateSSHKeyRequest = (request, defaults) => ({
298
275
  project_id: request.projectId ?? defaults.defaultProjectId,
299
276
  public_key: request.publicKey
300
277
  });
301
- const marshalRemoveGroupMemberRequest = (request, defaults) => ({ ...resolveOneOf([{
278
+ const marshalRemoveGroupMemberRequest = (request, defaults) => ({
279
+ ...resolveOneOf([{
302
280
  param: 'user_id',
303
281
  value: request.userId
304
282
  }, {
@@ -312,7 +290,7 @@ const marshalSetGroupMembersRequest = (request, defaults) => ({
312
290
  });
313
291
  const marshalSetRulesRequest = (request, defaults) => ({
314
292
  policy_id: request.policyId,
315
- rules: request.rules.map(elt => marshalRuleSpecs(elt, defaults))
293
+ rules: request.rules.map(elt => marshalRuleSpecs(elt))
316
294
  });
317
295
  const marshalUpdateAPIKeyRequest = (request, defaults) => ({
318
296
  default_project_id: request.defaultProjectId,